@envelop/core 2.2.0 → 2.3.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 +3 -1
  2. package/index.mjs +3 -1
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -486,8 +486,9 @@ function createEnvelopOrchestrator(plugins) {
486
486
  const customContextFactory = beforeCallbacks.context.length
487
487
  ? initialContext => async (orchestratorCtx) => {
488
488
  const afterCalls = [];
489
+ // In order to have access to the "last working" context object we keep this outside of the try block:
490
+ let context = orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext;
489
491
  try {
490
- let context = orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext;
491
492
  let isBreakingContextBuilding = false;
492
493
  for (const onContext of beforeCallbacks.context) {
493
494
  const afterHookResult = await onContext({
@@ -520,6 +521,7 @@ function createEnvelopOrchestrator(plugins) {
520
521
  let error = err;
521
522
  for (const errorCb of contextErrorHandlers) {
522
523
  errorCb({
524
+ context,
523
525
  error,
524
526
  setError: err => {
525
527
  error = err;
package/index.mjs CHANGED
@@ -482,8 +482,9 @@ function createEnvelopOrchestrator(plugins) {
482
482
  const customContextFactory = beforeCallbacks.context.length
483
483
  ? initialContext => async (orchestratorCtx) => {
484
484
  const afterCalls = [];
485
+ // In order to have access to the "last working" context object we keep this outside of the try block:
486
+ let context = orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext;
485
487
  try {
486
- let context = orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext;
487
488
  let isBreakingContextBuilding = false;
488
489
  for (const onContext of beforeCallbacks.context) {
489
490
  const afterHookResult = await onContext({
@@ -516,6 +517,7 @@ function createEnvelopOrchestrator(plugins) {
516
517
  let error = err;
517
518
  for (const errorCb of contextErrorHandlers) {
518
519
  errorCb({
520
+ context,
519
521
  error,
520
522
  setError: err => {
521
523
  error = err;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
7
7
  },
8
8
  "dependencies": {
9
- "@envelop/types": "2.1.0"
9
+ "@envelop/types": "2.2.0"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",