@graphitation/supermassive 0.4.5 → 0.6.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.
Files changed (44) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.json +61 -1
  3. package/CHANGELOG.md +34 -2
  4. package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
  5. package/lib/benchmarks/swapi-schema/resolvers.js +56 -0
  6. package/lib/benchmarks/swapi-schema/resolvers.mjs +41 -0
  7. package/lib/collectFields.d.ts.map +1 -1
  8. package/lib/collectFields.js +18 -4
  9. package/lib/collectFields.mjs +18 -4
  10. package/lib/definition.d.ts +4 -0
  11. package/lib/definition.d.ts.map +1 -0
  12. package/lib/definition.js +50 -0
  13. package/lib/definition.mjs +28 -0
  14. package/lib/directives.d.ts +79 -0
  15. package/lib/directives.d.ts.map +1 -0
  16. package/lib/directives.js +155 -0
  17. package/lib/directives.mjs +138 -0
  18. package/lib/executeWithoutSchema.d.ts +6 -5
  19. package/lib/executeWithoutSchema.d.ts.map +1 -1
  20. package/lib/executeWithoutSchema.js +5 -1
  21. package/lib/executeWithoutSchema.mjs +5 -1
  22. package/lib/index.d.ts +3 -0
  23. package/lib/index.d.ts.map +1 -1
  24. package/lib/index.js +5 -1
  25. package/lib/index.mjs +5 -1
  26. package/lib/subscribeWithSchema.d.ts +3 -0
  27. package/lib/subscribeWithSchema.d.ts.map +1 -0
  28. package/lib/subscribeWithSchema.js +78 -0
  29. package/lib/subscribeWithSchema.mjs +64 -0
  30. package/lib/subscribeWithoutSchema.d.ts +57 -0
  31. package/lib/subscribeWithoutSchema.d.ts.map +1 -0
  32. package/lib/subscribeWithoutSchema.js +155 -0
  33. package/lib/subscribeWithoutSchema.mjs +144 -0
  34. package/lib/types.d.ts +7 -2
  35. package/lib/types.d.ts.map +1 -1
  36. package/lib/utilities/mapAsyncIterator.d.ts +7 -0
  37. package/lib/utilities/mapAsyncIterator.d.ts.map +1 -0
  38. package/lib/utilities/mapAsyncIterator.js +71 -0
  39. package/lib/utilities/mapAsyncIterator.mjs +66 -0
  40. package/lib/values.d.ts +4 -3
  41. package/lib/values.d.ts.map +1 -1
  42. package/lib/values.js +6 -2
  43. package/lib/values.mjs +6 -2
  44. package/package.json +2 -1
