@graphitation/supermassive 3.8.0-alpha.1 → 3.8.0-alpha.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/CHANGELOG.md CHANGED
@@ -1,16 +1,24 @@
1
1
  # Change Log - @graphitation/supermassive
2
2
 
3
- <!-- This log was last generated on Sun, 15 Dec 2024 19:04:27 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Tue, 17 Dec 2024 19:43:04 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 3.8.0-alpha.1
7
+ ## 3.8.0-alpha.3
8
8
 
9
- Sun, 15 Dec 2024 19:04:27 GMT
9
+ Tue, 17 Dec 2024 19:43:04 GMT
10
10
 
11
11
  ### Changes
12
12
 
13
- - Supermassive hook error handling modified (77059398+vejrj@users.noreply.github.com)
13
+ - subscribe hooks fixed (77059398+vejrj@users.noreply.github.com)
14
+
15
+ ## 3.7.2
16
+
17
+ Mon, 16 Dec 2024 15:39:40 GMT
18
+
19
+ ### Patches
20
+
21
+ - fix hook execution order when non-nullable field throws (dsamsonov@microsoft.com)
14
22
 
15
23
  ## 3.7.0
16
24
 
@@ -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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,WAAW,CAAC,CAEpD"}
@@ -295,10 +295,16 @@ function buildResponse(exeContext, data) {
295
295
  };
296
296
  } else {
297
297
  if (hooks == null ? void 0 : hooks.afterBuildResponse) {
298
- invokeAfterBuildResponseHook(exeContext, initialResult);
298
+ const hookResult = invokeAfterBuildResponseHook(
299
+ exeContext,
300
+ initialResult
301
+ );
299
302
  if (exeContext.errors.length > ((_b = (_a = initialResult.errors) == null ? void 0 : _a.length) != null ? _b : 0)) {
300
303
  initialResult.errors = exeContext.errors;
301
304
  }
305
+ if (hookResult instanceof import_graphql.GraphQLError) {
306
+ return { errors: initialResult.errors };
307
+ }
302
308
  }
303
309
  return initialResult;
304
310
  }
