@envelop/core 2.0.0 → 2.0.1-alpha-ea62296.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
@@ -626,14 +626,12 @@ function createEnvelopOrchestrator(plugins) {
626
626
  const afterCalls = [];
627
627
  let context = args.contextValue || {};
628
628
  for (const onExecute of beforeCallbacks.execute) {
629
- let stopCalled = false;
630
629
  const after = await onExecute({
631
630
  executeFn,
632
631
  setExecuteFn: newExecuteFn => {
633
632
  executeFn = newExecuteFn;
634
633
  },
635
634
  setResultAndStopExecution: stopResult => {
636
- stopCalled = true;
637
635
  result = stopResult;
638
636
  },
639
637
  extendContext: extension => {
@@ -649,22 +647,22 @@ function createEnvelopOrchestrator(plugins) {
649
647
  },
650
648
  args: args,
651
649
  });
652
- if (stopCalled) {
653
- return result;
650
+ if (after === null || after === void 0 ? void 0 : after.onExecuteDone) {
651
+ afterCalls.push(after.onExecuteDone);
654
652
  }
655
- if (after) {
656
- if (after.onExecuteDone) {
657
- afterCalls.push(after.onExecuteDone);
658
- }
653
+ if (result !== undefined) {
654
+ break;
659
655
  }
660
656
  }
661
657
  if (onResolversHandlers.length) {
662
658
  context[resolversHooksSymbol] = onResolversHandlers;
663
659
  }
664
- result = (await executeFn({
665
- ...args,
666
- contextValue: context,
667
- }));
660
+ if (result === undefined) {
661
+ result = (await executeFn({
662
+ ...args,
663
+ contextValue: context,
664
+ }));
665
+ }
668
666
  const onNextHandler = [];
669
667
  const onEndHandler = [];
670
668
  for (const afterCb of afterCalls) {
package/index.mjs CHANGED
@@ -622,14 +622,12 @@ function createEnvelopOrchestrator(plugins) {
622
622
  const afterCalls = [];
623
623
  let context = args.contextValue || {};
624
624
  for (const onExecute of beforeCallbacks.execute) {
625
- let stopCalled = false;
626
625
  const after = await onExecute({
627
626
  executeFn,
628
627
  setExecuteFn: newExecuteFn => {
629
628
  executeFn = newExecuteFn;
630
629
  },
631
630
  setResultAndStopExecution: stopResult => {
632
- stopCalled = true;
633
631
  result = stopResult;
634
632
  },
635
633
  extendContext: extension => {
@@ -645,22 +643,22 @@ function createEnvelopOrchestrator(plugins) {
645
643
  },
646
644
  args: args,
647
645
  });
648
- if (stopCalled) {
649
- return result;
646
+ if (after === null || after === void 0 ? void 0 : after.onExecuteDone) {
647
+ afterCalls.push(after.onExecuteDone);
650
648
  }
651
- if (after) {
652
- if (after.onExecuteDone) {
653
- afterCalls.push(after.onExecuteDone);
654
- }
649
+ if (result !== undefined) {
650
+ break;
655
651
  }
656
652
  }
657
653
  if (onResolversHandlers.length) {
658
654
  context[resolversHooksSymbol] = onResolversHandlers;
659
655
  }
660
- result = (await executeFn({
661
- ...args,
662
- contextValue: context,
663
- }));
656
+ if (result === undefined) {
657
+ result = (await executeFn({
658
+ ...args,
659
+ contextValue: context,
660
+ }));
661
+ }
664
662
  const onNextHandler = [];
665
663
  const onEndHandler = [];
666
664
  for (const afterCb of afterCalls) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.1-alpha-ea62296.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"