@apollo/client#gql TypeScript Examples

The following examples show how to use @apollo/client#gql. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: fragments.generated.tsx    From atlas with GNU General Public License v3.0 6 votes vote down vote up
AllBidFieldsFragmentDoc = gql`
  fragment AllBidFields on Bid {
    ...BasicBidFields
    auction {
      auctionType {
        __typename
      }
      isCompleted
      winningMemberId
      id
    }
  }
  ${BasicBidFieldsFragmentDoc}
`
Example #2
Source File: WeirdStringIdEditor.tsx    From jmix-frontend with Apache License 2.0 6 votes vote down vote up
UPSERT_SCR_WEIRDSTRINGIDTESTENTITY = gql`
  mutation Upsert_scr_WeirdStringIdTestEntity(
    $weirdStringIdTestEntity: inp_scr_WeirdStringIdTestEntity!
  ) {
    upsert_scr_WeirdStringIdTestEntity(
      weirdStringIdTestEntity: $weirdStringIdTestEntity
    ) {
      id
    }
  }
`
Example #3
Source File: channels.generated.tsx    From atlas with GNU General Public License v3.0 6 votes vote down vote up
GetChannelsConnectionDocument = gql`
  query GetChannelsConnection(
    $first: Int
    $after: String
    $where: ChannelWhereInput
    $orderBy: [ChannelOrderByInput!] = [createdAt_DESC]
  ) {
    channelsConnection(first: $first, after: $after, where: $where, orderBy: $orderBy) {
      edges {
        cursor
        node {
          ...AllChannelFields
        }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
      totalCount
    }
  }
  ${AllChannelFieldsFragmentDoc}
`
Example #4
Source File: types.ts    From ExpressLRS-Configurator with GNU General Public License v3.0 6 votes vote down vote up
MulticastDnsMonitorUpdatesDocument = gql`
  subscription multicastDnsMonitorUpdates {
    multicastDnsMonitorUpdates {
      type
      data {
        name
        options {
          type
          key
          enabled
          enumValues
          value
          sensitive
        }
        version
        target
        type
        vendor
        ip
        dns
        port
        deviceName
      }
    }
  }
`
Example #5
Source File: CGraphQLClient.ts    From Cromwell with MIT License 6 votes vote down vote up
/** @internal */
    public createGetFiltered<TEntity, TFilter>(entityName: TDBEntity, nativeFragment: DocumentNode,
        nativeFragmentName: string, filterName: string, path?: string): ((options: TGetFilteredOptions<TEntity, TFilter>) => Promise<TPagedList<TEntity>>) {
        path = path ?? GraphQLPaths[entityName].getFiltered;

        return ({ pagedParams, filterParams, customFragment, customFragmentName }) => {
            const fragment = customFragment ?? nativeFragment;
            const fragmentName = customFragmentName ?? nativeFragmentName;

            return this.query({
                query: gql`
                query core${path}($pagedParams: PagedParamsInput, $filterParams: ${filterName}) {
                    ${path}(pagedParams: $pagedParams, filterParams: $filterParams) {
                        pagedMeta {
                            ...PagedMetaFragment
                        }
                        elements {
                            ...${fragmentName}
                        }
                    }
                }
                ${fragment}
                ${this.PagedMetaFragment}
            `,
                variables: {
                    pagedParams: pagedParams ?? {},
                    filterParams,
                }
            }, path as string);
        }
    }
Example #6
Source File: fragments.generated.tsx    From atlas with GNU General Public License v3.0 6 votes vote down vote up
StorageDataObjectFieldsFragmentDoc = gql`
  fragment StorageDataObjectFields on StorageDataObject {
    id
    createdAt
    size
    isAccepted
    ipfsHash
    storageBag {
      id
    }
    type {
      __typename
    }
  }
`
Example #7
Source File: EntityEdit.tsx    From Cromwell with MIT License 6 votes vote down vote up
private getEntity = async (entityId: number) => {
        let data: TEntityType;
        if (!this.props.getById) {
            console.error('this.props.getById in not defined, you must provide "getById" prop for entity to be displayed');
            return;
        }
        try {
            data = await this.props.getById(entityId,
                gql`
                    fragment ${this.props.entityCategory}AdminPanelFragment on ${this.props.entityCategory} {
                        id
                        slug
                        createDate
                        updateDate
                        pageTitle
                        pageDescription
                        meta {
                            keywords
                        }
                        isEnabled
                        entityType
                        customMeta (keys: ${JSON.stringify(getCustomMetaKeysFor(this.props.entityType ?? this.props.entityCategory))})
                    }`, `${this.props.entityCategory}AdminPanelFragment`
            );
        } catch (e) {
            console.error(e)
        }
        return data;
    }
Example #8
Source File: fragments.generated.tsx    From atlas with GNU General Public License v3.0 6 votes vote down vote up
BasicVideoFieldsFragmentDoc = gql`
  fragment BasicVideoFields on Video {
    id
    title
    views
    createdAt
    duration
    title
    isPublic
    media {
      ...StorageDataObjectFields
    }
    channel {
      ...BasicChannelFields
    }
    thumbnailPhoto {
      ...StorageDataObjectFields
    }
    nft {
      ...BasicNftFields
    }
  }
  ${StorageDataObjectFieldsFragmentDoc}
  ${BasicChannelFieldsFragmentDoc}
  ${BasicNftFieldsFragmentDoc}
`
Example #9
Source File: CGraphQLClient.ts    From Cromwell with MIT License 6 votes vote down vote up
/** @internal */
    public createDeleteMany(entityName: TDBEntity) {
        const path = GraphQLPaths[entityName].deleteMany;
        return (input: TDeleteManyInput) => {
            return this.mutate({
                mutation: gql`
                mutation core${path}($data: DeleteManyInput!) {
                    ${path}(data: $data)
                }
            `,
                variables: {
                    data: input,
                }
            }, path);
        }
    }