@graphitation/supermassive 3.0.0-alpha.1 → 3.0.0-alpha.4
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/.eslintcache +1 -1
- package/CHANGELOG.md +18 -2
- package/lib/__testUtils__/execute.d.ts +13 -0
- package/lib/__testUtils__/execute.d.ts.map +1 -0
- package/lib/__testUtils__/execute.js +203 -0
- package/lib/__testUtils__/execute.js.map +7 -0
- package/lib/__testUtils__/execute.mjs +181 -0
- package/lib/__testUtils__/execute.mjs.map +7 -0
- package/lib/__testUtils__/gql.d.ts +7 -0
- package/lib/__testUtils__/gql.d.ts.map +1 -0
- package/lib/{supermassive-ast/TypedAST.js → __testUtils__/gql.js} +8 -10
- package/lib/__testUtils__/gql.js.map +7 -0
- package/lib/__testUtils__/gql.mjs +8 -0
- package/lib/__testUtils__/gql.mjs.map +7 -0
- package/lib/benchmarks/index.js +15 -20
- package/lib/benchmarks/index.js.map +3 -3
- package/lib/benchmarks/index.mjs +16 -23
- package/lib/benchmarks/index.mjs.map +2 -2
- package/lib/collectFields.d.ts +4 -9
- package/lib/collectFields.d.ts.map +1 -1
- package/lib/collectFields.js +38 -99
- package/lib/collectFields.js.map +2 -2
- package/lib/collectFields.mjs +41 -100
- package/lib/collectFields.mjs.map +2 -2
- package/lib/executeWithSchema.d.ts +1 -1
- package/lib/executeWithSchema.d.ts.map +1 -1
- package/lib/executeWithSchema.js +27 -17
- package/lib/executeWithSchema.js.map +2 -2
- package/lib/executeWithSchema.mjs +32 -24
- package/lib/executeWithSchema.mjs.map +2 -2
- package/lib/executeWithoutSchema.d.ts +9 -5
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +217 -242
- package/lib/executeWithoutSchema.js.map +3 -3
- package/lib/executeWithoutSchema.mjs +225 -249
- package/lib/executeWithoutSchema.mjs.map +3 -3
- package/lib/index.d.ts +16 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +24 -11
- package/lib/index.js.map +2 -2
- package/lib/index.mjs +32 -11
- package/lib/index.mjs.map +2 -2
- package/lib/schema/definition.d.ts +100 -0
- package/lib/schema/definition.d.ts.map +1 -0
- package/lib/schema/definition.js +77 -0
- package/lib/schema/definition.js.map +7 -0
- package/lib/schema/definition.mjs +58 -0
- package/lib/schema/definition.mjs.map +7 -0
- package/lib/schema/directives.d.ts +42 -0
- package/lib/schema/directives.d.ts.map +1 -0
- package/lib/schema/directives.js +87 -0
- package/lib/schema/directives.js.map +7 -0
- package/lib/schema/directives.mjs +70 -0
- package/lib/schema/directives.mjs.map +7 -0
- package/lib/schema/fragment.d.ts +63 -0
- package/lib/schema/fragment.d.ts.map +1 -0
- package/lib/schema/fragment.js +295 -0
- package/lib/schema/fragment.js.map +7 -0
- package/lib/schema/fragment.mjs +292 -0
- package/lib/schema/fragment.mjs.map +7 -0
- package/lib/schema/reference.d.ts +12 -0
- package/lib/schema/reference.d.ts.map +1 -0
- package/lib/schema/reference.js +137 -0
- package/lib/schema/reference.js.map +7 -0
- package/lib/schema/reference.mjs +118 -0
- package/lib/schema/reference.mjs.map +7 -0
- package/lib/schema/resolvers.d.ts +9 -0
- package/lib/schema/resolvers.d.ts.map +1 -0
- package/lib/schema/resolvers.js +47 -0
- package/lib/schema/resolvers.js.map +7 -0
- package/lib/schema/resolvers.mjs +35 -0
- package/lib/schema/resolvers.mjs.map +7 -0
- package/lib/subscribeWithSchema.d.ts +1 -1
- package/lib/subscribeWithSchema.d.ts.map +1 -1
- package/lib/subscribeWithSchema.js +27 -17
- package/lib/subscribeWithSchema.js.map +2 -2
- package/lib/subscribeWithSchema.mjs +32 -24
- package/lib/subscribeWithSchema.mjs.map +2 -2
- package/lib/types.d.ts +16 -27
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +0 -14
- package/lib/types.js.map +2 -2
- package/lib/types.mjs +0 -11
- package/lib/types.mjs.map +3 -3
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.d.ts +12 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.d.ts.map +1 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.js +116 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.js.map +7 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs +105 -0
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs.map +7 -0
- package/lib/utilities/annotateDocumentGraphQLTransform.d.ts +4 -0
- package/lib/utilities/annotateDocumentGraphQLTransform.d.ts.map +1 -0
- package/lib/{supermassive-ast → utilities}/annotateDocumentGraphQLTransform.js +3 -10
- package/lib/utilities/annotateDocumentGraphQLTransform.js.map +7 -0
- package/lib/utilities/annotateDocumentGraphQLTransform.mjs +10 -0
- package/lib/utilities/annotateDocumentGraphQLTransform.mjs.map +7 -0
- package/lib/utilities/coerceInputValue.d.ts +10 -0
- package/lib/utilities/coerceInputValue.d.ts.map +1 -0
- package/lib/utilities/coerceInputValue.js +181 -0
- package/lib/utilities/coerceInputValue.js.map +7 -0
- package/lib/utilities/coerceInputValue.mjs +167 -0
- package/lib/utilities/coerceInputValue.mjs.map +7 -0
- package/lib/utilities/decodeASTSchema.d.ts +7 -0
- package/lib/utilities/decodeASTSchema.d.ts.map +1 -0
- package/lib/utilities/decodeASTSchema.js +246 -0
- package/lib/utilities/decodeASTSchema.js.map +7 -0
- package/lib/utilities/decodeASTSchema.mjs +245 -0
- package/lib/utilities/decodeASTSchema.mjs.map +7 -0
- package/lib/utilities/encodeASTSchema.d.ts +4 -0
- package/lib/utilities/encodeASTSchema.d.ts.map +1 -0
- package/lib/utilities/encodeASTSchema.js +151 -0
- package/lib/utilities/encodeASTSchema.js.map +7 -0
- package/lib/utilities/encodeASTSchema.mjs +134 -0
- package/lib/utilities/encodeASTSchema.mjs.map +7 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.d.ts +8 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.d.ts.map +1 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.js +238 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.js.map +7 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.mjs +245 -0
- package/lib/utilities/extractMinimalViableSchemaForRequestDocument.mjs.map +7 -0
- package/lib/utilities/makeReadableErrorPath.d.ts +3 -0
- package/lib/utilities/makeReadableErrorPath.d.ts.map +1 -0
- package/lib/utilities/makeReadableErrorPath.js +47 -0
- package/lib/utilities/makeReadableErrorPath.js.map +7 -0
- package/lib/utilities/makeReadableErrorPath.mjs +28 -0
- package/lib/utilities/makeReadableErrorPath.mjs.map +7 -0
- package/lib/utilities/mergeResolvers.d.ts +2 -2
- package/lib/utilities/mergeResolvers.d.ts.map +1 -1
- package/lib/utilities/mergeResolvers.js +20 -22
- package/lib/utilities/mergeResolvers.js.map +2 -2
- package/lib/utilities/mergeResolvers.mjs +20 -25
- package/lib/utilities/mergeResolvers.mjs.map +2 -2
- package/lib/utilities/mergeSchemaDefinitions.d.ts +8 -0
- package/lib/utilities/mergeSchemaDefinitions.d.ts.map +1 -0
- package/lib/utilities/mergeSchemaDefinitions.js +126 -0
- package/lib/utilities/mergeSchemaDefinitions.js.map +7 -0
- package/lib/utilities/mergeSchemaDefinitions.mjs +114 -0
- package/lib/utilities/mergeSchemaDefinitions.mjs.map +7 -0
- package/lib/utilities/typeNameFromAST.d.ts +1 -1
- package/lib/utilities/typeNameFromAST.d.ts.map +1 -1
- package/lib/utilities/typeNameFromAST.js.map +2 -2
- package/lib/utilities/typeNameFromAST.mjs.map +2 -2
- package/lib/utilities/valueFromAST.d.ts +27 -0
- package/lib/utilities/valueFromAST.d.ts.map +1 -0
- package/lib/utilities/valueFromAST.js +139 -0
- package/lib/utilities/valueFromAST.js.map +7 -0
- package/lib/utilities/valueFromAST.mjs +125 -0
- package/lib/utilities/valueFromAST.mjs.map +7 -0
- package/lib/utilities/valueFromASTUntyped.d.ts +21 -0
- package/lib/utilities/valueFromASTUntyped.d.ts.map +1 -0
- package/lib/utilities/valueFromASTUntyped.js +51 -0
- package/lib/utilities/valueFromASTUntyped.js.map +7 -0
- package/lib/utilities/valueFromASTUntyped.mjs +32 -0
- package/lib/utilities/valueFromASTUntyped.mjs.map +7 -0
- package/lib/values.d.ts +8 -12
- package/lib/values.d.ts.map +1 -1
- package/lib/values.js +75 -63
- package/lib/values.js.map +2 -2
- package/lib/values.mjs +77 -71
- package/lib/values.mjs.map +2 -2
- package/package.json +8 -6
- package/lib/definition.d.ts +0 -7
- package/lib/definition.d.ts.map +0 -1
- package/lib/definition.js +0 -59
- package/lib/definition.js.map +0 -7
- package/lib/definition.mjs +0 -40
- package/lib/definition.mjs.map +0 -7
- package/lib/directives.d.ts +0 -8
- package/lib/directives.d.ts.map +0 -1
- package/lib/directives.js +0 -47
- package/lib/directives.js.map +0 -7
- package/lib/directives.mjs +0 -37
- package/lib/directives.mjs.map +0 -7
- package/lib/extractImplicitTypesRuntime.d.ts +0 -4
- package/lib/extractImplicitTypesRuntime.d.ts.map +0 -1
- package/lib/extractImplicitTypesRuntime.js +0 -123
- package/lib/extractImplicitTypesRuntime.js.map +0 -7
- package/lib/extractImplicitTypesRuntime.mjs +0 -114
- package/lib/extractImplicitTypesRuntime.mjs.map +0 -7
- package/lib/supermassive-ast/TypedAST.d.ts +0 -370
- package/lib/supermassive-ast/TypedAST.d.ts.map +0 -1
- package/lib/supermassive-ast/TypedAST.js.map +0 -7
- package/lib/supermassive-ast/TypedAST.mjs +0 -10
- package/lib/supermassive-ast/TypedAST.mjs.map +0 -7
- package/lib/supermassive-ast/addTypesToRequestDocument.d.ts +0 -56
- package/lib/supermassive-ast/addTypesToRequestDocument.d.ts.map +0 -1
- package/lib/supermassive-ast/addTypesToRequestDocument.js +0 -473
- package/lib/supermassive-ast/addTypesToRequestDocument.js.map +0 -7
- package/lib/supermassive-ast/addTypesToRequestDocument.mjs +0 -463
- package/lib/supermassive-ast/addTypesToRequestDocument.mjs.map +0 -7
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts +0 -3
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts.map +0 -1
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js.map +0 -7
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs +0 -17
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs.map +0 -7
- package/lib/supermassive-ast/directives.d.ts +0 -36
- package/lib/supermassive-ast/directives.d.ts.map +0 -1
- package/lib/supermassive-ast/directives.js +0 -165
- package/lib/supermassive-ast/directives.js.map +0 -7
- package/lib/supermassive-ast/directives.mjs +0 -153
- package/lib/supermassive-ast/directives.mjs.map +0 -7
- package/lib/supermassive-ast/index.d.ts +0 -6
- package/lib/supermassive-ast/index.d.ts.map +0 -1
- package/lib/supermassive-ast/index.js +0 -37
- package/lib/supermassive-ast/index.js.map +0 -7
- package/lib/supermassive-ast/index.mjs +0 -27
- package/lib/supermassive-ast/index.mjs.map +0 -7
package/lib/index.mjs
CHANGED
|
@@ -1,24 +1,45 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
executeWithoutSchema,
|
|
4
|
+
isTotalExecutionResult,
|
|
5
|
+
isIncrementalExecutionResult
|
|
6
|
+
} from "./executeWithoutSchema.mjs";
|
|
3
7
|
import { executeWithSchema } from "./executeWithSchema.mjs";
|
|
4
8
|
import { subscribeWithSchema } from "./subscribeWithSchema.mjs";
|
|
5
9
|
import { subscribeWithoutSchema } from "./subscribeWithoutSchema.mjs";
|
|
6
|
-
import {
|
|
10
|
+
import { encodeASTSchema } from "./utilities/encodeASTSchema.mjs";
|
|
11
|
+
import { decodeASTSchema } from "./utilities/decodeASTSchema.mjs";
|
|
12
|
+
import { mergeSchemaDefinitions } from "./utilities/mergeSchemaDefinitions.mjs";
|
|
13
|
+
import { mergeResolvers } from "./utilities/mergeResolvers.mjs";
|
|
14
|
+
import { annotateDocumentGraphQLTransform } from "./utilities/annotateDocumentGraphQLTransform.mjs";
|
|
15
|
+
import {
|
|
16
|
+
addMinimalViableSchemaToRequestDocument,
|
|
17
|
+
addMinimalViableSchemaToExecutableDefinitionNode
|
|
18
|
+
} from "./utilities/addMinimalViableSchemaToRequestDocument.mjs";
|
|
19
|
+
import { extractMinimalViableSchemaForRequestDocument } from "./utilities/extractMinimalViableSchemaForRequestDocument.mjs";
|
|
20
|
+
import { specifiedScalarResolvers } from "./schema/resolvers.mjs";
|
|
7
21
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { specifiedScalars } from "./values.mjs";
|
|
22
|
+
typeNameFromReference,
|
|
23
|
+
typeReferenceFromName,
|
|
24
|
+
typeReferenceFromNode
|
|
25
|
+
} from "./schema/reference.mjs";
|
|
13
26
|
export {
|
|
14
|
-
|
|
27
|
+
addMinimalViableSchemaToExecutableDefinitionNode,
|
|
28
|
+
addMinimalViableSchemaToRequestDocument,
|
|
15
29
|
annotateDocumentGraphQLTransform,
|
|
30
|
+
decodeASTSchema,
|
|
31
|
+
encodeASTSchema,
|
|
16
32
|
executeWithSchema,
|
|
17
33
|
executeWithoutSchema,
|
|
18
|
-
|
|
34
|
+
extractMinimalViableSchemaForRequestDocument,
|
|
19
35
|
isIncrementalExecutionResult,
|
|
20
36
|
isTotalExecutionResult,
|
|
21
|
-
|
|
37
|
+
mergeResolvers,
|
|
38
|
+
mergeSchemaDefinitions,
|
|
39
|
+
specifiedScalarResolvers,
|
|
22
40
|
subscribeWithSchema,
|
|
23
|
-
subscribeWithoutSchema
|
|
41
|
+
subscribeWithoutSchema,
|
|
42
|
+
typeNameFromReference,
|
|
43
|
+
typeReferenceFromName,
|
|
44
|
+
typeReferenceFromNode
|
|
24
45
|
};
|
package/lib/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export {
|
|
5
|
-
"mappings": ";AAAA,
|
|
4
|
+
"sourcesContent": ["export {\n executeWithoutSchema,\n isTotalExecutionResult,\n isIncrementalExecutionResult,\n} from \"./executeWithoutSchema\";\nexport { executeWithSchema } from \"./executeWithSchema\";\nexport { subscribeWithSchema } from \"./subscribeWithSchema\";\nexport { subscribeWithoutSchema } from \"./subscribeWithoutSchema\";\nexport { encodeASTSchema } from \"./utilities/encodeASTSchema\";\nexport { decodeASTSchema } from \"./utilities/decodeASTSchema\";\nexport { mergeSchemaDefinitions } from \"./utilities/mergeSchemaDefinitions\";\nexport { mergeResolvers } from \"./utilities/mergeResolvers\";\nexport { annotateDocumentGraphQLTransform } from \"./utilities/annotateDocumentGraphQLTransform\";\nexport {\n addMinimalViableSchemaToRequestDocument,\n addMinimalViableSchemaToExecutableDefinitionNode,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport { extractMinimalViableSchemaForRequestDocument } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\nexport { specifiedScalarResolvers } from \"./schema/resolvers\";\nexport {\n typeNameFromReference,\n typeReferenceFromName,\n typeReferenceFromNode,\n} from \"./schema/reference\";\n\nexport type { ExtractMinimalViableSchemaResult } from \"./utilities/extractMinimalViableSchemaForRequestDocument\";\nexport type {\n AddMinimalViableSchemaToRequestDocumentOptions,\n ExecutableDefinitionNodeWithInlinedSchema,\n} from \"./utilities/addMinimalViableSchemaToRequestDocument\";\nexport type {\n SchemaDefinitions,\n OperationTypes,\n TypeDefinitionsRecord,\n TypeDefinitionTuple,\n DirectiveKeys,\n ObjectKeys,\n DirectiveDefinitionTuple,\n FieldKeys,\n TypeKind,\n InterfaceTypeDefinitionTuple,\n ObjectTypeDefinitionTuple,\n InterfaceKeys,\n InputObjectKeys,\n InputValueKeys,\n TypeReference,\n InputValueDefinition,\n InputValueDefinitionRecord,\n UnionTypeDefinitionTuple,\n UnionKeys,\n EnumTypeDefinitionTuple,\n EnumKeys,\n ScalarTypeDefinitionTuple,\n InputObjectTypeDefinitionTuple,\n FieldDefinition,\n FieldDefinitionTuple,\n CompositeTypeTuple,\n FieldDefinitionRecord,\n InputValueDefinitionTuple,\n DirectiveTuple,\n InterfaceImplementationsRecord,\n SpecTypeIndex,\n} from \"./schema/definition\";\n\nexport type {\n SchemaFragment,\n SchemaFragmentLoader,\n SchemaFragmentLoaderResult,\n SchemaFragmentLoadByField,\n SchemaFragmentLoadRequest,\n} from \"./schema/fragment\";\n\nexport type {\n ObjectTypeResolver,\n ScalarTypeResolver,\n EnumTypeResolver,\n FunctionFieldResolver,\n Resolvers,\n UserResolvers,\n ResolveInfo,\n TotalExecutionResult,\n ExecutionResult,\n SubscriptionExecutionResult,\n IncrementalExecutionResult,\n} from \"./types\";\n\nexport type { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\n\nexport type {\n NameNode,\n DocumentNode,\n OperationDefinitionNode,\n VariableDefinitionNode,\n VariableNode,\n SelectionSetNode,\n FieldNode,\n ArgumentNode,\n FragmentSpreadNode,\n InlineFragmentNode,\n FragmentDefinitionNode,\n IntValueNode,\n FloatValueNode,\n StringValueNode,\n BooleanValueNode,\n NullValueNode,\n EnumValueNode,\n ListValueNode,\n ObjectValueNode,\n ObjectFieldNode,\n DirectiveNode,\n NamedTypeNode,\n ListTypeNode,\n NonNullTypeNode,\n SchemaDefinitionNode,\n OperationTypeDefinitionNode,\n ScalarTypeDefinitionNode,\n ObjectTypeDefinitionNode,\n FieldDefinitionNode,\n InputValueDefinitionNode,\n InterfaceTypeDefinitionNode,\n UnionTypeDefinitionNode,\n EnumTypeDefinitionNode,\n EnumValueDefinitionNode,\n InputObjectTypeDefinitionNode,\n DirectiveDefinitionNode,\n SchemaExtensionNode,\n ScalarTypeExtensionNode,\n ObjectTypeExtensionNode,\n InterfaceTypeExtensionNode,\n UnionTypeExtensionNode,\n EnumTypeExtensionNode,\n InputObjectTypeExtensionNode,\n} from \"graphql\";\n\nexport type {\n BeforeFieldResolveHookArgs,\n AfterFieldResolveHookArgs,\n AfterFieldCompleteHookArgs,\n BeforeFieldResolveHook,\n AfterFieldResolveHook,\n AfterFieldCompleteHook,\n ExecutionHooks,\n} from \"./hooks/types\";\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,8BAA8B;AACvC,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AACvC,SAAS,sBAAsB;AAC/B,SAAS,wCAAwC;AACjD;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,oDAAoD;AAC7D,SAAS,gCAAgC;AACzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export type TypeName = string;
|
|
2
|
+
export type SpecTypeIndex = number;
|
|
3
|
+
export type TypeReference = string | SpecTypeIndex;
|
|
4
|
+
export declare const enum TypeKind {
|
|
5
|
+
SCALAR = 1,
|
|
6
|
+
OBJECT = 2,
|
|
7
|
+
INTERFACE = 3,
|
|
8
|
+
UNION = 4,
|
|
9
|
+
ENUM = 5,
|
|
10
|
+
INPUT = 6
|
|
11
|
+
}
|
|
12
|
+
export type ScalarTypeDefinitionTuple = [
|
|
13
|
+
kind: TypeKind.SCALAR
|
|
14
|
+
];
|
|
15
|
+
export type ObjectTypeDefinitionTuple = [
|
|
16
|
+
kind: TypeKind.OBJECT,
|
|
17
|
+
fields: FieldDefinitionRecord,
|
|
18
|
+
interfaces?: TypeName[]
|
|
19
|
+
];
|
|
20
|
+
export declare const enum ObjectKeys {
|
|
21
|
+
fields = 1,
|
|
22
|
+
interfaces = 2
|
|
23
|
+
}
|
|
24
|
+
export type InterfaceTypeDefinitionTuple = [
|
|
25
|
+
kind: TypeKind.INTERFACE,
|
|
26
|
+
fields: FieldDefinitionRecord,
|
|
27
|
+
interfaces?: TypeName[]
|
|
28
|
+
];
|
|
29
|
+
export declare const enum InterfaceKeys {
|
|
30
|
+
fields = 1,
|
|
31
|
+
interfaces = 2
|
|
32
|
+
}
|
|
33
|
+
export type UnionTypeDefinitionTuple = [
|
|
34
|
+
kind: TypeKind.UNION,
|
|
35
|
+
types: TypeName[]
|
|
36
|
+
];
|
|
37
|
+
export declare const enum UnionKeys {
|
|
38
|
+
types = 1
|
|
39
|
+
}
|
|
40
|
+
export type EnumTypeDefinitionTuple = [
|
|
41
|
+
kind: TypeKind.ENUM,
|
|
42
|
+
values: string[]
|
|
43
|
+
];
|
|
44
|
+
export declare const enum EnumKeys {
|
|
45
|
+
values = 1
|
|
46
|
+
}
|
|
47
|
+
export type InputObjectTypeDefinitionTuple = [
|
|
48
|
+
kind: TypeKind.INPUT,
|
|
49
|
+
fields: InputValueDefinitionRecord
|
|
50
|
+
];
|
|
51
|
+
export declare const enum InputObjectKeys {
|
|
52
|
+
fields = 1
|
|
53
|
+
}
|
|
54
|
+
export type TypeDefinitionTuple = ScalarTypeDefinitionTuple | ObjectTypeDefinitionTuple | InterfaceTypeDefinitionTuple | UnionTypeDefinitionTuple | EnumTypeDefinitionTuple | InputObjectTypeDefinitionTuple;
|
|
55
|
+
export type CompositeTypeTuple = ObjectTypeDefinitionTuple | InterfaceTypeDefinitionTuple | UnionTypeDefinitionTuple;
|
|
56
|
+
export type FieldDefinitionTuple = [
|
|
57
|
+
type: TypeReference,
|
|
58
|
+
arguments: InputValueDefinitionRecord
|
|
59
|
+
];
|
|
60
|
+
export declare const enum FieldKeys {
|
|
61
|
+
type = 0,
|
|
62
|
+
arguments = 1
|
|
63
|
+
}
|
|
64
|
+
export type FieldDefinition = TypeReference | FieldDefinitionTuple;
|
|
65
|
+
export type FieldDefinitionRecord = Record<string, FieldDefinition>;
|
|
66
|
+
export type InputValueDefinitionTuple = [
|
|
67
|
+
type: TypeReference,
|
|
68
|
+
defaultValue: unknown
|
|
69
|
+
];
|
|
70
|
+
export declare const enum InputValueKeys {
|
|
71
|
+
type = 0,
|
|
72
|
+
defaultValue = 1
|
|
73
|
+
}
|
|
74
|
+
export type InputValueDefinition = TypeReference | InputValueDefinitionTuple;
|
|
75
|
+
export type InputValueDefinitionRecord = Record<string, InputValueDefinition>;
|
|
76
|
+
export type DirectiveName = string;
|
|
77
|
+
export type DirectiveTuple = [
|
|
78
|
+
name: DirectiveName,
|
|
79
|
+
arguments?: Record<string, unknown>
|
|
80
|
+
];
|
|
81
|
+
export type DirectiveDefinitionTuple = [
|
|
82
|
+
name: DirectiveName,
|
|
83
|
+
arguments?: InputValueDefinitionRecord
|
|
84
|
+
];
|
|
85
|
+
export declare const enum DirectiveKeys {
|
|
86
|
+
name = 0,
|
|
87
|
+
arguments = 1
|
|
88
|
+
}
|
|
89
|
+
export type TypeDefinitionsRecord = Record<TypeName, TypeDefinitionTuple>;
|
|
90
|
+
export type InterfaceImplementationsRecord = Record<TypeName, TypeName[]>;
|
|
91
|
+
export type OperationTypes = {
|
|
92
|
+
query?: TypeName;
|
|
93
|
+
mutation?: TypeName;
|
|
94
|
+
subscription?: TypeName;
|
|
95
|
+
};
|
|
96
|
+
export type SchemaDefinitions = {
|
|
97
|
+
types: TypeDefinitionsRecord;
|
|
98
|
+
directives?: DirectiveDefinitionTuple[];
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/schema/definition.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,aAAa,CAAC;AAGnD,0BAAkB,QAAQ;IACxB,MAAM,IAAI;IACV,MAAM,IAAI;IACV,SAAS,IAAI;IACb,KAAK,IAAI;IACT,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,QAAQ,CAAC,MAAM;CAEtB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,QAAQ,CAAC,MAAM;IACrB,MAAM,EAAE,qBAAqB;IAC7B,UAAU,CAAC,EAAE,QAAQ,EAAE;CAExB,CAAC;AACF,0BAAkB,UAAU;IAC1B,MAAM,IAAI;IACV,UAAU,IAAI;CACf;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,QAAQ,CAAC,SAAS;IACxB,MAAM,EAAE,qBAAqB;IAC7B,UAAU,CAAC,EAAE,QAAQ,EAAE;CAExB,CAAC;AACF,0BAAkB,aAAa;IAC7B,MAAM,IAAI;IACV,UAAU,IAAI;CACf;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,QAAQ,CAAC,KAAK;IACpB,KAAK,EAAE,QAAQ,EAAE;CAElB,CAAC;AACF,0BAAkB,SAAS;IACzB,KAAK,IAAI;CACV;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,MAAM,EAAE,MAAM,EAAE;CAEjB,CAAC;AACF,0BAAkB,QAAQ;IACxB,MAAM,IAAI;CACX;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,QAAQ,CAAC,KAAK;IACpB,MAAM,EAAE,0BAA0B;CAEnC,CAAC;AACF,0BAAkB,eAAe;IAC/B,MAAM,IAAI;CACX;AAED,MAAM,MAAM,mBAAmB,GAC3B,yBAAyB,GACzB,yBAAyB,GACzB,4BAA4B,GAC5B,wBAAwB,GACxB,uBAAuB,GACvB,8BAA8B,CAAC;AAEnC,MAAM,MAAM,kBAAkB,GAC1B,yBAAyB,GACzB,4BAA4B,GAC5B,wBAAwB,CAAC;AAE7B,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,0BAA0B;CAEtC,CAAC;AACF,0BAAkB,SAAS;IACzB,IAAI,IAAI;IACR,SAAS,IAAI;CACd;AACD,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,oBAAoB,CAAC;AACnE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAEpE,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,OAAO;CAEtB,CAAC;AACF,0BAAkB,cAAc;IAC9B,IAAI,IAAI;IACR,YAAY,IAAI;CACjB;AACD,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,yBAAyB,CAAC;AAC7E,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAE9E,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,aAAa;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CACpC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,aAAa;IACnB,SAAS,CAAC,EAAE,0BAA0B;CACvC,CAAC;AACF,0BAAkB,aAAa;IAC7B,IAAI,IAAI;IACR,SAAS,IAAI;CACd;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAC1E,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;AAE1E,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,UAAU,CAAC,EAAE,wBAAwB,EAAE,CAAC;CAEzC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var definition_exports = {};
|
|
20
|
+
__export(definition_exports, {
|
|
21
|
+
DirectiveKeys: () => DirectiveKeys,
|
|
22
|
+
EnumKeys: () => EnumKeys,
|
|
23
|
+
FieldKeys: () => FieldKeys,
|
|
24
|
+
InputObjectKeys: () => InputObjectKeys,
|
|
25
|
+
InputValueKeys: () => InputValueKeys,
|
|
26
|
+
InterfaceKeys: () => InterfaceKeys,
|
|
27
|
+
ObjectKeys: () => ObjectKeys,
|
|
28
|
+
TypeKind: () => TypeKind,
|
|
29
|
+
UnionKeys: () => UnionKeys
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(definition_exports);
|
|
32
|
+
var TypeKind = /* @__PURE__ */ ((TypeKind2) => {
|
|
33
|
+
TypeKind2[TypeKind2["SCALAR"] = 1] = "SCALAR";
|
|
34
|
+
TypeKind2[TypeKind2["OBJECT"] = 2] = "OBJECT";
|
|
35
|
+
TypeKind2[TypeKind2["INTERFACE"] = 3] = "INTERFACE";
|
|
36
|
+
TypeKind2[TypeKind2["UNION"] = 4] = "UNION";
|
|
37
|
+
TypeKind2[TypeKind2["ENUM"] = 5] = "ENUM";
|
|
38
|
+
TypeKind2[TypeKind2["INPUT"] = 6] = "INPUT";
|
|
39
|
+
return TypeKind2;
|
|
40
|
+
})(TypeKind || {});
|
|
41
|
+
var ObjectKeys = /* @__PURE__ */ ((ObjectKeys2) => {
|
|
42
|
+
ObjectKeys2[ObjectKeys2["fields"] = 1] = "fields";
|
|
43
|
+
ObjectKeys2[ObjectKeys2["interfaces"] = 2] = "interfaces";
|
|
44
|
+
return ObjectKeys2;
|
|
45
|
+
})(ObjectKeys || {});
|
|
46
|
+
var InterfaceKeys = /* @__PURE__ */ ((InterfaceKeys2) => {
|
|
47
|
+
InterfaceKeys2[InterfaceKeys2["fields"] = 1] = "fields";
|
|
48
|
+
InterfaceKeys2[InterfaceKeys2["interfaces"] = 2] = "interfaces";
|
|
49
|
+
return InterfaceKeys2;
|
|
50
|
+
})(InterfaceKeys || {});
|
|
51
|
+
var UnionKeys = /* @__PURE__ */ ((UnionKeys2) => {
|
|
52
|
+
UnionKeys2[UnionKeys2["types"] = 1] = "types";
|
|
53
|
+
return UnionKeys2;
|
|
54
|
+
})(UnionKeys || {});
|
|
55
|
+
var EnumKeys = /* @__PURE__ */ ((EnumKeys2) => {
|
|
56
|
+
EnumKeys2[EnumKeys2["values"] = 1] = "values";
|
|
57
|
+
return EnumKeys2;
|
|
58
|
+
})(EnumKeys || {});
|
|
59
|
+
var InputObjectKeys = /* @__PURE__ */ ((InputObjectKeys2) => {
|
|
60
|
+
InputObjectKeys2[InputObjectKeys2["fields"] = 1] = "fields";
|
|
61
|
+
return InputObjectKeys2;
|
|
62
|
+
})(InputObjectKeys || {});
|
|
63
|
+
var FieldKeys = /* @__PURE__ */ ((FieldKeys2) => {
|
|
64
|
+
FieldKeys2[FieldKeys2["type"] = 0] = "type";
|
|
65
|
+
FieldKeys2[FieldKeys2["arguments"] = 1] = "arguments";
|
|
66
|
+
return FieldKeys2;
|
|
67
|
+
})(FieldKeys || {});
|
|
68
|
+
var InputValueKeys = /* @__PURE__ */ ((InputValueKeys2) => {
|
|
69
|
+
InputValueKeys2[InputValueKeys2["type"] = 0] = "type";
|
|
70
|
+
InputValueKeys2[InputValueKeys2["defaultValue"] = 1] = "defaultValue";
|
|
71
|
+
return InputValueKeys2;
|
|
72
|
+
})(InputValueKeys || {});
|
|
73
|
+
var DirectiveKeys = /* @__PURE__ */ ((DirectiveKeys2) => {
|
|
74
|
+
DirectiveKeys2[DirectiveKeys2["name"] = 0] = "name";
|
|
75
|
+
DirectiveKeys2[DirectiveKeys2["arguments"] = 1] = "arguments";
|
|
76
|
+
return DirectiveKeys2;
|
|
77
|
+
})(DirectiveKeys || {});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/schema/definition.ts"],
|
|
4
|
+
"sourcesContent": ["export type TypeName = string; // name without wrappers, i.e. \"MyType\", but not \"[MyType]\"\nexport type SpecTypeIndex = number;\nexport type TypeReference = string | SpecTypeIndex; // e.g. \"ComplexType\" | \"ComplexType!\" | \"[ComplexType!]\" | 4 (i.e. \"ID\")\n\n// Perf: const enums are inlined in the build (+small integers are stored on the stack in v8)\nexport const enum TypeKind {\n SCALAR = 1,\n OBJECT = 2,\n INTERFACE = 3,\n UNION = 4,\n ENUM = 5,\n INPUT = 6,\n}\n\nexport type ScalarTypeDefinitionTuple = [\n kind: TypeKind.SCALAR,\n // directives?: DirectiveTuple[], // TODO ?\n];\n\nexport type ObjectTypeDefinitionTuple = [\n kind: TypeKind.OBJECT,\n fields: FieldDefinitionRecord,\n interfaces?: TypeName[],\n // directives?: DirectiveTuple[],\n];\nexport const enum ObjectKeys {\n fields = 1,\n interfaces = 2,\n}\n\nexport type InterfaceTypeDefinitionTuple = [\n kind: TypeKind.INTERFACE,\n fields: FieldDefinitionRecord,\n interfaces?: TypeName[],\n // directives?: DirectiveTuple[],\n];\nexport const enum InterfaceKeys {\n fields = 1,\n interfaces = 2,\n}\n\nexport type UnionTypeDefinitionTuple = [\n kind: TypeKind.UNION,\n types: TypeName[],\n // directives?: DirectiveTuple[],\n];\nexport const enum UnionKeys {\n types = 1,\n}\n\nexport type EnumTypeDefinitionTuple = [\n kind: TypeKind.ENUM,\n values: string[],\n // directives?: DirectiveTuple[],\n];\nexport const enum EnumKeys {\n values = 1,\n}\n\nexport type InputObjectTypeDefinitionTuple = [\n kind: TypeKind.INPUT,\n fields: InputValueDefinitionRecord,\n // directives?: DirectiveTuple[],\n];\nexport const enum InputObjectKeys {\n fields = 1,\n}\n\nexport type TypeDefinitionTuple =\n | ScalarTypeDefinitionTuple\n | ObjectTypeDefinitionTuple\n | InterfaceTypeDefinitionTuple\n | UnionTypeDefinitionTuple\n | EnumTypeDefinitionTuple\n | InputObjectTypeDefinitionTuple;\n\nexport type CompositeTypeTuple =\n | ObjectTypeDefinitionTuple\n | InterfaceTypeDefinitionTuple\n | UnionTypeDefinitionTuple;\n\nexport type FieldDefinitionTuple = [\n type: TypeReference,\n arguments: InputValueDefinitionRecord,\n // directives?: DirectiveTuple[],\n];\nexport const enum FieldKeys {\n type = 0,\n arguments = 1,\n}\nexport type FieldDefinition = TypeReference | FieldDefinitionTuple;\nexport type FieldDefinitionRecord = Record<string, FieldDefinition>;\n\nexport type InputValueDefinitionTuple = [\n type: TypeReference,\n defaultValue: unknown,\n // directives?: DirectiveTuple[],\n];\nexport const enum InputValueKeys {\n type = 0,\n defaultValue = 1,\n}\nexport type InputValueDefinition = TypeReference | InputValueDefinitionTuple;\nexport type InputValueDefinitionRecord = Record<string, InputValueDefinition>;\n\nexport type DirectiveName = string;\nexport type DirectiveTuple = [\n name: DirectiveName,\n arguments?: Record<string, unknown>, // JS values (cannot be a variable inside schema definition, so it is fine)\n];\nexport type DirectiveDefinitionTuple = [\n name: DirectiveName,\n arguments?: InputValueDefinitionRecord,\n];\nexport const enum DirectiveKeys {\n name = 0,\n arguments = 1,\n}\n\nexport type TypeDefinitionsRecord = Record<TypeName, TypeDefinitionTuple>;\nexport type InterfaceImplementationsRecord = Record<TypeName, TypeName[]>;\n\nexport type OperationTypes = {\n query?: TypeName;\n mutation?: TypeName;\n subscription?: TypeName;\n};\n\nexport type SchemaDefinitions = {\n types: TypeDefinitionsRecord;\n directives?: DirectiveDefinitionTuple[];\n // implementations?: InterfaceImplementationsRecord; // TODO?\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAW,WAAX,kBAAWA,cAAX;AACL,EAAAA,oBAAA,YAAS,KAAT;AACA,EAAAA,oBAAA,YAAS,KAAT;AACA,EAAAA,oBAAA,eAAY,KAAZ;AACA,EAAAA,oBAAA,WAAQ,KAAR;AACA,EAAAA,oBAAA,UAAO,KAAP;AACA,EAAAA,oBAAA,WAAQ,KAAR;AANgB,SAAAA;AAAA,GAAA;AAoBX,IAAW,aAAX,kBAAWC,gBAAX;AACL,EAAAA,wBAAA,YAAS,KAAT;AACA,EAAAA,wBAAA,gBAAa,KAAb;AAFgB,SAAAA;AAAA,GAAA;AAWX,IAAW,gBAAX,kBAAWC,mBAAX;AACL,EAAAA,8BAAA,YAAS,KAAT;AACA,EAAAA,8BAAA,gBAAa,KAAb;AAFgB,SAAAA;AAAA,GAAA;AAUX,IAAW,YAAX,kBAAWC,eAAX;AACL,EAAAA,sBAAA,WAAQ,KAAR;AADgB,SAAAA;AAAA,GAAA;AASX,IAAW,WAAX,kBAAWC,cAAX;AACL,EAAAA,oBAAA,YAAS,KAAT;AADgB,SAAAA;AAAA,GAAA;AASX,IAAW,kBAAX,kBAAWC,qBAAX;AACL,EAAAA,kCAAA,YAAS,KAAT;AADgB,SAAAA;AAAA,GAAA;AAsBX,IAAW,YAAX,kBAAWC,eAAX;AACL,EAAAA,sBAAA,UAAO,KAAP;AACA,EAAAA,sBAAA,eAAY,KAAZ;AAFgB,SAAAA;AAAA,GAAA;AAYX,IAAW,iBAAX,kBAAWC,oBAAX;AACL,EAAAA,gCAAA,UAAO,KAAP;AACA,EAAAA,gCAAA,kBAAe,KAAf;AAFgB,SAAAA;AAAA,GAAA;AAgBX,IAAW,gBAAX,kBAAWC,mBAAX;AACL,EAAAA,8BAAA,UAAO,KAAP;AACA,EAAAA,8BAAA,eAAY,KAAZ;AAFgB,SAAAA;AAAA,GAAA;",
|
|
6
|
+
"names": ["TypeKind", "ObjectKeys", "InterfaceKeys", "UnionKeys", "EnumKeys", "InputObjectKeys", "FieldKeys", "InputValueKeys", "DirectiveKeys"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/schema/definition.ts
|
|
2
|
+
var TypeKind = /* @__PURE__ */ ((TypeKind2) => {
|
|
3
|
+
TypeKind2[TypeKind2["SCALAR"] = 1] = "SCALAR";
|
|
4
|
+
TypeKind2[TypeKind2["OBJECT"] = 2] = "OBJECT";
|
|
5
|
+
TypeKind2[TypeKind2["INTERFACE"] = 3] = "INTERFACE";
|
|
6
|
+
TypeKind2[TypeKind2["UNION"] = 4] = "UNION";
|
|
7
|
+
TypeKind2[TypeKind2["ENUM"] = 5] = "ENUM";
|
|
8
|
+
TypeKind2[TypeKind2["INPUT"] = 6] = "INPUT";
|
|
9
|
+
return TypeKind2;
|
|
10
|
+
})(TypeKind || {});
|
|
11
|
+
var ObjectKeys = /* @__PURE__ */ ((ObjectKeys2) => {
|
|
12
|
+
ObjectKeys2[ObjectKeys2["fields"] = 1] = "fields";
|
|
13
|
+
ObjectKeys2[ObjectKeys2["interfaces"] = 2] = "interfaces";
|
|
14
|
+
return ObjectKeys2;
|
|
15
|
+
})(ObjectKeys || {});
|
|
16
|
+
var InterfaceKeys = /* @__PURE__ */ ((InterfaceKeys2) => {
|
|
17
|
+
InterfaceKeys2[InterfaceKeys2["fields"] = 1] = "fields";
|
|
18
|
+
InterfaceKeys2[InterfaceKeys2["interfaces"] = 2] = "interfaces";
|
|
19
|
+
return InterfaceKeys2;
|
|
20
|
+
})(InterfaceKeys || {});
|
|
21
|
+
var UnionKeys = /* @__PURE__ */ ((UnionKeys2) => {
|
|
22
|
+
UnionKeys2[UnionKeys2["types"] = 1] = "types";
|
|
23
|
+
return UnionKeys2;
|
|
24
|
+
})(UnionKeys || {});
|
|
25
|
+
var EnumKeys = /* @__PURE__ */ ((EnumKeys2) => {
|
|
26
|
+
EnumKeys2[EnumKeys2["values"] = 1] = "values";
|
|
27
|
+
return EnumKeys2;
|
|
28
|
+
})(EnumKeys || {});
|
|
29
|
+
var InputObjectKeys = /* @__PURE__ */ ((InputObjectKeys2) => {
|
|
30
|
+
InputObjectKeys2[InputObjectKeys2["fields"] = 1] = "fields";
|
|
31
|
+
return InputObjectKeys2;
|
|
32
|
+
})(InputObjectKeys || {});
|
|
33
|
+
var FieldKeys = /* @__PURE__ */ ((FieldKeys2) => {
|
|
34
|
+
FieldKeys2[FieldKeys2["type"] = 0] = "type";
|
|
35
|
+
FieldKeys2[FieldKeys2["arguments"] = 1] = "arguments";
|
|
36
|
+
return FieldKeys2;
|
|
37
|
+
})(FieldKeys || {});
|
|
38
|
+
var InputValueKeys = /* @__PURE__ */ ((InputValueKeys2) => {
|
|
39
|
+
InputValueKeys2[InputValueKeys2["type"] = 0] = "type";
|
|
40
|
+
InputValueKeys2[InputValueKeys2["defaultValue"] = 1] = "defaultValue";
|
|
41
|
+
return InputValueKeys2;
|
|
42
|
+
})(InputValueKeys || {});
|
|
43
|
+
var DirectiveKeys = /* @__PURE__ */ ((DirectiveKeys2) => {
|
|
44
|
+
DirectiveKeys2[DirectiveKeys2["name"] = 0] = "name";
|
|
45
|
+
DirectiveKeys2[DirectiveKeys2["arguments"] = 1] = "arguments";
|
|
46
|
+
return DirectiveKeys2;
|
|
47
|
+
})(DirectiveKeys || {});
|
|
48
|
+
export {
|
|
49
|
+
DirectiveKeys,
|
|
50
|
+
EnumKeys,
|
|
51
|
+
FieldKeys,
|
|
52
|
+
InputObjectKeys,
|
|
53
|
+
InputValueKeys,
|
|
54
|
+
InterfaceKeys,
|
|
55
|
+
ObjectKeys,
|
|
56
|
+
TypeKind,
|
|
57
|
+
UnionKeys
|
|
58
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/schema/definition.ts"],
|
|
4
|
+
"sourcesContent": ["export type TypeName = string; // name without wrappers, i.e. \"MyType\", but not \"[MyType]\"\nexport type SpecTypeIndex = number;\nexport type TypeReference = string | SpecTypeIndex; // e.g. \"ComplexType\" | \"ComplexType!\" | \"[ComplexType!]\" | 4 (i.e. \"ID\")\n\n// Perf: const enums are inlined in the build (+small integers are stored on the stack in v8)\nexport const enum TypeKind {\n SCALAR = 1,\n OBJECT = 2,\n INTERFACE = 3,\n UNION = 4,\n ENUM = 5,\n INPUT = 6,\n}\n\nexport type ScalarTypeDefinitionTuple = [\n kind: TypeKind.SCALAR,\n // directives?: DirectiveTuple[], // TODO ?\n];\n\nexport type ObjectTypeDefinitionTuple = [\n kind: TypeKind.OBJECT,\n fields: FieldDefinitionRecord,\n interfaces?: TypeName[],\n // directives?: DirectiveTuple[],\n];\nexport const enum ObjectKeys {\n fields = 1,\n interfaces = 2,\n}\n\nexport type InterfaceTypeDefinitionTuple = [\n kind: TypeKind.INTERFACE,\n fields: FieldDefinitionRecord,\n interfaces?: TypeName[],\n // directives?: DirectiveTuple[],\n];\nexport const enum InterfaceKeys {\n fields = 1,\n interfaces = 2,\n}\n\nexport type UnionTypeDefinitionTuple = [\n kind: TypeKind.UNION,\n types: TypeName[],\n // directives?: DirectiveTuple[],\n];\nexport const enum UnionKeys {\n types = 1,\n}\n\nexport type EnumTypeDefinitionTuple = [\n kind: TypeKind.ENUM,\n values: string[],\n // directives?: DirectiveTuple[],\n];\nexport const enum EnumKeys {\n values = 1,\n}\n\nexport type InputObjectTypeDefinitionTuple = [\n kind: TypeKind.INPUT,\n fields: InputValueDefinitionRecord,\n // directives?: DirectiveTuple[],\n];\nexport const enum InputObjectKeys {\n fields = 1,\n}\n\nexport type TypeDefinitionTuple =\n | ScalarTypeDefinitionTuple\n | ObjectTypeDefinitionTuple\n | InterfaceTypeDefinitionTuple\n | UnionTypeDefinitionTuple\n | EnumTypeDefinitionTuple\n | InputObjectTypeDefinitionTuple;\n\nexport type CompositeTypeTuple =\n | ObjectTypeDefinitionTuple\n | InterfaceTypeDefinitionTuple\n | UnionTypeDefinitionTuple;\n\nexport type FieldDefinitionTuple = [\n type: TypeReference,\n arguments: InputValueDefinitionRecord,\n // directives?: DirectiveTuple[],\n];\nexport const enum FieldKeys {\n type = 0,\n arguments = 1,\n}\nexport type FieldDefinition = TypeReference | FieldDefinitionTuple;\nexport type FieldDefinitionRecord = Record<string, FieldDefinition>;\n\nexport type InputValueDefinitionTuple = [\n type: TypeReference,\n defaultValue: unknown,\n // directives?: DirectiveTuple[],\n];\nexport const enum InputValueKeys {\n type = 0,\n defaultValue = 1,\n}\nexport type InputValueDefinition = TypeReference | InputValueDefinitionTuple;\nexport type InputValueDefinitionRecord = Record<string, InputValueDefinition>;\n\nexport type DirectiveName = string;\nexport type DirectiveTuple = [\n name: DirectiveName,\n arguments?: Record<string, unknown>, // JS values (cannot be a variable inside schema definition, so it is fine)\n];\nexport type DirectiveDefinitionTuple = [\n name: DirectiveName,\n arguments?: InputValueDefinitionRecord,\n];\nexport const enum DirectiveKeys {\n name = 0,\n arguments = 1,\n}\n\nexport type TypeDefinitionsRecord = Record<TypeName, TypeDefinitionTuple>;\nexport type InterfaceImplementationsRecord = Record<TypeName, TypeName[]>;\n\nexport type OperationTypes = {\n query?: TypeName;\n mutation?: TypeName;\n subscription?: TypeName;\n};\n\nexport type SchemaDefinitions = {\n types: TypeDefinitionsRecord;\n directives?: DirectiveDefinitionTuple[];\n // implementations?: InterfaceImplementationsRecord; // TODO?\n};\n"],
|
|
5
|
+
"mappings": ";AAKO,IAAW,WAAX,kBAAWA,cAAX;AACL,EAAAA,oBAAA,YAAS,KAAT;AACA,EAAAA,oBAAA,YAAS,KAAT;AACA,EAAAA,oBAAA,eAAY,KAAZ;AACA,EAAAA,oBAAA,WAAQ,KAAR;AACA,EAAAA,oBAAA,UAAO,KAAP;AACA,EAAAA,oBAAA,WAAQ,KAAR;AANgB,SAAAA;AAAA,GAAA;AAoBX,IAAW,aAAX,kBAAWC,gBAAX;AACL,EAAAA,wBAAA,YAAS,KAAT;AACA,EAAAA,wBAAA,gBAAa,KAAb;AAFgB,SAAAA;AAAA,GAAA;AAWX,IAAW,gBAAX,kBAAWC,mBAAX;AACL,EAAAA,8BAAA,YAAS,KAAT;AACA,EAAAA,8BAAA,gBAAa,KAAb;AAFgB,SAAAA;AAAA,GAAA;AAUX,IAAW,YAAX,kBAAWC,eAAX;AACL,EAAAA,sBAAA,WAAQ,KAAR;AADgB,SAAAA;AAAA,GAAA;AASX,IAAW,WAAX,kBAAWC,cAAX;AACL,EAAAA,oBAAA,YAAS,KAAT;AADgB,SAAAA;AAAA,GAAA;AASX,IAAW,kBAAX,kBAAWC,qBAAX;AACL,EAAAA,kCAAA,YAAS,KAAT;AADgB,SAAAA;AAAA,GAAA;AAsBX,IAAW,YAAX,kBAAWC,eAAX;AACL,EAAAA,sBAAA,UAAO,KAAP;AACA,EAAAA,sBAAA,eAAY,KAAZ;AAFgB,SAAAA;AAAA,GAAA;AAYX,IAAW,iBAAX,kBAAWC,oBAAX;AACL,EAAAA,gCAAA,UAAO,KAAP;AACA,EAAAA,gCAAA,kBAAe,KAAf;AAFgB,SAAAA;AAAA,GAAA;AAgBX,IAAW,gBAAX,kBAAWC,mBAAX;AACL,EAAAA,8BAAA,UAAO,KAAP;AACA,EAAAA,8BAAA,eAAY,KAAZ;AAFgB,SAAAA;AAAA,GAAA;",
|
|
6
|
+
"names": ["TypeKind", "ObjectKeys", "InterfaceKeys", "UnionKeys", "EnumKeys", "InputObjectKeys", "FieldKeys", "InputValueKeys", "DirectiveKeys"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DirectiveDefinitionTuple, DirectiveName } from "./definition";
|
|
2
|
+
/**
|
|
3
|
+
* Used to conditionally include fields or fragments.
|
|
4
|
+
*/
|
|
5
|
+
export declare const GraphQLIncludeDirective: DirectiveDefinitionTuple;
|
|
6
|
+
/**
|
|
7
|
+
* Used to conditionally skip (exclude) fields or fragments.
|
|
8
|
+
*/
|
|
9
|
+
export declare const GraphQLSkipDirective: DirectiveDefinitionTuple;
|
|
10
|
+
/**
|
|
11
|
+
* Constant string used for default reason for a deprecation.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_DEPRECATION_REASON = "No longer supported";
|
|
14
|
+
/**
|
|
15
|
+
* Used to declare element of a GraphQL schema as deprecated.
|
|
16
|
+
*/
|
|
17
|
+
export declare const GraphQLDeprecatedDirective: DirectiveDefinitionTuple;
|
|
18
|
+
/**
|
|
19
|
+
* Used to provide a URL for specifying the behaviour of custom scalar definitions.
|
|
20
|
+
*/
|
|
21
|
+
export declare const GraphQLSpecifiedByDirective: DirectiveDefinitionTuple;
|
|
22
|
+
/**
|
|
23
|
+
* Used to conditionally defer fragments.
|
|
24
|
+
*/
|
|
25
|
+
export declare const GraphQLDeferDirective: DirectiveDefinitionTuple;
|
|
26
|
+
/**
|
|
27
|
+
* Used to conditionally stream list fields.
|
|
28
|
+
*/
|
|
29
|
+
export declare const GraphQLStreamDirective: DirectiveDefinitionTuple;
|
|
30
|
+
/**
|
|
31
|
+
* The full list of specified directives.
|
|
32
|
+
*/
|
|
33
|
+
export declare const specifiedDirectives: ReadonlyArray<DirectiveDefinitionTuple>;
|
|
34
|
+
export declare const SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME = "schema";
|
|
35
|
+
export declare const SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME = "definitions";
|
|
36
|
+
/**
|
|
37
|
+
* Used to conditionally stream list fields.
|
|
38
|
+
*/
|
|
39
|
+
export declare const SupermassiveSchemaDirective: DirectiveDefinitionTuple;
|
|
40
|
+
export declare function isKnownDirective(directive: DirectiveName | DirectiveDefinitionTuple): boolean;
|
|
41
|
+
export declare function isSpecifiedDirective(directive: DirectiveName | DirectiveDefinitionTuple): boolean;
|
|
42
|
+
//# sourceMappingURL=directives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../../src/schema/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAExB,aAAa,EACd,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,wBAIrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,wBAGlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,wBAAwB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,wBAGxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,wBAGzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,wBAGnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,wBAGpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CAQpE,CAAC;AAEL,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAC3D,eAAO,MAAM,uDAAuD,gBACrD,CAAC;AAEhB;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,wBAGzC,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,aAAa,GAAG,wBAAwB,GAClD,OAAO,CAOT;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,aAAa,GAAG,wBAAwB,GAClD,OAAO,CAMT"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var directives_exports = {};
|
|
20
|
+
__export(directives_exports, {
|
|
21
|
+
DEFAULT_DEPRECATION_REASON: () => DEFAULT_DEPRECATION_REASON,
|
|
22
|
+
GraphQLDeferDirective: () => GraphQLDeferDirective,
|
|
23
|
+
GraphQLDeprecatedDirective: () => GraphQLDeprecatedDirective,
|
|
24
|
+
GraphQLIncludeDirective: () => GraphQLIncludeDirective,
|
|
25
|
+
GraphQLSkipDirective: () => GraphQLSkipDirective,
|
|
26
|
+
GraphQLSpecifiedByDirective: () => GraphQLSpecifiedByDirective,
|
|
27
|
+
GraphQLStreamDirective: () => GraphQLStreamDirective,
|
|
28
|
+
SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME: () => SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME,
|
|
29
|
+
SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME: () => SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME,
|
|
30
|
+
SupermassiveSchemaDirective: () => SupermassiveSchemaDirective,
|
|
31
|
+
isKnownDirective: () => isKnownDirective,
|
|
32
|
+
isSpecifiedDirective: () => isSpecifiedDirective,
|
|
33
|
+
specifiedDirectives: () => specifiedDirectives
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(directives_exports);
|
|
36
|
+
var import_definition = require("./definition");
|
|
37
|
+
const GraphQLIncludeDirective = [
|
|
38
|
+
"include",
|
|
39
|
+
{ if: "Boolean!" }
|
|
40
|
+
// TODO: locations for all directives (maybe not - they are irrelevant for runtime)?
|
|
41
|
+
];
|
|
42
|
+
const GraphQLSkipDirective = [
|
|
43
|
+
"skip",
|
|
44
|
+
{ if: "Boolean!" }
|
|
45
|
+
];
|
|
46
|
+
const DEFAULT_DEPRECATION_REASON = "No longer supported";
|
|
47
|
+
const GraphQLDeprecatedDirective = [
|
|
48
|
+
"deprecated",
|
|
49
|
+
{ reason: ["String", DEFAULT_DEPRECATION_REASON] }
|
|
50
|
+
];
|
|
51
|
+
const GraphQLSpecifiedByDirective = [
|
|
52
|
+
"specifiedBy",
|
|
53
|
+
{ url: "String!" }
|
|
54
|
+
];
|
|
55
|
+
const GraphQLDeferDirective = [
|
|
56
|
+
"defer",
|
|
57
|
+
{ if: ["Boolean!", true], label: "String" }
|
|
58
|
+
];
|
|
59
|
+
const GraphQLStreamDirective = [
|
|
60
|
+
"stream",
|
|
61
|
+
{ if: ["Boolean!", true], label: "String", initialCount: ["Int", 0] }
|
|
62
|
+
];
|
|
63
|
+
const specifiedDirectives = Object.freeze([
|
|
64
|
+
GraphQLIncludeDirective,
|
|
65
|
+
GraphQLSkipDirective,
|
|
66
|
+
GraphQLDeprecatedDirective,
|
|
67
|
+
GraphQLSpecifiedByDirective,
|
|
68
|
+
GraphQLDeferDirective,
|
|
69
|
+
GraphQLStreamDirective
|
|
70
|
+
]);
|
|
71
|
+
const SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME = "schema";
|
|
72
|
+
const SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME = "definitions";
|
|
73
|
+
const SupermassiveSchemaDirective = [
|
|
74
|
+
SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME,
|
|
75
|
+
{ [SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME]: "String!" }
|
|
76
|
+
// Essentially JSON
|
|
77
|
+
];
|
|
78
|
+
function isKnownDirective(directive) {
|
|
79
|
+
const name = typeof directive === "string" ? directive : directive[import_definition.DirectiveKeys.name];
|
|
80
|
+
return isSpecifiedDirective(directive) || name === SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME;
|
|
81
|
+
}
|
|
82
|
+
function isSpecifiedDirective(directive) {
|
|
83
|
+
const name = typeof directive === "string" ? directive : directive[import_definition.DirectiveKeys.name];
|
|
84
|
+
return specifiedDirectives.some(
|
|
85
|
+
(specDirective) => specDirective[import_definition.DirectiveKeys.name] === name
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/schema/directives.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n DirectiveDefinitionTuple,\n DirectiveKeys,\n DirectiveName,\n} from \"./definition\";\n\n/**\n * Used to conditionally include fields or fragments.\n */\nexport const GraphQLIncludeDirective: DirectiveDefinitionTuple = [\n \"include\",\n { if: \"Boolean!\" },\n // TODO: locations for all directives (maybe not - they are irrelevant for runtime)?\n];\n\n/**\n * Used to conditionally skip (exclude) fields or fragments.\n */\nexport const GraphQLSkipDirective: DirectiveDefinitionTuple = [\n \"skip\",\n { if: \"Boolean!\" },\n];\n\n/**\n * Constant string used for default reason for a deprecation.\n */\nexport const DEFAULT_DEPRECATION_REASON = \"No longer supported\";\n\n/**\n * Used to declare element of a GraphQL schema as deprecated.\n */\nexport const GraphQLDeprecatedDirective: DirectiveDefinitionTuple = [\n \"deprecated\",\n { reason: [\"String\", DEFAULT_DEPRECATION_REASON] },\n];\n\n/**\n * Used to provide a URL for specifying the behaviour of custom scalar definitions.\n */\nexport const GraphQLSpecifiedByDirective: DirectiveDefinitionTuple = [\n \"specifiedBy\",\n { url: \"String!\" },\n];\n\n/**\n * Used to conditionally defer fragments.\n */\nexport const GraphQLDeferDirective: DirectiveDefinitionTuple = [\n \"defer\",\n { if: [\"Boolean!\", true], label: \"String\" },\n];\n\n/**\n * Used to conditionally stream list fields.\n */\nexport const GraphQLStreamDirective: DirectiveDefinitionTuple = [\n \"stream\",\n { if: [\"Boolean!\", true], label: \"String\", initialCount: [\"Int\", 0] },\n];\n\n/**\n * The full list of specified directives.\n */\nexport const specifiedDirectives: ReadonlyArray<DirectiveDefinitionTuple> =\n Object.freeze([\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n GraphQLDeprecatedDirective,\n GraphQLSpecifiedByDirective,\n GraphQLDeferDirective,\n GraphQLStreamDirective,\n ]);\n\nexport const SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME = \"schema\";\nexport const SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME =\n \"definitions\";\n\n/**\n * Used to conditionally stream list fields.\n */\nexport const SupermassiveSchemaDirective: DirectiveDefinitionTuple = [\n SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME,\n { [SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME]: \"String!\" }, // Essentially JSON\n];\n\nexport function isKnownDirective(\n directive: DirectiveName | DirectiveDefinitionTuple,\n): boolean {\n const name =\n typeof directive === \"string\" ? directive : directive[DirectiveKeys.name];\n return (\n isSpecifiedDirective(directive) ||\n name === SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME\n );\n}\n\nexport function isSpecifiedDirective(\n directive: DirectiveName | DirectiveDefinitionTuple,\n): boolean {\n const name =\n typeof directive === \"string\" ? directive : directive[DirectiveKeys.name];\n return specifiedDirectives.some(\n (specDirective) => specDirective[DirectiveKeys.name] === name,\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAIO;AAKA,MAAM,0BAAoD;AAAA,EAC/D;AAAA,EACA,EAAE,IAAI,WAAW;AAAA;AAEnB;AAKO,MAAM,uBAAiD;AAAA,EAC5D;AAAA,EACA,EAAE,IAAI,WAAW;AACnB;AAKO,MAAM,6BAA6B;AAKnC,MAAM,6BAAuD;AAAA,EAClE;AAAA,EACA,EAAE,QAAQ,CAAC,UAAU,0BAA0B,EAAE;AACnD;AAKO,MAAM,8BAAwD;AAAA,EACnE;AAAA,EACA,EAAE,KAAK,UAAU;AACnB;AAKO,MAAM,wBAAkD;AAAA,EAC7D;AAAA,EACA,EAAE,IAAI,CAAC,YAAY,IAAI,GAAG,OAAO,SAAS;AAC5C;AAKO,MAAM,yBAAmD;AAAA,EAC9D;AAAA,EACA,EAAE,IAAI,CAAC,YAAY,IAAI,GAAG,OAAO,UAAU,cAAc,CAAC,OAAO,CAAC,EAAE;AACtE;AAKO,MAAM,sBACX,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEI,MAAM,qCAAqC;AAC3C,MAAM,0DACX;AAKK,MAAM,8BAAwD;AAAA,EACnE;AAAA,EACA,EAAE,CAAC,uDAAuD,GAAG,UAAU;AAAA;AACzE;AAEO,SAAS,iBACd,WACS;AACT,QAAM,OACJ,OAAO,cAAc,WAAW,YAAY,UAAU,gCAAc,IAAI;AAC1E,SACE,qBAAqB,SAAS,KAC9B,SAAS;AAEb;AAEO,SAAS,qBACd,WACS;AACT,QAAM,OACJ,OAAO,cAAc,WAAW,YAAY,UAAU,gCAAc,IAAI;AAC1E,SAAO,oBAAoB;AAAA,IACzB,CAAC,kBAAkB,cAAc,gCAAc,IAAI,MAAM;AAAA,EAC3D;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// src/schema/directives.ts
|
|
2
|
+
import {
|
|
3
|
+
DirectiveKeys
|
|
4
|
+
} from "./definition.mjs";
|
|
5
|
+
var GraphQLIncludeDirective = [
|
|
6
|
+
"include",
|
|
7
|
+
{ if: "Boolean!" }
|
|
8
|
+
// TODO: locations for all directives (maybe not - they are irrelevant for runtime)?
|
|
9
|
+
];
|
|
10
|
+
var GraphQLSkipDirective = [
|
|
11
|
+
"skip",
|
|
12
|
+
{ if: "Boolean!" }
|
|
13
|
+
];
|
|
14
|
+
var DEFAULT_DEPRECATION_REASON = "No longer supported";
|
|
15
|
+
var GraphQLDeprecatedDirective = [
|
|
16
|
+
"deprecated",
|
|
17
|
+
{ reason: ["String", DEFAULT_DEPRECATION_REASON] }
|
|
18
|
+
];
|
|
19
|
+
var GraphQLSpecifiedByDirective = [
|
|
20
|
+
"specifiedBy",
|
|
21
|
+
{ url: "String!" }
|
|
22
|
+
];
|
|
23
|
+
var GraphQLDeferDirective = [
|
|
24
|
+
"defer",
|
|
25
|
+
{ if: ["Boolean!", true], label: "String" }
|
|
26
|
+
];
|
|
27
|
+
var GraphQLStreamDirective = [
|
|
28
|
+
"stream",
|
|
29
|
+
{ if: ["Boolean!", true], label: "String", initialCount: ["Int", 0] }
|
|
30
|
+
];
|
|
31
|
+
var specifiedDirectives = Object.freeze([
|
|
32
|
+
GraphQLIncludeDirective,
|
|
33
|
+
GraphQLSkipDirective,
|
|
34
|
+
GraphQLDeprecatedDirective,
|
|
35
|
+
GraphQLSpecifiedByDirective,
|
|
36
|
+
GraphQLDeferDirective,
|
|
37
|
+
GraphQLStreamDirective
|
|
38
|
+
]);
|
|
39
|
+
var SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME = "schema";
|
|
40
|
+
var SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME = "definitions";
|
|
41
|
+
var SupermassiveSchemaDirective = [
|
|
42
|
+
SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME,
|
|
43
|
+
{ [SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME]: "String!" }
|
|
44
|
+
// Essentially JSON
|
|
45
|
+
];
|
|
46
|
+
function isKnownDirective(directive) {
|
|
47
|
+
const name = typeof directive === "string" ? directive : directive[DirectiveKeys.name];
|
|
48
|
+
return isSpecifiedDirective(directive) || name === SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME;
|
|
49
|
+
}
|
|
50
|
+
function isSpecifiedDirective(directive) {
|
|
51
|
+
const name = typeof directive === "string" ? directive : directive[DirectiveKeys.name];
|
|
52
|
+
return specifiedDirectives.some(
|
|
53
|
+
(specDirective) => specDirective[DirectiveKeys.name] === name
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
DEFAULT_DEPRECATION_REASON,
|
|
58
|
+
GraphQLDeferDirective,
|
|
59
|
+
GraphQLDeprecatedDirective,
|
|
60
|
+
GraphQLIncludeDirective,
|
|
61
|
+
GraphQLSkipDirective,
|
|
62
|
+
GraphQLSpecifiedByDirective,
|
|
63
|
+
GraphQLStreamDirective,
|
|
64
|
+
SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME,
|
|
65
|
+
SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME,
|
|
66
|
+
SupermassiveSchemaDirective,
|
|
67
|
+
isKnownDirective,
|
|
68
|
+
isSpecifiedDirective,
|
|
69
|
+
specifiedDirectives
|
|
70
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/schema/directives.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n DirectiveDefinitionTuple,\n DirectiveKeys,\n DirectiveName,\n} from \"./definition\";\n\n/**\n * Used to conditionally include fields or fragments.\n */\nexport const GraphQLIncludeDirective: DirectiveDefinitionTuple = [\n \"include\",\n { if: \"Boolean!\" },\n // TODO: locations for all directives (maybe not - they are irrelevant for runtime)?\n];\n\n/**\n * Used to conditionally skip (exclude) fields or fragments.\n */\nexport const GraphQLSkipDirective: DirectiveDefinitionTuple = [\n \"skip\",\n { if: \"Boolean!\" },\n];\n\n/**\n * Constant string used for default reason for a deprecation.\n */\nexport const DEFAULT_DEPRECATION_REASON = \"No longer supported\";\n\n/**\n * Used to declare element of a GraphQL schema as deprecated.\n */\nexport const GraphQLDeprecatedDirective: DirectiveDefinitionTuple = [\n \"deprecated\",\n { reason: [\"String\", DEFAULT_DEPRECATION_REASON] },\n];\n\n/**\n * Used to provide a URL for specifying the behaviour of custom scalar definitions.\n */\nexport const GraphQLSpecifiedByDirective: DirectiveDefinitionTuple = [\n \"specifiedBy\",\n { url: \"String!\" },\n];\n\n/**\n * Used to conditionally defer fragments.\n */\nexport const GraphQLDeferDirective: DirectiveDefinitionTuple = [\n \"defer\",\n { if: [\"Boolean!\", true], label: \"String\" },\n];\n\n/**\n * Used to conditionally stream list fields.\n */\nexport const GraphQLStreamDirective: DirectiveDefinitionTuple = [\n \"stream\",\n { if: [\"Boolean!\", true], label: \"String\", initialCount: [\"Int\", 0] },\n];\n\n/**\n * The full list of specified directives.\n */\nexport const specifiedDirectives: ReadonlyArray<DirectiveDefinitionTuple> =\n Object.freeze([\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n GraphQLDeprecatedDirective,\n GraphQLSpecifiedByDirective,\n GraphQLDeferDirective,\n GraphQLStreamDirective,\n ]);\n\nexport const SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME = \"schema\";\nexport const SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME =\n \"definitions\";\n\n/**\n * Used to conditionally stream list fields.\n */\nexport const SupermassiveSchemaDirective: DirectiveDefinitionTuple = [\n SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME,\n { [SUPERMASSIVE_SCHEMA_DIRECTIVE_DEFINITIONS_ARGUMENT_NAME]: \"String!\" }, // Essentially JSON\n];\n\nexport function isKnownDirective(\n directive: DirectiveName | DirectiveDefinitionTuple,\n): boolean {\n const name =\n typeof directive === \"string\" ? directive : directive[DirectiveKeys.name];\n return (\n isSpecifiedDirective(directive) ||\n name === SUPERMASSIVE_SCHEMA_DIRECTIVE_NAME\n );\n}\n\nexport function isSpecifiedDirective(\n directive: DirectiveName | DirectiveDefinitionTuple,\n): boolean {\n const name =\n typeof directive === \"string\" ? directive : directive[DirectiveKeys.name];\n return specifiedDirectives.some(\n (specDirective) => specDirective[DirectiveKeys.name] === name,\n );\n}\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EAEE;AAAA,OAEK;AAKA,IAAM,0BAAoD;AAAA,EAC/D;AAAA,EACA,EAAE,IAAI,WAAW;AAAA;AAEnB;AAKO,IAAM,uBAAiD;AAAA,EAC5D;AAAA,EACA,EAAE,IAAI,WAAW;AACnB;AAKO,IAAM,6BAA6B;AAKnC,IAAM,6BAAuD;AAAA,EAClE;AAAA,EACA,EAAE,QAAQ,CAAC,UAAU,0BAA0B,EAAE;AACnD;AAKO,IAAM,8BAAwD;AAAA,EACnE;AAAA,EACA,EAAE,KAAK,UAAU;AACnB;AAKO,IAAM,wBAAkD;AAAA,EAC7D;AAAA,EACA,EAAE,IAAI,CAAC,YAAY,IAAI,GAAG,OAAO,SAAS;AAC5C;AAKO,IAAM,yBAAmD;AAAA,EAC9D;AAAA,EACA,EAAE,IAAI,CAAC,YAAY,IAAI,GAAG,OAAO,UAAU,cAAc,CAAC,OAAO,CAAC,EAAE;AACtE;AAKO,IAAM,sBACX,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEI,IAAM,qCAAqC;AAC3C,IAAM,0DACX;AAKK,IAAM,8BAAwD;AAAA,EACnE;AAAA,EACA,EAAE,CAAC,uDAAuD,GAAG,UAAU;AAAA;AACzE;AAEO,SAAS,iBACd,WACS;AACT,QAAM,OACJ,OAAO,cAAc,WAAW,YAAY,UAAU,cAAc,IAAI;AAC1E,SACE,qBAAqB,SAAS,KAC9B,SAAS;AAEb;AAEO,SAAS,qBACd,WACS;AACT,QAAM,OACJ,OAAO,cAAc,WAAW,YAAY,UAAU,cAAc,IAAI;AAC1E,SAAO,oBAAoB;AAAA,IACzB,CAAC,kBAAkB,cAAc,cAAc,IAAI,MAAM;AAAA,EAC3D;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|