@graphitation/supermassive 3.7.2 → 3.8.0-alpha.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 +10 -2
- 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,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @graphitation/supermassive
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on Mon, 16 Dec 2024
|
|
3
|
+
<!-- This log was last generated on Mon, 16 Dec 2024 18:09:33 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.8.0-alpha.2
|
|
8
|
+
|
|
9
|
+
Mon, 16 Dec 2024 18:09:33 GMT
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
- fix (77059398+vejrj@users.noreply.github.com)
|
|
14
|
+
|
|
7
15
|
## 3.7.2
|
|
8
16
|
|
|
9
|
-
Mon, 16 Dec 2024 15:39:
|
|
17
|
+
Mon, 16 Dec 2024 15:39:40 GMT
|
|
10
18
|
|
|
11
19
|
### Patches
|
|
12
20
|
|
|
@@ -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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
|
|
489
489
|
try {
|
|
490
490
|
const args = (0, import_values.getArgumentValues)(exeContext, fieldDef, fieldGroup[0]);
|
|
491
491
|
const contextValue = exeContext.contextValue;
|
|
492
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.
|
|
493
|
-
hookContext =
|
|
492
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldSubscribe)) {
|
|
493
|
+
hookContext = invokeBeforeFieldSubscribeHook(info, exeContext);
|
|
494
494
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
495
|
+
let result;
|
|
496
|
+
if (hookContext) {
|
|
497
|
+
if ((0, import_isPromise.isPromise)(hookContext)) {
|
|
498
|
+
result = hookContext.then((context) => {
|
|
499
|
+
hookContext = context;
|
|
500
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
return resolveFn(rootValue, args, contextValue, info);
|
|
504
|
+
});
|
|
505
|
+
} else if (hookContext instanceof import_graphql.GraphQLError) {
|
|
506
|
+
result = null;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
if (result === void 0) {
|
|
510
|
+
result = resolveFn(rootValue, args, contextValue, info);
|
|
511
|
+
}
|
|
512
|
+
const afterFieldSubscribeHandle = (resolved, error) => {
|
|
513
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldSubscribe)) {
|
|
514
|
+
hookContext = invokeAfterFieldSubscribeHook(
|
|
515
|
+
info,
|
|
516
|
+
exeContext,
|
|
517
|
+
hookContext,
|
|
518
|
+
resolved,
|
|
519
|
+
error
|
|
520
|
+
);
|
|
521
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
522
|
+
throw hookContext;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
};
|
|
499
526
|
if ((0, import_isPromise.isPromise)(result)) {
|
|
500
527
|
return result.then(assertEventStream).then(
|
|
501
528
|
(resolved) => {
|
|
502
|
-
if (
|
|
503
|
-
|
|
529
|
+
if (resolved instanceof import_graphql.GraphQLError) {
|
|
530
|
+
throw resolved;
|
|
531
|
+
}
|
|
532
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldSubscribe)) {
|
|
533
|
+
hookContext = invokeAfterFieldSubscribeHook(
|
|
504
534
|
info,
|
|
505
535
|
exeContext,
|
|
506
536
|
hookContext,
|
|
507
537
|
resolved
|
|
508
538
|
);
|
|
539
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
540
|
+
throw hookContext;
|
|
541
|
+
}
|
|
509
542
|
}
|
|
510
543
|
return resolved;
|
|
511
544
|
},
|
|
512
545
|
(error) => {
|
|
513
|
-
|
|
514
|
-
hookContext = invokeAfterFieldResolveHook(
|
|
515
|
-
info,
|
|
516
|
-
exeContext,
|
|
517
|
-
hookContext,
|
|
518
|
-
void 0,
|
|
519
|
-
error
|
|
520
|
-
);
|
|
521
|
-
}
|
|
546
|
+
afterFieldSubscribeHandle(void 0, error);
|
|
522
547
|
throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
523
548
|
}
|
|
524
549
|
);
|
|
525
550
|
}
|
|
526
551
|
const stream = assertEventStream(result);
|
|
527
|
-
|
|
528
|
-
hookContext = invokeAfterFieldResolveHook(
|
|
529
|
-
info,
|
|
530
|
-
exeContext,
|
|
531
|
-
hookContext,
|
|
532
|
-
stream
|
|
533
|
-
);
|
|
534
|
-
}
|
|
552
|
+
afterFieldSubscribeHandle(stream);
|
|
535
553
|
return stream;
|
|
536
554
|
} catch (error) {
|
|
537
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.
|
|
538
|
-
hookContext =
|
|
555
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldSubscribe)) {
|
|
556
|
+
hookContext = invokeAfterFieldSubscribeHook(
|
|
539
557
|
info,
|
|
540
558
|
exeContext,
|
|
541
559
|
hookContext,
|
|
@@ -543,6 +561,9 @@ function executeSubscriptionImpl(exeContext) {
|
|
|
543
561
|
error
|
|
544
562
|
);
|
|
545
563
|
}
|
|
564
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
565
|
+
throw hookContext;
|
|
566
|
+
}
|
|
546
567
|
throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
547
568
|
}
|
|
548
569
|
}
|
|
@@ -579,25 +600,28 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
|
|
|
579
600
|
payload
|
|
580
601
|
);
|
|
581
602
|
const hooks = exeContext == null ? void 0 : exeContext.fieldExecutionHooks;
|
|
582
|
-
let
|
|
603
|
+
let beforeExecuteSubscriptionEvenEmitHook;
|
|
583
604
|
if (hooks == null ? void 0 : hooks.beforeSubscriptionEventEmit) {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
605
|
+
beforeExecuteSubscriptionEvenEmitHook = invokeBeforeSubscriptionEventEmitHook(perEventContext, payload);
|
|
606
|
+
if (beforeExecuteSubscriptionEvenEmitHook instanceof import_graphql.GraphQLError) {
|
|
607
|
+
return buildResponse(perEventContext, null);
|
|
608
|
+
}
|
|
588
609
|
}
|
|
589
610
|
try {
|
|
590
|
-
const data = (0, import_isPromise.isPromise)(
|
|
591
|
-
()
|
|
592
|
-
|
|
611
|
+
const data = (0, import_isPromise.isPromise)(beforeExecuteSubscriptionEvenEmitHook) ? beforeExecuteSubscriptionEvenEmitHook.then((context) => {
|
|
612
|
+
if (context instanceof import_graphql.GraphQLError) {
|
|
613
|
+
return null;
|
|
614
|
+
}
|
|
615
|
+
return executeFields(
|
|
616
|
+
perEventContext,
|
|
593
617
|
parentTypeName,
|
|
594
618
|
payload,
|
|
595
619
|
path,
|
|
596
620
|
groupedFieldSet,
|
|
597
621
|
void 0
|
|
598
|
-
)
|
|
599
|
-
) : executeFields(
|
|
600
|
-
|
|
622
|
+
);
|
|
623
|
+
}) : executeFields(
|
|
624
|
+
perEventContext,
|
|
601
625
|
parentTypeName,
|
|
602
626
|
payload,
|
|
603
627
|
path,
|
|
@@ -662,54 +686,59 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
662
686
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldResolve)) {
|
|
663
687
|
hookContext = invokeBeforeFieldResolveHook(info, exeContext);
|
|
664
688
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
689
|
+
let result;
|
|
690
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
691
|
+
result = null;
|
|
692
|
+
} else if ((0, import_isPromise.isPromise)(hookContext)) {
|
|
693
|
+
result = hookContext.then((context) => {
|
|
694
|
+
hookContext = context;
|
|
695
|
+
if (hookContext instanceof import_graphql.GraphQLError) {
|
|
696
|
+
return null;
|
|
697
|
+
}
|
|
698
|
+
return resolveFn(source, args, contextValue, info);
|
|
699
|
+
});
|
|
700
|
+
} else {
|
|
701
|
+
result = resolveFn(source, args, contextValue, info);
|
|
702
|
+
}
|
|
669
703
|
let completed;
|
|
704
|
+
const handleAfterFieldHooks = (hook, useHook) => (resolved, error) => {
|
|
705
|
+
if (!isDefaultResolverUsed && useHook) {
|
|
706
|
+
hookContext = hook(info, exeContext, hookContext, resolved, error);
|
|
707
|
+
return hookContext instanceof import_graphql.GraphQLError ? null : resolved;
|
|
708
|
+
}
|
|
709
|
+
return resolved;
|
|
710
|
+
};
|
|
670
711
|
if ((0, import_isPromise.isPromise)(result)) {
|
|
671
712
|
completed = result.then(
|
|
713
|
+
handleAfterFieldHooks(
|
|
714
|
+
invokeAfterFieldResolveHook,
|
|
715
|
+
!!(hooks == null ? void 0 : hooks.afterFieldResolve)
|
|
716
|
+
)
|
|
717
|
+
).then(
|
|
672
718
|
(resolved) => {
|
|
673
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
674
|
-
hookContext = invokeAfterFieldResolveHook(
|
|
675
|
-
info,
|
|
676
|
-
exeContext,
|
|
677
|
-
hookContext,
|
|
678
|
-
resolved
|
|
679
|
-
);
|
|
680
|
-
}
|
|
681
719
|
return completeValue(
|
|
682
720
|
exeContext,
|
|
683
721
|
returnTypeRef,
|
|
684
722
|
fieldGroup,
|
|
685
723
|
info,
|
|
686
724
|
path,
|
|
687
|
-
resolved,
|
|
725
|
+
hookContext instanceof import_graphql.GraphQLError ? null : resolved,
|
|
688
726
|
incrementalDataRecord
|
|
689
727
|
);
|
|
690
728
|
},
|
|
691
729
|
(rawError) => {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
hookContext,
|
|
697
|
-
void 0,
|
|
698
|
-
rawError
|
|
699
|
-
);
|
|
700
|
-
}
|
|
730
|
+
handleAfterFieldHooks(
|
|
731
|
+
invokeAfterFieldResolveHook,
|
|
732
|
+
!!(hooks == null ? void 0 : hooks.afterFieldResolve)
|
|
733
|
+
)(void 0, rawError);
|
|
701
734
|
throw rawError;
|
|
702
735
|
}
|
|
703
736
|
);
|
|
704
737
|
} else {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
hookContext,
|
|
710
|
-
result
|
|
711
|
-
);
|
|
712
|
-
}
|
|
738
|
+
result = handleAfterFieldHooks(
|
|
739
|
+
invokeAfterFieldResolveHook,
|
|
740
|
+
!!(hooks == null ? void 0 : hooks.afterFieldResolve)
|
|
741
|
+
)(result);
|
|
713
742
|
completed = completeValue(
|
|
714
743
|
exeContext,
|
|
715
744
|
returnTypeRef,
|
|
@@ -722,27 +751,18 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
722
751
|
}
|
|
723
752
|
if ((0, import_isPromise.isPromise)(completed)) {
|
|
724
753
|
return completed.then(
|
|
725
|
-
(
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
exeContext,
|
|
730
|
-
hookContext,
|
|
731
|
-
resolved
|
|
732
|
-
);
|
|
733
|
-
}
|
|
734
|
-
return resolved;
|
|
735
|
-
},
|
|
754
|
+
handleAfterFieldHooks(
|
|
755
|
+
invokeAfterFieldCompleteHook,
|
|
756
|
+
!!(hooks == null ? void 0 : hooks.afterFieldComplete)
|
|
757
|
+
),
|
|
736
758
|
(rawError) => {
|
|
737
759
|
const error = (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
738
|
-
|
|
739
|
-
invokeAfterFieldCompleteHook
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
error
|
|
745
|
-
);
|
|
760
|
+
const hookResult = handleAfterFieldHooks(
|
|
761
|
+
invokeAfterFieldCompleteHook,
|
|
762
|
+
!!(hooks == null ? void 0 : hooks.afterFieldComplete)
|
|
763
|
+
)(void 0, error);
|
|
764
|
+
if (hookResult === null) {
|
|
765
|
+
return null;
|
|
746
766
|
}
|
|
747
767
|
handleFieldError(
|
|
748
768
|
rawError,
|
|
@@ -756,10 +776,10 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
756
776
|
}
|
|
757
777
|
);
|
|
758
778
|
}
|
|
759
|
-
|
|
760
|
-
invokeAfterFieldCompleteHook
|
|
761
|
-
|
|
762
|
-
|
|
779
|
+
return handleAfterFieldHooks(
|
|
780
|
+
invokeAfterFieldCompleteHook,
|
|
781
|
+
!!(hooks == null ? void 0 : hooks.afterFieldComplete)
|
|
782
|
+
)(completed);
|
|
763
783
|
} catch (rawError) {
|
|
764
784
|
const pathArray = (0, import_Path.pathToArray)(path);
|
|
765
785
|
const error = (0, import_graphql.locatedError)(rawError, fieldGroup, pathArray);
|
|
@@ -773,13 +793,16 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
773
793
|
);
|
|
774
794
|
}
|
|
775
795
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
776
|
-
invokeAfterFieldCompleteHook(
|
|
796
|
+
const invokeAfterFieldCompleteHookResult = invokeAfterFieldCompleteHook(
|
|
777
797
|
info,
|
|
778
798
|
exeContext,
|
|
779
799
|
hookContext,
|
|
780
800
|
void 0,
|
|
781
801
|
error
|
|
782
802
|
);
|
|
803
|
+
if (invokeAfterFieldCompleteHookResult instanceof import_graphql.GraphQLError) {
|
|
804
|
+
return null;
|
|
805
|
+
}
|
|
783
806
|
}
|
|
784
807
|
handleFieldError(
|
|
785
808
|
rawError,
|
|
@@ -1252,6 +1275,39 @@ function collectAndExecuteSubfields(exeContext, returnTypeName, fieldGroup, path
|
|
|
1252
1275
|
}
|
|
1253
1276
|
return subFields;
|
|
1254
1277
|
}
|
|
1278
|
+
function invokeBeforeFieldSubscribeHook(resolveInfo, exeContext) {
|
|
1279
|
+
var _a;
|
|
1280
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeFieldSubscribe;
|
|
1281
|
+
if (!hook) {
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
return executeSafe(
|
|
1285
|
+
() => hook({
|
|
1286
|
+
resolveInfo,
|
|
1287
|
+
context: exeContext.contextValue
|
|
1288
|
+
}),
|
|
1289
|
+
(result, rawError) => {
|
|
1290
|
+
if (rawError) {
|
|
1291
|
+
const error = toGraphQLError(
|
|
1292
|
+
rawError,
|
|
1293
|
+
resolveInfo.path,
|
|
1294
|
+
"Unexpected error in beforeFieldSubscribe hook"
|
|
1295
|
+
);
|
|
1296
|
+
exeContext.errors.push(error);
|
|
1297
|
+
return error;
|
|
1298
|
+
} else if (result instanceof Error) {
|
|
1299
|
+
const error = toGraphQLError(
|
|
1300
|
+
result,
|
|
1301
|
+
resolveInfo.path,
|
|
1302
|
+
"Unexpected error in beforeFieldSubscribe hook"
|
|
1303
|
+
);
|
|
1304
|
+
exeContext.errors.push(error);
|
|
1305
|
+
return error;
|
|
1306
|
+
}
|
|
1307
|
+
return result;
|
|
1308
|
+
}
|
|
1309
|
+
);
|
|
1310
|
+
}
|
|
1255
1311
|
function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
1256
1312
|
var _a;
|
|
1257
1313
|
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeFieldResolve;
|
|
@@ -1263,7 +1319,7 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1263
1319
|
resolveInfo,
|
|
1264
1320
|
context: exeContext.contextValue
|
|
1265
1321
|
}),
|
|
1266
|
-
(
|
|
1322
|
+
(result, rawError) => {
|
|
1267
1323
|
if (rawError) {
|
|
1268
1324
|
const error = toGraphQLError(
|
|
1269
1325
|
rawError,
|
|
@@ -1271,7 +1327,16 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1271
1327
|
"Unexpected error in beforeFieldResolve hook"
|
|
1272
1328
|
);
|
|
1273
1329
|
exeContext.errors.push(error);
|
|
1330
|
+
return error;
|
|
1331
|
+
} else if (result instanceof Error) {
|
|
1332
|
+
const error = toGraphQLError(
|
|
1333
|
+
result,
|
|
1334
|
+
resolveInfo.path,
|
|
1335
|
+
"Unexpected error in beforeFieldResolve hook"
|
|
1336
|
+
);
|
|
1337
|
+
exeContext.errors.push(error);
|
|
1274
1338
|
}
|
|
1339
|
+
return result;
|
|
1275
1340
|
}
|
|
1276
1341
|
);
|
|
1277
1342
|
}
|
|
@@ -1289,7 +1354,7 @@ function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, resul
|
|
|
1289
1354
|
result,
|
|
1290
1355
|
error
|
|
1291
1356
|
}),
|
|
1292
|
-
(
|
|
1357
|
+
(result2, rawError) => {
|
|
1293
1358
|
if (rawError) {
|
|
1294
1359
|
const error2 = toGraphQLError(
|
|
1295
1360
|
rawError,
|
|
@@ -1297,7 +1362,52 @@ function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, resul
|
|
|
1297
1362
|
"Unexpected error in afterFieldResolve hook"
|
|
1298
1363
|
);
|
|
1299
1364
|
exeContext.errors.push(error2);
|
|
1365
|
+
return error2;
|
|
1366
|
+
} else if (result2 instanceof Error) {
|
|
1367
|
+
const error2 = toGraphQLError(
|
|
1368
|
+
result2,
|
|
1369
|
+
resolveInfo.path,
|
|
1370
|
+
"Unexpected error in afterFieldResolve hook"
|
|
1371
|
+
);
|
|
1372
|
+
exeContext.errors.push(error2);
|
|
1373
|
+
}
|
|
1374
|
+
return result2;
|
|
1375
|
+
}
|
|
1376
|
+
);
|
|
1377
|
+
}
|
|
1378
|
+
function invokeAfterFieldSubscribeHook(resolveInfo, exeContext, hookContext, result, error) {
|
|
1379
|
+
var _a;
|
|
1380
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterFieldSubscribe;
|
|
1381
|
+
if (!hook) {
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1384
|
+
return executeSafe(
|
|
1385
|
+
() => hook({
|
|
1386
|
+
resolveInfo,
|
|
1387
|
+
context: exeContext.contextValue,
|
|
1388
|
+
hookContext,
|
|
1389
|
+
result,
|
|
1390
|
+
error
|
|
1391
|
+
}),
|
|
1392
|
+
(result2, rawError) => {
|
|
1393
|
+
if (rawError) {
|
|
1394
|
+
const error2 = toGraphQLError(
|
|
1395
|
+
rawError,
|
|
1396
|
+
resolveInfo.path,
|
|
1397
|
+
"Unexpected error in afterFieldSubscribe hook"
|
|
1398
|
+
);
|
|
1399
|
+
exeContext.errors.push(error2);
|
|
1400
|
+
return error2;
|
|
1401
|
+
} else if (result2 instanceof Error) {
|
|
1402
|
+
const error2 = toGraphQLError(
|
|
1403
|
+
result2,
|
|
1404
|
+
resolveInfo.path,
|
|
1405
|
+
"Unexpected error in afterFieldSubscribe hook"
|
|
1406
|
+
);
|
|
1407
|
+
exeContext.errors.push(error2);
|
|
1408
|
+
return error2;
|
|
1300
1409
|
}
|
|
1410
|
+
return result2;
|
|
1301
1411
|
}
|
|
1302
1412
|
);
|
|
1303
1413
|
}
|
|
@@ -1307,7 +1417,7 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
|
|
|
1307
1417
|
if (!hook) {
|
|
1308
1418
|
return;
|
|
1309
1419
|
}
|
|
1310
|
-
executeSafe(
|
|
1420
|
+
return executeSafe(
|
|
1311
1421
|
() => hook({
|
|
1312
1422
|
resolveInfo,
|
|
1313
1423
|
context: exeContext.contextValue,
|
|
@@ -1315,7 +1425,7 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
|
|
|
1315
1425
|
result,
|
|
1316
1426
|
error
|
|
1317
1427
|
}),
|
|
1318
|
-
(
|
|
1428
|
+
(result2, rawError) => {
|
|
1319
1429
|
if (rawError) {
|
|
1320
1430
|
const error2 = toGraphQLError(
|
|
1321
1431
|
rawError,
|
|
@@ -1323,7 +1433,16 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
|
|
|
1323
1433
|
"Unexpected error in afterFieldComplete hook"
|
|
1324
1434
|
);
|
|
1325
1435
|
exeContext.errors.push(error2);
|
|
1436
|
+
return error2;
|
|
1437
|
+
} else if (result2 instanceof Error) {
|
|
1438
|
+
const error2 = toGraphQLError(
|
|
1439
|
+
result2,
|
|
1440
|
+
resolveInfo.path,
|
|
1441
|
+
"Unexpected error in afterFieldComplete hook"
|
|
1442
|
+
);
|
|
1443
|
+
exeContext.errors.push(error2);
|
|
1326
1444
|
}
|
|
1445
|
+
return result2;
|
|
1327
1446
|
}
|
|
1328
1447
|
);
|
|
1329
1448
|
}
|
|
@@ -1338,8 +1457,16 @@ function invokeBeforeOperationExecuteHook(exeContext) {
|
|
|
1338
1457
|
context: exeContext.contextValue,
|
|
1339
1458
|
operation: exeContext.operation
|
|
1340
1459
|
}),
|
|
1341
|
-
(
|
|
1460
|
+
(result, rawError) => {
|
|
1342
1461
|
if (rawError) {
|
|
1462
|
+
const error = toGraphQLError(
|
|
1463
|
+
rawError,
|
|
1464
|
+
void 0,
|
|
1465
|
+
"Unexpected error in beforeOperationExecute hook"
|
|
1466
|
+
);
|
|
1467
|
+
throw error;
|
|
1468
|
+
}
|
|
1469
|
+
if (result instanceof Error) {
|
|
1343
1470
|
const error = toGraphQLError(
|
|
1344
1471
|
rawError,
|
|
1345
1472
|
void 0,
|
|
@@ -1347,6 +1474,7 @@ function invokeBeforeOperationExecuteHook(exeContext) {
|
|
|
1347
1474
|
);
|
|
1348
1475
|
exeContext.errors.push(error);
|
|
1349
1476
|
}
|
|
1477
|
+
return result;
|
|
1350
1478
|
}
|
|
1351
1479
|
);
|
|
1352
1480
|
}
|
|
@@ -1362,7 +1490,7 @@ function invokeBeforeSubscriptionEventEmitHook(exeContext, eventPayload) {
|
|
|
1362
1490
|
operation: exeContext.operation,
|
|
1363
1491
|
eventPayload
|
|
1364
1492
|
}),
|
|
1365
|
-
(
|
|
1493
|
+
(result, rawError) => {
|
|
1366
1494
|
if (rawError) {
|
|
1367
1495
|
const error = toGraphQLError(
|
|
1368
1496
|
rawError,
|
|
@@ -1370,7 +1498,16 @@ function invokeBeforeSubscriptionEventEmitHook(exeContext, eventPayload) {
|
|
|
1370
1498
|
"Unexpected error in beforeSubscriptionEventEmit hook"
|
|
1371
1499
|
);
|
|
1372
1500
|
exeContext.errors.push(error);
|
|
1501
|
+
return error;
|
|
1502
|
+
} else if (result instanceof Error) {
|
|
1503
|
+
const error = toGraphQLError(
|
|
1504
|
+
result,
|
|
1505
|
+
void 0,
|
|
1506
|
+
"Unexpected error in beforeSubscriptionEventEmit hook"
|
|
1507
|
+
);
|
|
1508
|
+
exeContext.errors.push(error);
|
|
1373
1509
|
}
|
|
1510
|
+
return result;
|
|
1374
1511
|
}
|
|
1375
1512
|
);
|
|
1376
1513
|
}
|
|
@@ -1405,20 +1542,14 @@ function executeSafe(execute, onComplete) {
|
|
|
1405
1542
|
result = execute();
|
|
1406
1543
|
} catch (e) {
|
|
1407
1544
|
error = e;
|
|
1408
|
-
} finally {
|
|
1409
|
-
if (!(0, import_isPromise.isPromise)(result)) {
|
|
1410
|
-
onComplete(result, error);
|
|
1411
|
-
}
|
|
1412
1545
|
}
|
|
1413
1546
|
if (!(0, import_isPromise.isPromise)(result)) {
|
|
1414
|
-
return result;
|
|
1547
|
+
return onComplete(result, error);
|
|
1415
1548
|
}
|
|
1416
1549
|
return result.then((hookResult) => {
|
|
1417
|
-
onComplete(hookResult, error);
|
|
1418
|
-
return hookResult;
|
|
1550
|
+
return onComplete(hookResult, error);
|
|
1419
1551
|
}).catch((e) => {
|
|
1420
|
-
onComplete(void 0, e);
|
|
1421
|
-
return void 0;
|
|
1552
|
+
return onComplete(void 0, e);
|
|
1422
1553
|
});
|
|
1423
1554
|
}
|
|
1424
1555
|
function toGraphQLError(originalError, path, prependMessage) {
|