@envelop/core
Advanced tools
Comparing version 4.0.2-alpha-20230908154216-af1cec7c to 4.0.2-alpha-20230915095210-15c83003
@@ -196,6 +196,5 @@ "use strict"; | ||
// In order to have access to the "last working" context object we keep this outside of the try block: | ||
const context = initialContext; | ||
if (orchestratorCtx) { | ||
Object.assign(context, orchestratorCtx); | ||
} | ||
let context = orchestratorCtx | ||
? { ...initialContext, ...orchestratorCtx } | ||
: initialContext; | ||
try { | ||
@@ -207,3 +206,3 @@ let isBreakingContextBuilding = false; | ||
extendContext: extension => { | ||
Object.assign(context, extension); | ||
context = { ...context, ...extension }; | ||
}, | ||
@@ -225,3 +224,3 @@ breakContextBuilding: () => { | ||
extendContext: extension => { | ||
Object.assign(context, extension); | ||
context = { ...context, ...extension }; | ||
}, | ||
@@ -246,8 +245,3 @@ }); | ||
} | ||
: initialContext => orchestratorCtx => { | ||
if (orchestratorCtx) { | ||
Object.assign(initialContext, orchestratorCtx); | ||
} | ||
return initialContext; | ||
}; | ||
: initialContext => orchestratorCtx => orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext; | ||
const useCustomSubscribe = beforeCallbacks.subscribe.length; | ||
@@ -259,3 +253,3 @@ const customSubscribe = useCustomSubscribe | ||
const subscribeErrorHandlers = []; | ||
const context = args.contextValue || {}; | ||
let context = args.contextValue || {}; | ||
let result; | ||
@@ -269,3 +263,3 @@ for (const onSubscribe of beforeCallbacks.subscribe) { | ||
extendContext: extension => { | ||
Object.assign(context, extension); | ||
context = { ...context, ...extension }; | ||
}, | ||
@@ -361,3 +355,3 @@ args: args, | ||
const afterCalls = []; | ||
const context = args.contextValue || {}; | ||
let context = args.contextValue || {}; | ||
for (const onExecute of beforeCallbacks.execute) { | ||
@@ -374,3 +368,6 @@ const after = await onExecute({ | ||
if (typeof extension === 'object') { | ||
Object.assign(context, extension); | ||
context = { | ||
...context, | ||
...extension, | ||
}; | ||
} | ||
@@ -377,0 +374,0 @@ else { |
@@ -5,3 +5,3 @@ "use strict"; | ||
const useEnvelop = (envelop) => { | ||
return { | ||
const plugin = { | ||
onPluginInit({ addPlugin }) { | ||
@@ -11,5 +11,8 @@ for (const plugin of envelop._plugins) { | ||
} | ||
// Avoid double execution if envelop is extended multiple times | ||
plugin.onPluginInit = undefined; | ||
}, | ||
}; | ||
return plugin; | ||
}; | ||
exports.useEnvelop = useEnvelop; |
@@ -193,6 +193,5 @@ import { documentStringMap } from './document-string-map.js'; | ||
// In order to have access to the "last working" context object we keep this outside of the try block: | ||
const context = initialContext; | ||
if (orchestratorCtx) { | ||
Object.assign(context, orchestratorCtx); | ||
} | ||
let context = orchestratorCtx | ||
? { ...initialContext, ...orchestratorCtx } | ||
: initialContext; | ||
try { | ||
@@ -204,3 +203,3 @@ let isBreakingContextBuilding = false; | ||
extendContext: extension => { | ||
Object.assign(context, extension); | ||
context = { ...context, ...extension }; | ||
}, | ||
@@ -222,3 +221,3 @@ breakContextBuilding: () => { | ||
extendContext: extension => { | ||
Object.assign(context, extension); | ||
context = { ...context, ...extension }; | ||
}, | ||
@@ -243,8 +242,3 @@ }); | ||
} | ||
: initialContext => orchestratorCtx => { | ||
if (orchestratorCtx) { | ||
Object.assign(initialContext, orchestratorCtx); | ||
} | ||
return initialContext; | ||
}; | ||
: initialContext => orchestratorCtx => orchestratorCtx ? { ...initialContext, ...orchestratorCtx } : initialContext; | ||
const useCustomSubscribe = beforeCallbacks.subscribe.length; | ||
@@ -256,3 +250,3 @@ const customSubscribe = useCustomSubscribe | ||
const subscribeErrorHandlers = []; | ||
const context = args.contextValue || {}; | ||
let context = args.contextValue || {}; | ||
let result; | ||
@@ -266,3 +260,3 @@ for (const onSubscribe of beforeCallbacks.subscribe) { | ||
extendContext: extension => { | ||
Object.assign(context, extension); | ||
context = { ...context, ...extension }; | ||
}, | ||
@@ -358,3 +352,3 @@ args: args, | ||
const afterCalls = []; | ||
const context = args.contextValue || {}; | ||
let context = args.contextValue || {}; | ||
for (const onExecute of beforeCallbacks.execute) { | ||
@@ -371,3 +365,6 @@ const after = await onExecute({ | ||
if (typeof extension === 'object') { | ||
Object.assign(context, extension); | ||
context = { | ||
...context, | ||
...extension, | ||
}; | ||
} | ||
@@ -374,0 +371,0 @@ else { |
export const useEnvelop = (envelop) => { | ||
return { | ||
const plugin = { | ||
onPluginInit({ addPlugin }) { | ||
@@ -7,4 +7,7 @@ for (const plugin of envelop._plugins) { | ||
} | ||
// Avoid double execution if envelop is extended multiple times | ||
plugin.onPluginInit = undefined; | ||
}, | ||
}; | ||
return plugin; | ||
}; |
{ | ||
"name": "@envelop/core", | ||
"version": "4.0.2-alpha-20230908154216-af1cec7c", | ||
"version": "4.0.2-alpha-20230915095210-15c83003", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88825