@graphitation/supermassive 3.5.0 → 3.5.2
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 +18 -2
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +186 -29
- package/lib/executeWithoutSchema.js.map +2 -2
- package/lib/executeWithoutSchema.mjs +186 -29
- package/lib/executeWithoutSchema.mjs.map +2 -2
- package/lib/hooks/types.d.ts +25 -8
- package/lib/hooks/types.d.ts.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/jsutils/printPathArray.d.ts.map +1 -1
- package/lib/jsutils/printPathArray.js +12 -3
- package/lib/jsutils/printPathArray.js.map +2 -2
- package/lib/jsutils/printPathArray.mjs +12 -3
- package/lib/jsutils/printPathArray.mjs.map +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @graphitation/supermassive
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 03 Jul 2024 17:33:29 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.5.2
|
|
8
|
+
|
|
9
|
+
Wed, 03 Jul 2024 17:33:29 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Introduce new execution hooks: beforeOperationExecute, beforeSubscriptionEvent and afterBuildResponse (sergeystoyan@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 3.5.1
|
|
16
|
+
|
|
17
|
+
Fri, 14 Jun 2024 18:43:53 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- Revert back changes in execution where afterFieldResolve hook can return promise if async (sergeystoyan@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 3.5.0
|
|
8
24
|
|
|
9
|
-
Thu, 07 Mar 2024 13:08:
|
|
25
|
+
Thu, 07 Mar 2024 13:08:30 GMT
|
|
10
26
|
|
|
11
27
|
### Minor changes
|
|
12
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeWithoutSchema.d.ts","sourceRoot":"","sources":["../src/executeWithoutSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIZ,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,EAGL,UAAU,EAEX,MAAM,iBAAiB,CAAC;AAOzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,oBAAoB,EAKpB,0BAA0B,EAC1B,cAAc,EACd,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAMjB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAgCpD;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IACxD,SAAS,EAAE,uBAAuB,CAAC;IACnC,cAAc,EAAE;QAAE,CAAC,QA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WAAW,CAAC,GAC1C,MAAM,IAAI,0BAA0B,CAAC,KAAK,EAAE,WAAW,CAAC,CAE1D;AAED,wBAAgB,sBAAsB,CACpC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EACvB,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,EAE7B,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,GAC1C,MAAM,IAAI,oBAAoB,CAAC,KAAK,EAAE,WAAW,CAAC,CAEpD"}
|
|
@@ -205,6 +205,10 @@ function executeOperation(exeContext) {
|
|
|
205
205
|
);
|
|
206
206
|
const path = void 0;
|
|
207
207
|
let result;
|
|
208
|
+
const hooks = exeContext.fieldExecutionHooks;
|
|
209
|
+
if (hooks == null ? void 0 : hooks.beforeOperationExecute) {
|
|
210
|
+
invokeBeforeOperationExecuteHook(exeContext);
|
|
211
|
+
}
|
|
208
212
|
switch (operation.operation) {
|
|
209
213
|
case "query":
|
|
210
214
|
result = executeFields(
|
|
@@ -262,6 +266,7 @@ function executeOperation(exeContext) {
|
|
|
262
266
|
}
|
|
263
267
|
}
|
|
264
268
|
function buildResponse(exeContext, data) {
|
|
269
|
+
var _a, _b;
|
|
265
270
|
if ((0, import_isPromise.isPromise)(data)) {
|
|
266
271
|
return data.then(
|
|
267
272
|
(resolved) => buildResponse(exeContext, resolved),
|
|
@@ -271,6 +276,7 @@ function buildResponse(exeContext, data) {
|
|
|
271
276
|
}
|
|
272
277
|
);
|
|
273
278
|
}
|
|
279
|
+
const hooks = exeContext.fieldExecutionHooks;
|
|
274
280
|
try {
|
|
275
281
|
const initialResult = exeContext.errors.length === 0 ? { data } : { errors: exeContext.errors, data };
|
|
276
282
|
if (exeContext.subsequentPayloads.size > 0) {
|
|
@@ -281,6 +287,12 @@ function buildResponse(exeContext, data) {
|
|
|
281
287
|
subsequentResults: yieldSubsequentPayloads(exeContext)
|
|
282
288
|
};
|
|
283
289
|
} else {
|
|
290
|
+
if (hooks == null ? void 0 : hooks.afterBuildResponse) {
|
|
291
|
+
invokeAfterBuildResponseHook(exeContext, initialResult);
|
|
292
|
+
if (exeContext.errors.length > ((_b = (_a = initialResult.errors) == null ? void 0 : _a.length) != null ? _b : 0)) {
|
|
293
|
+
initialResult.errors = exeContext.errors;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
284
296
|
return initialResult;
|
|
285
297
|
}
|
|
286
298
|
} catch (error) {
|
|
@@ -452,17 +464,63 @@ function executeSubscriptionImpl(exeContext) {
|
|
|
452
464
|
(0, import_reference.typeNameFromReference)(returnTypeRef),
|
|
453
465
|
path
|
|
454
466
|
);
|
|
467
|
+
const isDefaultResolverUsed = resolveFn === exeContext.subscribeFieldResolver;
|
|
468
|
+
const hooks = exeContext.fieldExecutionHooks;
|
|
469
|
+
let hookContext = void 0;
|
|
455
470
|
try {
|
|
456
471
|
const args = (0, import_values.getArgumentValues)(exeContext, fieldDef, fieldGroup[0]);
|
|
457
472
|
const contextValue = exeContext.contextValue;
|
|
473
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldResolve)) {
|
|
474
|
+
hookContext = invokeBeforeFieldResolveHook(info, exeContext);
|
|
475
|
+
}
|
|
458
476
|
const result = resolveFn(rootValue, args, contextValue, info);
|
|
459
477
|
if ((0, import_isPromise.isPromise)(result)) {
|
|
460
|
-
return result.then(assertEventStream).then(
|
|
461
|
-
|
|
462
|
-
|
|
478
|
+
return result.then(assertEventStream).then(
|
|
479
|
+
(resolved) => {
|
|
480
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
481
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
482
|
+
info,
|
|
483
|
+
exeContext,
|
|
484
|
+
hookContext,
|
|
485
|
+
resolved
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
return resolved;
|
|
489
|
+
},
|
|
490
|
+
(error) => {
|
|
491
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
492
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
493
|
+
info,
|
|
494
|
+
exeContext,
|
|
495
|
+
hookContext,
|
|
496
|
+
void 0,
|
|
497
|
+
error
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
501
|
+
}
|
|
502
|
+
);
|
|
463
503
|
}
|
|
464
|
-
|
|
504
|
+
const stream = assertEventStream(result);
|
|
505
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
506
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
507
|
+
info,
|
|
508
|
+
exeContext,
|
|
509
|
+
hookContext,
|
|
510
|
+
stream
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
return stream;
|
|
465
514
|
} catch (error) {
|
|
515
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
516
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
517
|
+
info,
|
|
518
|
+
exeContext,
|
|
519
|
+
hookContext,
|
|
520
|
+
void 0,
|
|
521
|
+
error
|
|
522
|
+
);
|
|
523
|
+
}
|
|
466
524
|
throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
467
525
|
}
|
|
468
526
|
}
|
|
@@ -498,6 +556,10 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
|
|
|
498
556
|
exeContext,
|
|
499
557
|
payload
|
|
500
558
|
);
|
|
559
|
+
const hooks = exeContext == null ? void 0 : exeContext.fieldExecutionHooks;
|
|
560
|
+
if (hooks == null ? void 0 : hooks.beforeSubscriptionEventEmit) {
|
|
561
|
+
invokeBeforeSubscriptionEventEmitHook(perEventContext, payload);
|
|
562
|
+
}
|
|
501
563
|
try {
|
|
502
564
|
const data = executeFields(
|
|
503
565
|
exeContext,
|
|
@@ -556,7 +618,7 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
556
618
|
(0, import_reference.typeNameFromReference)(returnTypeRef),
|
|
557
619
|
path
|
|
558
620
|
);
|
|
559
|
-
const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver;
|
|
621
|
+
const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver || fieldName === "__typename";
|
|
560
622
|
const hooks = exeContext.fieldExecutionHooks;
|
|
561
623
|
let hookContext = void 0;
|
|
562
624
|
try {
|
|
@@ -566,28 +628,50 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
566
628
|
hookContext = invokeBeforeFieldResolveHook(info, exeContext);
|
|
567
629
|
}
|
|
568
630
|
const result = resolveFn(source, args, contextValue, info);
|
|
569
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
570
|
-
hookContext = invokeAfterFieldResolveHook(
|
|
571
|
-
info,
|
|
572
|
-
exeContext,
|
|
573
|
-
hookContext,
|
|
574
|
-
result
|
|
575
|
-
);
|
|
576
|
-
}
|
|
577
631
|
let completed;
|
|
578
632
|
if ((0, import_isPromise.isPromise)(result)) {
|
|
579
|
-
completed = result.then(
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
633
|
+
completed = result.then(
|
|
634
|
+
(resolved) => {
|
|
635
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
636
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
637
|
+
info,
|
|
638
|
+
exeContext,
|
|
639
|
+
hookContext,
|
|
640
|
+
resolved
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
return completeValue(
|
|
644
|
+
exeContext,
|
|
645
|
+
returnTypeRef,
|
|
646
|
+
fieldGroup,
|
|
647
|
+
info,
|
|
648
|
+
path,
|
|
649
|
+
resolved,
|
|
650
|
+
incrementalDataRecord
|
|
651
|
+
);
|
|
652
|
+
},
|
|
653
|
+
(rawError) => {
|
|
654
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
655
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
656
|
+
info,
|
|
657
|
+
exeContext,
|
|
658
|
+
hookContext,
|
|
659
|
+
void 0,
|
|
660
|
+
rawError
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
throw rawError;
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
} else {
|
|
667
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
668
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
584
669
|
info,
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
670
|
+
exeContext,
|
|
671
|
+
hookContext,
|
|
672
|
+
result
|
|
588
673
|
);
|
|
589
|
-
}
|
|
590
|
-
} else {
|
|
674
|
+
}
|
|
591
675
|
completed = completeValue(
|
|
592
676
|
exeContext,
|
|
593
677
|
returnTypeRef,
|
|
@@ -646,7 +730,8 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
646
730
|
info,
|
|
647
731
|
exeContext,
|
|
648
732
|
hookContext,
|
|
649
|
-
void 0
|
|
733
|
+
void 0,
|
|
734
|
+
error
|
|
650
735
|
);
|
|
651
736
|
}
|
|
652
737
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
@@ -1152,7 +1237,7 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1152
1237
|
}
|
|
1153
1238
|
);
|
|
1154
1239
|
}
|
|
1155
|
-
function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, result) {
|
|
1240
|
+
function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, result, error) {
|
|
1156
1241
|
var _a;
|
|
1157
1242
|
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterFieldResolve;
|
|
1158
1243
|
if (!hook) {
|
|
@@ -1163,16 +1248,17 @@ function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, resul
|
|
|
1163
1248
|
resolveInfo,
|
|
1164
1249
|
context: exeContext.contextValue,
|
|
1165
1250
|
hookContext,
|
|
1166
|
-
result
|
|
1251
|
+
result,
|
|
1252
|
+
error
|
|
1167
1253
|
}),
|
|
1168
1254
|
(_, rawError) => {
|
|
1169
1255
|
if (rawError) {
|
|
1170
|
-
const
|
|
1256
|
+
const error2 = toGraphQLError(
|
|
1171
1257
|
rawError,
|
|
1172
1258
|
resolveInfo.path,
|
|
1173
1259
|
"Unexpected error in afterFieldResolve hook"
|
|
1174
1260
|
);
|
|
1175
|
-
exeContext.errors.push(
|
|
1261
|
+
exeContext.errors.push(error2);
|
|
1176
1262
|
}
|
|
1177
1263
|
}
|
|
1178
1264
|
);
|
|
@@ -1203,6 +1289,77 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
|
|
|
1203
1289
|
}
|
|
1204
1290
|
);
|
|
1205
1291
|
}
|
|
1292
|
+
function invokeBeforeOperationExecuteHook(exeContext) {
|
|
1293
|
+
var _a;
|
|
1294
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeOperationExecute;
|
|
1295
|
+
if (!hook) {
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
return executeSafe(
|
|
1299
|
+
() => hook({
|
|
1300
|
+
context: exeContext.contextValue,
|
|
1301
|
+
operation: exeContext.operation
|
|
1302
|
+
}),
|
|
1303
|
+
(_, rawError) => {
|
|
1304
|
+
if (rawError) {
|
|
1305
|
+
const error = toGraphQLError(
|
|
1306
|
+
rawError,
|
|
1307
|
+
void 0,
|
|
1308
|
+
"Unexpected error in beforeOperationExecute hook"
|
|
1309
|
+
);
|
|
1310
|
+
exeContext.errors.push(error);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
function invokeBeforeSubscriptionEventEmitHook(exeContext, eventPayload) {
|
|
1316
|
+
var _a;
|
|
1317
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeSubscriptionEventEmit;
|
|
1318
|
+
if (!hook) {
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
return executeSafe(
|
|
1322
|
+
() => hook({
|
|
1323
|
+
context: exeContext.contextValue,
|
|
1324
|
+
operation: exeContext.operation,
|
|
1325
|
+
eventPayload
|
|
1326
|
+
}),
|
|
1327
|
+
(_, rawError) => {
|
|
1328
|
+
if (rawError) {
|
|
1329
|
+
const error = toGraphQLError(
|
|
1330
|
+
rawError,
|
|
1331
|
+
void 0,
|
|
1332
|
+
"Unexpected error in beforeSubscriptionEventEmit hook"
|
|
1333
|
+
);
|
|
1334
|
+
exeContext.errors.push(error);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
);
|
|
1338
|
+
}
|
|
1339
|
+
function invokeAfterBuildResponseHook(exeContext, result) {
|
|
1340
|
+
var _a;
|
|
1341
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterBuildResponse;
|
|
1342
|
+
if (!hook) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
return executeSafe(
|
|
1346
|
+
() => hook({
|
|
1347
|
+
context: exeContext.contextValue,
|
|
1348
|
+
operation: exeContext.operation,
|
|
1349
|
+
result
|
|
1350
|
+
}),
|
|
1351
|
+
(_, rawError) => {
|
|
1352
|
+
if (rawError) {
|
|
1353
|
+
const error = toGraphQLError(
|
|
1354
|
+
rawError,
|
|
1355
|
+
void 0,
|
|
1356
|
+
"Unexpected error in afterBuildResponse hook"
|
|
1357
|
+
);
|
|
1358
|
+
exeContext.errors.push(error);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
);
|
|
1362
|
+
}
|
|
1206
1363
|
function executeSafe(execute, onComplete) {
|
|
1207
1364
|
let error;
|
|
1208
1365
|
let result;
|
|
@@ -1218,7 +1375,7 @@ function executeSafe(execute, onComplete) {
|
|
|
1218
1375
|
function toGraphQLError(originalError, path, prependMessage) {
|
|
1219
1376
|
const originalMessage = originalError instanceof Error ? originalError.message : (0, import_inspect.inspect)(originalError);
|
|
1220
1377
|
const error = new Error(`${prependMessage}: ${originalMessage}`);
|
|
1221
|
-
return (0, import_graphql.locatedError)(error, void 0, (0, import_Path.pathToArray)(path));
|
|
1378
|
+
return (0, import_graphql.locatedError)(error, void 0, path ? (0, import_Path.pathToArray)(path) : void 0);
|
|
1222
1379
|
}
|
|
1223
1380
|
const defaultTypeResolver = function(value) {
|
|
1224
1381
|
if ((0, import_isObjectLike.isObjectLike)(value) && typeof value.__typename === "string") {
|