@graphitation/supermassive 3.5.1 → 3.5.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/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @graphitation/supermassive
2
2
 
3
- This log was last generated on Fri, 14 Jun 2024 18:43:34 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 03 Jul 2024 17:33:29 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 3.5.2
8
+
9
+ Wed, 03 Jul 2024 17:33:29 GMT
10
+
11
+ ### Patches
12
+
13
+ - Introduce new execution hooks: beforeOperationExecute, beforeSubscriptionEvent and afterBuildResponse (sergeystoyan@microsoft.com)
14
+
7
15
  ## 3.5.1
8
16
 
9
- Fri, 14 Jun 2024 18:43:34 GMT
17
+ Fri, 14 Jun 2024 18:43:53 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,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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qBAAqB,GAAG,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"}
@@ -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) {
@@ -452,17 +464,63 @@ function executeSubscriptionImpl(exeContext) {
452
464
  (0, import_reference.typeNameFromReference)(returnTypeRef),
453
465
  path
454
466
  );
467
+ const isDefaultResolverUsed = resolveFn === exeContext.subscribeFieldResolver;
468
+ const hooks = exeContext.fieldExecutionHooks;
469
+ let hookContext = void 0;
455
470
  try {
456
471
  const args = (0, import_values.getArgumentValues)(exeContext, fieldDef, fieldGroup[0]);
457
472
  const contextValue = exeContext.contextValue;
473
+ if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldResolve)) {
474
+ hookContext = invokeBeforeFieldResolveHook(info, exeContext);
475
+ }
458
476
  const result = resolveFn(rootValue, args, contextValue, info);
459
477
  if ((0, import_isPromise.isPromise)(result)) {
460
- return result.then(assertEventStream).then(void 0, (error) => {
461
- throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
462
- });
478
+ return result.then(assertEventStream).then(
479
+ (resolved) => {
480
+ if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
481
+ hookContext = invokeAfterFieldResolveHook(
482
+ info,
483
+ exeContext,
484
+ hookContext,
485
+ resolved
486
+ );
487
+ }
488
+ return resolved;
489
+ },
490
+ (error) => {
491
+ if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
492
+ hookContext = invokeAfterFieldResolveHook(
493
+ info,
494
+ exeContext,
495
+ hookContext,
496
+ void 0,
497
+ error
498
+ );
499
+ }
500
+ throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
501
+ }
502
+ );
503
+ }
504
+ const stream = assertEventStream(result);
505
+ if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
506
+ hookContext = invokeAfterFieldResolveHook(
507
+ info,
508
+ exeContext,
509
+ hookContext,
510
+ stream
511
+ );
463
512
  }
464
- return assertEventStream(result);
513
+ return stream;
465
514
  } catch (error) {
515
+ if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldResolve)) {
516
+ hookContext = invokeAfterFieldResolveHook(
517
+ info,
518
+ exeContext,
519
+ hookContext,
520
+ void 0,
521
+ error
522
+ );
523
+ }
466
524
  throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
467
525
  }
468
526
  }
@@ -498,6 +556,10 @@ function mapResultOrEventStreamOrPromise(resultOrStreamOrPromise, exeContext, pa
498
556
  exeContext,
499
557
  payload
500
558
  );
559
+ const hooks = exeContext == null ? void 0 : exeContext.fieldExecutionHooks;
560
+ if (hooks == null ? void 0 : hooks.beforeSubscriptionEventEmit) {
561
+ invokeBeforeSubscriptionEventEmitHook(perEventContext, payload);
562
+ }
501
563
  try {
502
564
  const data = executeFields(
503
565
  exeContext,
@@ -1227,6 +1289,77 @@ function invokeAfterFieldCompleteHook(resolveInfo, exeContext, hookContext, resu
1227
1289
  }
1228
1290
  );
1229
1291
  }
1292
+ function invokeBeforeOperationExecuteHook(exeContext) {
1293
+ var _a;
1294
+ const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeOperationExecute;
1295
+ if (!hook) {
1296
+ return;
1297
+ }
1298
+ return executeSafe(
1299
+ () => hook({
1300
+ context: exeContext.contextValue,
1301
+ operation: exeContext.operation
1302
+ }),
1303
+ (_, rawError) => {
1304
+ if (rawError) {
1305
+ const error = toGraphQLError(
1306
+ rawError,
1307
+ void 0,
1308
+ "Unexpected error in beforeOperationExecute hook"
1309
+ );
1310
+ exeContext.errors.push(error);
1311
+ }
1312
+ }
1313
+ );
1314
+ }
1315
+ function invokeBeforeSubscriptionEventEmitHook(exeContext, eventPayload) {
1316
+ var _a;
1317
+ const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.beforeSubscriptionEventEmit;
1318
+ if (!hook) {
1319
+ return;
1320
+ }
1321
+ return executeSafe(
1322
+ () => hook({
1323
+ context: exeContext.contextValue,
1324
+ operation: exeContext.operation,
1325
+ eventPayload
1326
+ }),
1327
+ (_, rawError) => {
1328
+ if (rawError) {
1329
+ const error = toGraphQLError(
1330
+ rawError,
1331
+ void 0,
1332
+ "Unexpected error in beforeSubscriptionEventEmit hook"
1333
+ );
1334
+ exeContext.errors.push(error);
1335
+ }
1336
+ }
1337
+ );
1338
+ }
1339
+ function invokeAfterBuildResponseHook(exeContext, result) {
1340
+ var _a;
1341
+ const hook = (_a = exeContext.fieldExecutionHooks) == null ? void 0 : _a.afterBuildResponse;
1342
+ if (!hook) {
1343
+ return;
1344
+ }
1345
+ return executeSafe(
1346
+ () => hook({
1347
+ context: exeContext.contextValue,
1348
+ operation: exeContext.operation,
1349
+ result
1350
+ }),
1351
+ (_, rawError) => {
1352
+ if (rawError) {
1353
+ const error = toGraphQLError(
1354
+ rawError,
1355
+ void 0,
1356
+ "Unexpected error in afterBuildResponse hook"
1357
+ );
1358
+ exeContext.errors.push(error);
1359
+ }
1360
+ }
1361
+ );
1362
+ }
1230
1363
  function executeSafe(execute, onComplete) {
1231
1364
  let error;
1232
1365
  let result;
@@ -1242,7 +1375,7 @@ function executeSafe(execute, onComplete) {
1242
1375
  function toGraphQLError(originalError, path, prependMessage) {
1243
1376
  const originalMessage = originalError instanceof Error ? originalError.message : (0, import_inspect.inspect)(originalError);
1244
1377
  const error = new Error(`${prependMessage}: ${originalMessage}`);
1245
- return (0, import_graphql.locatedError)(error, void 0, (0, import_Path.pathToArray)(path));
1378
+ return (0, import_graphql.locatedError)(error, void 0, path ? (0, import_Path.pathToArray)(path) : void 0);
1246
1379
  }
1247
1380
  const defaultTypeResolver = function(value) {
1248
1381
  if ((0, import_isObjectLike.isObjectLike)(value) && typeof value.__typename === "string") {