@graphitation/supermassive 3.4.1 → 3.5.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/executeWithoutSchema.d.ts +1 -1
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +57 -39
- package/lib/executeWithoutSchema.js.map +2 -2
- package/lib/executeWithoutSchema.mjs +57 -39
- package/lib/executeWithoutSchema.mjs.map +2 -2
- package/lib/hooks/types.d.ts +25 -18
- package/lib/hooks/types.d.ts.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +2 -2
- package/lib/index.mjs +6 -0
- package/lib/index.mjs.map +2 -2
- package/package.json +1 -1
|
@@ -538,41 +538,36 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
538
538
|
);
|
|
539
539
|
const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver;
|
|
540
540
|
const hooks = exeContext.fieldExecutionHooks;
|
|
541
|
+
let hookContext = void 0;
|
|
541
542
|
try {
|
|
542
543
|
const args = getArgumentValues(exeContext, fieldDefinition, fieldGroup[0]);
|
|
543
544
|
const contextValue = exeContext.contextValue;
|
|
544
545
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldResolve)) {
|
|
545
|
-
invokeBeforeFieldResolveHook(info, exeContext);
|
|
546
|
+
hookContext = invokeBeforeFieldResolveHook(info, exeContext);
|
|
546
547
|
}
|
|
547
548
|
const result = resolveFn(source, args, contextValue, info);
|
|
549
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
550
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
551
|
+
info,
|
|
552
|
+
exeContext,
|
|
553
|
+
hookContext,
|
|
554
|
+
result
|
|
555
|
+
);
|
|
556
|
+
}
|
|
548
557
|
let completed;
|
|
549
558
|
if (isPromise(result)) {
|
|
550
|
-
completed = result.then(
|
|
551
|
-
(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
resolved,
|
|
562
|
-
incrementalDataRecord
|
|
563
|
-
);
|
|
564
|
-
},
|
|
565
|
-
(rawError) => {
|
|
566
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
567
|
-
invokeAfterFieldResolveHook(info, exeContext, void 0, rawError);
|
|
568
|
-
}
|
|
569
|
-
throw rawError;
|
|
570
|
-
}
|
|
571
|
-
);
|
|
559
|
+
completed = result.then((resolved) => {
|
|
560
|
+
return completeValue(
|
|
561
|
+
exeContext,
|
|
562
|
+
returnTypeRef,
|
|
563
|
+
fieldGroup,
|
|
564
|
+
info,
|
|
565
|
+
path,
|
|
566
|
+
resolved,
|
|
567
|
+
incrementalDataRecord
|
|
568
|
+
);
|
|
569
|
+
});
|
|
572
570
|
} else {
|
|
573
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
574
|
-
invokeAfterFieldResolveHook(info, exeContext, result);
|
|
575
|
-
}
|
|
576
571
|
completed = completeValue(
|
|
577
572
|
exeContext,
|
|
578
573
|
returnTypeRef,
|
|
@@ -587,14 +582,25 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
587
582
|
return completed.then(
|
|
588
583
|
(resolved) => {
|
|
589
584
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
590
|
-
invokeAfterFieldCompleteHook(
|
|
585
|
+
invokeAfterFieldCompleteHook(
|
|
586
|
+
info,
|
|
587
|
+
exeContext,
|
|
588
|
+
hookContext,
|
|
589
|
+
resolved
|
|
590
|
+
);
|
|
591
591
|
}
|
|
592
592
|
return resolved;
|
|
593
593
|
},
|
|
594
594
|
(rawError) => {
|
|
595
595
|
const error = locatedError(rawError, fieldGroup, pathToArray(path));
|
|
596
596
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
597
|
-
invokeAfterFieldCompleteHook(
|
|
597
|
+
invokeAfterFieldCompleteHook(
|
|
598
|
+
info,
|
|
599
|
+
exeContext,
|
|
600
|
+
hookContext,
|
|
601
|
+
void 0,
|
|
602
|
+
error
|
|
603
|
+
);
|
|
598
604
|
}
|
|
599
605
|
handleFieldError(
|
|
600
606
|
rawError,
|
|
@@ -609,17 +615,28 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
609
615
|
);
|
|
610
616
|
}
|
|
611
617
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
612
|
-
invokeAfterFieldCompleteHook(info, exeContext, completed);
|
|
618
|
+
invokeAfterFieldCompleteHook(info, exeContext, hookContext, completed);
|
|
613
619
|
}
|
|
614
620
|
return completed;
|
|
615
621
|
} catch (rawError) {
|
|
616
622
|
const pathArray = pathToArray(path);
|
|
617
623
|
const error = locatedError(rawError, fieldGroup, pathArray);
|
|
618
624
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve) && error.path && arraysAreEqual(pathArray, error.path)) {
|
|
619
|
-
invokeAfterFieldResolveHook(
|
|
625
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
626
|
+
info,
|
|
627
|
+
exeContext,
|
|
628
|
+
hookContext,
|
|
629
|
+
void 0
|
|
630
|
+
);
|
|
620
631
|
}
|
|
621
632
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
622
|
-
invokeAfterFieldCompleteHook(
|
|
633
|
+
invokeAfterFieldCompleteHook(
|
|
634
|
+
info,
|
|
635
|
+
exeContext,
|
|
636
|
+
hookContext,
|
|
637
|
+
void 0,
|
|
638
|
+
error
|
|
639
|
+
);
|
|
623
640
|
}
|
|
624
641
|
handleFieldError(
|
|
625
642
|
rawError,
|
|
@@ -1098,7 +1115,7 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1098
1115
|
if (!hook) {
|
|
1099
1116
|
return;
|
|
1100
1117
|
}
|
|
1101
|
-
executeSafe(
|
|
1118
|
+
return executeSafe(
|
|
1102
1119
|
() => hook({
|
|
1103
1120
|
resolveInfo,
|
|
1104
1121
|
context: exeContext.contextValue
|
|
@@ -1115,32 +1132,32 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1115
1132
|
}
|
|
1116
1133
|
);
|
|
1117
1134
|
}
|
|
1118
|
-
function invokeAfterFieldResolveHook(resolveInfo, exeContext,
|
|
1135
|
+
function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, result) {
|
|
1119
1136
|
var _a;
|
|
1120
1137
|
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterFieldResolve;
|
|
1121
1138
|
if (!hook) {
|
|
1122
1139
|
return;
|
|
1123
1140
|
}
|
|
1124
|
-
executeSafe(
|
|
1141
|
+
return executeSafe(
|
|
1125
1142
|
() => hook({
|
|
1126
1143
|
resolveInfo,
|
|
1127
1144
|
context: exeContext.contextValue,
|
|
1128
|
-
|
|
1129
|
-
|
|
1145
|
+
hookContext,
|
|
1146
|
+
result
|
|
1130
1147
|
}),
|
|
1131
1148
|
(_, rawError) => {
|
|
1132
1149
|
if (rawError) {
|
|
1133
|
-
const
|
|
1150
|
+
const error = toGraphQLError(
|
|
1134
1151
|
rawError,
|
|
1135
1152
|
resolveInfo.path,
|
|
1136
1153
|
"Unexpected error in afterFieldResolve hook"
|
|
1137
1154
|
);
|
|
1138
|
-
exeContext.errors.push(
|
|
1155
|
+
exeContext.errors.push(error);
|
|
1139
1156
|
}
|
|
1140
1157
|
}
|
|
1141
1158
|
);
|
|
1142
1159
|
}
|
|
1143
|
-
function invokeAfterFieldCompleteHook(resolveInfo, exeContext, result, error) {
|
|
1160
|
+
function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, result, error) {
|
|
1144
1161
|
var _a;
|
|
1145
1162
|
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterFieldComplete;
|
|
1146
1163
|
if (!hook) {
|
|
@@ -1150,6 +1167,7 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, result, error) {
|
|
|
1150
1167
|
() => hook({
|
|
1151
1168
|
resolveInfo,
|
|
1152
1169
|
context: exeContext.contextValue,
|
|
1170
|
+
hookContext,
|
|
1153
1171
|
result,
|
|
1154
1172
|
error
|
|
1155
1173
|
}),
|