@graphitation/supermassive 3.9.0 → 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 +10 -2
- package/lib/__testUtils__/execute.js +77 -121
- package/lib/__testUtils__/execute.js.map +1 -1
- package/lib/__testUtils__/execute.mjs +77 -124
- package/lib/__testUtils__/execute.mjs.map +1 -1
- 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/executeWithoutSchema.js +199 -248
- package/lib/executeWithoutSchema.js.map +1 -1
- package/lib/executeWithoutSchema.mjs +199 -251
- package/lib/executeWithoutSchema.mjs.map +1 -1
- 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/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,
|
|
@@ -171,12 +131,13 @@ function buildExecutionContext(args) {
|
|
|
171
131
|
};
|
|
172
132
|
}
|
|
173
133
|
function buildPerEventExecutionContext(exeContext, payload) {
|
|
174
|
-
return
|
|
134
|
+
return {
|
|
135
|
+
...exeContext,
|
|
175
136
|
contextValue: exeContext.buildContextValue ? exeContext.buildContextValue(exeContext.contextValue) : exeContext.contextValue,
|
|
176
137
|
rootValue: payload,
|
|
177
138
|
subsequentPayloads: /* @__PURE__ */ new Set(),
|
|
178
139
|
errors: []
|
|
179
|
-
}
|
|
140
|
+
};
|
|
180
141
|
}
|
|
181
142
|
function executeOperationWithBeforeHook(exeContext) {
|
|
182
143
|
const hooks = exeContext.fieldExecutionHooks;
|
|
@@ -279,9 +240,10 @@ function buildResponse(exeContext, data) {
|
|
|
279
240
|
const initialResult = exeContext.errors.length === 0 ? { data } : { errors: exeContext.errors, data };
|
|
280
241
|
if (exeContext.subsequentPayloads.size > 0) {
|
|
281
242
|
return {
|
|
282
|
-
initialResult:
|
|
243
|
+
initialResult: {
|
|
244
|
+
...initialResult,
|
|
283
245
|
hasNext: true
|
|
284
|
-
}
|
|
246
|
+
},
|
|
285
247
|
subsequentResults: yieldSubsequentPayloads(exeContext)
|
|
286
248
|
};
|
|
287
249
|
} else {
|
|
@@ -896,36 +858,34 @@ function completeValue(exeContext, returnTypeRef, fieldGroup, info, path, result
|
|
|
896
858
|
"Cannot complete value of unexpected output type: " + inspectTypeReference(returnTypeRef)
|
|
897
859
|
);
|
|
898
860
|
}
|
|
899
|
-
function completePromisedValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
completed = yield completed;
|
|
914
|
-
}
|
|
915
|
-
return completed;
|
|
916
|
-
} catch (rawError) {
|
|
917
|
-
handleFieldError(
|
|
918
|
-
rawError,
|
|
919
|
-
exeContext,
|
|
920
|
-
returnTypeRef,
|
|
921
|
-
fieldGroup,
|
|
922
|
-
path,
|
|
923
|
-
incrementalDataRecord
|
|
924
|
-
);
|
|
925
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
926
|
-
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;
|
|
927
875
|
}
|
|
928
|
-
|
|
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
|
+
}
|
|
929
889
|
}
|
|
930
890
|
function completeListValue(exeContext, returnTypeRef, fieldGroup, info, path, result, incrementalDataRecord) {
|
|
931
891
|
const itemTypeRef = unwrap(returnTypeRef);
|
|
@@ -1074,53 +1034,51 @@ function getStreamValues(exeContext, fieldGroup, path) {
|
|
|
1074
1034
|
label: typeof stream.label === "string" ? stream.label : void 0
|
|
1075
1035
|
};
|
|
1076
1036
|
}
|
|
1077
|
-
function completeAsyncIteratorValue(exeContext, itemTypeRef, fieldGroup, info, path, asyncIterator, incrementalDataRecord) {
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
asyncIterator,
|
|
1088
|
-
exeContext,
|
|
1089
|
-
fieldGroup,
|
|
1090
|
-
info,
|
|
1091
|
-
itemTypeRef,
|
|
1092
|
-
path,
|
|
1093
|
-
stream.label,
|
|
1094
|
-
incrementalDataRecord
|
|
1095
|
-
);
|
|
1096
|
-
break;
|
|
1097
|
-
}
|
|
1098
|
-
const itemPath = addPath(path, index, void 0);
|
|
1099
|
-
let iteration;
|
|
1100
|
-
try {
|
|
1101
|
-
iteration = yield asyncIterator.next();
|
|
1102
|
-
if (iteration.done) {
|
|
1103
|
-
break;
|
|
1104
|
-
}
|
|
1105
|
-
} catch (rawError) {
|
|
1106
|
-
throw locatedError(rawError, fieldGroup, pathToArray(path));
|
|
1107
|
-
}
|
|
1108
|
-
if (completeListItemValue(
|
|
1109
|
-
iteration.value,
|
|
1110
|
-
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,
|
|
1111
1047
|
exeContext,
|
|
1112
|
-
itemTypeRef,
|
|
1113
1048
|
fieldGroup,
|
|
1114
1049
|
info,
|
|
1115
|
-
|
|
1050
|
+
itemTypeRef,
|
|
1051
|
+
path,
|
|
1052
|
+
stream.label,
|
|
1116
1053
|
incrementalDataRecord
|
|
1117
|
-
)
|
|
1118
|
-
|
|
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;
|
|
1119
1063
|
}
|
|
1120
|
-
|
|
1064
|
+
} catch (rawError) {
|
|
1065
|
+
throw locatedError(rawError, fieldGroup, pathToArray(path));
|
|
1121
1066
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
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;
|
|
1124
1082
|
}
|
|
1125
1083
|
function completeLeafValue(returnType, result) {
|
|
1126
1084
|
const serializedResult = returnType.serialize(result);
|
|
@@ -1730,116 +1688,112 @@ function executeStreamField(path, itemPath, item, exeContext, fieldGroup, info,
|
|
|
1730
1688
|
incrementalDataRecord.addItems([completedItem]);
|
|
1731
1689
|
return incrementalDataRecord;
|
|
1732
1690
|
}
|
|
1733
|
-
function executeStreamAsyncIteratorItem(asyncIterator, exeContext, fieldGroup, info, itemTypeRef, incrementalDataRecord, path, itemPath) {
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
return { done, value: void 0 };
|
|
1741
|
-
}
|
|
1742
|
-
item = value;
|
|
1743
|
-
} catch (rawError) {
|
|
1744
|
-
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 };
|
|
1745
1698
|
}
|
|
1746
|
-
|
|
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;
|
|
1747
1755
|
try {
|
|
1748
|
-
|
|
1756
|
+
iteration = await executeStreamAsyncIteratorItem(
|
|
1757
|
+
asyncIterator,
|
|
1749
1758
|
exeContext,
|
|
1750
|
-
itemTypeRef,
|
|
1751
1759
|
fieldGroup,
|
|
1752
1760
|
info,
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1761
|
+
itemTypeRef,
|
|
1762
|
+
incrementalDataRecord,
|
|
1763
|
+
path,
|
|
1764
|
+
itemPath
|
|
1756
1765
|
);
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
fieldGroup,
|
|
1764
|
-
itemPath,
|
|
1765
|
-
incrementalDataRecord
|
|
1766
|
-
);
|
|
1767
|
-
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1768
|
-
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(() => {
|
|
1769
1772
|
});
|
|
1770
1773
|
}
|
|
1771
|
-
return
|
|
1772
|
-
} catch (rawError) {
|
|
1773
|
-
handleFieldError(
|
|
1774
|
-
rawError,
|
|
1775
|
-
exeContext,
|
|
1776
|
-
itemTypeRef,
|
|
1777
|
-
fieldGroup,
|
|
1778
|
-
itemPath,
|
|
1779
|
-
incrementalDataRecord
|
|
1780
|
-
);
|
|
1781
|
-
filterSubsequentPayloads(exeContext, itemPath, incrementalDataRecord);
|
|
1782
|
-
return { done: false, value: null };
|
|
1774
|
+
return;
|
|
1783
1775
|
}
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
label,
|
|
1794
|
-
path: itemPath,
|
|
1795
|
-
parentContext: previousIncrementalDataRecord,
|
|
1796
|
-
asyncIterator,
|
|
1797
|
-
exeContext
|
|
1798
|
-
});
|
|
1799
|
-
let iteration;
|
|
1800
|
-
try {
|
|
1801
|
-
iteration = yield executeStreamAsyncIteratorItem(
|
|
1802
|
-
asyncIterator,
|
|
1803
|
-
exeContext,
|
|
1804
|
-
fieldGroup,
|
|
1805
|
-
info,
|
|
1806
|
-
itemTypeRef,
|
|
1807
|
-
incrementalDataRecord,
|
|
1808
|
-
path,
|
|
1809
|
-
itemPath
|
|
1810
|
-
);
|
|
1811
|
-
} catch (error) {
|
|
1812
|
-
incrementalDataRecord.errors.push(error);
|
|
1813
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1814
|
-
incrementalDataRecord.addItems(null);
|
|
1815
|
-
if (asyncIterator == null ? void 0 : asyncIterator.return) {
|
|
1816
|
-
asyncIterator.return().catch(() => {
|
|
1817
|
-
});
|
|
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;
|
|
1818
1785
|
}
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
let completedItems;
|
|
1823
|
-
if (isPromise(completedItem)) {
|
|
1824
|
-
completedItems = completedItem.then(
|
|
1825
|
-
(value) => [value],
|
|
1826
|
-
(error) => {
|
|
1827
|
-
incrementalDataRecord.errors.push(error);
|
|
1828
|
-
filterSubsequentPayloads(exeContext, path, incrementalDataRecord);
|
|
1829
|
-
return null;
|
|
1830
|
-
}
|
|
1831
|
-
);
|
|
1832
|
-
} else {
|
|
1833
|
-
completedItems = [completedItem];
|
|
1834
|
-
}
|
|
1835
|
-
incrementalDataRecord.addItems(completedItems);
|
|
1836
|
-
if (done) {
|
|
1837
|
-
break;
|
|
1838
|
-
}
|
|
1839
|
-
previousIncrementalDataRecord = incrementalDataRecord;
|
|
1840
|
-
index++;
|
|
1786
|
+
);
|
|
1787
|
+
} else {
|
|
1788
|
+
completedItems = [completedItem];
|
|
1841
1789
|
}
|
|
1842
|
-
|
|
1790
|
+
incrementalDataRecord.addItems(completedItems);
|
|
1791
|
+
if (done) {
|
|
1792
|
+
break;
|
|
1793
|
+
}
|
|
1794
|
+
previousIncrementalDataRecord = incrementalDataRecord;
|
|
1795
|
+
index++;
|
|
1796
|
+
}
|
|
1843
1797
|
}
|
|
1844
1798
|
function filterSubsequentPayloads(exeContext, nullPath, currentIncrementalDataRecord) {
|
|
1845
1799
|
const nullPathArray = pathToArray(nullPath);
|
|
@@ -1891,36 +1845,34 @@ function getCompletedIncrementalResults(exeContext) {
|
|
|
1891
1845
|
}
|
|
1892
1846
|
function yieldSubsequentPayloads(exeContext) {
|
|
1893
1847
|
let isDone = false;
|
|
1894
|
-
function next() {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
};
|
|
1917
|
-
});
|
|
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
|
+
};
|
|
1918
1870
|
}
|
|
1919
1871
|
function returnStreamIterators() {
|
|
1920
1872
|
const promises = [];
|
|
1921
1873
|
exeContext.subsequentPayloads.forEach((incrementalDataRecord) => {
|
|
1922
|
-
var
|
|
1923
|
-
if (isStreamItemsRecord(incrementalDataRecord) && ((
|
|
1874
|
+
var _a;
|
|
1875
|
+
if (isStreamItemsRecord(incrementalDataRecord) && ((_a = incrementalDataRecord.asyncIterator) == null ? void 0 : _a.return)) {
|
|
1924
1876
|
promises.push(incrementalDataRecord.asyncIterator.return());
|
|
1925
1877
|
}
|
|
1926
1878
|
});
|
|
@@ -1931,19 +1883,15 @@ function yieldSubsequentPayloads(exeContext) {
|
|
|
1931
1883
|
return this;
|
|
1932
1884
|
},
|
|
1933
1885
|
next,
|
|
1934
|
-
return() {
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
return { value: void 0, done: true };
|
|
1939
|
-
});
|
|
1886
|
+
async return() {
|
|
1887
|
+
await returnStreamIterators();
|
|
1888
|
+
isDone = true;
|
|
1889
|
+
return { value: void 0, done: true };
|
|
1940
1890
|
},
|
|
1941
|
-
throw(error) {
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
return Promise.reject(error);
|
|
1946
|
-
});
|
|
1891
|
+
async throw(error) {
|
|
1892
|
+
await returnStreamIterators();
|
|
1893
|
+
isDone = true;
|
|
1894
|
+
return Promise.reject(error);
|
|
1947
1895
|
}
|
|
1948
1896
|
};
|
|
1949
1897
|
}
|