@graphitation/supermassive 3.7.1 → 3.8.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 +9 -1
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +238 -107
- package/lib/executeWithoutSchema.js.map +3 -3
- package/lib/executeWithoutSchema.mjs +239 -107
- package/lib/executeWithoutSchema.mjs.map +3 -3
- package/lib/hooks/types.d.ts +18 -6
- package/lib/hooks/types.d.ts.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# Change Log - @graphitation/supermassive
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Sun, 15 Dec 2024 19:04:27 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.8.0-alpha.1
|
|
8
|
+
|
|
9
|
+
Sun, 15 Dec 2024 19:04:27 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- Supermassive hook error handling modified (77059398+vejrj@users.noreply.github.com)
|
|
14
|
+
|
|
7
15
|
## 3.7.0
|
|
8
16
|
|
|
9
17
|
Wed, 06 Nov 2024 13:29:21 GMT
|
|
@@ -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;A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G,SAAS,CAAC;IACjD,aAAa,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IAClD,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;gBACpD,IAAI,EAAE;QAChB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;QAC1B,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;QACvB,aAAa,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QACvC,aAAa,EAAE,qBAAqB,GAAG,SAAS,CAAC;QACjD,UAAU,EAAE,gBAAgB,CAAC;KAC9B;IAsBD,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IASrD,2BAA2B;CAG5B;AAED,wBAAgB,4BAA4B,CAC1C,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,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"}
|
|
@@ -480,53 +480,71 @@ function executeSubscriptionImpl(exeContext) {
|
|
|
480
480
|
try {
|
|
481
481
|
const args = (0, import_values.getArgumentValues)(exeContext, fieldDef, fieldGroup[0]);
|
|
482
482
|
const contextValue = exeContext.contextValue;
|
|
483
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.
|
|
484
|
-
hookContext =
|
|
483
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldSubscribe)) {
|
|
484
|
+
hookContext = invokeBeforeFieldSubscribeHook(info, exeContext);
|
|
485
485
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
486
|
+
let result;
|
|
487
|
+
if (hookContext) {
|
|
488
|
+
if ((0, import_isPromise.isPromise)(hookContext)) {
|
|
489
|
+
result = hookContext.then((context) => {
|
|
490
|
+
hookContext = context;
|
|
491
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
return resolveFn(rootValue, args, contextValue, info);
|
|
495
|
+
});
|
|
496
|
+
} else if (hookContext instanceof import_graphql.GraphQLError) {
|
|
497
|
+
result = null;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (result === void 0) {
|
|
501
|
+
result = resolveFn(rootValue, args, contextValue, info);
|
|
502
|
+
}
|
|
503
|
+
const afterFieldSubscribeHandle = (resolved, error) => {
|
|
504
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldSubscribe)) {
|
|
505
|
+
hookContext = invokeAfterFieldSubscribeHook(
|
|
506
|
+
info,
|
|
507
|
+
exeContext,
|
|
508
|
+
hookContext,
|
|
509
|
+
resolved,
|
|
510
|
+
error
|
|
511
|
+
);
|
|
512
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
513
|
+
throw hookContext;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
};
|
|
490
517
|
if ((0, import_isPromise.isPromise)(result)) {
|
|
491
518
|
return result.then(assertEventStream).then(
|
|
492
519
|
(resolved) => {
|
|
493
|
-
if (
|
|
494
|
-
|
|
520
|
+
if (resolved instanceof import_graphql.GraphQLError) {
|
|
521
|
+
throw resolved;
|
|
522
|
+
}
|
|
523
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldSubscribe)) {
|
|
524
|
+
hookContext = invokeAfterFieldSubscribeHook(
|
|
495
525
|
info,
|
|
496
526
|
exeContext,
|
|
497
527
|
hookContext,
|
|
498
528
|
resolved
|
|
499
529
|
);
|
|
530
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
531
|
+
throw hookContext;
|
|
532
|
+
}
|
|
500
533
|
}
|
|
501
534
|
return resolved;
|
|
502
535
|
},
|
|
503
536
|
(error) => {
|
|
504
|
-
|
|
505
|
-
hookContext = invokeAfterFieldResolveHook(
|
|
506
|
-
info,
|
|
507
|
-
exeContext,
|
|
508
|
-
hookContext,
|
|
509
|
-
void 0,
|
|
510
|
-
error
|
|
511
|
-
);
|
|
512
|
-
}
|
|
537
|
+
afterFieldSubscribeHandle(void 0, error);
|
|
513
538
|
throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
514
539
|
}
|
|
515
540
|
);
|
|
516
541
|
}
|
|
517
542
|
const stream = assertEventStream(result);
|
|
518
|
-
|
|
519
|
-
hookContext = invokeAfterFieldResolveHook(
|
|
520
|
-
info,
|
|
521
|
-
exeContext,
|
|
522
|
-
hookContext,
|
|
523
|
-
stream
|
|
524
|
-
);
|
|
525
|
-
}
|
|
543
|
+
afterFieldSubscribeHandle(stream);
|
|
526
544
|
return stream;
|
|
527
545
|
} catch (error) {
|
|
528
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.
|
|
529
|
-
hookContext =
|
|
546
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldSubscribe)) {
|
|
547
|
+
hookContext = invokeAfterFieldSubscribeHook(
|
|
530
548
|
info,
|
|
531
549
|
exeContext,
|
|
532
550
|
hookContext,
|
|
@@ -534,6 +552,9 @@ function executeSubscriptionImpl(exeContext) {
|
|
|
534
552
|
error
|
|
535
553
|
);
|
|
536
554
|
}
|
|
555
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
556
|
+
throw hookContext;
|
|
557
|
+
}
|
|
537
558
|
throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
538
559
|
}
|
|
539
560
|
}
|
|
@@ -570,25 +591,28 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
|
|
|
570
591
|
payload
|
|
571
592
|
);
|
|
572
593
|
const hooks = exeContext == null ? void 0 : exeContext.fieldExecutionHooks;
|
|
573
|
-
let
|
|
594
|
+
let beforeExecuteSubscriptionEvenEmitHook;
|
|
574
595
|
if (hooks == null ? void 0 : hooks.beforeSubscriptionEventEmit) {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
596
|
+
beforeExecuteSubscriptionEvenEmitHook = invokeBeforeSubscriptionEventEmitHook(perEventContext, payload);
|
|
597
|
+
if (beforeExecuteSubscriptionEvenEmitHook instanceof import_graphql.GraphQLError) {
|
|
598
|
+
return buildResponse(perEventContext, null);
|
|
599
|
+
}
|
|
579
600
|
}
|
|
580
601
|
try {
|
|
581
|
-
const data = (0, import_isPromise.isPromise)(
|
|
582
|
-
()
|
|
583
|
-
|
|
602
|
+
const data = (0, import_isPromise.isPromise)(beforeExecuteSubscriptionEvenEmitHook) ? beforeExecuteSubscriptionEvenEmitHook.then((context) => {
|
|
603
|
+
if (context instanceof import_graphql.GraphQLError) {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
return executeFields(
|
|
607
|
+
perEventContext,
|
|
584
608
|
parentTypeName,
|
|
585
609
|
payload,
|
|
586
610
|
path,
|
|
587
611
|
groupedFieldSet,
|
|
588
612
|
void 0
|
|
589
|
-
)
|
|
590
|
-
) : executeFields(
|
|
591
|
-
|
|
613
|
+
);
|
|
614
|
+
}) : executeFields(
|
|
615
|
+
perEventContext,
|
|
592
616
|
parentTypeName,
|
|
593
617
|
payload,
|
|
594
618
|
path,
|
|
@@ -653,54 +677,59 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
653
677
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldResolve)) {
|
|
654
678
|
hookContext = invokeBeforeFieldResolveHook(info, exeContext);
|
|
655
679
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}
|
|
680
|
+
let result;
|
|
681
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
682
|
+
result = null;
|
|
683
|
+
} else if ((0, import_isPromise.isPromise)(hookContext)) {
|
|
684
|
+
result = hookContext.then((context) => {
|
|
685
|
+
hookContext = context;
|
|
686
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
687
|
+
return null;
|
|
688
|
+
}
|
|
689
|
+
return resolveFn(source, args, contextValue, info);
|
|
690
|
+
});
|
|
691
|
+
} else {
|
|
692
|
+
result = resolveFn(source, args, contextValue, info);
|
|
693
|
+
}
|
|
660
694
|
let completed;
|
|
695
|
+
const handleAfterFieldHooks = (hook, useHook) => (resolved, error) => {
|
|
696
|
+
if (!isDefaultResolverUsed && useHook) {
|
|
697
|
+
hookContext = hook(info, exeContext, hookContext, resolved, error);
|
|
698
|
+
return hookContext instanceof import_graphql.GraphQLError ? null : resolved;
|
|
699
|
+
}
|
|
700
|
+
return resolved;
|
|
701
|
+
};
|
|
661
702
|
if ((0, import_isPromise.isPromise)(result)) {
|
|
662
703
|
completed = result.then(
|
|
704
|
+
handleAfterFieldHooks(
|
|
705
|
+
invokeAfterFieldResolveHook,
|
|
706
|
+
!!(hooks == null ? void 0 : hooks.afterFieldResolve)
|
|
707
|
+
)
|
|
708
|
+
).then(
|
|
663
709
|
(resolved) => {
|
|
664
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
665
|
-
hookContext = invokeAfterFieldResolveHook(
|
|
666
|
-
info,
|
|
667
|
-
exeContext,
|
|
668
|
-
hookContext,
|
|
669
|
-
resolved
|
|
670
|
-
);
|
|
671
|
-
}
|
|
672
710
|
return completeValue(
|
|
673
711
|
exeContext,
|
|
674
712
|
returnTypeRef,
|
|
675
713
|
fieldGroup,
|
|
676
714
|
info,
|
|
677
715
|
path,
|
|
678
|
-
resolved,
|
|
716
|
+
hookContext instanceof import_graphql.GraphQLError ? null : resolved,
|
|
679
717
|
incrementalDataRecord
|
|
680
718
|
);
|
|
681
719
|
},
|
|
682
720
|
(rawError) => {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
hookContext,
|
|
688
|
-
void 0,
|
|
689
|
-
rawError
|
|
690
|
-
);
|
|
691
|
-
}
|
|
721
|
+
handleAfterFieldHooks(
|
|
722
|
+
invokeAfterFieldResolveHook,
|
|
723
|
+
!!(hooks == null ? void 0 : hooks.afterFieldResolve)
|
|
724
|
+
)(void 0, rawError);
|
|
692
725
|
throw rawError;
|
|
693
726
|
}
|
|
694
727
|
);
|
|
695
728
|
} else {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
hookContext,
|
|
701
|
-
result
|
|
702
|
-
);
|
|
703
|
-
}
|
|
729
|
+
result = handleAfterFieldHooks(
|
|
730
|
+
invokeAfterFieldResolveHook,
|
|
731
|
+
!!(hooks == null ? void 0 : hooks.afterFieldResolve)
|
|
732
|
+
)(result);
|
|
704
733
|
completed = completeValue(
|
|
705
734
|
exeContext,
|
|
706
735
|
returnTypeRef,
|
|
@@ -713,27 +742,18 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
713
742
|
}
|
|
714
743
|
if ((0, import_isPromise.isPromise)(completed)) {
|
|
715
744
|
return completed.then(
|
|
716
|
-
(
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
exeContext,
|
|
721
|
-
hookContext,
|
|
722
|
-
resolved
|
|
723
|
-
);
|
|
724
|
-
}
|
|
725
|
-
return resolved;
|
|
726
|
-
},
|
|
745
|
+
handleAfterFieldHooks(
|
|
746
|
+
invokeAfterFieldCompleteHook,
|
|
747
|
+
!!(hooks == null ? void 0 : hooks.afterFieldComplete)
|
|
748
|
+
),
|
|
727
749
|
(rawError) => {
|
|
728
750
|
const error = (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
729
|
-
|
|
730
|
-
invokeAfterFieldCompleteHook
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
error
|
|
736
|
-
);
|
|
751
|
+
const hookResult = handleAfterFieldHooks(
|
|
752
|
+
invokeAfterFieldCompleteHook,
|
|
753
|
+
!!(hooks == null ? void 0 : hooks.afterFieldComplete)
|
|
754
|
+
)(void 0, error);
|
|
755
|
+
if (hookResult === null) {
|
|
756
|
+
return null;
|
|
737
757
|
}
|
|
738
758
|
handleFieldError(
|
|
739
759
|
rawError,
|
|
@@ -747,10 +767,10 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
747
767
|
}
|
|
748
768
|
);
|
|
749
769
|
}
|
|
750
|
-
|
|
751
|
-
invokeAfterFieldCompleteHook
|
|
752
|
-
|
|
753
|
-
|
|
770
|
+
return handleAfterFieldHooks(
|
|
771
|
+
invokeAfterFieldCompleteHook,
|
|
772
|
+
!!(hooks == null ? void 0 : hooks.afterFieldComplete)
|
|
773
|
+
)(completed);
|
|
754
774
|
} catch (rawError) {
|
|
755
775
|
const pathArray = (0, import_Path.pathToArray)(path);
|
|
756
776
|
const error = (0, import_graphql.locatedError)(rawError, fieldGroup, pathArray);
|
|
@@ -764,13 +784,16 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
764
784
|
);
|
|
765
785
|
}
|
|
766
786
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
767
|
-
invokeAfterFieldCompleteHook(
|
|
787
|
+
const invokeAfterFieldCompleteHookResult = invokeAfterFieldCompleteHook(
|
|
768
788
|
info,
|
|
769
789
|
exeContext,
|
|
770
790
|
hookContext,
|
|
771
791
|
void 0,
|
|
772
792
|
error
|
|
773
793
|
);
|
|
794
|
+
if (invokeAfterFieldCompleteHookResult instanceof import_graphql.GraphQLError) {
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
774
797
|
}
|
|
775
798
|
handleFieldError(
|
|
776
799
|
rawError,
|
|
@@ -1243,6 +1266,39 @@ function collectAndExecuteSubfields(exeContext, returnTypeName, fieldGroup, path
|
|
|
1243
1266
|
}
|
|
1244
1267
|
return subFields;
|
|
1245
1268
|
}
|
|
1269
|
+
function invokeBeforeFieldSubscribeHook(resolveInfo, exeContext) {
|
|
1270
|
+
var _a;
|
|
1271
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeFieldSubscribe;
|
|
1272
|
+
if (!hook) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
return executeSafe(
|
|
1276
|
+
() => hook({
|
|
1277
|
+
resolveInfo,
|
|
1278
|
+
context: exeContext.contextValue
|
|
1279
|
+
}),
|
|
1280
|
+
(result, rawError) => {
|
|
1281
|
+
if (rawError) {
|
|
1282
|
+
const error = toGraphQLError(
|
|
1283
|
+
rawError,
|
|
1284
|
+
resolveInfo.path,
|
|
1285
|
+
"Unexpected error in beforeFieldSubscribe hook"
|
|
1286
|
+
);
|
|
1287
|
+
exeContext.errors.push(error);
|
|
1288
|
+
return error;
|
|
1289
|
+
} else if (result instanceof Error) {
|
|
1290
|
+
const error = toGraphQLError(
|
|
1291
|
+
result,
|
|
1292
|
+
resolveInfo.path,
|
|
1293
|
+
"Unexpected error in beforeFieldSubscribe hook"
|
|
1294
|
+
);
|
|
1295
|
+
exeContext.errors.push(error);
|
|
1296
|
+
return error;
|
|
1297
|
+
}
|
|
1298
|
+
return result;
|
|
1299
|
+
}
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1246
1302
|
function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
1247
1303
|
var _a;
|
|
1248
1304
|
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeFieldResolve;
|
|
@@ -1254,7 +1310,7 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1254
1310
|
resolveInfo,
|
|
1255
1311
|
context: exeContext.contextValue
|
|
1256
1312
|
}),
|
|
1257
|
-
(
|
|
1313
|
+
(result, rawError) => {
|
|
1258
1314
|
if (rawError) {
|
|
1259
1315
|
const error = toGraphQLError(
|
|
1260
1316
|
rawError,
|
|
@@ -1262,7 +1318,16 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1262
1318
|
"Unexpected error in beforeFieldResolve hook"
|
|
1263
1319
|
);
|
|
1264
1320
|
exeContext.errors.push(error);
|
|
1321
|
+
return error;
|
|
1322
|
+
} else if (result instanceof Error) {
|
|
1323
|
+
const error = toGraphQLError(
|
|
1324
|
+
result,
|
|
1325
|
+
resolveInfo.path,
|
|
1326
|
+
"Unexpected error in beforeFieldResolve hook"
|
|
1327
|
+
);
|
|
1328
|
+
exeContext.errors.push(error);
|
|
1265
1329
|
}
|
|
1330
|
+
return result;
|
|
1266
1331
|
}
|
|
1267
1332
|
);
|
|
1268
1333
|
}
|
|
@@ -1280,7 +1345,7 @@ function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, resul
|
|
|
1280
1345
|
result,
|
|
1281
1346
|
error
|
|
1282
1347
|
}),
|
|
1283
|
-
(
|
|
1348
|
+
(result2, rawError) => {
|
|
1284
1349
|
if (rawError) {
|
|
1285
1350
|
const error2 = toGraphQLError(
|
|
1286
1351
|
rawError,
|
|
@@ -1288,7 +1353,52 @@ function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, resul
|
|
|
1288
1353
|
"Unexpected error in afterFieldResolve hook"
|
|
1289
1354
|
);
|
|
1290
1355
|
exeContext.errors.push(error2);
|
|
1356
|
+
return error2;
|
|
1357
|
+
} else if (result2 instanceof Error) {
|
|
1358
|
+
const error2 = toGraphQLError(
|
|
1359
|
+
result2,
|
|
1360
|
+
resolveInfo.path,
|
|
1361
|
+
"Unexpected error in afterFieldResolve hook"
|
|
1362
|
+
);
|
|
1363
|
+
exeContext.errors.push(error2);
|
|
1364
|
+
}
|
|
1365
|
+
return result2;
|
|
1366
|
+
}
|
|
1367
|
+
);
|
|
1368
|
+
}
|
|
1369
|
+
function invokeAfterFieldSubscribeHook(resolveInfo, exeContext, hookContext, result, error) {
|
|
1370
|
+
var _a;
|
|
1371
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterFieldSubscribe;
|
|
1372
|
+
if (!hook) {
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
return executeSafe(
|
|
1376
|
+
() => hook({
|
|
1377
|
+
resolveInfo,
|
|
1378
|
+
context: exeContext.contextValue,
|
|
1379
|
+
hookContext,
|
|
1380
|
+
result,
|
|
1381
|
+
error
|
|
1382
|
+
}),
|
|
1383
|
+
(result2, rawError) => {
|
|
1384
|
+
if (rawError) {
|
|
1385
|
+
const error2 = toGraphQLError(
|
|
1386
|
+
rawError,
|
|
1387
|
+
resolveInfo.path,
|
|
1388
|
+
"Unexpected error in afterFieldSubscribe hook"
|
|
1389
|
+
);
|
|
1390
|
+
exeContext.errors.push(error2);
|
|
1391
|
+
return error2;
|
|
1392
|
+
} else if (result2 instanceof Error) {
|
|
1393
|
+
const error2 = toGraphQLError(
|
|
1394
|
+
result2,
|
|
1395
|
+
resolveInfo.path,
|
|
1396
|
+
"Unexpected error in afterFieldSubscribe hook"
|
|
1397
|
+
);
|
|
1398
|
+
exeContext.errors.push(error2);
|
|
1399
|
+
return error2;
|
|
1291
1400
|
}
|
|
1401
|
+
return result2;
|
|
1292
1402
|
}
|
|
1293
1403
|
);
|
|
1294
1404
|
}
|
|
@@ -1298,7 +1408,7 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
|
|
|
1298
1408
|
if (!hook) {
|
|
1299
1409
|
return;
|
|
1300
1410
|
}
|
|
1301
|
-
executeSafe(
|
|
1411
|
+
return executeSafe(
|
|
1302
1412
|
() => hook({
|
|
1303
1413
|
resolveInfo,
|
|
1304
1414
|
context: exeContext.contextValue,
|
|
@@ -1306,7 +1416,7 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
|
|
|
1306
1416
|
result,
|
|
1307
1417
|
error
|
|
1308
1418
|
}),
|
|
1309
|
-
(
|
|
1419
|
+
(result2, rawError) => {
|
|
1310
1420
|
if (rawError) {
|
|
1311
1421
|
const error2 = toGraphQLError(
|
|
1312
1422
|
rawError,
|
|
@@ -1314,7 +1424,16 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
|
|
|
1314
1424
|
"Unexpected error in afterFieldComplete hook"
|
|
1315
1425
|
);
|
|
1316
1426
|
exeContext.errors.push(error2);
|
|
1427
|
+
return error2;
|
|
1428
|
+
} else if (result2 instanceof Error) {
|
|
1429
|
+
const error2 = toGraphQLError(
|
|
1430
|
+
result2,
|
|
1431
|
+
resolveInfo.path,
|
|
1432
|
+
"Unexpected error in afterFieldComplete hook"
|
|
1433
|
+
);
|
|
1434
|
+
exeContext.errors.push(error2);
|
|
1317
1435
|
}
|
|
1436
|
+
return result2;
|
|
1318
1437
|
}
|
|
1319
1438
|
);
|
|
1320
1439
|
}
|
|
@@ -1329,8 +1448,16 @@ function invokeBeforeOperationExecuteHook(exeContext) {
|
|
|
1329
1448
|
context: exeContext.contextValue,
|
|
1330
1449
|
operation: exeContext.operation
|
|
1331
1450
|
}),
|
|
1332
|
-
(
|
|
1451
|
+
(result, rawError) => {
|
|
1333
1452
|
if (rawError) {
|
|
1453
|
+
const error = toGraphQLError(
|
|
1454
|
+
rawError,
|
|
1455
|
+
void 0,
|
|
1456
|
+
"Unexpected error in beforeOperationExecute hook"
|
|
1457
|
+
);
|
|
1458
|
+
throw error;
|
|
1459
|
+
}
|
|
1460
|
+
if (result instanceof Error) {
|
|
1334
1461
|
const error = toGraphQLError(
|
|
1335
1462
|
rawError,
|
|
1336
1463
|
void 0,
|
|
@@ -1338,6 +1465,7 @@ function invokeBeforeOperationExecuteHook(exeContext) {
|
|
|
1338
1465
|
);
|
|
1339
1466
|
exeContext.errors.push(error);
|
|
1340
1467
|
}
|
|
1468
|
+
return result;
|
|
1341
1469
|
}
|
|
1342
1470
|
);
|
|
1343
1471
|
}
|
|
@@ -1353,7 +1481,7 @@ function invokeBeforeSubscriptionEventEmitHook(exeContext, eventPayload) {
|
|
|
1353
1481
|
operation: exeContext.operation,
|
|
1354
1482
|
eventPayload
|
|
1355
1483
|
}),
|
|
1356
|
-
(
|
|
1484
|
+
(result, rawError) => {
|
|
1357
1485
|
if (rawError) {
|
|
1358
1486
|
const error = toGraphQLError(
|
|
1359
1487
|
rawError,
|
|
@@ -1361,7 +1489,16 @@ function invokeBeforeSubscriptionEventEmitHook(exeContext, eventPayload) {
|
|
|
1361
1489
|
"Unexpected error in beforeSubscriptionEventEmit hook"
|
|
1362
1490
|
);
|
|
1363
1491
|
exeContext.errors.push(error);
|
|
1492
|
+
return error;
|
|
1493
|
+
} else if (result instanceof Error) {
|
|
1494
|
+
const error = toGraphQLError(
|
|
1495
|
+
result,
|
|
1496
|
+
void 0,
|
|
1497
|
+
"Unexpected error in beforeSubscriptionEventEmit hook"
|
|
1498
|
+
);
|
|
1499
|
+
exeContext.errors.push(error);
|
|
1364
1500
|
}
|
|
1501
|
+
return result;
|
|
1365
1502
|
}
|
|
1366
1503
|
);
|
|
1367
1504
|
}
|
|
@@ -1396,20 +1533,14 @@ function executeSafe(execute, onComplete) {
|
|
|
1396
1533
|
result = execute();
|
|
1397
1534
|
} catch (e) {
|
|
1398
1535
|
error = e;
|
|
1399
|
-
} finally {
|
|
1400
|
-
if (!(0, import_isPromise.isPromise)(result)) {
|
|
1401
|
-
onComplete(result, error);
|
|
1402
|
-
}
|
|
1403
1536
|
}
|
|
1404
1537
|
if (!(0, import_isPromise.isPromise)(result)) {
|
|
1405
|
-
return result;
|
|
1538
|
+
return onComplete(result, error);
|
|
1406
1539
|
}
|
|
1407
1540
|
return result.then((hookResult) => {
|
|
1408
|
-
onComplete(hookResult, error);
|
|
1409
|
-
return hookResult;
|
|
1541
|
+
return onComplete(hookResult, error);
|
|
1410
1542
|
}).catch((e) => {
|
|
1411
|
-
onComplete(void 0, e);
|
|
1412
|
-
return void 0;
|
|
1543
|
+
return onComplete(void 0, e);
|
|
1413
1544
|
});
|
|
1414
1545
|
}
|
|
1415
1546
|
function toGraphQLError(originalError, path, prependMessage) {
|