@envelop/core 1.7.1 → 1.8.0-alpha-25d99ca.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.
- package/index.js +7 -0
- package/index.mjs +7 -0
- package/package.json +2 -2
- package/plugins/use-immediate-introspection.d.ts +6 -0
package/index.js
CHANGED
|
@@ -477,16 +477,23 @@ function createEnvelopOrchestrator(plugins) {
|
|
|
477
477
|
const afterCalls = [];
|
|
478
478
|
try {
|
|
479
479
|
let context = orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext;
|
|
480
|
+
let isBreakingContextBuilding = false;
|
|
480
481
|
for (const onContext of beforeCallbacks.context) {
|
|
481
482
|
const afterHookResult = await onContext({
|
|
482
483
|
context,
|
|
483
484
|
extendContext: extension => {
|
|
484
485
|
context = { ...context, ...extension };
|
|
485
486
|
},
|
|
487
|
+
breakContextBuilding: () => {
|
|
488
|
+
isBreakingContextBuilding = true;
|
|
489
|
+
},
|
|
486
490
|
});
|
|
487
491
|
if (typeof afterHookResult === 'function') {
|
|
488
492
|
afterCalls.push(afterHookResult);
|
|
489
493
|
}
|
|
494
|
+
if (isBreakingContextBuilding === true) {
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
490
497
|
}
|
|
491
498
|
for (const afterCb of afterCalls) {
|
|
492
499
|
afterCb({
|
package/index.mjs
CHANGED
|
@@ -473,16 +473,23 @@ function createEnvelopOrchestrator(plugins) {
|
|
|
473
473
|
const afterCalls = [];
|
|
474
474
|
try {
|
|
475
475
|
let context = orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext;
|
|
476
|
+
let isBreakingContextBuilding = false;
|
|
476
477
|
for (const onContext of beforeCallbacks.context) {
|
|
477
478
|
const afterHookResult = await onContext({
|
|
478
479
|
context,
|
|
479
480
|
extendContext: extension => {
|
|
480
481
|
context = { ...context, ...extension };
|
|
481
482
|
},
|
|
483
|
+
breakContextBuilding: () => {
|
|
484
|
+
isBreakingContextBuilding = true;
|
|
485
|
+
},
|
|
482
486
|
});
|
|
483
487
|
if (typeof afterHookResult === 'function') {
|
|
484
488
|
afterCalls.push(afterHookResult);
|
|
485
489
|
}
|
|
490
|
+
if (isBreakingContextBuilding === true) {
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
486
493
|
}
|
|
487
494
|
for (const afterCb of afterCalls) {
|
|
488
495
|
afterCb({
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-alpha-25d99ca.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": "1.
|
|
9
|
+
"@envelop/types": "1.6.0-alpha-25d99ca.0"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Plugin } from '@envelop/types';
|
|
2
|
+
/**
|
|
3
|
+
* In case a GraphQL operation only contains introspection fields the context building can be skipped completely.
|
|
4
|
+
* With this plugin any further context extensions will be skipped.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useImmediateIntrospection: () => Plugin;
|