@@ -0,0 +1,79 @@
1
+ import { GraphQLArgument, DirectiveLocationEnum, GraphQLFieldConfigArgumentMap } from "graphql";
2
+ import type { Maybe } from "./jsutils/Maybe";
3
+ import type { DirectiveDefinitionNode } from "./ast/TypedAST";
4
+ /**
5
+ * Test if the given value is a GraphQL directive.
6
+ */
7
+ export declare function isDirective(directive: unknown): directive is GraphQLDirective;
8
+ export declare function assertDirective(directive: unknown): GraphQLDirective;
9
+ /**
10
+ * Custom extensions
11
+ *
12
+ * @remarks
13
+ * Use a unique identifier name for your extension, for example the name of
14
+ * your library or project. Do not use a shortened identifier as this increases
15
+ * the risk of conflicts. We recommend you add at most one extension field,
16
+ * an object which can contain all the values you need.
17
+ */
18
+ export interface GraphQLDirectiveExtensions {
19
+ [attributeName: string]: unknown;
20
+ }
21
+ /**
22
+ * Directives are used by the GraphQL runtime as a way of modifying execution
23
+ * behavior. Type system creators will usually not create these directly.
24
+ */
25
+ export declare class GraphQLDirective {
26
+ name: string;
27
+ description: Maybe<string>;
28
+ locations: ReadonlyArray<DirectiveLocationEnum>;
29
+ args: ReadonlyArray<GraphQLArgument>;
30
+ isRepeatable: boolean;
31
+ extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
32
+ astNode: Maybe<DirectiveDefinitionNode>;
33
+ constructor(config: Readonly<GraphQLDirectiveConfig>);
34
+ toConfig(): GraphQLDirectiveNormalizedConfig;
35
+ toString(): string;
36
+ toJSON(): string;
37
+ get [Symbol.toStringTag](): string;
38
+ }
39
+ export interface GraphQLDirectiveConfig {
40
+ name: string;
41
+ description?: Maybe<string>;
42
+ locations: ReadonlyArray<DirectiveLocationEnum>;
43
+ args?: Maybe<GraphQLFieldConfigArgumentMap>;
44
+ isRepeatable?: Maybe<boolean>;
45
+ extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;
46
+ astNode?: Maybe<DirectiveDefinitionNode>;
47
+ }
48
+ interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {
49
+ args: GraphQLFieldConfigArgumentMap;
50
+ isRepeatable: boolean;
51
+ extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
52
+ }
53
+ /**
54
+ * Used to conditionally include fields or fragments.
55
+ */
56
+ export declare const GraphQLIncludeDirective: GraphQLDirective;
57
+ /**
58
+ * Used to conditionally skip (exclude) fields or fragments.
59
+ */
60
+ export declare const GraphQLSkipDirective: GraphQLDirective;
61
+ /**
62
+ * Constant string used for default reason for a deprecation.
63
+ */
64
+ export declare const DEFAULT_DEPRECATION_REASON = "No longer supported";
65
+ /**
66
+ * Used to declare element of a GraphQL schema as deprecated.
67
+ */
68
+ export declare const GraphQLDeprecatedDirective: GraphQLDirective;
69
+ /**
70
+ * Used to provide a URL for specifying the behaviour of custom scalar definitions.
71
+ */
72
+ export declare const GraphQLSpecifiedByDirective: GraphQLDirective;
73
+ /**
74
+ * The full list of specified directives.
75
+ */
76
+ export declare const specifiedDirectives: ReadonlyArray<GraphQLDirective>;
77
+ export declare function isSpecifiedDirective(directive: GraphQLDirective): boolean;
78
+ export {};
79
+ //# sourceMappingURL=directives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEf,qBAAqB,EAErB,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAMjB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAI9D;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,gBAAgB,CAE7E;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,EAAE,KAAK,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC;CACzD;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAepC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBAejC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B,wBAAwB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,gBAmBxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,gBAYzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,gBAAgB,CAO/D,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAEzE"}
@@ -0,0 +1,155 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, {get: all[name], enumerable: true});
11
+ };
12
+ var __reExport = (target, module2, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && key !== "default")
16
+ __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
17
+ }
18
+ return target;
19
+ };
20
+ var __toModule = (module2) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
22
+ };
23
+ __markAsModule(exports);
24
+ __export(exports, {
25
+ DEFAULT_DEPRECATION_REASON: () => DEFAULT_DEPRECATION_REASON,
26
+ GraphQLDeprecatedDirective: () => GraphQLDeprecatedDirective,
27
+ GraphQLDirective: () => GraphQLDirective,
28
+ GraphQLIncludeDirective: () => GraphQLIncludeDirective,
29
+ GraphQLSkipDirective: () => GraphQLSkipDirective,
30
+ GraphQLSpecifiedByDirective: () => GraphQLSpecifiedByDirective,
31
+ assertDirective: () => assertDirective,
32
+ isDirective: () => isDirective,
33
+ isSpecifiedDirective: () => isSpecifiedDirective,
34
+ specifiedDirectives: () => specifiedDirectives
35
+ });
36
+ var import_graphql = __toModule(require("graphql"));
37
+ var import_inspect = __toModule(require("./jsutils/inspect"));
38
+ var import_toObjMap = __toModule(require("./jsutils/toObjMap"));
39
+ var import_devAssert = __toModule(require("./jsutils/devAssert"));
40
+ var import_instanceOf = __toModule(require("./jsutils/instanceOf"));
41
+ var import_isObjectLike = __toModule(require("./jsutils/isObjectLike"));
42
+ var import_definition = __toModule(require("./definition"));
43
+ function isDirective(directive) {
44
+ return (0, import_instanceOf.instanceOf)(directive, GraphQLDirective);
45
+ }
46
+ function assertDirective(directive) {
47
+ if (!isDirective(directive)) {
48
+ throw new Error(`Expected ${(0, import_inspect.inspect)(directive)} to be a GraphQL directive.`);
49
+ }
50
+ return directive;
51
+ }
52
+ class GraphQLDirective {
53
+ constructor(config) {
54
+ var _a, _b;
55
+ this.name = config.name;
56
+ this.description = config.description;
57
+ this.locations = config.locations;
58
+ this.isRepeatable = (_a = config.isRepeatable) != null ? _a : false;
59
+ this.extensions = config.extensions && (0, import_toObjMap.toObjMap)(config.extensions);
60
+ this.astNode = config.astNode;
61
+ (0, import_devAssert.devAssert)(config.name, "Directive must be named.");
62
+ (0, import_devAssert.devAssert)(Array.isArray(config.locations), `@${config.name} locations must be an Array.`);
63
+ const args = (_b = config.args) != null ? _b : {};
64
+ (0, import_devAssert.devAssert)((0, import_isObjectLike.isObjectLike)(args) && !Array.isArray(args), `@${config.name} args must be an object with argument names as keys.`);
65
+ this.args = (0, import_definition.defineArguments)(args);
66
+ }
67
+ toConfig() {
68
+ return {
69
+ name: this.name,
70
+ description: this.description,
71
+ locations: this.locations,
72
+ args: (0, import_definition.argsToArgsConfig)(this.args),
73
+ isRepeatable: this.isRepeatable,
74
+ extensions: this.extensions,
75
+ astNode: this.astNode
76
+ };
77
+ }
78
+ toString() {
79
+ return "@" + this.name;
80
+ }
81
+ toJSON() {
82
+ return this.toString();
83
+ }
84
+ get [Symbol.toStringTag]() {
85
+ return "GraphQLDirective";
86
+ }
87
+ }
88
+ const GraphQLIncludeDirective = new GraphQLDirective({
89
+ name: "include",
90
+ description: "Directs the executor to include this field or fragment only when the `if` argument is true.",
91
+ locations: [
92
+ import_graphql.DirectiveLocation.FIELD,
93
+ import_graphql.DirectiveLocation.FRAGMENT_SPREAD,
94
+ import_graphql.DirectiveLocation.INLINE_FRAGMENT
95
+ ],
96
+ args: {
97
+ if: {
98
+ type: new import_graphql.GraphQLNonNull(import_graphql.GraphQLBoolean),
99
+ description: "Included when true."
100
+ }
101
+ }
102
+ });
103
+ const GraphQLSkipDirective = new GraphQLDirective({
104
+ name: "skip",
105
+ description: "Directs the executor to skip this field or fragment when the `if` argument is true.",
106
+ locations: [
107
+ import_graphql.DirectiveLocation.FIELD,
108
+ import_graphql.DirectiveLocation.FRAGMENT_SPREAD,
109
+ import_graphql.DirectiveLocation.INLINE_FRAGMENT
110
+ ],
111
+ args: {
112
+ if: {
113
+ type: new import_graphql.GraphQLNonNull(import_graphql.GraphQLBoolean),
114
+ description: "Skipped when true."
115
+ }
116
+ }
117
+ });
118
+ const DEFAULT_DEPRECATION_REASON = "No longer supported";
119
+ const GraphQLDeprecatedDirective = new GraphQLDirective({
120
+ name: "deprecated",
121
+ description: "Marks an element of a GraphQL schema as no longer supported.",
122
+ locations: [
123
+ import_graphql.DirectiveLocation.FIELD_DEFINITION,
124
+ import_graphql.DirectiveLocation.ARGUMENT_DEFINITION,
125
+ import_graphql.DirectiveLocation.INPUT_FIELD_DEFINITION,
126
+ import_graphql.DirectiveLocation.ENUM_VALUE
127
+ ],
128
+ args: {
129
+ reason: {
130
+ type: import_graphql.GraphQLString,
131
+ description: "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",
132
+ defaultValue: DEFAULT_DEPRECATION_REASON
133
+ }
134
+ }
135
+ });
136
+ const GraphQLSpecifiedByDirective = new GraphQLDirective({
137
+ name: "specifiedBy",
138
+ description: "Exposes a URL that specifies the behaviour of this scalar.",
139
+ locations: [import_graphql.DirectiveLocation.SCALAR],
140
+ args: {
141
+ url: {
142
+ type: new import_graphql.GraphQLNonNull(import_graphql.GraphQLString),
143
+ description: "The URL that specifies the behaviour of this scalar."
144
+ }
145
+ }
146
+ });
147
+ const specifiedDirectives = Object.freeze([
148
+ GraphQLIncludeDirective,
149
+ GraphQLSkipDirective,
150
+ GraphQLDeprecatedDirective,
151
+ GraphQLSpecifiedByDirective
152
+ ]);
153
+ function isSpecifiedDirective(directive) {
154
+ return specifiedDirectives.some(({name}) => name === directive.name);
155
+ }
@@ -0,0 +1,138 @@
1
+ // src/directives.ts
2
+ import {
3
+ GraphQLString,
4
+ GraphQLBoolean,
5
+ GraphQLNonNull,
6
+ DirectiveLocation
7
+ } from "graphql";
8
+ import {inspect} from "./jsutils/inspect.mjs";
9
+ import {toObjMap} from "./jsutils/toObjMap.mjs";
10
+ import {devAssert} from "./jsutils/devAssert.mjs";
11
+ import {instanceOf} from "./jsutils/instanceOf.mjs";
12
+ import {isObjectLike} from "./jsutils/isObjectLike.mjs";
13
+ import {defineArguments, argsToArgsConfig} from "./definition.mjs";
14
+ function isDirective(directive) {
15
+ return instanceOf(directive, GraphQLDirective);
16
+ }
17
+ function assertDirective(directive) {
18
+ if (!isDirective(directive)) {
19
+ throw new Error(`Expected ${inspect(directive)} to be a GraphQL directive.`);
20
+ }
21
+ return directive;
22
+ }
23
+ var GraphQLDirective = class {
24
+ constructor(config) {
25
+ var _a, _b;
26
+ this.name = config.name;
27
+ this.description = config.description;
28
+ this.locations = config.locations;
29
+ this.isRepeatable = (_a = config.isRepeatable) != null ? _a : false;
30
+ this.extensions = config.extensions && toObjMap(config.extensions);
31
+ this.astNode = config.astNode;
32
+ devAssert(config.name, "Directive must be named.");
33
+ devAssert(Array.isArray(config.locations), `@${config.name} locations must be an Array.`);
34
+ const args = (_b = config.args) != null ? _b : {};
35
+ devAssert(isObjectLike(args) && !Array.isArray(args), `@${config.name} args must be an object with argument names as keys.`);
36
+ this.args = defineArguments(args);
37
+ }
38
+ toConfig() {
39
+ return {
40
+ name: this.name,
41
+ description: this.description,
42
+ locations: this.locations,
43
+ args: argsToArgsConfig(this.args),
44
+ isRepeatable: this.isRepeatable,
45
+ extensions: this.extensions,
46
+ astNode: this.astNode
47
+ };
48
+ }
49
+ toString() {
50
+ return "@" + this.name;
51
+ }
52
+ toJSON() {
53
+ return this.toString();
54
+ }
55
+ get [Symbol.toStringTag]() {
56
+ return "GraphQLDirective";
57
+ }
58
+ };
59
+ var GraphQLIncludeDirective = new GraphQLDirective({
60
+ name: "include",
61
+ description: "Directs the executor to include this field or fragment only when the `if` argument is true.",
62
+ locations: [
63
+ DirectiveLocation.FIELD,
64
+ DirectiveLocation.FRAGMENT_SPREAD,
65
+ DirectiveLocation.INLINE_FRAGMENT
66
+ ],
67
+ args: {
68
+ if: {
69
+ type: new GraphQLNonNull(GraphQLBoolean),
70
+ description: "Included when true."
71
+ }
72
+ }
73
+ });
74
+ var GraphQLSkipDirective = new GraphQLDirective({
75
+ name: "skip",
76
+ description: "Directs the executor to skip this field or fragment when the `if` argument is true.",
77
+ locations: [
78
+ DirectiveLocation.FIELD,
79
+ DirectiveLocation.FRAGMENT_SPREAD,
80
+ DirectiveLocation.INLINE_FRAGMENT
81
+ ],
82
+ args: {
83
+ if: {
84
+ type: new GraphQLNonNull(GraphQLBoolean),
85
+ description: "Skipped when true."
86
+ }
87
+ }
88
+ });
89
+ var DEFAULT_DEPRECATION_REASON = "No longer supported";
90
+ var GraphQLDeprecatedDirective = new GraphQLDirective({
91
+ name: "deprecated",
92
+ description: "Marks an element of a GraphQL schema as no longer supported.",
93
+ locations: [
94
+ DirectiveLocation.FIELD_DEFINITION,
95
+ DirectiveLocation.ARGUMENT_DEFINITION,
96
+ DirectiveLocation.INPUT_FIELD_DEFINITION,
97
+ DirectiveLocation.ENUM_VALUE
98
+ ],
99
+ args: {
100
+ reason: {
101
+ type: GraphQLString,
102
+ description: "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",
103
+ defaultValue: DEFAULT_DEPRECATION_REASON
104
+ }
105
+ }
106
+ });
107
+ var GraphQLSpecifiedByDirective = new GraphQLDirective({
108
+ name: "specifiedBy",
109
+ description: "Exposes a URL that specifies the behaviour of this scalar.",
110
+ locations: [DirectiveLocation.SCALAR],
111
+ args: {
112
+ url: {
113
+ type: new GraphQLNonNull(GraphQLString),
114
+ description: "The URL that specifies the behaviour of this scalar."
115
+ }
116
+ }
117
+ });
118
+ var specifiedDirectives = Object.freeze([
119
+ GraphQLIncludeDirective,
120
+ GraphQLSkipDirective,
121
+ GraphQLDeprecatedDirective,
122
+ GraphQLSpecifiedByDirective
123
+ ]);
124
+ function isSpecifiedDirective(directive) {
125
+ return specifiedDirectives.some(({name}) => name === directive.name);
126
+ }
127
+ export {
128
+ DEFAULT_DEPRECATION_REASON,
129
+ GraphQLDeprecatedDirective,
130
+ GraphQLDirective,
131
+ GraphQLIncludeDirective,
132
+ GraphQLSkipDirective,
133
+ GraphQLSpecifiedByDirective,
134
+ assertDirective,
135
+ isDirective,
136
+ isSpecifiedDirective,
137
+ specifiedDirectives
138
+ };
@@ -1,10 +1,10 @@
1
1
  import { GraphQLError } from "graphql";
