@envelop/core
Advanced tools
Comparing version 5.1.1 to 5.2.0-alpha-20250225223609-ad770ba43578c029a5f7274b702cbc310acccc85
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.envelop = envelop; | ||
const instruments_1 = require("@envelop/instruments"); | ||
const orchestrator_js_1 = require("./orchestrator.js"); | ||
@@ -9,15 +10,17 @@ function notEmpty(value) { | ||
function envelop(options) { | ||
const plugins = options.plugins.filter(notEmpty); | ||
const { pluginInstruments, plugins } = (0, instruments_1.getInstrumentsAndPlugins)(options.plugins.filter(notEmpty)); | ||
const instruments = (0, instruments_1.composeInstruments)(pluginInstruments); | ||
const orchestrator = (0, orchestrator_js_1.createEnvelopOrchestrator)({ | ||
plugins, | ||
}); | ||
const getEnveloped = (initialContext = {}) => { | ||
const getEnveloped = (context = {}) => { | ||
const instrumented = (0, instruments_1.getInstrumented)({ context }); | ||
const typedOrchestrator = orchestrator; | ||
typedOrchestrator.init(initialContext); | ||
instrumented.fn(instruments?.init, orchestrator.init)(context); | ||
return { | ||
parse: typedOrchestrator.parse(initialContext), | ||
validate: typedOrchestrator.validate(initialContext), | ||
contextFactory: typedOrchestrator.contextFactory(initialContext), | ||
execute: typedOrchestrator.execute, | ||
subscribe: typedOrchestrator.subscribe, | ||
parse: instrumented.fn(instruments?.parse, typedOrchestrator.parse(context)), | ||
validate: instrumented.fn(instruments?.validate, typedOrchestrator.validate(context)), | ||
contextFactory: instrumented.fn(instruments?.context, typedOrchestrator.contextFactory(context)), | ||
execute: instrumented.asyncFn(instruments?.execute, typedOrchestrator.execute), | ||
subscribe: instrumented.asyncFn(instruments?.subscribe, typedOrchestrator.subscribe), | ||
schema: typedOrchestrator.getCurrentSchema(), | ||
@@ -24,0 +27,0 @@ }; |
@@ -0,1 +1,2 @@ | ||
import { composeInstruments, getInstrumented, getInstrumentsAndPlugins, } from '@envelop/instruments'; | ||
import { createEnvelopOrchestrator } from './orchestrator.js'; | ||
@@ -6,15 +7,17 @@ function notEmpty(value) { | ||
export function envelop(options) { | ||
const plugins = options.plugins.filter(notEmpty); | ||
const { pluginInstruments, plugins } = getInstrumentsAndPlugins(options.plugins.filter(notEmpty)); | ||
const instruments = composeInstruments(pluginInstruments); | ||
const orchestrator = createEnvelopOrchestrator({ | ||
plugins, | ||
}); | ||
const getEnveloped = (initialContext = {}) => { | ||
const getEnveloped = (context = {}) => { | ||
const instrumented = getInstrumented({ context }); | ||
const typedOrchestrator = orchestrator; | ||
typedOrchestrator.init(initialContext); | ||
instrumented.fn(instruments?.init, orchestrator.init)(context); | ||
return { | ||
parse: typedOrchestrator.parse(initialContext), | ||
validate: typedOrchestrator.validate(initialContext), | ||
contextFactory: typedOrchestrator.contextFactory(initialContext), | ||
execute: typedOrchestrator.execute, | ||
subscribe: typedOrchestrator.subscribe, | ||
parse: instrumented.fn(instruments?.parse, typedOrchestrator.parse(context)), | ||
validate: instrumented.fn(instruments?.validate, typedOrchestrator.validate(context)), | ||
contextFactory: instrumented.fn(instruments?.context, typedOrchestrator.contextFactory(context)), | ||
execute: instrumented.asyncFn(instruments?.execute, typedOrchestrator.execute), | ||
subscribe: instrumented.asyncFn(instruments?.subscribe, typedOrchestrator.subscribe), | ||
schema: typedOrchestrator.getCurrentSchema(), | ||
@@ -21,0 +24,0 @@ }; |
{ | ||
"name": "@envelop/core", | ||
"version": "5.1.1", | ||
"version": "5.2.0-alpha-20250225223609-ad770ba43578c029a5f7274b702cbc310acccc85", | ||
"sideEffects": false, | ||
@@ -8,3 +8,4 @@ "dependencies": { | ||
"tslib": "^2.5.0", | ||
"@envelop/types": "^5.1.1" | ||
"@envelop/instruments": "^5.0.3", | ||
"@envelop/types": "^5.2.0-alpha-20250225223609-ad770ba43578c029a5f7274b702cbc310acccc85" | ||
}, | ||
@@ -11,0 +12,0 @@ "repository": { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
89392
2007
4
2
+ Added@envelop/instruments@^5.0.3
+ Added@envelop/instruments@5.0.3(transitive)
+ Added@envelop/types@5.2.0-alpha-20250228204257-fea2ea0dbc59802cb3bf7042c0f1a473e051b44b(transitive)
- Removed@envelop/types@5.1.1(transitive)
Updated@envelop/types@^5.2.0-alpha-20250225223609-ad770ba43578c029a5f7274b702cbc310acccc85