@apollo-elements/lib
TypeScript icon, indicating that this package has built-in type declarations

4.0.4 • Public • Published

@apollo-elements/lib

Published on npm ISC License Release

Helper functions for Apollo Elements

🔎 Read the Full API Docs 🔎

createApolloClient

Creates a simple ApolloClient instance given a URI and some params.

createApolloClient({
  uri: '/graphql',
  typePolicies: {
    User: {
      fields: {
        fullName(_, { readField }) {
          return `${readField('firstName')} ${readField('lastName')}`;
        }
      }
    }
  }
});

hasAllVariables

Predicate that validates a GraphQL request (a DocumentNode and a variables object) as having all of its required (i.e. non-nullable) variables defined.

function hasAllVariables(params: { query: DocumentNode, variables: any }): boolean

isClientOperation

Predicate that validates a DocumentNode as being an exclusively client-side operation, i.e. all of it's requests are modified by a @client directive.

function isClientOperation(operation: Operation): boolean

isValidGql

Predicate that validates an object as a DocumentNode.

function isValidGql(document: DocumentNode | any): boolean

Package Sidebar

Install

npm i @apollo-elements/lib

Weekly Downloads

50

Version

4.0.4

License

ISC

Unpacked Size

119 kB

Total Files

46

Last publish

Collaborators

  • bennyp