2
- import { DocumentNode, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, TypeNode } from "./ast/TypedAST";
2
+ import { DocumentNode, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, OperationTypeDefinitionNode, TypeNode } from "./ast/TypedAST";
3
3
  import type { Maybe } from "./jsutils/Maybe";
4
4
  import type { ObjMap } from "./jsutils/ObjMap";
5
5
  import type { Path } from "./jsutils/Path";
6
6
  import type { PromiseOrValue } from "./jsutils/PromiseOrValue";
7
- import { ExecutionWithoutSchemaArgs, FieldResolver, ResolveInfo, Resolvers, TypeResolver, ExecutionResult } from "./types";
7
+ import { ExecutionWithoutSchemaArgs, FunctionFieldResolver, ResolveInfo, Resolvers, TypeResolver, ExecutionResult } from "./types";
8
8
  /**
9
9
  * Terminology
10
10
  *
@@ -39,7 +39,7 @@ export interface ExecutionContext {
39
39
  variableValues: {
40
40
  [variable: string]: unknown;
41
41
  };
42
- fieldResolver: FieldResolver<any, any>;
42
+ fieldResolver: FunctionFieldResolver<any, any>;
43
43
  typeResolver: TypeResolver<any, any>;
44
44
  errors: Array<GraphQLError>;
45
45
  }
@@ -73,7 +73,7 @@ export declare function assertValidExecutionArguments(document: DocumentNode, ra
73
73
  */
