@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,43 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __async = (__this, __arguments, generator) => {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
var fulfilled = (value) => {
|
|
23
|
-
try {
|
|
24
|
-
step(generator.next(value));
|
|
25
|
-
} catch (e) {
|
|
26
|
-
reject(e);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var rejected = (value) => {
|
|
30
|
-
try {
|
|
31
|
-
step(generator.throw(value));
|
|
32
|
-
} catch (e) {
|
|
33
|
-
reject(e);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
1
|
// src/executeWithoutSchema.ts
|
|
42
2
|
import {
|
|
43
3
|
GraphQLError,
|
|
@@ -108,7 +68,8 @@ function buildExecutionContext(args) {
|
|
|
108
68
|
fieldResolver,
|
|
109
69
|
typeResolver,
|
|
110
70
|
subscribeFieldResolver,
|
|
111
|
-
fieldExecutionHooks
|
|
71
|
+
fieldExecutionHooks,
|
|
72
|
+
enablePerEventContext
|
|
112
73
|
} = args;
|
|
113
74
|
assertValidExecutionArguments(document, variableValues);
|
|
114
75
|
let operation;
|
|
@@ -165,16 +126,18 @@ function buildExecutionContext(args) {
|
|
|
165
126
|
subscribeFieldResolver: subscribeFieldResolver != null ? subscribeFieldResolver : defaultFieldResolver,
|
|
166
127
|
errors: [],
|
|
167
128
|
fieldExecutionHooks,
|
|
168
|
-
subsequentPayloads: /* @__PURE__ */ new Set()
|
|
129
|
+
subsequentPayloads: /* @__PURE__ */ new Set(),
|
|
130
|
+
enablePerEventContext: enablePerEventContext != null ? enablePerEventContext : true
|
|
169
131
|
};
|
|
170
132
|
}
|
|
171
133
|
function buildPerEventExecutionContext(exeContext, payload) {
|
|
172
|
-
return
|
|
134
|
+
return {
|
|
135
|
+
...exeContext,
|
|
173
136
|
contextValue: exeContext.buildContextValue ? exeContext.buildContextValue(exeContext.contextValue) : exeContext.contextValue,
|
|
174
137
|
rootValue: payload,
|
|
175
138
|
subsequentPayloads: /* @__PURE__ */ new Set(),
|
|
176
139
|
errors: []
|
|
177
|
-
}
|
|
140
|
+
};
|
|
178
141
|
}
|
|
179
142
|
function executeOperationWithBeforeHook(exeContext) {
|
|
180
143
|
const hooks = exeContext.fieldExecutionHooks;
|
|
@@ -277,9 +240,10 @@ function buildResponse(exeContext, data) {
|
|
|
277
240
|
const initialResult = exeContext.errors.length === 0 ? { data } : { errors: exeContext.errors, data };
|
|
278
241
|
if (exeContext.subsequentPayloads.size > 0) {
|
|
279
242
|
return {
|
|
280
|
-
initialResult:
|
|
243
|
+
initialResult: {
|
|
244
|
+
...initialResult,
|
|
281
245
|
hasNext: true
|
|
282
|
-
}
|
|
246
|
+
},
|
|
283
247
|
subsequentResults: yieldSubsequentPayloads(exeContext)
|
|
284
248
|
};
|
|
285
249
|
} else {
|
|
@@ -603,7 +567,7 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
|
|
|
603
567
|
return null;
|
|
604
568
|
}
|
|
605
569
|
return executeFields(
|
|
606
|
-
exeContext,
|
|
570
|
+
exeContext.enablePerEventContext ? perEventContext : exeContext,
|
|
607
571
|
parentTypeName,
|
|
608
572
|
payload,
|
|
609
573
|
path,
|
|
@@ -611,7 +575,7 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
|
|
|
611
575
|
void 0
|
|
612
576
|
);
|
|
613
577
|
}) : executeFields(
|
|
614
|
-
exeContext,
|
|
578
|
+
exeContext.enablePerEventContext ? perEventContext : exeContext,
|
|
615
579
|
parentTypeName,
|
|
616
580
|
payload,
|
|
617
581
|
path,
|
|
@@ -894,36 +858,34 @@ function completeValue(exeContext, returnTypeRef, fieldGroup, info, path, result
|
|
|
894
858
|
"Cannot complete value of unexpected output type: " + inspectTypeReference(returnTypeRef)
|
|
895
859
|
);
|
|
896
860
|
}
|
|
897
|
-
function completePromisedValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
completed = yield completed;
|
|
912
|
-
}
|
|
913
|
-
return completed;
|
|
914
|
-
} catch (rawError) {
|
|
915
|
-
handleFieldError(
|
|
916
|
-
rawError,
|
|
917
|
-
exeContext,
|
|
918
|
-
returnTypeRef,
|
|
919
|
-
fieldGroup,
|
|
920
|
-
path,
|
|
921
|
-
incrementalDataRecord
|
|
922
|
-
);
|
|
923
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
924
|
-
return null;
|
|
861
|
+
async function completePromisedValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
862
|
+
try {
|
|
863
|
+
const resolved = await result;
|
|
864
|
+
let completed = completeValue(
|
|
865
|
+
exeContext,
|
|
866
|
+
returnTypeRef,
|
|
867
|
+
fieldGroup,
|
|
868
|
+
info,
|
|
869
|
+
path,
|
|
870
|
+
resolved,
|
|
871
|
+
incrementalDataRecord
|
|
872
|
+
);
|
|
873
|
+
if (isPromise(completed)) {
|
|
874
|
+
completed = await completed;
|
|
925
875
|
}
|
|
926
|
-
|
|
876
|
+
return completed;
|
|
877
|
+
} catch (rawError) {
|
|
878
|
+
handleFieldError(
|
|
879
|
+
rawError,
|
|
880
|
+
exeContext,
|
|
881
|
+
returnTypeRef,
|
|
882
|
+
fieldGroup,
|
|
883
|
+
path,
|
|
884
|
+
incrementalDataRecord
|
|
885
|
+
);
|
|
886
|
+
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
887
|
+
return null;
|
|
888
|
+
}
|
|
927
889
|
}
|
|
928
890
|
function completeListValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
929
891
|
const itemTypeRef = unwrap(returnTypeRef);
|
|
@@ -1072,53 +1034,51 @@ function getStreamValues(exeContext, fieldGroup, path) {
|
|
|
1072
1034
|
label: typeof stream.label === "string" ? stream.label : void 0
|
|
1073
1035
|
};
|
|
1074
1036
|
}
|
|
1075
|
-
function completeAsyncIteratorValue(exeContext, itemTypeRef, fieldGroup, info, path, asyncIterator, incrementalDataRecord) {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
asyncIterator,
|
|
1086
|
-
exeContext,
|
|
1087
|
-
fieldGroup,
|
|
1088
|
-
info,
|
|
1089
|
-
itemTypeRef,
|
|
1090
|
-
path,
|
|
1091
|
-
stream.label,
|
|
1092
|
-
incrementalDataRecord
|
|
1093
|
-
);
|
|
1094
|
-
break;
|
|
1095
|
-
}
|
|
1096
|
-
const itemPath = addPath(path, index, void 0);
|
|
1097
|
-
let iteration;
|
|
1098
|
-
try {
|
|
1099
|
-
iteration = yield asyncIterator.next();
|
|
1100
|
-
if (iteration.done) {
|
|
1101
|
-
break;
|
|
1102
|
-
}
|
|
1103
|
-
} catch (rawError) {
|
|
1104
|
-
throw locatedError(rawError, fieldGroup, pathToArray(path));
|
|
1105
|
-
}
|
|
1106
|
-
if (completeListItemValue(
|
|
1107
|
-
iteration.value,
|
|
1108
|
-
completedResults,
|
|
1037
|
+
async function completeAsyncIteratorValue(exeContext, itemTypeRef, fieldGroup, info, path, asyncIterator, incrementalDataRecord) {
|
|
1038
|
+
const stream = getStreamValues(exeContext, fieldGroup, path);
|
|
1039
|
+
let containsPromise = false;
|
|
1040
|
+
const completedResults = [];
|
|
1041
|
+
let index = 0;
|
|
1042
|
+
while (true) {
|
|
1043
|
+
if (stream && typeof stream.initialCount === "number" && index >= stream.initialCount) {
|
|
1044
|
+
executeStreamAsyncIterator(
|
|
1045
|
+
index,
|
|
1046
|
+
asyncIterator,
|
|
1109
1047
|
exeContext,
|
|
1110
|
-
itemTypeRef,
|
|
1111
1048
|
fieldGroup,
|
|
1112
1049
|
info,
|
|
1113
|
-
|
|
1050
|
+
itemTypeRef,
|
|
1051
|
+
path,
|
|
1052
|
+
stream.label,
|
|
1114
1053
|
incrementalDataRecord
|
|
1115
|
-
)
|
|
1116
|
-
|
|
1054
|
+
);
|
|
1055
|
+
break;
|
|
1056
|
+
}
|
|
1057
|
+
const itemPath = addPath(path, index, void 0);
|
|
1058
|
+
let iteration;
|
|
1059
|
+
try {
|
|
1060
|
+
iteration = await asyncIterator.next();
|
|
1061
|
+
if (iteration.done) {
|
|
1062
|
+
break;
|
|
1117
1063
|
}
|
|
1118
|
-
|
|
1064
|
+
} catch (rawError) {
|
|
1065
|
+
throw locatedError(rawError, fieldGroup, pathToArray(path));
|
|
1119
1066
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1067
|
+
if (completeListItemValue(
|
|
1068
|
+
iteration.value,
|
|
1069
|
+
completedResults,
|
|
1070
|
+
exeContext,
|
|
1071
|
+
itemTypeRef,
|
|
1072
|
+
fieldGroup,
|
|
1073
|
+
info,
|
|
1074
|
+
itemPath,
|
|
1075
|
+
incrementalDataRecord
|
|
1076
|
+
)) {
|
|
1077
|
+
containsPromise = true;
|
|
1078
|
+
}
|
|
1079
|
+
index += 1;
|
|
1080
|
+
}
|
|
1081
|
+
return containsPromise ? Promise.all(completedResults) : completedResults;
|
|
1122
1082
|
}
|
|
1123
1083
|
function completeLeafValue(returnType, result) {
|
|
1124
1084
|
const serializedResult = returnType.serialize(result);
|
|
@@ -1728,116 +1688,112 @@ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info,
|
|
|
1728
1688
|
incrementalDataRecord.addItems([completedItem]);
|
|
1729
1689
|
return incrementalDataRecord;
|
|
1730
1690
|
}
|
|
1731
|
-
function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, info, itemTypeRef, incrementalDataRecord, path, itemPath) {
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
return { done, value: void 0 };
|
|
1739
|
-
}
|
|
1740
|
-
item = value;
|
|
1741
|
-
} catch (rawError) {
|
|
1742
|
-
throw locatedError(rawError, fieldGroup, pathToArray(path));
|
|
1691
|
+
async function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, info, itemTypeRef, incrementalDataRecord, path, itemPath) {
|
|
1692
|
+
let item;
|
|
1693
|
+
try {
|
|
1694
|
+
const { value, done } = await asyncIterator.next();
|
|
1695
|
+
if (done) {
|
|
1696
|
+
incrementalDataRecord.setIsCompletedAsyncIterator();
|
|
1697
|
+
return { done, value: void 0 };
|
|
1743
1698
|
}
|
|
1744
|
-
|
|
1699
|
+
item = value;
|
|
1700
|
+
} catch (rawError) {
|
|
1701
|
+
throw locatedError(rawError, fieldGroup, pathToArray(path));
|
|
1702
|
+
}
|
|
1703
|
+
let completedItem;
|
|
1704
|
+
try {
|
|
1705
|
+
completedItem = completeValue(
|
|
1706
|
+
exeContext,
|
|
1707
|
+
itemTypeRef,
|
|
1708
|
+
fieldGroup,
|
|
1709
|
+
info,
|
|
1710
|
+
itemPath,
|
|
1711
|
+
item,
|
|
1712
|
+
incrementalDataRecord
|
|
1713
|
+
);
|
|
1714
|
+
if (isPromise(completedItem)) {
|
|
1715
|
+
completedItem = completedItem.then(void 0, (rawError) => {
|
|
1716
|
+
handleFieldError(
|
|
1717
|
+
rawError,
|
|
1718
|
+
exeContext,
|
|
1719
|
+
itemTypeRef,
|
|
1720
|
+
fieldGroup,
|
|
1721
|
+
itemPath,
|
|
1722
|
+
incrementalDataRecord
|
|
1723
|
+
);
|
|
1724
|
+
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1725
|
+
return null;
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
return { done: false, value: completedItem };
|
|
1729
|
+
} catch (rawError) {
|
|
1730
|
+
handleFieldError(
|
|
1731
|
+
rawError,
|
|
1732
|
+
exeContext,
|
|
1733
|
+
itemTypeRef,
|
|
1734
|
+
fieldGroup,
|
|
1735
|
+
itemPath,
|
|
1736
|
+
incrementalDataRecord
|
|
1737
|
+
);
|
|
1738
|
+
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1739
|
+
return { done: false, value: null };
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
async function executeStreamAsyncIterator(initialIndex, asyncIterator, exeContext, fieldGroup, info, itemTypeRef, path, label, parentContext) {
|
|
1743
|
+
let index = initialIndex;
|
|
1744
|
+
let previousIncrementalDataRecord = parentContext != null ? parentContext : void 0;
|
|
1745
|
+
while (true) {
|
|
1746
|
+
const itemPath = addPath(path, index, void 0);
|
|
1747
|
+
const incrementalDataRecord = new StreamItemsRecord({
|
|
1748
|
+
label,
|
|
1749
|
+
path: itemPath,
|
|
1750
|
+
parentContext: previousIncrementalDataRecord,
|
|
1751
|
+
asyncIterator,
|
|
1752
|
+
exeContext
|
|
1753
|
+
});
|
|
1754
|
+
let iteration;
|
|
1745
1755
|
try {
|
|
1746
|
-
|
|
1756
|
+
iteration = await executeStreamAsyncIteratorItem(
|
|
1757
|
+
asyncIterator,
|
|
1747
1758
|
exeContext,
|
|
1748
|
-
itemTypeRef,
|
|
1749
1759
|
fieldGroup,
|
|
1750
1760
|
info,
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1761
|
+
itemTypeRef,
|
|
1762
|
+
incrementalDataRecord,
|
|
1763
|
+
path,
|
|
1764
|
+
itemPath
|
|
1754
1765
|
);
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
fieldGroup,
|
|
1762
|
-
itemPath,
|
|
1763
|
-
incrementalDataRecord
|
|
1764
|
-
);
|
|
1765
|
-
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1766
|
-
return null;
|
|
1766
|
+
} catch (error) {
|
|
1767
|
+
incrementalDataRecord.errors.push(error);
|
|
1768
|
+
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1769
|
+
incrementalDataRecord.addItems(null);
|
|
1770
|
+
if (asyncIterator == null ? void 0 : asyncIterator.return) {
|
|
1771
|
+
asyncIterator.return().catch(() => {
|
|
1767
1772
|
});
|
|
1768
1773
|
}
|
|
1769
|
-
return
|
|
1770
|
-
} catch (rawError) {
|
|
1771
|
-
handleFieldError(
|
|
1772
|
-
rawError,
|
|
1773
|
-
exeContext,
|
|
1774
|
-
itemTypeRef,
|
|
1775
|
-
fieldGroup,
|
|
1776
|
-
itemPath,
|
|
1777
|
-
incrementalDataRecord
|
|
1778
|
-
);
|
|
1779
|
-
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1780
|
-
return { done: false, value: null };
|
|
1774
|
+
return;
|
|
1781
1775
|
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
label,
|
|
1792
|
-
path: itemPath,
|
|
1793
|
-
parentContext: previousIncrementalDataRecord,
|
|
1794
|
-
asyncIterator,
|
|
1795
|
-
exeContext
|
|
1796
|
-
});
|
|
1797
|
-
let iteration;
|
|
1798
|
-
try {
|
|
1799
|
-
iteration = yield executeStreamAsyncIteratorItem(
|
|
1800
|
-
asyncIterator,
|
|
1801
|
-
exeContext,
|
|
1802
|
-
fieldGroup,
|
|
1803
|
-
info,
|
|
1804
|
-
itemTypeRef,
|
|
1805
|
-
incrementalDataRecord,
|
|
1806
|
-
path,
|
|
1807
|
-
itemPath
|
|
1808
|
-
);
|
|
1809
|
-
} catch (error) {
|
|
1810
|
-
incrementalDataRecord.errors.push(error);
|
|
1811
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1812
|
-
incrementalDataRecord.addItems(null);
|
|
1813
|
-
if (asyncIterator == null ? void 0 : asyncIterator.return) {
|
|
1814
|
-
asyncIterator.return().catch(() => {
|
|
1815
|
-
});
|
|
1776
|
+
const { done, value: completedItem } = iteration;
|
|
1777
|
+
let completedItems;
|
|
1778
|
+
if (isPromise(completedItem)) {
|
|
1779
|
+
completedItems = completedItem.then(
|
|
1780
|
+
(value) => [value],
|
|
1781
|
+
(error) => {
|
|
1782
|
+
incrementalDataRecord.errors.push(error);
|
|
1783
|
+
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1784
|
+
return null;
|
|
1816
1785
|
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
let completedItems;
|
|
1821
|
-
if (isPromise(completedItem)) {
|
|
1822
|
-
completedItems = completedItem.then(
|
|
1823
|
-
(value) => [value],
|
|
1824
|
-
(error) => {
|
|
1825
|
-
incrementalDataRecord.errors.push(error);
|
|
1826
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1827
|
-
return null;
|
|
1828
|
-
}
|
|
1829
|
-
);
|
|
1830
|
-
} else {
|
|
1831
|
-
completedItems = [completedItem];
|
|
1832
|
-
}
|
|
1833
|
-
incrementalDataRecord.addItems(completedItems);
|
|
1834
|
-
if (done) {
|
|
1835
|
-
break;
|
|
1836
|
-
}
|
|
1837
|
-
previousIncrementalDataRecord = incrementalDataRecord;
|
|
1838
|
-
index++;
|
|
1786
|
+
);
|
|
1787
|
+
} else {
|
|
1788
|
+
completedItems = [completedItem];
|
|
1839
1789
|
}
|
|
1840
|
-
|
|
1790
|
+
incrementalDataRecord.addItems(completedItems);
|
|
1791
|
+
if (done) {
|
|
1792
|
+
break;
|
|
1793
|
+
}
|
|
1794
|
+
previousIncrementalDataRecord = incrementalDataRecord;
|
|
1795
|
+
index++;
|
|
1796
|
+
}
|
|
1841
1797
|
}
|
|
1842
1798
|
function filterSubsequentPayloads(exeContext, nullPath, currentIncrementalDataRecord) {
|
|
1843
1799
|
const nullPathArray = pathToArray(nullPath);
|
|
@@ -1889,36 +1845,34 @@ function getCompletedIncrementalResults(exeContext) {
|
|
|
1889
1845
|
}
|
|
1890
1846
|
function yieldSubsequentPayloads(exeContext) {
|
|
1891
1847
|
let isDone = false;
|
|
1892
|
-
function next() {
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
};
|
|
1915
|
-
});
|
|
1848
|
+
async function next() {
|
|
1849
|
+
if (isDone) {
|
|
1850
|
+
return { value: void 0, done: true };
|
|
1851
|
+
}
|
|
1852
|
+
await Promise.race(
|
|
1853
|
+
Array.from(exeContext.subsequentPayloads).map((p) => p.promise)
|
|
1854
|
+
);
|
|
1855
|
+
if (isDone) {
|
|
1856
|
+
return { value: void 0, done: true };
|
|
1857
|
+
}
|
|
1858
|
+
const incremental = getCompletedIncrementalResults(exeContext);
|
|
1859
|
+
const hasNext = exeContext.subsequentPayloads.size > 0;
|
|
1860
|
+
if (!incremental.length && hasNext) {
|
|
1861
|
+
return next();
|
|
1862
|
+
}
|
|
1863
|
+
if (!hasNext) {
|
|
1864
|
+
isDone = true;
|
|
1865
|
+
}
|
|
1866
|
+
return {
|
|
1867
|
+
value: incremental.length ? { incremental, hasNext } : { hasNext },
|
|
1868
|
+
done: false
|
|
1869
|
+
};
|
|
1916
1870
|
}
|
|
1917
1871
|
function returnStreamIterators() {
|
|
1918
1872
|
const promises = [];
|
|
1919
1873
|
exeContext.subsequentPayloads.forEach((incrementalDataRecord) => {
|
|
1920
|
-
var
|
|
1921
|
-
if (isStreamItemsRecord(incrementalDataRecord) && ((
|
|
1874
|
+
var _a;
|
|
1875
|
+
if (isStreamItemsRecord(incrementalDataRecord) && ((_a = incrementalDataRecord.asyncIterator) == null ? void 0 : _a.return)) {
|
|
1922
1876
|
promises.push(incrementalDataRecord.asyncIterator.return());
|
|
1923
1877
|
}
|
|
1924
1878
|
});
|
|
@@ -1929,19 +1883,15 @@ function yieldSubsequentPayloads(exeContext) {
|
|
|
1929
1883
|
return this;
|
|
1930
1884
|
},
|
|
1931
1885
|
next,
|
|
1932
|
-
return() {
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
return { value: void 0, done: true };
|
|
1937
|
-
});
|
|
1886
|
+
async return() {
|
|
1887
|
+
await returnStreamIterators();
|
|
1888
|
+
isDone = true;
|
|
1889
|
+
return { value: void 0, done: true };
|
|
1938
1890
|
},
|
|
1939
|
-
throw(error) {
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
return Promise.reject(error);
|
|
1944
|
-
});
|
|
1891
|
+
async throw(error) {
|
|
1892
|
+
await returnStreamIterators();
|
|
1893
|
+
isDone = true;
|
|
1894
|
+
return Promise.reject(error);
|
|
1945
1895
|
}
|
|
1946
1896
|
};
|
|
1947
1897
|
}
|