@envelop/core 2.1.0-alpha-4ba70ab.0 → 2.1.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.
Files changed (3) hide show
  1. package/index.js +10 -12
  2. package/index.mjs +10 -12
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -635,14 +635,12 @@ function createEnvelopOrchestrator(plugins) {
635
635
  const afterCalls = [];
636
636
  let context = args.contextValue || {};
637
637
  for (const onExecute of beforeCallbacks.execute) {
638
- let stopCalled = false;
639
638
  const after = await onExecute({
640
639
  executeFn,
641
640
  setExecuteFn: newExecuteFn => {
642
641
  executeFn = newExecuteFn;
643
642
  },
644
643
  setResultAndStopExecution: stopResult => {
645
- stopCalled = true;
646
644
  result = stopResult;
647
645
  },
648
646
  extendContext: extension => {
@@ -658,22 +656,22 @@ function createEnvelopOrchestrator(plugins) {
658
656
  },
659
657
  args: args,
660
658
  });
661
- if (stopCalled) {
662
- return result;
659
+ if (after === null || after === void 0 ? void 0 : after.onExecuteDone) {
660
+ afterCalls.push(after.onExecuteDone);
663
661
  }
664
- if (after) {
665
- if (after.onExecuteDone) {
666
- afterCalls.push(after.onExecuteDone);
667
- }
662
+ if (result !== undefined) {
663
+ break;
668
664
  }
669
665
  }
670
666
  if (onResolversHandlers.length) {
671
667
  context[resolversHooksSymbol] = onResolversHandlers;
672
668
  }
673
- result = (await executeFn({
674
- ...args,
675
- contextValue: context,
676
- }));
669
+ if (result === undefined) {
670
+ result = (await executeFn({
671
+ ...args,
672
+ contextValue: context,
673
+ }));
674
+ }
677
675
  const onNextHandler = [];
678
676
  const onEndHandler = [];
679
677
  for (const afterCb of afterCalls) {
package/index.mjs CHANGED
@@ -631,14 +631,12 @@ function createEnvelopOrchestrator(plugins) {
631
631
  const afterCalls = [];
632
632
  let context = args.contextValue || {};
633
633
  for (const onExecute of beforeCallbacks.execute) {
634
- let stopCalled = false;
635
634
  const after = await onExecute({
636
635
  executeFn,
637
636
  setExecuteFn: newExecuteFn => {
638
637
  executeFn = newExecuteFn;
639
638
  },
640
639
  setResultAndStopExecution: stopResult => {
641
- stopCalled = true;
642
640
  result = stopResult;
643
641
  },
644
642
  extendContext: extension => {
@@ -654,22 +652,22 @@ function createEnvelopOrchestrator(plugins) {
654
652
  },
655
653
  args: args,
656
654
  });
657
- if (stopCalled) {
658
- return result;
655
+ if (after === null || after === void 0 ? void 0 : after.onExecuteDone) {
656
+ afterCalls.push(after.onExecuteDone);
659
657
  }
660
- if (after) {
661
- if (after.onExecuteDone) {
662
- afterCalls.push(after.onExecuteDone);
663
- }
658
+ if (result !== undefined) {
659
+ break;
664
660
  }
665
661
  }
666
662
  if (onResolversHandlers.length) {
667
663
  context[resolversHooksSymbol] = onResolversHandlers;
668
664
  }
669
- result = (await executeFn({
670
- ...args,
671
- contextValue: context,
672
- }));
665
+ if (result === undefined) {
666
+ result = (await executeFn({
667
+ ...args,
668
+ contextValue: context,
669
+ }));
670
+ }
673
671
  const onNextHandler = [];
674
672
  const onEndHandler = [];
675
673
  for (const afterCb of afterCalls) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "2.1.0-alpha-4ba70ab.0",
3
+ "version": "2.1.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"