@conduit-client/onestore-graphql-parser 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/index.js +6 -0
- package/dist/main/index.js.map +1 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/v1/__tests__/gql.spec.d.ts +1 -0
- package/dist/types/v1/__tests__/utils.d.ts +4 -0
- package/dist/types/v1/gql.d.ts +47 -0
- package/dist/types/v1/index.d.ts +6 -0
- package/dist/v1/index.js +3176 -0
- package/dist/v1/index.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exposes a tagged template literal to parse graphql operation string
|
|
3
|
+
* "gql" is the only publicly exposed method
|
|
4
|
+
* @module gql
|
|
5
|
+
*/
|
|
6
|
+
import type { DefinitionNode, DocumentNode } from 'graphql/language';
|
|
7
|
+
export type AstResolver = (astReference: any) => DocumentNode | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* we should look into optimizing this before it turns into a memory hog
|
|
10
|
+
* weakmaps, or limiting the size of the cache, or something
|
|
11
|
+
*/
|
|
12
|
+
export declare const docMap: Map<string, DocumentNode>;
|
|
13
|
+
/**
|
|
14
|
+
* Opaque reference map to return keys to userland
|
|
15
|
+
* As a user shouldn't have access to the Document
|
|
16
|
+
*/
|
|
17
|
+
export declare const referenceMap: WeakMap<Object, DocumentNode>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns document node if cached or else update the cache and return the document node
|
|
20
|
+
* @param inputString - operation string
|
|
21
|
+
* @returns DocumentNode
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseDocument(inputString: string): DocumentNode | null;
|
|
24
|
+
export declare function updateReferenceMapWithKnownKey(doc: DocumentNode, key: object): void;
|
|
25
|
+
export declare function updateReferenceMapAndGetKey(doc: DocumentNode): object;
|
|
26
|
+
/**
|
|
27
|
+
* Insert string and fragment substitutions with the actual nodes
|
|
28
|
+
* @param inputString
|
|
29
|
+
* @param substitutions - string | fragment DocumentNode
|
|
30
|
+
* @returns { operation string, fragment docs [] }
|
|
31
|
+
*/
|
|
32
|
+
export declare function processSubstitutions(inputString: ReadonlyArray<string>, substitutions: (string | object)[]): {
|
|
33
|
+
operationString: string;
|
|
34
|
+
fragments: DefinitionNode[];
|
|
35
|
+
} | null;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param astReference - ast reference passed from user land
|
|
39
|
+
*/
|
|
40
|
+
export declare const astResolver: AstResolver;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param literals - operation query string
|
|
44
|
+
* @param subs - all other substitutions
|
|
45
|
+
* @returns an opaque reference to the parsed document
|
|
46
|
+
*/
|
|
47
|
+
export declare function gql(literals: ReadonlyArray<string> | string, ...subs: (string | object)[]): object | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { GraphQLObjectType, GraphQLInterfaceType, GraphQLDirective, GraphQLUnionType, GraphQLNamedType, } from 'graphql/type';
|
|
2
|
+
export type { ASTNode, ObjectValueNode, ListTypeNode, BooleanValueNode, EnumTypeDefinitionNode, FieldDefinitionNode, FloatValueNode, InterfaceTypeDefinitionNode, IntValueNode, NamedTypeNode, ObjectTypeDefinitionNode, StringValueNode, TypeNode, UnionTypeDefinitionNode, DocumentNode, OperationDefinitionNode, FieldNode, ArgumentNode, ValueNode, SelectionNode, SelectionSetNode, FragmentDefinitionNode, DirectiveNode, ObjectFieldNode, ScalarTypeDefinitionNode, InputObjectTypeDefinitionNode, InlineFragmentNode, FragmentSpreadNode, VariableDefinitionNode, ListValueNode, VariableNode, NullValueNode, } from 'graphql/language';
|
|
3
|
+
export { Kind } from 'graphql/language';
|
|
4
|
+
export { gql, astResolver } from './gql';
|
|
5
|
+
export type { AstResolver } from './gql';
|
|
6
|
+
export { parse, print, visit } from 'graphql/language';
|