74
74
  export declare function buildExecutionContext(resolvers: Resolvers, document: DocumentNode, rootValue: unknown, contextValue: unknown, rawVariableValues: Maybe<{
75
75
  [variable: string]: unknown;
76
- }>, operationName: Maybe<string>, fieldResolver: Maybe<FieldResolver<unknown, unknown>>, typeResolver?: Maybe<TypeResolver<unknown, unknown>>): Array<GraphQLError> | ExecutionContext;
76
+ }>, operationName: Maybe<string>, fieldResolver: Maybe<FunctionFieldResolver<unknown, unknown>>, typeResolver?: Maybe<TypeResolver<unknown, unknown>>): Array<GraphQLError> | ExecutionContext;
77
77
  /**
78
78
  * @internal
79
79
  */
@@ -95,5 +95,6 @@ export declare const defaultTypeResolver: TypeResolver<unknown, unknown>;
95
95
  * and returns it as the result, or if it's a function, returns the result
96
96
  * of calling that function while passing along args and context value.
97
97
  */
98
- export declare const defaultFieldResolver: FieldResolver<unknown, unknown>;
98
+ export declare const defaultFieldResolver: FunctionFieldResolver<unknown, unknown>;
99
+ export declare function getOperationRootTypeName(operation: OperationDefinitionNode | OperationTypeDefinitionNode): string;
99
100
  //# sourceMappingURL=executeWithoutSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executeWithoutSchema.d.ts","sourceRoot":"","sources":["../src/executeWithoutSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EASb,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EAEvB,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAQxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EACL,0BAA0B,EAC1B,aAAa,EAGb,WAAW,EAEX,SAAS,EACT,YAAY,EAEZ,eAAe,EAChB,MAAM,SAAS,CAAC;AAQjB;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,uBAAuB,CAAC;IACnC,cAAc,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAChD,aAAa,EAAE,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACvC,YAAY,EAAE,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACrC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;CAC7B;AAED;;;;;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AAY,EACtB,iBAAiB,EAAE,KAAK,CAAC;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC,GACxD,IAAI,CAQN;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,OAAO,EAClB,YAAY,EAAE,OAAO,EACrB,iBAAiB,EAAE,KAAK,CAAC;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC,EACzD,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,EAC5B,aAAa,EAAE,KAAK,CAAC,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EAC7D,YAAY,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,GACnD,KAAK,CAAC,YAAY,CAAC,GAAG,gBAAgB,CAyDxC;AAoPD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,gBAAgB,EAC5B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,EAC5B,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,QAAQ,EACxB,IAAI,EAAE,IAAI,GACT,WAAW,CAeb;AAoWD;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,CAM9D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,qBAAqB,CACtD,OAAO,EACP,OAAO,CAUR,CAAC;AAGF,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,uBAAuB,GAAG,2BAA2B,GAC/D,MAAM,CASR"}
