@graphitation/supermassive 3.5.1 → 3.5.3
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/__testUtils__/execute.d.ts.map +1 -1
- package/lib/benchmarks/swapi-schema/makeExecutableSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.d.ts.map +1 -1
- package/lib/executeWithoutSchema.js +141 -5
- package/lib/executeWithoutSchema.js.map +2 -2
- package/lib/executeWithoutSchema.mjs +141 -5
- package/lib/executeWithoutSchema.mjs.map +2 -2
- package/lib/hooks/types.d.ts +23 -1
- package/lib/hooks/types.d.ts.map +1 -1
- package/lib/hooks/types.js.map +1 -1
- package/package.json +2 -2
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 Mon, 14 Oct 2024 07:58:19 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.5.3
|
|
8
|
+
|
|
9
|
+
Mon, 14 Oct 2024 07:58:19 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump TS version to 5.5 (pavelglac@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 3.5.2
|
|
16
|
+
|
|
17
|
+
Wed, 03 Jul 2024 17:33:49 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- Introduce new execution hooks: beforeOperationExecute, beforeSubscriptionEvent and afterBuildResponse (sergeystoyan@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 3.5.1
|
|
8
24
|
|
|
9
|
-
Fri, 14 Jun 2024 18:43:
|
|
25
|
+
Fri, 14 Jun 2024 18:43:53 GMT
|
|
10
26
|
|
|
11
27
|
### Patches
|
|
12
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/__testUtils__/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAIb,aAAa,EACb,aAAa,IAAI,oBAAoB,EACrC,eAAe,IAAI,sBAAsB,EAC1C,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,eAAe,EAAiB,MAAM,UAAU,CAAC;AAI1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,KAAK,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IACrE,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,GAC1C,cAAc,CAAC,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE3E,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,cAAc,CAAC,eAAe,CAAC,EACxE,gBAAgB,EAAE,CAChB,IAAI,EAAE,aAAa,KAChB,cAAc,CAAC,qBAAqB,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;oEAkCnE,aAAa,SACd,MAAM,cACF,
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/__testUtils__/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAIb,aAAa,EACb,aAAa,IAAI,oBAAoB,EACrC,eAAe,IAAI,sBAAsB,EAC1C,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,eAAe,EAAiB,MAAM,UAAU,CAAC;AAI1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,KAAK,aAAa,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IACrE,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,GAC1C,cAAc,CAAC,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE3E,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,cAAc,CAAC,eAAe,CAAC,EACxE,gBAAgB,EAAE,CAChB,IAAI,EAAE,aAAa,KAChB,cAAc,CAAC,qBAAqB,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;oEAkCnE,aAAa,SACd,MAAM,cACF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;iDAjC1B,aAAa,SACd,MAAM,cACD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;6BAkG3B,eAAe,GAAG,aAAa,KACtC,OAAO,CAAC,OAAO,CAAC;sCAhCX,oBAAoB,KACzB,cAAc,CAAC,aAAa,CAAC;EA8DjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeExecutableSchema.d.ts","sourceRoot":"","sources":["../../../src/benchmarks/swapi-schema/makeExecutableSchema.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EA6BZ,aAAa,EAoBd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,eAAO,MAAM,oBAAoB;
|
|
1
|
+
{"version":3,"file":"makeExecutableSchema.d.ts","sourceRoot":"","sources":["../../../src/benchmarks/swapi-schema/makeExecutableSchema.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EA6BZ,aAAa,EAoBd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,eAAO,MAAM,oBAAoB,GAAI,OAAO,EAAE,QAAQ,4BAGnD;IACD,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E,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) {
|
|
@@ -424,6 +436,9 @@ function executeSubscriptionImpl(exeContext) {
|
|
|
424
436
|
const rootTypeName = getOperationRootTypeName(operation);
|
|
425
437
|
const { groupedFieldSet } = (0, import_collectFields.collectFields)(exeContext, rootTypeName);
|
|
426
438
|
const firstRootField = groupedFieldSet.entries().next().value;
|
|
439
|
+
if (firstRootField === void 0) {
|
|
440
|
+
throw (0, import_graphql.locatedError)("Must have at least one root field.", []);
|
|
441
|
+
}
|
|
427
442
|
const [responseName, fieldGroup] = firstRootField;
|
|
428
443
|
const fieldName = fieldGroup[0].name.value;
|
|
429
444
|
const fieldDef = Definitions.getField(
|
|
@@ -452,17 +467,63 @@ function executeSubscriptionImpl(exeContext) {
|
|
|
452
467
|
(0, import_reference.typeNameFromReference)(returnTypeRef),
|
|
453
468
|
path
|
|
454
469
|
);
|
|
470
|
+
const isDefaultResolverUsed = resolveFn === exeContext.subscribeFieldResolver;
|
|
471
|
+
const hooks = exeContext.fieldExecutionHooks;
|
|
472
|
+
let hookContext = void 0;
|
|
455
473
|
try {
|
|
456
474
|
const args = (0, import_values.getArgumentValues)(exeContext, fieldDef, fieldGroup[0]);
|
|
457
475
|
const contextValue = exeContext.contextValue;
|
|
476
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldResolve)) {
|
|
477
|
+
hookContext = invokeBeforeFieldResolveHook(info, exeContext);
|
|
478
|
+
}
|
|
458
479
|
const result = resolveFn(rootValue, args, contextValue, info);
|
|
459
480
|
if ((0, import_isPromise.isPromise)(result)) {
|
|
460
|
-
return result.then(assertEventStream).then(
|
|
461
|
-
|
|
462
|
-
|
|
481
|
+
return result.then(assertEventStream).then(
|
|
482
|
+
(resolved) => {
|
|
483
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
484
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
485
|
+
info,
|
|
486
|
+
exeContext,
|
|
487
|
+
hookContext,
|
|
488
|
+
resolved
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
return resolved;
|
|
492
|
+
},
|
|
493
|
+
(error) => {
|
|
494
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
495
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
496
|
+
info,
|
|
497
|
+
exeContext,
|
|
498
|
+
hookContext,
|
|
499
|
+
void 0,
|
|
500
|
+
error
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
const stream = assertEventStream(result);
|
|
508
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
509
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
510
|
+
info,
|
|
511
|
+
exeContext,
|
|
512
|
+
hookContext,
|
|
513
|
+
stream
|
|
514
|
+
);
|
|
463
515
|
}
|
|
464
|
-
return
|
|
516
|
+
return stream;
|
|
465
517
|
} catch (error) {
|
|
518
|
+
if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
|
|
519
|
+
hookContext = invokeAfterFieldResolveHook(
|
|
520
|
+
info,
|
|
521
|
+
exeContext,
|
|
522
|
+
hookContext,
|
|
523
|
+
void 0,
|
|
524
|
+
error
|
|
525
|
+
);
|
|
526
|
+
}
|
|
466
527
|
throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
|
|
467
528
|
}
|
|
468
529
|
}
|
|
@@ -498,6 +559,10 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
|
|
|
498
559
|
exeContext,
|
|
499
560
|
payload
|
|
500
561
|
);
|
|
562
|
+
const hooks = exeContext == null ? void 0 : exeContext.fieldExecutionHooks;
|
|
563
|
+
if (hooks == null ? void 0 : hooks.beforeSubscriptionEventEmit) {
|
|
564
|
+
invokeBeforeSubscriptionEventEmitHook(perEventContext, payload);
|
|
565
|
+
}
|
|
501
566
|
try {
|
|
502
567
|
const data = executeFields(
|
|
503
568
|
exeContext,
|
|
@@ -1227,6 +1292,77 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
|
|
|
1227
1292
|
}
|
|
1228
1293
|
);
|
|
1229
1294
|
}
|
|
1295
|
+
function invokeBeforeOperationExecuteHook(exeContext) {
|
|
1296
|
+
var _a;
|
|
1297
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeOperationExecute;
|
|
1298
|
+
if (!hook) {
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1301
|
+
return executeSafe(
|
|
1302
|
+
() => hook({
|
|
1303
|
+
context: exeContext.contextValue,
|
|
1304
|
+
operation: exeContext.operation
|
|
1305
|
+
}),
|
|
1306
|
+
(_, rawError) => {
|
|
1307
|
+
if (rawError) {
|
|
1308
|
+
const error = toGraphQLError(
|
|
1309
|
+
rawError,
|
|
1310
|
+
void 0,
|
|
1311
|
+
"Unexpected error in beforeOperationExecute hook"
|
|
1312
|
+
);
|
|
1313
|
+
exeContext.errors.push(error);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
function invokeBeforeSubscriptionEventEmitHook(exeContext, eventPayload) {
|
|
1319
|
+
var _a;
|
|
1320
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeSubscriptionEventEmit;
|
|
1321
|
+
if (!hook) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
return executeSafe(
|
|
1325
|
+
() => hook({
|
|
1326
|
+
context: exeContext.contextValue,
|
|
1327
|
+
operation: exeContext.operation,
|
|
1328
|
+
eventPayload
|
|
1329
|
+
}),
|
|
1330
|
+
(_, rawError) => {
|
|
1331
|
+
if (rawError) {
|
|
1332
|
+
const error = toGraphQLError(
|
|
1333
|
+
rawError,
|
|
1334
|
+
void 0,
|
|
1335
|
+
"Unexpected error in beforeSubscriptionEventEmit hook"
|
|
1336
|
+
);
|
|
1337
|
+
exeContext.errors.push(error);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
function invokeAfterBuildResponseHook(exeContext, result) {
|
|
1343
|
+
var _a;
|
|
1344
|
+
const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterBuildResponse;
|
|
1345
|
+
if (!hook) {
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
return executeSafe(
|
|
1349
|
+
() => hook({
|
|
1350
|
+
context: exeContext.contextValue,
|
|
1351
|
+
operation: exeContext.operation,
|
|
1352
|
+
result
|
|
1353
|
+
}),
|
|
1354
|
+
(_, rawError) => {
|
|
1355
|
+
if (rawError) {
|
|
1356
|
+
const error = toGraphQLError(
|
|
1357
|
+
rawError,
|
|
1358
|
+
void 0,
|
|
1359
|
+
"Unexpected error in afterBuildResponse hook"
|
|
1360
|
+
);
|
|
1361
|
+
exeContext.errors.push(error);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
);
|
|
1365
|
+
}
|
|
1230
1366
|
function executeSafe(execute, onComplete) {
|
|
1231
1367
|
let error;
|
|
1232
1368
|
let result;
|
|
@@ -1242,7 +1378,7 @@ function executeSafe(execute, onComplete) {
|
|
|
1242
1378
|
function toGraphQLError(originalError, path, prependMessage) {
|
|
1243
1379
|
const originalMessage = originalError instanceof Error ? originalError.message : (0, import_inspect.inspect)(originalError);
|
|
1244
1380
|
const error = new Error(`${prependMessage}: ${originalMessage}`);
|
|
1245
|
-
return (0, import_graphql.locatedError)(error, void 0, (0, import_Path.pathToArray)(path));
|
|
1381
|
+
return (0, import_graphql.locatedError)(error, void 0, path ? (0, import_Path.pathToArray)(path) : void 0);
|
|
1246
1382
|
}
|
|
1247
1383
|
const defaultTypeResolver = function(value) {
|
|
1248
1384
|
if ((0, import_isObjectLike.isObjectLike)(value) && typeof value.__typename === "string") {
|