apollo-utilities
- Version 1.3.4
- Published
- 567 kB
- 4 dependencies
- MIT license
Install
npm i apollo-utilities
yarn add apollo-utilities
pnpm add apollo-utilities
Overview
Utilities for working with GraphQL ASTs
Index
Variables
Functions
- addTypenameToDocument()
- argumentsObjectFromField()
- assign()
- buildQueryFromSelectionSet()
- checkDocument()
- cloneDeep()
- createFragmentMap()
- getDefaultValues()
- getDirectiveInfoFromField()
- getDirectiveNames()
- getDirectivesFromDocument()
- getEnv()
- getFragmentDefinition()
- getFragmentDefinitions()
- getFragmentQueryDocument()
- getInclusionDirectives()
- getMainDefinition()
- getMutationDefinition()
- getOperationDefinition()
- getOperationDefinitionOrDie()
- getOperationName()
- getQueryDefinition()
- getStoreKeyName()
- graphQLResultHasError()
- hasClientExports()
- hasDirectives()
- isDevelopment()
- isEnv()
- isField()
- isIdValue()
- isInlineFragment()
- isJsonValue()
- isNumberValue()
- isProduction()
- isScalarValue()
- isTest()
- maybeDeepFreeze()
- mergeDeep()
- mergeDeepArray()
- removeArgumentsFromDocument()
- removeClientSetsFromDocument()
- removeConnectionDirectiveFromDocument()
- removeDirectivesFromDocument()
- removeFragmentSpreadFromDocument()
- resultKeyNameFromField()
- shouldInclude()
- storeKeyNameFromField()
- stripSymbols()
- toIdValue()
- tryFunctionOrLogError()
- valueFromNode()
- valueToObjectRepresentation()
- variablesInOperation()
- warnOnceInDevelopment()
Interfaces
Type Aliases
- DirectiveInfo
- Directives
- GetDirectiveConfig
- GetFragmentSpreadConfig
- GetNodeConfig
- IdConfig
- InclusionDirectives
- ListValue
- NumberValue
- RemoveArgumentsConfig
- RemoveDirectiveConfig
- RemoveFragmentDefinitionConfig
- RemoveFragmentSpreadConfig
- RemoveNodeConfig
- RemoveVariableDefinitionConfig
- ScalarValue
- StoreValue
- TupleToIntersection
- VariableValue
Namespaces
Variables
variable canUseWeakMap
const canUseWeakMap: boolean;
Functions
function addTypenameToDocument
addTypenameToDocument: (doc: DocumentNode) => DocumentNode;
function argumentsObjectFromField
argumentsObjectFromField: ( field: FieldNode | DirectiveNode, variables: Object) => Object;
function assign
assign: { <A, B>(a: A, b: B): A & B; <A, B, C>(a: A, b: B, c: C): A & B & C; <A, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D; <A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E; (target: any, ...sources: any[]): any;};
function buildQueryFromSelectionSet
buildQueryFromSelectionSet: (document: DocumentNode) => DocumentNode;
function checkDocument
checkDocument: (doc: DocumentNode) => DocumentNode;
function cloneDeep
cloneDeep: <T>(value: T) => T;
function createFragmentMap
createFragmentMap: (fragments?: FragmentDefinitionNode[]) => FragmentMap;
function getDefaultValues
getDefaultValues: (definition: OperationDefinitionNode | undefined) => { [key: string]: JsonValue;};
function getDirectiveInfoFromField
getDirectiveInfoFromField: ( field: FieldNode, variables: Object) => DirectiveInfo;
function getDirectiveNames
getDirectiveNames: (doc: DocumentNode) => string[];
function getDirectivesFromDocument
getDirectivesFromDocument: ( directives: GetDirectiveConfig[], doc: DocumentNode) => DocumentNode;
function getEnv
getEnv: () => string | undefined;
function getFragmentDefinition
getFragmentDefinition: (doc: DocumentNode) => FragmentDefinitionNode;
function getFragmentDefinitions
getFragmentDefinitions: (doc: DocumentNode) => FragmentDefinitionNode[];
function getFragmentQueryDocument
getFragmentQueryDocument: ( document: DocumentNode, fragmentName?: string) => DocumentNode;
function getInclusionDirectives
getInclusionDirectives: ( directives: ReadonlyArray<DirectiveNode>) => InclusionDirectives;
function getMainDefinition
getMainDefinition: ( queryDoc: DocumentNode) => OperationDefinitionNode | FragmentDefinitionNode;
function getMutationDefinition
getMutationDefinition: (doc: DocumentNode) => OperationDefinitionNode;
function getOperationDefinition
getOperationDefinition: ( doc: DocumentNode) => OperationDefinitionNode | undefined;
function getOperationDefinitionOrDie
getOperationDefinitionOrDie: (document: DocumentNode) => OperationDefinitionNode;
function getOperationName
getOperationName: (doc: DocumentNode) => string | null;
function getQueryDefinition
getQueryDefinition: (doc: DocumentNode) => OperationDefinitionNode;
function getStoreKeyName
getStoreKeyName: ( fieldName: string, args?: Object, directives?: Directives) => string;
function graphQLResultHasError
graphQLResultHasError: (result: ExecutionResult) => number;
function hasClientExports
hasClientExports: (document: DocumentNode) => boolean;
function hasDirectives
hasDirectives: (names: string[], doc: DocumentNode) => boolean;
function isDevelopment
isDevelopment: () => boolean;
function isEnv
isEnv: (env: string) => boolean;
function isField
isField: (selection: SelectionNode) => selection is FieldNode;
function isIdValue
isIdValue: (idObject: StoreValue) => idObject is IdValue;
function isInlineFragment
isInlineFragment: (selection: SelectionNode) => selection is InlineFragmentNode;
function isJsonValue
isJsonValue: (jsonObject: StoreValue) => jsonObject is JsonValue;
function isNumberValue
isNumberValue: (value: ValueNode) => value is any;
function isProduction
isProduction: () => boolean;
function isScalarValue
isScalarValue: (value: ValueNode) => value is any;
function isTest
isTest: () => boolean;
function maybeDeepFreeze
maybeDeepFreeze: (obj: any) => any;
function mergeDeep
mergeDeep: <T extends any[]>(...sources: T) => TupleToIntersection<T>;
function mergeDeepArray
mergeDeepArray: <T>(sources: T[]) => T;
function removeArgumentsFromDocument
removeArgumentsFromDocument: ( config: RemoveArgumentsConfig[], doc: DocumentNode) => DocumentNode;
function removeClientSetsFromDocument
removeClientSetsFromDocument: (document: DocumentNode) => DocumentNode | null;
function removeConnectionDirectiveFromDocument
removeConnectionDirectiveFromDocument: (doc: DocumentNode) => DocumentNode;
function removeDirectivesFromDocument
removeDirectivesFromDocument: ( directives: RemoveDirectiveConfig[], doc: DocumentNode) => DocumentNode | null;
function removeFragmentSpreadFromDocument
removeFragmentSpreadFromDocument: ( config: RemoveFragmentSpreadConfig[], doc: DocumentNode) => DocumentNode;
function resultKeyNameFromField
resultKeyNameFromField: (field: FieldNode) => string;
function shouldInclude
shouldInclude: ( selection: SelectionNode, variables?: { [name: string]: any }) => boolean;
function storeKeyNameFromField
storeKeyNameFromField: (field: FieldNode, variables?: Object) => string;
function stripSymbols
stripSymbols: <T>(data: T) => T;
function toIdValue
toIdValue: (idConfig: string | IdConfig, generated?: boolean) => IdValue;
function tryFunctionOrLogError
tryFunctionOrLogError: (f: Function) => any;
function valueFromNode
valueFromNode: (node: ValueNode, onVariable?: VariableValue) => any;
function valueToObjectRepresentation
valueToObjectRepresentation: ( argObj: any, name: NameNode, value: ValueNode, variables?: Object) => void;
function variablesInOperation
variablesInOperation: (operation: OperationDefinitionNode) => Set<string>;
function warnOnceInDevelopment
warnOnceInDevelopment: (msg: string, type?: string) => void;
Interfaces
interface FragmentMap
interface FragmentMap {}
index signature
[fragmentName: string]: FragmentDefinitionNode;
interface IdValue
interface IdValue {}
Type Aliases
type DirectiveInfo
type DirectiveInfo = { [fieldName: string]: { [argName: string]: any; };};
type Directives
type Directives = { [directiveName: string]: { [argName: string]: any; };};
type GetDirectiveConfig
type GetDirectiveConfig = GetNodeConfig<DirectiveNode>;
type GetFragmentSpreadConfig
type GetFragmentSpreadConfig = GetNodeConfig<FragmentSpreadNode>;
type GetNodeConfig
type GetNodeConfig<N> = { name?: string; test?: (node: N) => boolean;};
type IdConfig
type IdConfig = { id: string; typename: string | undefined;};
type InclusionDirectives
type InclusionDirectives = Array<{ directive: DirectiveNode; ifArgument: ArgumentNode;}>;
type ListValue
type ListValue = Array<null | IdValue>;
type NumberValue
type NumberValue = IntValueNode | FloatValueNode;
type RemoveArgumentsConfig
type RemoveArgumentsConfig = RemoveNodeConfig<ArgumentNode>;
type RemoveDirectiveConfig
type RemoveDirectiveConfig = RemoveNodeConfig<DirectiveNode>;
type RemoveFragmentDefinitionConfig
type RemoveFragmentDefinitionConfig = RemoveNodeConfig<FragmentDefinitionNode>;
type RemoveFragmentSpreadConfig
type RemoveFragmentSpreadConfig = RemoveNodeConfig<FragmentSpreadNode>;
type RemoveNodeConfig
type RemoveNodeConfig<N> = { name?: string; test?: (node: N) => boolean; remove?: boolean;};
type RemoveVariableDefinitionConfig
type RemoveVariableDefinitionConfig = RemoveNodeConfig<VariableDefinitionNode>;
type ScalarValue
type ScalarValue = StringValueNode | BooleanValueNode | EnumValueNode;
type StoreValue
type StoreValue = | number | string | string[] | IdValue | ListValue | JsonValue | null | undefined | void | Object;
type TupleToIntersection
type TupleToIntersection<T extends any[]> = T extends [infer A] ? A : T extends [infer A, infer B] ? A & B : T extends [infer A, infer B, infer C] ? A & B & C : T extends [infer A, infer B, infer C, infer D] ? A & B & C & D : T extends [infer A, infer B, infer C, infer D, infer E] ? A & B & C & D & E : T extends (infer U)[] ? U : any;
type VariableValue
type VariableValue = (node: VariableNode) => any;
Namespaces
namespace fast-json-stable-stringify
module 'fast-json-stable-stringify' {}
Package Files (16)
- lib/directives.d.ts
- lib/fragments.d.ts
- lib/getFromAST.d.ts
- lib/index.d.ts
- lib/storeUtils.d.ts
- lib/transform.d.ts
- lib/util/assign.d.ts
- lib/util/canUse.d.ts
- lib/util/cloneDeep.d.ts
- lib/util/environment.d.ts
- lib/util/errorHandling.d.ts
- lib/util/maybeDeepFreeze.d.ts
- lib/util/mergeDeep.d.ts
- lib/util/stripSymbols.d.ts
- lib/util/warnOnce.d.ts
- src/declarations.d.ts
Dependencies (4)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/apollo-utilities
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/apollo-utilities)
- HTML<a href="https://www.jsdocs.io/package/apollo-utilities"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6085 ms. - Missing or incorrect documentation? Open an issue for this package.