@graphitation/supermassive 3.4.2 → 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 +9 -1
- 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
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 Thu, 07 Mar 2024 13:08:07 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.5.0
|
|
8
|
+
|
|
9
|
+
Thu, 07 Mar 2024 13:08:07 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Execution hooks context (sergeystoyan@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 3.4.1
|
|
8
16
|
|
|
9
17
|
Mon, 15 Jan 2024 17:31:26 GMT
|
|
@@ -5,7 +5,7 @@ import type { ObjMap } from "./jsutils/ObjMap";
|
|
|
5
5
|
import type { Path } from "./jsutils/Path";
|
|
6
6
|
import type { PromiseOrValue } from "./jsutils/PromiseOrValue";
|
|
7
7
|
import type { ExecutionWithoutSchemaArgs, FunctionFieldResolver, ResolveInfo, TypeResolver, ExecutionResult, TotalExecutionResult, IncrementalExecutionResult, SchemaFragment, SchemaFragmentLoader } from "./types";
|
|
8
|
-
import { ExecutionHooks } from "./hooks/types";
|
|
8
|
+
import type { ExecutionHooks } from "./hooks/types";
|
|
9
9
|
/**
|
|
10
10
|
* Terminology
|
|
11
11
|
*
|
|
@@ -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,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
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,EA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AC,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"}
|
|
@@ -558,41 +558,36 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
558
558
|
);
|
|
559
559
|
const isDefaultResolverUsed = resolveFn === exeContext.fieldResolver;
|
|
560
560
|
const hooks = exeContext.fieldExecutionHooks;
|
|
561
|
+
let hookContext = void 0;
|
|
561
562
|
try {
|
|
562
563
|
const args = (0, import_values.getArgumentValues)(exeContext, fieldDefinition, fieldGroup[0]);
|
|
563
564
|
const contextValue = exeContext.contextValue;
|
|
564
565
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldResolve)) {
|
|
565
|
-
invokeBeforeFieldResolveHook(info, exeContext);
|
|
566
|
+
hookContext = invokeBeforeFieldResolveHook(info, exeContext);
|
|
566
567
|
}
|
|
567
568
|
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
|
+
}
|
|
568
577
|
let completed;
|
|
569
578
|
if ((0, import_isPromise.isPromise)(result)) {
|
|
570
|
-
completed = result.then(
|
|
571
|
-
(
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
resolved,
|
|
582
|
-
incrementalDataRecord
|
|
583
|
-
);
|
|
584
|
-
},
|
|
585
|
-
(rawError) => {
|
|
586
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
587
|
-
invokeAfterFieldResolveHook(info, exeContext, void 0, rawError);
|
|
588
|
-
}
|
|
589
|
-
throw rawError;
|
|
590
|
-
}
|
|
591
|
-
);
|
|
579
|
+
completed = result.then((resolved) => {
|
|
580
|
+
return completeValue(
|
|
581
|
+
exeContext,
|
|
582
|
+
returnTypeRef,
|
|
583
|
+
fieldGroup,
|
|
584
|
+
info,
|
|
585
|
+
path,
|
|
586
|
+
resolved,
|
|
587
|
+
incrementalDataRecord
|
|
588
|
+
);
|
|
589
|
+
});
|
|
592
590
|
} else {
|
|
593
|
-
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
594
|
-
invokeAfterFieldResolveHook(info, exeContext, result);
|
|
595
|
-
}
|
|
596
591
|
completed = completeValue(
|
|
597
592
|
exeContext,
|
|
598
593
|
returnTypeRef,
|
|
@@ -607,14 +602,25 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
607
602
|
return completed.then(
|
|
608
603
|
(resolved) => {
|
|
609
604
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
610
|
-
invokeAfterFieldCompleteHook(
|
|
605
|
+
invokeAfterFieldCompleteHook(
|
|
606
|
+
info,
|
|
607
|
+
exeContext,
|
|
608
|
+
hookContext,
|
|
609
|
+
resolved
|
|
610
|
+
);
|
|
611
611
|
}
|
|
612
612
|
return resolved;
|
|
613
613
|
},
|
|
614
614
|
(rawError) => {
|
|
615
615
|
const error = (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
616
616
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
617
|
-
invokeAfterFieldCompleteHook(
|
|
617
|
+
invokeAfterFieldCompleteHook(
|
|
618
|
+
info,
|
|
619
|
+
exeContext,
|
|
620
|
+
hookContext,
|
|
621
|
+
void 0,
|
|
622
|
+
error
|
|
623
|
+
);
|
|
618
624
|
}
|
|
619
625
|
handleFieldError(
|
|
620
626
|
rawError,
|
|
@@ -629,17 +635,28 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
|
|
|
629
635
|
);
|
|
630
636
|
}
|
|
631
637
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
632
|
-
invokeAfterFieldCompleteHook(info, exeContext, completed);
|
|
638
|
+
invokeAfterFieldCompleteHook(info, exeContext, hookContext, completed);
|
|
633
639
|
}
|
|
634
640
|
return completed;
|
|
635
641
|
} catch (rawError) {
|
|
636
642
|
const pathArray = (0, import_Path.pathToArray)(path);
|
|
637
643
|
const error = (0, import_graphql.locatedError)(rawError, fieldGroup, pathArray);
|
|
638
644
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve) && error.path && (0, import_array.arraysAreEqual)(pathArray, error.path)) {
|
|
639
|
-
invokeAfterFieldResolveHook(
|
|
645
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
646
|
+
info,
|
|
647
|
+
exeContext,
|
|
648
|
+
hookContext,
|
|
649
|
+
void 0
|
|
650
|
+
);
|
|
640
651
|
}
|
|
641
652
|
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldComplete)) {
|
|
642
|
-
invokeAfterFieldCompleteHook(
|
|
653
|
+
invokeAfterFieldCompleteHook(
|
|
654
|
+
info,
|
|
655
|
+
exeContext,
|
|
656
|
+
hookContext,
|
|
657
|
+
void 0,
|
|
658
|
+
error
|
|
659
|
+
);
|
|
643
660
|
}
|
|
644
661
|
handleFieldError(
|
|
645
662
|
rawError,
|
|
@@ -1118,7 +1135,7 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1118
1135
|
if (!hook) {
|
|
1119
1136
|
return;
|
|
1120
1137
|
}
|
|
1121
|
-
executeSafe(
|
|
1138
|
+
return executeSafe(
|
|
1122
1139
|
() => hook({
|
|
1123
1140
|
resolveInfo,
|
|
1124
1141
|
context: exeContext.contextValue
|
|
@@ -1135,32 +1152,32 @@ function invokeBeforeFieldResolveHook(resolveInfo, exeContext) {
|
|
|
1135
1152
|
}
|
|
1136
1153
|
);
|
|
1137
1154
|
}
|
|
1138
|
-
function invokeAfterFieldResolveHook(resolveInfo, exeContext,
|
|
1155
|
+
function invokeAfterFieldResolveHook(resolveInfo, exeContext, hookContext, result) {
|
|
1139
1156
|
var _a;
|
|
1140
1157
|
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterFieldResolve;
|
|
1141
1158
|
if (!hook) {
|
|
1142
1159
|
return;
|
|
1143
1160
|
}
|
|
1144
|
-
executeSafe(
|
|
1161
|
+
return executeSafe(
|
|
1145
1162
|
() => hook({
|
|
1146
1163
|
resolveInfo,
|
|
1147
1164
|
context: exeContext.contextValue,
|
|
1148
|
-
|
|
1149
|
-
|
|
1165
|
+
hookContext,
|
|
1166
|
+
result
|
|
1150
1167
|
}),
|
|
1151
1168
|
(_, rawError) => {
|
|
1152
1169
|
if (rawError) {
|
|
1153
|
-
const
|
|
1170
|
+
const error = toGraphQLError(
|
|
1154
1171
|
rawError,
|
|
1155
1172
|
resolveInfo.path,
|
|
1156
1173
|
"Unexpected error in afterFieldResolve hook"
|
|
1157
1174
|
);
|
|
1158
|
-
exeContext.errors.push(
|
|
1175
|
+
exeContext.errors.push(error);
|
|
1159
1176
|
}
|
|
1160
1177
|
}
|
|
1161
1178
|
);
|
|
1162
1179
|
}
|
|
1163
|
-
function invokeAfterFieldCompleteHook(resolveInfo, exeContext, result, error) {
|
|
1180
|
+
function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, result, error) {
|
|
1164
1181
|
var _a;
|
|
1165
1182
|
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterFieldComplete;
|
|
1166
1183
|
if (!hook) {
|
|
@@ -1170,6 +1187,7 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, result, error) {
|
|
|
1170
1187
|
() => hook({
|
|
1171
1188
|
resolveInfo,
|
|
1172
1189
|
context: exeContext.contextValue,
|
|
1190
|
+
hookContext,
|
|
1173
1191
|
result,
|
|
1174
1192
|
error
|
|
1175
1193
|
}),
|