@graphitation/supermassive 2.6.0 → 3.0.0-alpha.1
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 +10 -2
- package/lib/benchmarks/index.js +2 -2
- package/lib/benchmarks/index.js.map +2 -2
- package/lib/benchmarks/index.mjs +2 -2
- package/lib/benchmarks/index.mjs.map +2 -2
- package/lib/benchmarks/swapi-schema/index.d.ts +4 -2
- package/lib/benchmarks/swapi-schema/index.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/index.js +8 -2
- package/lib/benchmarks/swapi-schema/index.js.map +2 -2
- package/lib/benchmarks/swapi-schema/index.mjs +8 -2
- package/lib/benchmarks/swapi-schema/index.mjs.map +2 -2
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.d.ts +7 -0
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.d.ts.map +1 -0
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.js +916 -0
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.js.map +7 -0
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.mjs +903 -0
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.mjs.map +7 -0
- package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/resolvers.js +53 -17
- package/lib/benchmarks/swapi-schema/resolvers.js.map +2 -2
- package/lib/benchmarks/swapi-schema/resolvers.mjs +54 -18
- package/lib/benchmarks/swapi-schema/resolvers.mjs.map +2 -2
- package/lib/collectFields.d.ts +28 -6
- package/lib/collectFields.d.ts.map +1 -1
- package/lib/collectFields.js +155 -28
- package/lib/collectFields.js.map +3 -3
- package/lib/collectFields.mjs +150 -29
- package/lib/collectFields.mjs.map +2 -2
- package/lib/definition.js +1 -1
- package/lib/definition.js.map +2 -2
- package/lib/definition.mjs +1 -1
- package/lib/definition.mjs.map +2 -2
- package/lib/directives.d.ts +2 -73
- package/lib/directives.d.ts.map +1 -1
- package/lib/directives.js +10 -123
- package/lib/directives.js.map +2 -2
- package/lib/directives.mjs +13 -122
- package/lib/directives.mjs.map +2 -2
- package/lib/executeWithoutSchema.d.ts +50 -13
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +1038 -184
- package/lib/executeWithoutSchema.js.map +3 -3
- package/lib/executeWithoutSchema.mjs +1049 -186
- package/lib/executeWithoutSchema.mjs.map +3 -3
- package/lib/extractImplicitTypesRuntime.js +2 -2
- package/lib/extractImplicitTypesRuntime.js.map +2 -2
- package/lib/extractImplicitTypesRuntime.mjs +2 -2
- package/lib/extractImplicitTypesRuntime.mjs.map +2 -2
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +2 -2
- package/lib/index.mjs +4 -1
- package/lib/index.mjs.map +2 -2
- package/lib/jsutils/AccumulatorMap.d.ts +8 -0
- package/lib/jsutils/AccumulatorMap.d.ts.map +1 -0
- package/lib/jsutils/AccumulatorMap.js +36 -0
- package/lib/jsutils/AccumulatorMap.js.map +7 -0
- package/lib/jsutils/AccumulatorMap.mjs +17 -0
- package/lib/jsutils/AccumulatorMap.mjs.map +7 -0
- package/lib/jsutils/didYouMean.d.ts +1 -2
- package/lib/jsutils/didYouMean.d.ts.map +1 -1
- package/lib/jsutils/didYouMean.js.map +2 -2
- package/lib/jsutils/didYouMean.mjs.map +2 -2
- package/lib/jsutils/instanceOf.js.map +2 -2
- package/lib/jsutils/instanceOf.mjs.map +2 -2
- package/lib/subscribeWithSchema.d.ts +3 -2
- package/lib/subscribeWithSchema.d.ts.map +1 -1
- package/lib/subscribeWithSchema.js.map +2 -2
- package/lib/subscribeWithSchema.mjs.map +2 -2
- package/lib/subscribeWithoutSchema.d.ts +3 -35
- package/lib/subscribeWithoutSchema.d.ts.map +1 -1
- package/lib/subscribeWithoutSchema.js +1 -163
- package/lib/subscribeWithoutSchema.js.map +2 -2
- package/lib/subscribeWithoutSchema.mjs +2 -175
- package/lib/subscribeWithoutSchema.mjs.map +2 -2
- package/lib/supermassive-ast/TypedAST.d.ts +370 -0
- package/lib/supermassive-ast/TypedAST.d.ts.map +1 -0
- package/lib/supermassive-ast/TypedAST.js +29 -0
- package/lib/supermassive-ast/TypedAST.js.map +7 -0
- package/lib/supermassive-ast/TypedAST.mjs +10 -0
- package/lib/supermassive-ast/TypedAST.mjs.map +7 -0
- package/lib/supermassive-ast/addTypesToRequestDocument.d.ts +56 -0
- package/lib/supermassive-ast/addTypesToRequestDocument.d.ts.map +1 -0
- package/lib/supermassive-ast/addTypesToRequestDocument.js +473 -0
- package/lib/supermassive-ast/addTypesToRequestDocument.js.map +7 -0
- package/lib/supermassive-ast/addTypesToRequestDocument.mjs +463 -0
- package/lib/supermassive-ast/addTypesToRequestDocument.mjs.map +7 -0
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts +3 -0
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts.map +1 -0
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js +34 -0
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js.map +7 -0
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs +17 -0
- package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs.map +7 -0
- package/lib/supermassive-ast/directives.d.ts +36 -0
- package/lib/supermassive-ast/directives.d.ts.map +1 -0
- package/lib/supermassive-ast/directives.js +165 -0
- package/lib/supermassive-ast/directives.js.map +7 -0
- package/lib/supermassive-ast/directives.mjs +153 -0
- package/lib/supermassive-ast/directives.mjs.map +7 -0
- package/lib/supermassive-ast/index.d.ts +6 -0
- package/lib/supermassive-ast/index.d.ts.map +1 -0
- package/lib/supermassive-ast/index.js +37 -0
- package/lib/supermassive-ast/index.js.map +7 -0
- package/lib/supermassive-ast/index.mjs +27 -0
- package/lib/supermassive-ast/index.mjs.map +7 -0
- package/lib/types.d.ts +62 -6
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +14 -0
- package/lib/types.js.map +2 -2
- package/lib/types.mjs +11 -0
- package/lib/types.mjs.map +3 -3
- package/lib/utilities/mergeResolvers.d.ts +1 -1
- package/lib/utilities/mergeResolvers.d.ts.map +1 -1
- package/lib/utilities/mergeResolvers.js.map +2 -2
- package/lib/utilities/mergeResolvers.mjs.map +2 -2
- package/lib/utilities/typeNameFromAST.d.ts +1 -1
- package/lib/utilities/typeNameFromAST.d.ts.map +1 -1
- package/lib/utilities/typeNameFromAST.js.map +1 -1
- package/lib/utilities/typeNameFromAST.mjs.map +1 -1
- package/lib/values.d.ts +2 -3
- package/lib/values.d.ts.map +1 -1
- package/lib/values.js +10 -14
- package/lib/values.js.map +2 -2
- package/lib/values.mjs +10 -14
- package/lib/values.mjs.map +2 -2
- package/package.json +2 -5
|
@@ -0,0 +1,36 @@
|
|
|
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 AccumulatorMap_exports = {};
|
|
20
|
+
__export(AccumulatorMap_exports, {
|
|
21
|
+
AccumulatorMap: () => AccumulatorMap
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(AccumulatorMap_exports);
|
|
24
|
+
class AccumulatorMap extends Map {
|
|
25
|
+
get [Symbol.toStringTag]() {
|
|
26
|
+
return "AccumulatorMap";
|
|
27
|
+
}
|
|
28
|
+
add(key, item) {
|
|
29
|
+
const group = this.get(key);
|
|
30
|
+
if (group === void 0) {
|
|
31
|
+
this.set(key, [item]);
|
|
32
|
+
} else {
|
|
33
|
+
group.push(item);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/jsutils/AccumulatorMap.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * ES6 Map with additional `add` method to accumulate items.\n */\nexport class AccumulatorMap<K, T> extends Map<K, Array<T>> {\n get [Symbol.toStringTag]() {\n return \"AccumulatorMap\";\n }\n\n add(key: K, item: T): void {\n const group = this.get(key);\n if (group === undefined) {\n this.set(key, [item]);\n } else {\n group.push(item);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,uBAA6B,IAAiB;AAAA,EACzD,KAAK,OAAO,WAAW,IAAI;AACzB,WAAO;AAAA,EACT;AAAA,EAEA,IAAI,KAAQ,MAAe;AACzB,UAAM,QAAQ,KAAK,IAAI,GAAG;AAC1B,QAAI,UAAU,QAAW;AACvB,WAAK,IAAI,KAAK,CAAC,IAAI,CAAC;AAAA,IACtB,OAAO;AACL,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/jsutils/AccumulatorMap.ts
|
|
2
|
+
var AccumulatorMap = class extends Map {
|
|
3
|
+
get [Symbol.toStringTag]() {
|
|
4
|
+
return "AccumulatorMap";
|
|
5
|
+
}
|
|
6
|
+
add(key, item) {
|
|
7
|
+
const group = this.get(key);
|
|
8
|
+
if (group === void 0) {
|
|
9
|
+
this.set(key, [item]);
|
|
10
|
+
} else {
|
|
11
|
+
group.push(item);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
AccumulatorMap
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/jsutils/AccumulatorMap.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * ES6 Map with additional `add` method to accumulate items.\n */\nexport class AccumulatorMap<K, T> extends Map<K, Array<T>> {\n get [Symbol.toStringTag]() {\n return \"AccumulatorMap\";\n }\n\n add(key: K, item: T): void {\n const group = this.get(key);\n if (group === undefined) {\n this.set(key, [item]);\n } else {\n group.push(item);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAGO,IAAM,iBAAN,cAAmC,IAAiB;AAAA,EACzD,KAAK,OAAO,WAAW,IAAI;AACzB,WAAO;AAAA,EACT;AAAA,EAEA,IAAI,KAAQ,MAAe;AACzB,UAAM,QAAQ,KAAK,IAAI,GAAG;AAC1B,QAAI,UAAU,QAAW;AACvB,WAAK,IAAI,KAAK,CAAC,IAAI,CAAC;AAAA,IACtB,OAAO;AACL,YAAM,KAAK,IAAI;AAAA,IACjB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Given [ A, B, C ] return ' Did you mean A, B, or C?'.
|
|
3
3
|
*/
|
|
4
|
-
export declare function didYouMean(
|
|
5
|
-
export declare function didYouMean(subMessage: string, suggestions: ReadonlyArray<string>): string;
|
|
4
|
+
export declare function didYouMean(firstArg: string | ReadonlyArray<string>, secondArg?: ReadonlyArray<string>): string;
|
|
6
5
|
//# sourceMappingURL=didYouMean.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"didYouMean.d.ts","sourceRoot":"","sources":["../../src/jsutils/didYouMean.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,UAAU,
|
|
1
|
+
{"version":3,"file":"didYouMean.d.ts","sourceRoot":"","sources":["../../src/jsutils/didYouMean.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,EACxC,SAAS,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAChC,MAAM,CAuBR"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/jsutils/didYouMean.ts"],
|
|
4
|
-
"sourcesContent": ["const MAX_SUGGESTIONS = 5;\n\n/**\n * Given [ A, B, C ] return ' Did you mean A, B, or C?'.\n */\nexport function didYouMean(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,kBAAkB;
|
|
4
|
+
"sourcesContent": ["const MAX_SUGGESTIONS = 5;\n\n/**\n * Given [ A, B, C ] return ' Did you mean A, B, or C?'.\n */\nexport function didYouMean(\n firstArg: string | ReadonlyArray<string>,\n secondArg?: ReadonlyArray<string>,\n): string {\n const [subMessage, suggestionsArg] = secondArg\n ? [firstArg as string, secondArg]\n : [undefined, firstArg as ReadonlyArray<string>];\n\n let message = \" Did you mean \";\n if (subMessage) {\n message += subMessage + \" \";\n }\n\n const suggestions = suggestionsArg.map((x) => `\"${x}\"`);\n switch (suggestions.length) {\n case 0:\n return \"\";\n case 1:\n return message + suggestions[0] + \"?\";\n case 2:\n return message + suggestions[0] + \" or \" + suggestions[1] + \"?\";\n }\n\n const selected = suggestions.slice(0, MAX_SUGGESTIONS);\n const lastItem = selected.pop();\n return message + selected.join(\", \") + \", or \" + lastItem + \"?\";\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,kBAAkB;AAKjB,SAAS,WACd,UACA,WACQ;AACR,QAAM,CAAC,YAAY,cAAc,IAAI,YACjC,CAAC,UAAoB,SAAS,IAC9B,CAAC,QAAW,QAAiC;AAEjD,MAAI,UAAU;AACd,MAAI,YAAY;AACd,eAAW,aAAa;AAAA,EAC1B;AAEA,QAAM,cAAc,eAAe,IAAI,CAAC,MAAM,IAAI,IAAI;AACtD,UAAQ,YAAY,QAAQ;AAAA,IAC1B,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,UAAU,YAAY,CAAC,IAAI;AAAA,IACpC,KAAK;AACH,aAAO,UAAU,YAAY,CAAC,IAAI,SAAS,YAAY,CAAC,IAAI;AAAA,EAChE;AAEA,QAAM,WAAW,YAAY,MAAM,GAAG,eAAe;AACrD,QAAM,WAAW,SAAS,IAAI;AAC9B,SAAO,UAAU,SAAS,KAAK,IAAI,IAAI,UAAU,WAAW;AAC9D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/jsutils/didYouMean.ts"],
|
|
4
|
-
"sourcesContent": ["const MAX_SUGGESTIONS = 5;\n\n/**\n * Given [ A, B, C ] return ' Did you mean A, B, or C?'.\n */\nexport function didYouMean(
|
|
5
|
-
"mappings": ";AAAA,IAAM,kBAAkB;
|
|
4
|
+
"sourcesContent": ["const MAX_SUGGESTIONS = 5;\n\n/**\n * Given [ A, B, C ] return ' Did you mean A, B, or C?'.\n */\nexport function didYouMean(\n firstArg: string | ReadonlyArray<string>,\n secondArg?: ReadonlyArray<string>,\n): string {\n const [subMessage, suggestionsArg] = secondArg\n ? [firstArg as string, secondArg]\n : [undefined, firstArg as ReadonlyArray<string>];\n\n let message = \" Did you mean \";\n if (subMessage) {\n message += subMessage + \" \";\n }\n\n const suggestions = suggestionsArg.map((x) => `\"${x}\"`);\n switch (suggestions.length) {\n case 0:\n return \"\";\n case 1:\n return message + suggestions[0] + \"?\";\n case 2:\n return message + suggestions[0] + \" or \" + suggestions[1] + \"?\";\n }\n\n const selected = suggestions.slice(0, MAX_SUGGESTIONS);\n const lastItem = selected.pop();\n return message + selected.join(\", \") + \", or \" + lastItem + \"?\";\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,IAAM,kBAAkB;AAKjB,SAAS,WACd,UACA,WACQ;AACR,QAAM,CAAC,YAAY,cAAc,IAAI,YACjC,CAAC,UAAoB,SAAS,IAC9B,CAAC,QAAW,QAAiC;AAEjD,MAAI,UAAU;AACd,MAAI,YAAY;AACd,eAAW,aAAa;AAAA,EAC1B;AAEA,QAAM,cAAc,eAAe,IAAI,CAAC,MAAM,IAAI,IAAI;AACtD,UAAQ,YAAY,QAAQ;AAAA,IAC1B,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,UAAU,YAAY,CAAC,IAAI;AAAA,IACpC,KAAK;AACH,aAAO,UAAU,YAAY,CAAC,IAAI,SAAS,YAAY,CAAC,IAAI;AAAA,EAChE;AAEA,QAAM,WAAW,YAAY,MAAM,GAAG,eAAe;AACrD,QAAM,WAAW,SAAS,IAAI;AAC9B,SAAO,UAAU,SAAS,KAAK,IAAI,IAAI,UAAU,WAAW;AAC9D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/jsutils/instanceOf.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from \"./inspect\";\n\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\nexport const instanceOf: (value: unknown, constructor: Constructor) => boolean =\n process.env.NODE_ENV === \"production\"\n ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n function instanceOf(value: unknown, constructor: Constructor): boolean {\n return value instanceof constructor;\n }\n : function instanceOf(value: unknown, constructor: Constructor): boolean {\n if (value instanceof constructor) {\n return true;\n }\n if (typeof value === \"object\" && value !== null) {\n // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName =\n // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value\n ?
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAQjB,MAAM,aACX;AAAA;AAAA,EAEI,SAASA,YAAW,OAAgB,aAAmC;AACrE,WAAO,iBAAiB;AAAA,EAC1B;AAAA,IACA,SAASA,YAAW,OAAgB,aAAmC;AAd7E;AAeQ,MAAI,iBAAiB,aAAa;AAChC,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAE/C,UAAM,YAAY,YAAY,UAAU,OAAO,WAAW;AAC1D,UAAM;AAAA;AAAA,MAEJ,OAAO,eAAe,
|
|
4
|
+
"sourcesContent": ["import { inspect } from \"./inspect\";\n\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\nexport const instanceOf: (value: unknown, constructor: Constructor) => boolean =\n process.env.NODE_ENV === \"production\"\n ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n function instanceOf(value: unknown, constructor: Constructor): boolean {\n return value instanceof constructor;\n }\n : function instanceOf(value: unknown, constructor: Constructor): boolean {\n if (value instanceof constructor) {\n return true;\n }\n if (typeof value === \"object\" && value !== null) {\n // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName =\n // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value\n ? value[Symbol.toStringTag]\n : value.constructor?.name;\n if (className === valueClassName) {\n const stringifiedValue = inspect(value);\n throw new Error(\n `Cannot use ${className} \"${stringifiedValue}\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`,\n );\n }\n }\n return false;\n };\n\ninterface Constructor extends Function {\n prototype: {\n [Symbol.toStringTag]: string;\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAQjB,MAAM,aACX;AAAA;AAAA,EAEI,SAASA,YAAW,OAAgB,aAAmC;AACrE,WAAO,iBAAiB;AAAA,EAC1B;AAAA,IACA,SAASA,YAAW,OAAgB,aAAmC;AAd7E;AAeQ,MAAI,iBAAiB,aAAa;AAChC,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAE/C,UAAM,YAAY,YAAY,UAAU,OAAO,WAAW;AAC1D,UAAM;AAAA;AAAA,MAEJ,OAAO,eAAe,QAClB,MAAM,OAAO,WAAW,KACxB,WAAM,gBAAN,mBAAmB;AAAA;AACzB,QAAI,cAAc,gBAAgB;AAChC,YAAM,uBAAmB,wBAAQ,KAAK;AACtC,YAAM,IAAI;AAAA,QACR,cAAc,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAY9B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
6
|
"names": ["instanceOf"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/jsutils/instanceOf.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from \"./inspect\";\n\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\nexport const instanceOf: (value: unknown, constructor: Constructor) => boolean =\n process.env.NODE_ENV === \"production\"\n ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n function instanceOf(value: unknown, constructor: Constructor): boolean {\n return value instanceof constructor;\n }\n : function instanceOf(value: unknown, constructor: Constructor): boolean {\n if (value instanceof constructor) {\n return true;\n }\n if (typeof value === \"object\" && value !== null) {\n // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName =\n // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value\n ?
|
|
5
|
-
"mappings": ";AAAA,SAAS,eAAe;AAQjB,IAAM,aACX;AAAA;AAAA,EAEI,SAASA,YAAW,OAAgB,aAAmC;AACrE,WAAO,iBAAiB;AAAA,EAC1B;AAAA,IACA,SAASA,YAAW,OAAgB,aAAmC;AAd7E;AAeQ,MAAI,iBAAiB,aAAa;AAChC,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAE/C,UAAM,YAAY,YAAY,UAAU,OAAO,WAAW;AAC1D,UAAM;AAAA;AAAA,MAEJ,OAAO,eAAe,
|
|
4
|
+
"sourcesContent": ["import { inspect } from \"./inspect\";\n\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\nexport const instanceOf: (value: unknown, constructor: Constructor) => boolean =\n process.env.NODE_ENV === \"production\"\n ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n function instanceOf(value: unknown, constructor: Constructor): boolean {\n return value instanceof constructor;\n }\n : function instanceOf(value: unknown, constructor: Constructor): boolean {\n if (value instanceof constructor) {\n return true;\n }\n if (typeof value === \"object\" && value !== null) {\n // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName =\n // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value\n ? value[Symbol.toStringTag]\n : value.constructor?.name;\n if (className === valueClassName) {\n const stringifiedValue = inspect(value);\n throw new Error(\n `Cannot use ${className} \"${stringifiedValue}\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`,\n );\n }\n }\n return false;\n };\n\ninterface Constructor extends Function {\n prototype: {\n [Symbol.toStringTag]: string;\n };\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,eAAe;AAQjB,IAAM,aACX;AAAA;AAAA,EAEI,SAASA,YAAW,OAAgB,aAAmC;AACrE,WAAO,iBAAiB;AAAA,EAC1B;AAAA,IACA,SAASA,YAAW,OAAgB,aAAmC;AAd7E;AAeQ,MAAI,iBAAiB,aAAa;AAChC,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAE/C,UAAM,YAAY,YAAY,UAAU,OAAO,WAAW;AAC1D,UAAM;AAAA;AAAA,MAEJ,OAAO,eAAe,QAClB,MAAM,OAAO,WAAW,KACxB,WAAM,gBAAN,mBAAmB;AAAA;AACzB,QAAI,cAAc,gBAAgB;AAChC,YAAM,mBAAmB,QAAQ,KAAK;AACtC,YAAM,IAAI;AAAA,QACR,cAAc,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAY9B;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
6
|
"names": ["instanceOf"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { PromiseOrValue } from "./jsutils/PromiseOrValue";
|
|
2
|
+
import { ExecutionWithSchemaArgs, ExecutionResult } from "./types";
|
|
3
|
+
export declare function subscribeWithSchema({ typeDefs, resolvers, document: rawDocument, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver, }: ExecutionWithSchemaArgs): PromiseOrValue<ExecutionResult>;
|
|
3
4
|
//# sourceMappingURL=subscribeWithSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribeWithSchema.d.ts","sourceRoot":"","sources":["../src/subscribeWithSchema.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"subscribeWithSchema.d.ts","sourceRoot":"","sources":["../src/subscribeWithSchema.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAa,uBAAuB,EAAE,eAAe,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,cAAc,CAAC,eAAe,CAAC,CA0B3D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/subscribeWithSchema.ts"],
|
|
4
|
-
"sourcesContent": ["import { isInputType, buildASTSchema } from \"graphql\";\nimport {\n addTypesToRequestDocument,\n subscribeWithoutSchema,\n extractImplicitTypes,\n specifiedScalars,\n} from \"./index\";\nimport { Resolvers,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA4C;AAC5C,mBAKO;
|
|
4
|
+
"sourcesContent": ["import { isInputType, buildASTSchema } from \"graphql\";\nimport {\n addTypesToRequestDocument,\n subscribeWithoutSchema,\n extractImplicitTypes,\n specifiedScalars,\n} from \"./index\";\nimport { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nimport { Resolvers, ExecutionWithSchemaArgs, ExecutionResult } from \"./types\";\n\nexport function subscribeWithSchema({\n typeDefs,\n resolvers,\n document: rawDocument,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n}: ExecutionWithSchemaArgs): PromiseOrValue<ExecutionResult> {\n const schema = buildASTSchema(typeDefs);\n let extractedResolvers: Resolvers = {};\n const getTypeByName = (name: string) => {\n const type = specifiedScalars[name] || extractedResolvers[name];\n if (isInputType(type)) {\n return type;\n } else {\n throw new Error(\"Invalid type\");\n }\n };\n extractedResolvers = extractImplicitTypes(typeDefs, getTypeByName);\n\n const document = addTypesToRequestDocument(schema, rawDocument);\n\n return subscribeWithoutSchema({\n document,\n resolvers,\n schemaResolvers: extractedResolvers,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA4C;AAC5C,mBAKO;AAIA,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6D;AAC3D,QAAM,aAAS,+BAAe,QAAQ;AACtC,MAAI,qBAAgC,CAAC;AACrC,QAAM,gBAAgB,CAAC,SAAiB;AACtC,UAAM,OAAO,8BAAiB,IAAI,KAAK,mBAAmB,IAAI;AAC9D,YAAI,4BAAY,IAAI,GAAG;AACrB,aAAO;AAAA,IACT,OAAO;AACL,YAAM,IAAI,MAAM,cAAc;AAAA,IAChC;AAAA,EACF;AACA,2BAAqB,mCAAqB,UAAU,aAAa;AAEjE,QAAM,eAAW,wCAA0B,QAAQ,WAAW;AAE9D,aAAO,qCAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/subscribeWithSchema.ts"],
|
|
4
|
-
"sourcesContent": ["import { isInputType, buildASTSchema } from \"graphql\";\nimport {\n addTypesToRequestDocument,\n subscribeWithoutSchema,\n extractImplicitTypes,\n specifiedScalars,\n} from \"./index\";\nimport { Resolvers,
|
|
5
|
-
"mappings": ";AAAA,SAAS,aAAa,sBAAsB;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;
|
|
4
|
+
"sourcesContent": ["import { isInputType, buildASTSchema } from \"graphql\";\nimport {\n addTypesToRequestDocument,\n subscribeWithoutSchema,\n extractImplicitTypes,\n specifiedScalars,\n} from \"./index\";\nimport { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\nimport { Resolvers, ExecutionWithSchemaArgs, ExecutionResult } from \"./types\";\n\nexport function subscribeWithSchema({\n typeDefs,\n resolvers,\n document: rawDocument,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n}: ExecutionWithSchemaArgs): PromiseOrValue<ExecutionResult> {\n const schema = buildASTSchema(typeDefs);\n let extractedResolvers: Resolvers = {};\n const getTypeByName = (name: string) => {\n const type = specifiedScalars[name] || extractedResolvers[name];\n if (isInputType(type)) {\n return type;\n } else {\n throw new Error(\"Invalid type\");\n }\n };\n extractedResolvers = extractImplicitTypes(typeDefs, getTypeByName);\n\n const document = addTypesToRequestDocument(schema, rawDocument);\n\n return subscribeWithoutSchema({\n document,\n resolvers,\n schemaResolvers: extractedResolvers,\n rootValue,\n contextValue,\n variableValues,\n operationName,\n fieldResolver,\n typeResolver,\n });\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,aAAa,sBAAsB;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6D;AAC3D,QAAM,SAAS,eAAe,QAAQ;AACtC,MAAI,qBAAgC,CAAC;AACrC,QAAM,gBAAgB,CAAC,SAAiB;AACtC,UAAM,OAAO,iBAAiB,IAAI,KAAK,mBAAmB,IAAI;AAC9D,QAAI,YAAY,IAAI,GAAG;AACrB,aAAO;AAAA,IACT,OAAO;AACL,YAAM,IAAI,MAAM,cAAc;AAAA,IAChC;AAAA,EACF;AACA,uBAAqB,qBAAqB,UAAU,aAAa;AAEjE,QAAM,WAAW,0BAA0B,QAAQ,WAAW;AAE9D,SAAO,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { FunctionFieldResolver, ExecutionWithoutSchemaArgs, Resolvers, ExecutionResult } from "./types";
|
|
1
|
+
import { ExecutionWithoutSchemaArgs, ExecutionResult } from "./types";
|
|
2
|
+
import type { PromiseOrValue } from "./jsutils/PromiseOrValue";
|
|
4
3
|
/**
|
|
5
4
|
* Implements the "Subscribe" algorithm described in the GraphQL specification.
|
|
6
5
|
*
|
|
@@ -22,36 +21,5 @@ import { FunctionFieldResolver, ExecutionWithoutSchemaArgs, Resolvers, Execution
|
|
|
22
21
|
*
|
|
23
22
|
* Accepts either an object with named arguments, or individual arguments.
|
|
24
23
|
*/
|
|
25
|
-
export declare function subscribeWithoutSchema(args: ExecutionWithoutSchemaArgs):
|
|
26
|
-
/**
|
|
27
|
-
* Implements the "CreateSourceEventStream" algorithm described in the
|
|
28
|
-
* GraphQL specification, resolving the subscription source event stream.
|
|
29
|
-
*
|
|
30
|
-
* Returns a Promise which resolves to either an AsyncIterable (if successful)
|
|
31
|
-
* or an ExecutionResult (error). The promise will be rejected if the schema or
|
|
32
|
-
* other arguments to this function are invalid, or if the resolved event stream
|
|
33
|
-
* is not an async iterable.
|
|
34
|
-
*
|
|
35
|
-
* If the client-provided arguments to this function do not result in a
|
|
36
|
-
* compliant subscription, a GraphQL Response (ExecutionResult) with
|
|
37
|
-
* descriptive errors and no data will be returned.
|
|
38
|
-
*
|
|
39
|
-
* If the the source stream could not be created due to faulty subscription
|
|
40
|
-
* resolver logic or underlying systems, the promise will resolve to a single
|
|
41
|
-
* ExecutionResult containing `errors` and no `data`.
|
|
42
|
-
*
|
|
43
|
-
* If the operation succeeded, the promise resolves to the AsyncIterable for the
|
|
44
|
-
* event stream returned by the resolver.
|
|
45
|
-
*
|
|
46
|
-
* A Source Event Stream represents a sequence of events, each of which triggers
|
|
47
|
-
* a GraphQL execution for that event.
|
|
48
|
-
*
|
|
49
|
-
* This may be useful when hosting the stateful subscription service in a
|
|
50
|
-
* different process or machine than the stateless GraphQL execution engine,
|
|
51
|
-
* or otherwise separating these two steps. For more on this, see the
|
|
52
|
-
* "Supporting Subscriptions at Scale" information in the GraphQL specification.
|
|
53
|
-
*/
|
|
54
|
-
export declare function createSourceEventStream(resolvers: Resolvers, document: DocumentNode, rootValue?: unknown, contextValue?: unknown, variableValues?: Maybe<{
|
|
55
|
-
readonly [variable: string]: unknown;
|
|
56
|
-
}>, operationName?: Maybe<string>, fieldResolver?: Maybe<FunctionFieldResolver<unknown, unknown>>): Promise<AsyncIterable<unknown> | ExecutionResult>;
|
|
24
|
+
export declare function subscribeWithoutSchema(args: ExecutionWithoutSchemaArgs): PromiseOrValue<ExecutionResult>;
|
|
57
25
|
//# sourceMappingURL=subscribeWithoutSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscribeWithoutSchema.d.ts","sourceRoot":"","sources":["../src/subscribeWithoutSchema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscribeWithoutSchema.d.ts","sourceRoot":"","sources":["../src/subscribeWithoutSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,0BAA0B,GAC/B,cAAc,CAAC,eAAe,CAAC,CAEjC"}
|
|
@@ -16,174 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __async = (__this, __arguments, generator) => {
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
var fulfilled = (value) => {
|
|
22
|
-
try {
|
|
23
|
-
step(generator.next(value));
|
|
24
|
-
} catch (e) {
|
|
25
|
-
reject(e);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var rejected = (value) => {
|
|
29
|
-
try {
|
|
30
|
-
step(generator.throw(value));
|
|
31
|
-
} catch (e) {
|
|
32
|
-
reject(e);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
36
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
19
|
var subscribeWithoutSchema_exports = {};
|
|
40
20
|
__export(subscribeWithoutSchema_exports, {
|
|
41
|
-
createSourceEventStream: () => createSourceEventStream,
|
|
42
21
|
subscribeWithoutSchema: () => subscribeWithoutSchema
|
|
43
22
|
});
|
|
44
23
|
module.exports = __toCommonJS(subscribeWithoutSchema_exports);
|
|
45
|
-
var import_inspect = require("./jsutils/inspect");
|
|
46
|
-
var import_isAsyncIterable = require("./jsutils/isAsyncIterable");
|
|
47
|
-
var import_Path = require("./jsutils/Path");
|
|
48
|
-
var import_graphql = require("graphql");
|
|
49
24
|
var import_executeWithoutSchema = require("./executeWithoutSchema");
|
|
50
|
-
var import_collectFields = require("./collectFields");
|
|
51
|
-
var import_values = require("./values");
|
|
52
|
-
var import_typeNameFromAST = require("./utilities/typeNameFromAST");
|
|
53
|
-
var import_mergeResolvers = require("./utilities/mergeResolvers");
|
|
54
|
-
var import_mapAsyncIterator = require("./utilities/mapAsyncIterator");
|
|
55
25
|
function subscribeWithoutSchema(args) {
|
|
56
|
-
return
|
|
57
|
-
const {
|
|
58
|
-
resolvers,
|
|
59
|
-
schemaResolvers,
|
|
60
|
-
document,
|
|
61
|
-
rootValue,
|
|
62
|
-
contextValue,
|
|
63
|
-
variableValues,
|
|
64
|
-
operationName,
|
|
65
|
-
fieldResolver,
|
|
66
|
-
subscribeFieldResolver
|
|
67
|
-
} = args;
|
|
68
|
-
const combinedResolvers = schemaResolvers ? (0, import_mergeResolvers.mergeResolvers)(resolvers, schemaResolvers) : resolvers;
|
|
69
|
-
const resultOrStream = yield createSourceEventStream(
|
|
70
|
-
combinedResolvers,
|
|
71
|
-
document,
|
|
72
|
-
rootValue,
|
|
73
|
-
contextValue,
|
|
74
|
-
variableValues,
|
|
75
|
-
operationName,
|
|
76
|
-
subscribeFieldResolver
|
|
77
|
-
);
|
|
78
|
-
if (!(0, import_isAsyncIterable.isAsyncIterable)(resultOrStream)) {
|
|
79
|
-
return resultOrStream;
|
|
80
|
-
}
|
|
81
|
-
const mapSourceToResponse = (payload) => (0, import_executeWithoutSchema.executeWithoutSchema)({
|
|
82
|
-
resolvers,
|
|
83
|
-
schemaResolvers,
|
|
84
|
-
document,
|
|
85
|
-
rootValue: payload,
|
|
86
|
-
contextValue,
|
|
87
|
-
variableValues,
|
|
88
|
-
operationName,
|
|
89
|
-
fieldResolver
|
|
90
|
-
});
|
|
91
|
-
return (0, import_mapAsyncIterator.mapAsyncIterator)(resultOrStream, mapSourceToResponse);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
function createSourceEventStream(resolvers, document, rootValue, contextValue, variableValues, operationName, fieldResolver) {
|
|
95
|
-
return __async(this, null, function* () {
|
|
96
|
-
(0, import_executeWithoutSchema.assertValidExecutionArguments)(document, variableValues);
|
|
97
|
-
try {
|
|
98
|
-
const exeContext = (0, import_executeWithoutSchema.buildExecutionContext)(
|
|
99
|
-
resolvers,
|
|
100
|
-
document,
|
|
101
|
-
rootValue,
|
|
102
|
-
contextValue,
|
|
103
|
-
variableValues,
|
|
104
|
-
operationName,
|
|
105
|
-
fieldResolver
|
|
106
|
-
);
|
|
107
|
-
if (!("resolvers" in exeContext)) {
|
|
108
|
-
return { errors: exeContext };
|
|
109
|
-
}
|
|
110
|
-
const eventStream = yield executeSubscription(exeContext);
|
|
111
|
-
if (!(0, import_isAsyncIterable.isAsyncIterable)(eventStream)) {
|
|
112
|
-
throw new Error(
|
|
113
|
-
`Subscription field must return Async Iterable. Received: ${(0, import_inspect.inspect)(eventStream)}.`
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
return eventStream;
|
|
117
|
-
} catch (error) {
|
|
118
|
-
if (error instanceof import_graphql.GraphQLError) {
|
|
119
|
-
return { errors: [error] };
|
|
120
|
-
}
|
|
121
|
-
throw error;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function executeSubscription(exeContext) {
|
|
126
|
-
return __async(this, null, function* () {
|
|
127
|
-
const { resolvers, fragments, operation, variableValues, rootValue } = exeContext;
|
|
128
|
-
const typeName = (0, import_executeWithoutSchema.getOperationRootTypeName)(operation);
|
|
129
|
-
const fields = (0, import_collectFields.collectFields)(
|
|
130
|
-
resolvers,
|
|
131
|
-
fragments,
|
|
132
|
-
variableValues,
|
|
133
|
-
typeName,
|
|
134
|
-
operation.selectionSet,
|
|
135
|
-
/* @__PURE__ */ new Map(),
|
|
136
|
-
/* @__PURE__ */ new Set()
|
|
137
|
-
);
|
|
138
|
-
const [responseName, fieldNodes] = [...fields.entries()][0];
|
|
139
|
-
const fieldName = fieldNodes[0].name.value;
|
|
140
|
-
let resolveFn;
|
|
141
|
-
let returnTypeName;
|
|
142
|
-
let returnTypeNode;
|
|
143
|
-
if (fieldName === "__typename" && !resolveFn) {
|
|
144
|
-
resolveFn = () => typeName;
|
|
145
|
-
returnTypeName = "String";
|
|
146
|
-
returnTypeNode = {
|
|
147
|
-
kind: import_graphql.Kind.NAMED_TYPE,
|
|
148
|
-
name: {
|
|
149
|
-
kind: import_graphql.Kind.NAME,
|
|
150
|
-
value: "String"
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
} else {
|
|
154
|
-
returnTypeNode = fieldNodes[0].__type;
|
|
155
|
-
returnTypeName = (0, import_typeNameFromAST.typeNameFromAST)(returnTypeNode);
|
|
156
|
-
const typeResolvers = exeContext.resolvers[typeName];
|
|
157
|
-
const fieldResolver = typeResolvers == null ? void 0 : typeResolvers[fieldName];
|
|
158
|
-
resolveFn = fieldResolver == null ? void 0 : fieldResolver.subscribe;
|
|
159
|
-
}
|
|
160
|
-
if (!resolveFn) {
|
|
161
|
-
resolveFn = exeContext.fieldResolver;
|
|
162
|
-
}
|
|
163
|
-
const path = (0, import_Path.addPath)(void 0, responseName, typeName);
|
|
164
|
-
const info = (0, import_executeWithoutSchema.buildResolveInfo)(
|
|
165
|
-
exeContext,
|
|
166
|
-
fieldName,
|
|
167
|
-
fieldNodes,
|
|
168
|
-
typeName,
|
|
169
|
-
returnTypeName,
|
|
170
|
-
returnTypeNode,
|
|
171
|
-
path
|
|
172
|
-
);
|
|
173
|
-
try {
|
|
174
|
-
const args = (0, import_values.getArgumentValues)(resolvers, fieldNodes[0], variableValues);
|
|
175
|
-
const contextValue = exeContext.contextValue;
|
|
176
|
-
const eventStream = yield resolveFn(rootValue, args, contextValue, info);
|
|
177
|
-
if (eventStream instanceof Error) {
|
|
178
|
-
throw eventStream;
|
|
179
|
-
}
|
|
180
|
-
return eventStream;
|
|
181
|
-
} catch (error) {
|
|
182
|
-
throw (0, import_graphql.locatedError)(
|
|
183
|
-
error,
|
|
184
|
-
fieldNodes,
|
|
185
|
-
(0, import_Path.pathToArray)(path)
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
26
|
+
return (0, import_executeWithoutSchema.executeWithoutSchema)(args);
|
|
189
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/subscribeWithoutSchema.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { executeWithoutSchema } from \"./executeWithoutSchema\";\n\nimport { ExecutionWithoutSchemaArgs, ExecutionResult } from \"./types\";\nimport type { PromiseOrValue } from \"./jsutils/PromiseOrValue\";\n\n/**\n * Implements the \"Subscribe\" algorithm described in the GraphQL specification.\n *\n * Returns a Promise which resolves to either an AsyncIterator (if successful)\n * or an ExecutionResult (error). The promise will be rejected if the schema or\n * other arguments to this function are invalid, or if the resolved event stream\n * is not an async iterable.\n *\n * If the client-provided arguments to this function do not result in a\n * compliant subscription, a GraphQL Response (ExecutionResult) with\n * descriptive errors and no data will be returned.\n *\n * If the source stream could not be created due to faulty subscription\n * resolver logic or underlying systems, the promise will resolve to a single\n * ExecutionResult containing `errors` and no `data`.\n *\n * If the operation succeeded, the promise resolves to an AsyncIterator, which\n * yields a stream of ExecutionResults representing the response stream.\n *\n * Accepts either an object with named arguments, or individual arguments.\n */\nexport function subscribeWithoutSchema(\n args: ExecutionWithoutSchemaArgs,\n): PromiseOrValue<ExecutionResult> {\n return executeWithoutSchema(args);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAqC;AA0B9B,SAAS,uBACd,MACiC;AACjC,aAAO,kDAAqB,IAAI;AAClC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|