@@ -338,22 +344,31 @@ function executeFieldsSerially(exeContext, parentTypeName, sourceValue, path, gr
338
344
  function executeFields(exeContext, parentTypeName, sourceValue, path, groupedFieldSet, incrementalDataRecord) {
339
345
  const results = /* @__PURE__ */ Object.create(null);
340
346
  let containsPromise = false;
341
- for (const [responseName, fieldGroup] of groupedFieldSet) {
342
- const fieldPath = (0, import_Path.addPath)(path, responseName, parentTypeName);
343
- const result = executeField(
344
- exeContext,
345
- parentTypeName,
346
- sourceValue,
347
- fieldGroup,
348
- fieldPath,
349
- incrementalDataRecord
350
- );
351
- if (result !== void 0) {
352
- results[responseName] = result;
353
- if ((0, import_isPromise.isPromise)(result)) {
354
- containsPromise = true;
347
+ try {
348
+ for (const [responseName, fieldGroup] of groupedFieldSet) {
349
+ const fieldPath = (0, import_Path.addPath)(path, responseName, parentTypeName);
350
+ const result = executeField(
351
+ exeContext,
352
+ parentTypeName,
353
+ sourceValue,
354
+ fieldGroup,
355
+ fieldPath,
356
+ incrementalDataRecord
357
+ );
358
+ if (result !== void 0) {
359
+ results[responseName] = result;
360
+ if ((0, import_isPromise.isPromise)(result)) {
361
+ containsPromise = true;
362
+ }
355
363
  }
356
364
  }
365
+ } catch (error) {
366
+ if (containsPromise) {
367
+ return (0, import_promiseForObject.promiseForObject)(results).finally(() => {
368
+ throw error;
369
+ });
370
+ }
371
+ throw error;
357
372
  }
358
373
  if (!containsPromise) {
359
374
  return results;
@@ -478,23 +493,18 @@ function executeSubscriptionImpl(exeContext) {
478
493
  const hooks = exeContext.fieldExecutionHooks;
479
494
  let hookContext = void 0;
480
495
  try {
481
- const args = (0, import_values.getArgumentValues)(exeContext, fieldDef, fieldGroup[0]);
482
- const contextValue = exeContext.contextValue;
496
+ let result;
483
497
  if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.beforeFieldSubscribe)) {
484
498
  hookContext = invokeBeforeFieldSubscribeHook(info, exeContext);
485
499
  }
486
- let result;
500
+ const args = (0, import_values.getArgumentValues)(exeContext, fieldDef, fieldGroup[0]);
501
+ const contextValue = exeContext.contextValue;
487
502
  if (hookContext) {
488
503
  if ((0, import_isPromise.isPromise)(hookContext)) {
489
504
  result = hookContext.then((context) => {
490
505
  hookContext = context;
491
- if (hookContext instanceof import_graphql.GraphQLError) {
492
- return null;
493
- }
494
506
  return resolveFn(rootValue, args, contextValue, info);
495
507
  });
496
- } else if (hookContext instanceof import_graphql.GraphQLError) {
497
- result = null;
498
508
  }
499
509
  }
500
510
  if (result === void 0) {
@@ -509,42 +519,23 @@ function executeSubscriptionImpl(exeContext) {
509
519
  resolved,
510
520
  error
511
521
  );
512
- if (hookContext instanceof import_graphql.GraphQLError) {
513
- throw hookContext;
514
- }
515
522
  }
516
523
  };
517
524
  if ((0, import_isPromise.isPromise)(result)) {
518
- return result.then(assertEventStream).then(
519
- (resolved) => {
520
- if (resolved instanceof import_graphql.GraphQLError) {
521
- throw resolved;
522
- }
523
- if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldSubscribe)) {
524
- hookContext = invokeAfterFieldSubscribeHook(
525
- info,
526
- exeContext,
527
- hookContext,
528
- resolved
529
- );
530
- if (hookContext instanceof import_graphql.GraphQLError) {
531
- throw hookContext;
532
- }
533
- }
534
- return resolved;
535
- },
536
- (error) => {
537
- afterFieldSubscribeHandle(void 0, error);
538
- throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
539
- }
540
- );
525
+ return result.then(assertEventStream, (error) => {
526
+ afterFieldSubscribeHandle(void 0, error);
527
+ throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
528
+ }).then((resolved) => {
529
+ afterFieldSubscribeHandle(resolved);
530
+ return resolved;
531
+ });
541
532
  }
542
533
  const stream = assertEventStream(result);
543
534
  afterFieldSubscribeHandle(stream);
544
535
  return stream;
545
536
  } catch (error) {
546
537
  if (!isDefaultResolverUsed && (hooks == null ? void 0 : hooks.afterFieldSubscribe)) {
547
- hookContext = invokeAfterFieldSubscribeHook(
538
+ invokeAfterFieldSubscribeHook(
548
539
  info,
549
540
  exeContext,
550
541
  hookContext,
@@ -552,9 +543,6 @@ function executeSubscriptionImpl(exeContext) {
552
543
  error
553
544
  );
554
545
  }
555
- if (hookContext instanceof import_graphql.GraphQLError) {
556
- throw hookContext;
557
- }
558
546
  throw (0, import_graphql.locatedError)(error, fieldGroup, (0, import_Path.pathToArray)(path));
559
547
  }
560
548
  }
@@ -748,13 +736,10 @@ function resolveAndCompleteField(exeContext, parentTypeName, fieldDefinition, fi
748
736
  ),
749
737
  (rawError) => {
750
738
  const error = (0, import_graphql.locatedError)(rawError, fieldGroup, (0, import_Path.pathToArray)(path));
751
- const hookResult = handleAfterFieldHooks(
739
+ handleAfterFieldHooks(
752
740
  invokeAfterFieldCompleteHook,
753
741
  !!(hooks == null ? void 0 : hooks.afterFieldComplete)
754
742
  )(void 0, error);
755
- if (hookResult === null) {
756
- return null;
757
- }
758
743
  handleFieldError(
759
744
  rawError,
760
745
  exeContext,
@@ -1285,7 +1270,7 @@ function invokeBeforeFieldSubscribeHook(resolveInfo, exeContext) {
1285
1270
  "Unexpected error in beforeFieldSubscribe hook"
1286
1271
  );
1287
1272
  exeContext.errors.push(error);
1288
- return error;
1273
+ throw error;
1289
1274
  } else if (result instanceof Error) {
1290
1275
  const error = toGraphQLError(
1291
1276
  result,
@@ -1293,7 +1278,7 @@ function invokeBeforeFieldSubscribeHook(resolveInfo, exeContext) {
1293
1278
  "Unexpected error in beforeFieldSubscribe hook"
1294
1279
  );
1295
1280
  exeContext.errors.push(error);
1296
- return error;
1281
+ throw error;
1297
1282
  }
1298
1283
  return result;
1299
1284
  }
@@ -1388,7 +1373,7 @@ function invokeAfterFieldSubscribeHook(resolveInfo, exeContext, hookContext, res
1388
1373
  "Unexpected error in afterFieldSubscribe hook"
1389
1374
  );
1390
1375
  exeContext.errors.push(error2);
1391
- return error2;
1376
+ throw error2;
1392
1377
  } else if (result2 instanceof Error) {
1393
1378
  const error2 = toGraphQLError(
1394
1379
  result2,
@@ -1396,7 +1381,7 @@ function invokeAfterFieldSubscribeHook(resolveInfo, exeContext, hookContext, res
1396
1381
  "Unexpected error in afterFieldSubscribe hook"
1397
1382
  );
1398
1383
  exeContext.errors.push(error2);
1399
- return error2;
1384
+ throw error2;
1400
1385
  }
1401
1386
  return result2;
1402
1387
  }
@@ -1459,7 +1444,7 @@ function invokeBeforeOperationExecuteHook(exeContext) {
1459
1444
  }
1460
1445
  if (result instanceof Error) {
1461
1446
  const error = toGraphQLError(
1462
- rawError,
1447
+ result,
1463
1448
  void 0,
1464
1449
  "Unexpected error in beforeOperationExecute hook"
1465
1450
  );
@@ -1514,7 +1499,7 @@ function invokeAfterBuildResponseHook(exeContext, result) {
1514
1499
  operation: exeContext.operation,
1515
1500
  result
1516
1501
  }),
1517
- (_, rawError) => {
1502
+ (result2, rawError) => {
1518
1503
  if (rawError) {
1519
1504
  const error = toGraphQLError(
1520
1505
  rawError,
@@ -1522,6 +1507,14 @@ function invokeAfterBuildResponseHook(exeContext, result) {
1522
1507
  "Unexpected error in afterBuildResponse hook"
1523
1508
  );
1524
1509
  exeContext.errors.push(error);
1510
+ return error;
1511
+ } else if (result2 instanceof Error) {
1512
+ const error = toGraphQLError(
1513
+ result2,
1514
+ void 0,
1515
+ "Unexpected error in afterBuildResponse hook"
1516
+ );
1517
+ exeContext.errors.push(error);
1525
1518
  }
1526
1519
  }
1527
1520
  );