@@ -27,7 +27,8 @@ __export(exports, {
27
27
  buildResolveInfo: () => buildResolveInfo,
28
28
  defaultFieldResolver: () => defaultFieldResolver,
29
29
  defaultTypeResolver: () => defaultTypeResolver,
30
- executeWithoutSchema: () => executeWithoutSchema
30
+ executeWithoutSchema: () => executeWithoutSchema,
31
+ getOperationRootTypeName: () => getOperationRootTypeName
31
32
  });
32
33
  var import_graphql = __toModule(require("graphql"));
33
34
  var import_collectFields = __toModule(require("./collectFields"));
@@ -191,6 +192,9 @@ function executeField(exeContext, parentTypeName, source, fieldNodes, path) {
191
192
  returnTypeName = (0, import_typeNameFromAST.typeNameFromAST)(returnTypeNode);
192
193
  const typeResolvers = exeContext.resolvers[parentTypeName];
193
194
  resolveFn = typeResolvers == null ? void 0 : typeResolvers[fieldName];
195
+ if (typeof resolveFn !== "function" && resolveFn != null) {
196
+ resolveFn = resolveFn.resolve;
197
+ }
194
198
  }
195
199
  if (!resolveFn) {
196
200
  resolveFn = exeContext.fieldResolver;
@@ -173,6 +173,9 @@ function executeField(exeContext, parentTypeName, source, fieldNodes, path) {
173
173
  returnTypeName = typeNameFromAST(returnTypeNode);
174
174
  const typeResolvers = exeContext.resolvers[parentTypeName];
175
175
  resolveFn = typeResolvers == null ? void 0 : typeResolvers[fieldName];
176
+ if (typeof resolveFn !== "function" && resolveFn != null) {
177
+ resolveFn = resolveFn.resolve;
178
+ }
176
179
  }
177
180
  if (!resolveFn) {
178
181
  resolveFn = exeContext.fieldResolver;
@@ -359,5 +362,6 @@ export {
359
362
  buildResolveInfo,
360
363
  defaultFieldResolver,
361
364
  defaultTypeResolver,
362
- executeWithoutSchema
365
+ executeWithoutSchema,
366
+ getOperationRootTypeName
363
367
  };
package/lib/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  export { executeWithoutSchema } from "./executeWithoutSchema";
2
2
  export { executeWithSchema } from "./executeWithSchema";
3
+ export { subscribeWithSchema } from "./subscribeWithSchema";
4
+ export { subscribeWithoutSchema } from "./subscribeWithoutSchema";
3
5
  export type { Resolvers } from "./types";
4
6
  export { addTypesToRequestDocument } from "./ast/addTypesToRequestDocument";
5
7
  export { extractImplicitTypes } from "./extractImplicitTypesRuntime";
6
8
  export { specifiedScalars } from "./values";
7
9
  export { annotateDocumentGraphQLTransform } from "./transforms/annotateDocumentGraphQLTransform";
10
+ export type { NameNode, DocumentNode, OperationDefinitionNode, VariableDefinitionNode, VariableNode, SelectionSetNode, FieldNode, ArgumentNode, FragmentSpreadNode, InlineFragmentNode, FragmentDefinitionNode, IntValueNode, FloatValueNode, StringValueNode, BooleanValueNode, NullValueNode, EnumValueNode, ListValueNode, ObjectValueNode, ObjectFieldNode, DirectiveNode, NamedTypeNode, ListTypeNode, NonNullTypeNode, SchemaDefinitionNode, OperationTypeDefinitionNode, ScalarTypeDefinitionNode, ObjectTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, UnionTypeDefinitionNode, EnumTypeDefinitionNode, EnumValueDefinitionNode, InputObjectTypeDefinitionNode, DirectiveDefinitionNode, SchemaExtensionNode, ScalarTypeExtensionNode, ObjectTypeExtensionNode, InterfaceTypeExtensionNode, UnionTypeExtensionNode, EnumTypeExtensionNode, InputObjectTypeExtensionNode, } from "./ast/TypedAST";
8
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AAEjG,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC"}
package/lib/index.js CHANGED
@@ -27,10 +27,14 @@ __export(exports, {
27
27
  executeWithSchema: () => import_executeWithSchema.executeWithSchema,
28
28
  executeWithoutSchema: () => import_executeWithoutSchema.executeWithoutSchema,
29
29
  extractImplicitTypes: () => import_extractImplicitTypesRuntime.extractImplicitTypes,
30
- specifiedScalars: () => import_values.specifiedScalars
30
+ specifiedScalars: () => import_values.specifiedScalars,
31
+ subscribeWithSchema: () => import_subscribeWithSchema.subscribeWithSchema,
32
+ subscribeWithoutSchema: () => import_subscribeWithoutSchema.subscribeWithoutSchema
31
33
  });
32
34
  var import_executeWithoutSchema = __toModule(require("./executeWithoutSchema"));
33
35
  var import_executeWithSchema = __toModule(require("./executeWithSchema"));
36
+ var import_subscribeWithSchema = __toModule(require("./subscribeWithSchema"));
37
+ var import_subscribeWithoutSchema = __toModule(require("./subscribeWithoutSchema"));
34
38
  var import_addTypesToRequestDocument = __toModule(require("./ast/addTypesToRequestDocument"));
35
39
  var import_extractImplicitTypesRuntime = __toModule(require("./extractImplicitTypesRuntime"));
36
40
  var import_values = __toModule(require("./values"));
package/lib/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  // src/index.ts
2
2
  import {executeWithoutSchema} from "./executeWithoutSchema.mjs";
3
3
  import {executeWithSchema} from "./executeWithSchema.mjs";
4
+ import {subscribeWithSchema} from "./subscribeWithSchema.mjs";
5
+ import {subscribeWithoutSchema} from "./subscribeWithoutSchema.mjs";
4
6
  import {addTypesToRequestDocument} from "./ast/addTypesToRequestDocument.mjs";
5
7
  import {extractImplicitTypes} from "./extractImplicitTypesRuntime.mjs";
6
8
  import {specifiedScalars} from "./values.mjs";
@@ -11,5 +13,7 @@ export {
11
13
  executeWithSchema,
12
14
  executeWithoutSchema,
13
15
  extractImplicitTypes,
14
- specifiedScalars
16
+ specifiedScalars,
17
+ subscribeWithSchema,
18
+ subscribeWithoutSchema
15
19
  };
@@ -0,0 +1,3 @@
1
+ import { ExecutionResult, ExecutionWithSchemaArgs } from "./types";
2
+ export declare function subscribeWithSchema({ typeDefs, resolvers, document: rawDocument, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver, }: ExecutionWithSchemaArgs): Promise<AsyncGenerator<ExecutionResult, void, void> | ExecutionResult>;
3
+ //# sourceMappingURL=subscribeWithSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribeWithSchema.d.ts","sourceRoot":"","sources":["../src/subscribeWithSchema.ts"],"names":[],"mappings":"AASA,OAAO,EAAa,eAAe,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAE9E,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,EACT,QAAQ,EAAE,WAAW,EACrB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,GACb,EAAE,uBAAuB,GAAG,OAAO,CAClC,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,eAAe,CAC9D,CA6BA"}
@@ -0,0 +1,78 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
10
+ var __objSpread = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
22
+ var __export = (target, all) => {
23
+ for (var name in all)
24
+ __defProp(target, name, {get: all[name], enumerable: true});
25
+ };
26
+ var __reExport = (target, module2, desc) => {
27
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
28
+ for (let key of __getOwnPropNames(module2))
29
+ if (!__hasOwnProp.call(target, key) && key !== "default")
30
+ __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
31
+ }
32
+ return target;
33
+ };
34
+ var __toModule = (module2) => {
35
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
36
+ };
37
+ __markAsModule(exports);
38
+ __export(exports, {
39
+ subscribeWithSchema: () => subscribeWithSchema
40
+ });
41
+ var import_schema = __toModule(require("@graphql-tools/schema"));
42
+ var import_graphql = __toModule(require("graphql"));
43
+ var import_index = __toModule(require("./index"));
44
+ function subscribeWithSchema({
45
+ typeDefs,
46
+ resolvers,
47
+ document: rawDocument,
48
+ rootValue,
49
+ contextValue,
50
+ variableValues,
51
+ operationName,
52
+ fieldResolver,
53
+ typeResolver
54
+ }) {
55
+ const schema = (0, import_schema.makeExecutableSchema)({typeDefs, resolvers});
56
+ let extractedResolvers = {};
57
+ const getTypeByName = (name) => {
58
+ const type = import_index.specifiedScalars[name] || extractedResolvers[name];
59
+ if ((0, import_graphql.isInputType)(type)) {
60
+ return type;
61
+ } else {
62
+ throw new Error("Invalid type");
63
+ }
64
+ };
65
+ extractedResolvers = (0, import_index.extractImplicitTypes)(typeDefs, getTypeByName);
66
+ const fullResolvers = __objSpread(__objSpread({}, extractedResolvers), resolvers);
67
+ const document = (0, import_index.addTypesToRequestDocument)(schema, rawDocument);
68
+ return (0, import_index.subscribeWithoutSchema)({
69
+ document,
70
+ resolvers: fullResolvers,
71
+ rootValue,
72
+ contextValue,
73
+ variableValues,
74
+ operationName,
75
+ fieldResolver,
76
+ typeResolver
77
+ });
78
+ }