@graphitation/supermassive 3.8.7 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -1
- package/CHANGELOG.md +17 -1
- package/lib/__testUtils__/execute.d.ts +2 -2
- package/lib/__testUtils__/execute.d.ts.map +1 -1
- package/lib/__testUtils__/execute.js +77 -119
- package/lib/__testUtils__/execute.js.map +2 -2
- package/lib/__testUtils__/execute.mjs +77 -122
- package/lib/__testUtils__/execute.mjs.map +2 -2
- package/lib/benchmarks/index.js +41 -63
- package/lib/benchmarks/index.js.map +1 -1
- package/lib/benchmarks/index.mjs +152 -184
- package/lib/benchmarks/index.mjs.map +1 -1
- package/lib/benchmarks/nice-benchmark.js +3 -23
- package/lib/benchmarks/nice-benchmark.js.map +1 -1
- package/lib/benchmarks/nice-benchmark.mjs +3 -24
- package/lib/benchmarks/nice-benchmark.mjs.map +1 -1
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.js +78 -68
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.js.map +1 -1
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.mjs +78 -71
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.mjs.map +1 -1
- package/lib/benchmarks/swapi-schema/resolvers.js +31 -71
- package/lib/benchmarks/swapi-schema/resolvers.js.map +1 -1
- package/lib/benchmarks/swapi-schema/resolvers.mjs +31 -74
- package/lib/benchmarks/swapi-schema/resolvers.mjs.map +1 -1
- package/lib/executeWithSchema.d.ts +1 -1
- package/lib/executeWithSchema.d.ts.map +1 -1
- package/lib/executeWithSchema.js +4 -2
- package/lib/executeWithSchema.js.map +2 -2
- package/lib/executeWithSchema.mjs +4 -2
- package/lib/executeWithSchema.mjs.map +2 -2
- package/lib/executeWithoutSchema.d.ts +1 -0
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +205 -252
- package/lib/executeWithoutSchema.js.map +2 -2
- package/lib/executeWithoutSchema.mjs +205 -255
- package/lib/executeWithoutSchema.mjs.map +2 -2
- package/lib/legacyAST/addTypesToRequestDocument.js +6 -21
- package/lib/legacyAST/addTypesToRequestDocument.js.map +1 -1
- package/lib/legacyAST/addTypesToRequestDocument.mjs +6 -24
- package/lib/legacyAST/addTypesToRequestDocument.mjs.map +1 -1
- package/lib/types.d.ts +1 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.js +9 -23
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.js.map +1 -1
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs +9 -26
- package/lib/utilities/addMinimalViableSchemaToRequestDocument.mjs.map +1 -1
- package/lib/utilities/mapAsyncIterator.js +19 -47
- package/lib/utilities/mapAsyncIterator.js.map +1 -1
- package/lib/utilities/mapAsyncIterator.mjs +19 -48
- package/lib/utilities/mapAsyncIterator.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -43,26 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
43
26
|
mod
|
|
44
27
|
));
|
|
45
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
-
var __async = (__this, __arguments, generator) => {
|
|
47
|
-
return new Promise((resolve, reject) => {
|
|
48
|
-
var fulfilled = (value) => {
|
|
49
|
-
try {
|
|
50
|
-
step(generator.next(value));
|
|
51
|
-
} catch (e) {
|
|
52
|
-
reject(e);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var rejected = (value) => {
|
|
56
|
-
try {
|
|
57
|
-
step(generator.throw(value));
|
|
58
|
-
} catch (e) {
|
|
59
|
-
reject(e);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
63
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
29
|
var executeWithoutSchema_exports = {};
|
|
67
30
|
__export(executeWithoutSchema_exports, {
|
|
68
31
|
assertValidExecutionArguments: () => assertValidExecutionArguments,
|
|
@@ -127,7 +90,8 @@ function buildExecutionContext(args) {
|
|
|
127
90
|
fieldResolver,
|
|
128
91
|
typeResolver,
|
|
129
92
|
subscribeFieldResolver,
|
|
130
|
-
fieldExecutionHooks
|
|
93
|
+
fieldExecutionHooks,
|
|
94
|
+
enablePerEventContext
|
|
131
95
|
} = args;
|
|
132
96
|
assertValidExecutionArguments(document, variableValues);
|
|
133
97
|
let operation;
|
|
@@ -184,16 +148,18 @@ function buildExecutionContext(args) {
|
|
|
184
148
|
subscribeFieldResolver: subscribeFieldResolver != null ? subscribeFieldResolver : defaultFieldResolver,
|
|
185
149
|
errors: [],
|
|
186
150
|
fieldExecutionHooks,
|
|
187
|
-
subsequentPayloads: /* @__PURE__ */ new Set()
|
|
151
|
+
subsequentPayloads: /* @__PURE__ */ new Set(),
|
|
152
|
+
enablePerEventContext: enablePerEventContext != null ? enablePerEventContext : true
|
|
188
153
|
};
|
|
189
154
|
}
|
|
190
155
|
function buildPerEventExecutionContext(exeContext, payload) {
|
|
191
|
-
return
|
|
156
|
+
return {
|
|
157
|
+
...exeContext,
|
|
192
158
|
contextValue: exeContext.buildContextValue ? exeContext.buildContextValue(exeContext.contextValue) : exeContext.contextValue,
|
|
193
159
|
rootValue: payload,
|
|
194
160
|
subsequentPayloads: /* @__PURE__ */ new Set(),
|
|
195
161
|
errors: []
|
|
196
|
-
}
|
|
162
|
+
};
|
|
197
163
|
}
|
|
198
164
|
function executeOperationWithBeforeHook(exeContext) {
|
|
199
165
|
const hooks = exeContext.fieldExecutionHooks;
|
|
@@ -296,9 +262,10 @@ function buildResponse(exeContext, data) {
|
|
|
296
262
|
const initialResult = exeContext.errors.length === 0 ? { data } : { errors: exeContext.errors, data };
|
|
297
263
|
if (exeContext.subsequentPayloads.size > 0) {
|
|
298
264
|
return {
|
|
299
|
-
initialResult:
|
|
265
|
+
initialResult: {
|
|
266
|
+
...initialResult,
|
|
300
267
|
hasNext: true
|
|
301
|
-
}
|
|
268
|
+
},
|
|
302
269
|
subsequentResults: yieldSubsequentPayloads(exeContext)
|
|
303
270
|
};
|
|
304
271
|
} else {
|
|
@@ -622,7 +589,7 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
|
|
|
622
589
|
return null;
|
|
623
590
|
}
|
|
624
591
|
return executeFields(
|
|
625
|
-
exeContext,
|
|
592
|
+
exeContext.enablePerEventContext ? perEventContext : exeContext,
|
|
626
593
|
parentTypeName,
|
|
627
594
|
payload,
|
|
628
595
|
path,
|
|
@@ -630,7 +597,7 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
|
|
|
630
597
|
void 0
|
|
631
598
|
);
|
|
632
599
|
}) : executeFields(
|
|
633
|
-
exeContext,
|
|
600
|
+
exeContext.enablePerEventContext ? perEventContext : exeContext,
|
|
634
601
|
parentTypeName,
|
|
635
602
|
payload,
|
|
636
603
|
path,
|
|
@@ -913,36 +880,34 @@ function completeValue(exeContext, returnTypeRef, fieldGroup, info, path, result
|
|
|
913
880
|
"Cannot complete value of unexpected output type: " + (0, import_reference.inspectTypeReference)(returnTypeRef)
|
|
914
881
|
);
|
|
915
882
|
}
|
|
916
|
-
function completePromisedValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
completed = yield completed;
|
|
931
|
-
}
|
|
932
|
-
return completed;
|
|
933
|
-
} catch (rawError) {
|
|
934
|
-
handleFieldError(
|
|
935
|
-
rawError,
|
|
936
|
-
exeContext,
|
|
937
|
-
returnTypeRef,
|
|
938
|
-
fieldGroup,
|
|
939
|
-
path,
|
|
940
|
-
incrementalDataRecord
|
|
941
|
-
);
|
|
942
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
943
|
-
return null;
|
|
883
|
+
async function completePromisedValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
884
|
+
try {
|
|
885
|
+
const resolved = await result;
|
|
886
|
+
let completed = completeValue(
|
|
887
|
+
exeContext,
|
|
888
|
+
returnTypeRef,
|
|
889
|
+
fieldGroup,
|
|
890
|
+
info,
|
|
891
|
+
path,
|
|
892
|
+
resolved,
|
|
893
|
+
incrementalDataRecord
|
|
894
|
+
);
|
|
895
|
+
if ((0, import_isPromise.isPromise)(completed)) {
|
|
896
|
+
completed = await completed;
|
|
944
897
|
}
|
|
945
|
-
|
|
898
|
+
return completed;
|
|
899
|
+
} catch (rawError) {
|
|
900
|
+
handleFieldError(
|
|
901
|
+
rawError,
|
|
902
|
+
exeContext,
|
|
903
|
+
returnTypeRef,
|
|
904
|
+
fieldGroup,
|
|
905
|
+
path,
|
|
906
|
+
incrementalDataRecord
|
|
907
|
+
);
|
|
908
|
+
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
909
|
+
return null;
|
|
910
|
+
}
|
|
946
911
|
}
|
|
947
912
|
function completeListValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
948
913
|
const itemTypeRef = (0, import_reference.unwrap)(returnTypeRef);
|
|
@@ -1091,53 +1056,51 @@ function getStreamValues(exeContext, fieldGroup, path) {
|
|
|
1091
1056
|
label: typeof stream.label === "string" ? stream.label : void 0
|
|
1092
1057
|
};
|
|
1093
1058
|
}
|
|
1094
|
-
function completeAsyncIteratorValue(exeContext, itemTypeRef, fieldGroup, info, path, asyncIterator, incrementalDataRecord) {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
asyncIterator,
|
|
1105
|
-
exeContext,
|
|
1106
|
-
fieldGroup,
|
|
1107
|
-
info,
|
|
1108
|
-
itemTypeRef,
|
|
1109
|
-
path,
|
|
1110
|
-
stream.label,
|
|
1111
|
-
incrementalDataRecord
|
|
1112
|
-
);
|
|
1113
|
-
break;
|
|
1114
|
-
}
|
|
1115
|
-
const itemPath = (0, import_Path.addPath)(path, index, void 0);
|
|
1116
|
-
let iteration;
|
|
1117
|
-
try {
|
|
1118
|
-
iteration = yield asyncIterator.next();
|
|
1119
|
-
if (iteration.done) {
|
|
1120
|
-
break;
|
|
1121
|
-
}
|
|
1122
|
-
} catch (rawError) {
|
|
1123
|
-
throw (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
1124
|
-
}
|
|
1125
|
-
if (completeListItemValue(
|
|
1126
|
-
iteration.value,
|
|
1127
|
-
completedResults,
|
|
1059
|
+
async function completeAsyncIteratorValue(exeContext, itemTypeRef, fieldGroup, info, path, asyncIterator, incrementalDataRecord) {
|
|
1060
|
+
const stream = getStreamValues(exeContext, fieldGroup, path);
|
|
1061
|
+
let containsPromise = false;
|
|
1062
|
+
const completedResults = [];
|
|
1063
|
+
let index = 0;
|
|
1064
|
+
while (true) {
|
|
1065
|
+
if (stream && typeof stream.initialCount === "number" && index >= stream.initialCount) {
|
|
1066
|
+
executeStreamAsyncIterator(
|
|
1067
|
+
index,
|
|
1068
|
+
asyncIterator,
|
|
1128
1069
|
exeContext,
|
|
1129
|
-
itemTypeRef,
|
|
1130
1070
|
fieldGroup,
|
|
1131
1071
|
info,
|
|
1132
|
-
|
|
1072
|
+
itemTypeRef,
|
|
1073
|
+
path,
|
|
1074
|
+
stream.label,
|
|
1133
1075
|
incrementalDataRecord
|
|
1134
|
-
)
|
|
1135
|
-
|
|
1076
|
+
);
|
|
1077
|
+
break;
|
|
1078
|
+
}
|
|
1079
|
+
const itemPath = (0, import_Path.addPath)(path, index, void 0);
|
|
1080
|
+
let iteration;
|
|
1081
|
+
try {
|
|
1082
|
+
iteration = await asyncIterator.next();
|
|
1083
|
+
if (iteration.done) {
|
|
1084
|
+
break;
|
|
1136
1085
|
}
|
|
1137
|
-
|
|
1086
|
+
} catch (rawError) {
|
|
1087
|
+
throw (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
1138
1088
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1089
|
+
if (completeListItemValue(
|
|
1090
|
+
iteration.value,
|
|
1091
|
+
completedResults,
|
|
1092
|
+
exeContext,
|
|
1093
|
+
itemTypeRef,
|
|
1094
|
+
fieldGroup,
|
|
1095
|
+
info,
|
|
1096
|
+
itemPath,
|
|
1097
|
+
incrementalDataRecord
|
|
1098
|
+
)) {
|
|
1099
|
+
containsPromise = true;
|
|
1100
|
+
}
|
|
1101
|
+
index += 1;
|
|
1102
|
+
}
|
|
1103
|
+
return containsPromise ? Promise.all(completedResults) : completedResults;
|
|
1141
1104
|
}
|
|
1142
1105
|
function completeLeafValue(returnType, result) {
|
|
1143
1106
|
const serializedResult = returnType.serialize(result);
|
|
@@ -1747,116 +1710,112 @@ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info,
|
|
|
1747
1710
|
incrementalDataRecord.addItems([completedItem]);
|
|
1748
1711
|
return incrementalDataRecord;
|
|
1749
1712
|
}
|
|
1750
|
-
function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, info, itemTypeRef, incrementalDataRecord, path, itemPath) {
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
return { done, value: void 0 };
|
|
1758
|
-
}
|
|
1759
|
-
item = value;
|
|
1760
|
-
} catch (rawError) {
|
|
1761
|
-
throw (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
1713
|
+
async function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, info, itemTypeRef, incrementalDataRecord, path, itemPath) {
|
|
1714
|
+
let item;
|
|
1715
|
+
try {
|
|
1716
|
+
const { value, done } = await asyncIterator.next();
|
|
1717
|
+
if (done) {
|
|
1718
|
+
incrementalDataRecord.setIsCompletedAsyncIterator();
|
|
1719
|
+
return { done, value: void 0 };
|
|
1762
1720
|
}
|
|
1763
|
-
|
|
1721
|
+
item = value;
|
|
1722
|
+
} catch (rawError) {
|
|
1723
|
+
throw (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
1724
|
+
}
|
|
1725
|
+
let completedItem;
|
|
1726
|
+
try {
|
|
1727
|
+
completedItem = completeValue(
|
|
1728
|
+
exeContext,
|
|
1729
|
+
itemTypeRef,
|
|
1730
|
+
fieldGroup,
|
|
1731
|
+
info,
|
|
1732
|
+
itemPath,
|
|
1733
|
+
item,
|
|
1734
|
+
incrementalDataRecord
|
|
1735
|
+
);
|
|
1736
|
+
if ((0, import_isPromise.isPromise)(completedItem)) {
|
|
1737
|
+
completedItem = completedItem.then(void 0, (rawError) => {
|
|
1738
|
+
handleFieldError(
|
|
1739
|
+
rawError,
|
|
1740
|
+
exeContext,
|
|
1741
|
+
itemTypeRef,
|
|
1742
|
+
fieldGroup,
|
|
1743
|
+
itemPath,
|
|
1744
|
+
incrementalDataRecord
|
|
1745
|
+
);
|
|
1746
|
+
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1747
|
+
return null;
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
return { done: false, value: completedItem };
|
|
1751
|
+
} catch (rawError) {
|
|
1752
|
+
handleFieldError(
|
|
1753
|
+
rawError,
|
|
1754
|
+
exeContext,
|
|
1755
|
+
itemTypeRef,
|
|
1756
|
+
fieldGroup,
|
|
1757
|
+
itemPath,
|
|
1758
|
+
incrementalDataRecord
|
|
1759
|
+
);
|
|
1760
|
+
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1761
|
+
return { done: false, value: null };
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
async function executeStreamAsyncIterator(initialIndex, asyncIterator, exeContext, fieldGroup, info, itemTypeRef, path, label, parentContext) {
|
|
1765
|
+
let index = initialIndex;
|
|
1766
|
+
let previousIncrementalDataRecord = parentContext != null ? parentContext : void 0;
|
|
1767
|
+
while (true) {
|
|
1768
|
+
const itemPath = (0, import_Path.addPath)(path, index, void 0);
|
|
1769
|
+
const incrementalDataRecord = new StreamItemsRecord({
|
|
1770
|
+
label,
|
|
1771
|
+
path: itemPath,
|
|
1772
|
+
parentContext: previousIncrementalDataRecord,
|
|
1773
|
+
asyncIterator,
|
|
1774
|
+
exeContext
|
|
1775
|
+
});
|
|
1776
|
+
let iteration;
|
|
1764
1777
|
try {
|
|
1765
|
-
|
|
1778
|
+
iteration = await executeStreamAsyncIteratorItem(
|
|
1779
|
+
asyncIterator,
|
|
1766
1780
|
exeContext,
|
|
1767
|
-
itemTypeRef,
|
|
1768
1781
|
fieldGroup,
|
|
1769
1782
|
info,
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1783
|
+
itemTypeRef,
|
|
1784
|
+
incrementalDataRecord,
|
|
1785
|
+
path,
|
|
1786
|
+
itemPath
|
|
1773
1787
|
);
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
fieldGroup,
|
|
1781
|
-
itemPath,
|
|
1782
|
-
incrementalDataRecord
|
|
1783
|
-
);
|
|
1784
|
-
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1785
|
-
return null;
|
|
1788
|
+
} catch (error) {
|
|
1789
|
+
incrementalDataRecord.errors.push(error);
|
|
1790
|
+
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1791
|
+
incrementalDataRecord.addItems(null);
|
|
1792
|
+
if (asyncIterator == null ? void 0 : asyncIterator.return) {
|
|
1793
|
+
asyncIterator.return().catch(() => {
|
|
1786
1794
|
});
|
|
1787
1795
|
}
|
|
1788
|
-
return
|
|
1789
|
-
} catch (rawError) {
|
|
1790
|
-
handleFieldError(
|
|
1791
|
-
rawError,
|
|
1792
|
-
exeContext,
|
|
1793
|
-
itemTypeRef,
|
|
1794
|
-
fieldGroup,
|
|
1795
|
-
itemPath,
|
|
1796
|
-
incrementalDataRecord
|
|
1797
|
-
);
|
|
1798
|
-
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1799
|
-
return { done: false, value: null };
|
|
1796
|
+
return;
|
|
1800
1797
|
}
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
label,
|
|
1811
|
-
path: itemPath,
|
|
1812
|
-
parentContext: previousIncrementalDataRecord,
|
|
1813
|
-
asyncIterator,
|
|
1814
|
-
exeContext
|
|
1815
|
-
});
|
|
1816
|
-
let iteration;
|
|
1817
|
-
try {
|
|
1818
|
-
iteration = yield executeStreamAsyncIteratorItem(
|
|
1819
|
-
asyncIterator,
|
|
1820
|
-
exeContext,
|
|
1821
|
-
fieldGroup,
|
|
1822
|
-
info,
|
|
1823
|
-
itemTypeRef,
|
|
1824
|
-
incrementalDataRecord,
|
|
1825
|
-
path,
|
|
1826
|
-
itemPath
|
|
1827
|
-
);
|
|
1828
|
-
} catch (error) {
|
|
1829
|
-
incrementalDataRecord.errors.push(error);
|
|
1830
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1831
|
-
incrementalDataRecord.addItems(null);
|
|
1832
|
-
if (asyncIterator == null ? void 0 : asyncIterator.return) {
|
|
1833
|
-
asyncIterator.return().catch(() => {
|
|
1834
|
-
});
|
|
1798
|
+
const { done, value: completedItem } = iteration;
|
|
1799
|
+
let completedItems;
|
|
1800
|
+
if ((0, import_isPromise.isPromise)(completedItem)) {
|
|
1801
|
+
completedItems = completedItem.then(
|
|
1802
|
+
(value) => [value],
|
|
1803
|
+
(error) => {
|
|
1804
|
+
incrementalDataRecord.errors.push(error);
|
|
1805
|
+
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1806
|
+
return null;
|
|
1835
1807
|
}
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
let completedItems;
|
|
1840
|
-
if ((0, import_isPromise.isPromise)(completedItem)) {
|
|
1841
|
-
completedItems = completedItem.then(
|
|
1842
|
-
(value) => [value],
|
|
1843
|
-
(error) => {
|
|
1844
|
-
incrementalDataRecord.errors.push(error);
|
|
1845
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1846
|
-
return null;
|
|
1847
|
-
}
|
|
1848
|
-
);
|
|
1849
|
-
} else {
|
|
1850
|
-
completedItems = [completedItem];
|
|
1851
|
-
}
|
|
1852
|
-
incrementalDataRecord.addItems(completedItems);
|
|
1853
|
-
if (done) {
|
|
1854
|
-
break;
|
|
1855
|
-
}
|
|
1856
|
-
previousIncrementalDataRecord = incrementalDataRecord;
|
|
1857
|
-
index++;
|
|
1808
|
+
);
|
|
1809
|
+
} else {
|
|
1810
|
+
completedItems = [completedItem];
|
|
1858
1811
|
}
|
|
1859
|
-
|
|
1812
|
+
incrementalDataRecord.addItems(completedItems);
|
|
1813
|
+
if (done) {
|
|
1814
|
+
break;
|
|
1815
|
+
}
|
|
1816
|
+
previousIncrementalDataRecord = incrementalDataRecord;
|
|
1817
|
+
index++;
|
|
1818
|
+
}
|
|
1860
1819
|
}
|
|
1861
1820
|
function filterSubsequentPayloads(exeContext, nullPath, currentIncrementalDataRecord) {
|
|
1862
1821
|
const nullPathArray = (0, import_Path.pathToArray)(nullPath);
|
|
@@ -1908,36 +1867,34 @@ function getCompletedIncrementalResults(exeContext) {
|
|
|
1908
1867
|
}
|
|
1909
1868
|
function yieldSubsequentPayloads(exeContext) {
|
|
1910
1869
|
let isDone = false;
|
|
1911
|
-
function next() {
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
};
|
|
1934
|
-
});
|
|
1870
|
+
async function next() {
|
|
1871
|
+
if (isDone) {
|
|
1872
|
+
return { value: void 0, done: true };
|
|
1873
|
+
}
|
|
1874
|
+
await Promise.race(
|
|
1875
|
+
Array.from(exeContext.subsequentPayloads).map((p) => p.promise)
|
|
1876
|
+
);
|
|
1877
|
+
if (isDone) {
|
|
1878
|
+
return { value: void 0, done: true };
|
|
1879
|
+
}
|
|
1880
|
+
const incremental = getCompletedIncrementalResults(exeContext);
|
|
1881
|
+
const hasNext = exeContext.subsequentPayloads.size > 0;
|
|
1882
|
+
if (!incremental.length && hasNext) {
|
|
1883
|
+
return next();
|
|
1884
|
+
}
|
|
1885
|
+
if (!hasNext) {
|
|
1886
|
+
isDone = true;
|
|
1887
|
+
}
|
|
1888
|
+
return {
|
|
1889
|
+
value: incremental.length ? { incremental, hasNext } : { hasNext },
|
|
1890
|
+
done: false
|
|
1891
|
+
};
|
|
1935
1892
|
}
|
|
1936
1893
|
function returnStreamIterators() {
|
|
1937
1894
|
const promises = [];
|
|
1938
1895
|
exeContext.subsequentPayloads.forEach((incrementalDataRecord) => {
|
|
1939
|
-
var
|
|
1940
|
-
if (isStreamItemsRecord(incrementalDataRecord) && ((
|
|
1896
|
+
var _a;
|
|
1897
|
+
if (isStreamItemsRecord(incrementalDataRecord) && ((_a = incrementalDataRecord.asyncIterator) == null ? void 0 : _a.return)) {
|
|
1941
1898
|
promises.push(incrementalDataRecord.asyncIterator.return());
|
|
1942
1899
|
}
|
|
1943
1900
|
});
|
|
@@ -1948,19 +1905,15 @@ function yieldSubsequentPayloads(exeContext) {
|
|
|
1948
1905
|
return this;
|
|
1949
1906
|
},
|
|
1950
1907
|
next,
|
|
1951
|
-
return() {
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
return { value: void 0, done: true };
|
|
1956
|
-
});
|
|
1908
|
+
async return() {
|
|
1909
|
+
await returnStreamIterators();
|
|
1910
|
+
isDone = true;
|
|
1911
|
+
return { value: void 0, done: true };
|
|
1957
1912
|
},
|
|
1958
|
-
throw(error) {
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
return Promise.reject(error);
|
|
1963
|
-
});
|
|
1913
|
+
async throw(error) {
|
|
1914
|
+
await returnStreamIterators();
|
|
1915
|
+
isDone = true;
|
|
1916
|
+
return Promise.reject(error);
|
|
1964
1917
|
}
|
|
1965
1918
|
};
|
|
1966
1919
|
}
|