@envelop/core 5.5.1 → 5.6.1
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/LICENSE +3 -1
- package/cjs/index.js +0 -1
- package/cjs/orchestrator.js +3 -7
- package/cjs/plugin-with-state.js +10 -13
- package/cjs/plugins/use-masked-errors.js +1 -1
- package/cjs/utils.js +3 -7
- package/esm/index.js +0 -1
- package/esm/orchestrator.js +3 -7
- package/esm/plugin-with-state.js +10 -13
- package/esm/plugins/use-masked-errors.js +1 -1
- package/esm/utils.js +3 -7
- package/package.json +6 -5
- package/typings/create.d.cts +1 -1
- package/typings/create.d.ts +1 -1
- package/typings/orchestrator.d.cts +2 -2
- package/typings/orchestrator.d.ts +2 -2
- package/typings/plugin-with-state.d.cts +1 -1
- package/typings/plugin-with-state.d.ts +1 -1
- package/typings/plugins/use-engine.d.cts +1 -1
- package/typings/plugins/use-engine.d.ts +1 -1
- package/typings/plugins/use-envelop.d.cts +1 -1
- package/typings/plugins/use-envelop.d.ts +1 -1
- package/typings/plugins/use-error-handler.d.cts +3 -3
- package/typings/plugins/use-error-handler.d.ts +3 -3
- package/typings/plugins/use-extend-context.d.cts +1 -1
- package/typings/plugins/use-extend-context.d.ts +1 -1
- package/typings/plugins/use-logger.d.cts +1 -1
- package/typings/plugins/use-logger.d.ts +1 -1
- package/typings/plugins/use-masked-errors.d.cts +1 -1
- package/typings/plugins/use-masked-errors.d.ts +1 -1
- package/typings/plugins/use-payload-formatter.d.cts +1 -1
- package/typings/plugins/use-payload-formatter.d.ts +1 -1
- package/typings/plugins/use-schema.d.cts +1 -1
- package/typings/plugins/use-schema.d.ts +1 -1
- package/typings/plugins/use-validation-rule.d.cts +1 -1
- package/typings/plugins/use-validation-rule.d.ts +1 -1
- package/typings/utils.d.cts +1 -1
- package/typings/utils.d.ts +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2020
|
|
3
|
+
Copyright (c) 2018-2020 Graphcool
|
|
4
|
+
Copyright (c) 2020-2021 Prisma
|
|
5
|
+
Copyright (c) 2021- The Guild
|
|
4
6
|
|
|
5
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
8
|
of this software and associated documentation files (the "Software"), to deal
|
package/cjs/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.documentStringMap = exports.getDocumentString = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
// eslint-disable-next-line import/export
|
|
6
5
|
tslib_1.__exportStar(require("@envelop/types"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("@envelop/instrumentation"), exports);
|
|
8
7
|
tslib_1.__exportStar(require("./create.js"), exports);
|
package/cjs/orchestrator.js
CHANGED
|
@@ -43,7 +43,7 @@ function createEnvelopOrchestrator({ plugins, }) {
|
|
|
43
43
|
for (let i = 0; i < plugins.length; i++) {
|
|
44
44
|
const plugin = plugins[i];
|
|
45
45
|
const pluginsToAdd = [];
|
|
46
|
-
plugin
|
|
46
|
+
plugin?.onPluginInit?.({
|
|
47
47
|
plugins,
|
|
48
48
|
addPlugin: newPlugin => {
|
|
49
49
|
pluginsToAdd.push(newPlugin);
|
|
@@ -167,9 +167,7 @@ function createEnvelopOrchestrator({ plugins, }) {
|
|
|
167
167
|
},
|
|
168
168
|
validateFn,
|
|
169
169
|
addValidationRule: rule => {
|
|
170
|
-
|
|
171
|
-
actualRules = [];
|
|
172
|
-
}
|
|
170
|
+
actualRules ||= [];
|
|
173
171
|
actualRules.push(rule);
|
|
174
172
|
},
|
|
175
173
|
setValidationFn: newFn => {
|
|
@@ -181,9 +179,7 @@ function createEnvelopOrchestrator({ plugins, }) {
|
|
|
181
179
|
});
|
|
182
180
|
afterFn && afterCalls.push(afterFn);
|
|
183
181
|
}
|
|
184
|
-
|
|
185
|
-
result = validateFn(schema, documentAST, actualRules, typeInfo, validationOptions);
|
|
186
|
-
}
|
|
182
|
+
result ||= validateFn(schema, documentAST, actualRules, typeInfo, validationOptions);
|
|
187
183
|
if (!result) {
|
|
188
184
|
return;
|
|
189
185
|
}
|
package/cjs/plugin-with-state.js
CHANGED
|
@@ -7,8 +7,7 @@ function withState(pluginFactory) {
|
|
|
7
7
|
function getProp(scope, key) {
|
|
8
8
|
return {
|
|
9
9
|
get() {
|
|
10
|
-
|
|
11
|
-
states[scope] = new WeakMap();
|
|
10
|
+
states[scope] ||= new WeakMap();
|
|
12
11
|
let value = states[scope].get(key);
|
|
13
12
|
if (!value)
|
|
14
13
|
states[scope].set(key, (value = {}));
|
|
@@ -47,14 +46,7 @@ function withState(pluginFactory) {
|
|
|
47
46
|
const properties = Object.entries(Object.getOwnPropertyDescriptors(src));
|
|
48
47
|
for (const [hookName, descriptor] of properties) {
|
|
49
48
|
const hook = descriptor.value;
|
|
50
|
-
if (typeof hook
|
|
51
|
-
descriptor.get &&= () => src[hookName];
|
|
52
|
-
descriptor.set &&= value => {
|
|
53
|
-
src[hookName] = value;
|
|
54
|
-
};
|
|
55
|
-
Object.defineProperty(result, hookName, descriptor);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
49
|
+
if (typeof hook === 'function') {
|
|
58
50
|
result[hookName] = {
|
|
59
51
|
[hook.name](payload, ...args) {
|
|
60
52
|
if (payload && (payload.request || payload.context || payload.executionRequest)) {
|
|
@@ -65,12 +57,17 @@ function withState(pluginFactory) {
|
|
|
65
57
|
},
|
|
66
58
|
}, ...args);
|
|
67
59
|
}
|
|
68
|
-
|
|
69
|
-
return hook(payload, ...args);
|
|
70
|
-
}
|
|
60
|
+
return hook(payload, ...args);
|
|
71
61
|
},
|
|
72
62
|
}[hook.name];
|
|
73
63
|
}
|
|
64
|
+
else {
|
|
65
|
+
descriptor.get &&= () => src[hookName];
|
|
66
|
+
descriptor.set &&= value => {
|
|
67
|
+
src[hookName] = value;
|
|
68
|
+
};
|
|
69
|
+
Object.defineProperty(result, hookName, descriptor);
|
|
70
|
+
}
|
|
74
71
|
}
|
|
75
72
|
return result;
|
|
76
73
|
}
|
|
@@ -48,7 +48,7 @@ const createDefaultMaskError = (isDev) => (error, message) => {
|
|
|
48
48
|
return createSerializableGraphQLError(message, error, isDev);
|
|
49
49
|
};
|
|
50
50
|
exports.createDefaultMaskError = createDefaultMaskError;
|
|
51
|
-
const isDev = globalThis.process?.env?.NODE_ENV === 'development';
|
|
51
|
+
const isDev = globalThis.process?.env?.['NODE_ENV'] === 'development';
|
|
52
52
|
exports.defaultMaskError = (0, exports.createDefaultMaskError)(isDev);
|
|
53
53
|
const makeHandleResult = (maskError, message) => ({ result, setResult, }) => {
|
|
54
54
|
if (result.errors != null) {
|
package/cjs/utils.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.errorAsyncIterator = errorAsyncIterator;
|
|
|
9
9
|
const promise_helpers_1 = require("@whatwg-node/promise-helpers");
|
|
10
10
|
exports.envelopIsIntrospectionSymbol = Symbol('ENVELOP_IS_INTROSPECTION');
|
|
11
11
|
function isIntrospectionOperationString(operation) {
|
|
12
|
-
return (typeof operation === 'string' ? operation : operation.body).
|
|
12
|
+
return (typeof operation === 'string' ? operation : operation.body).includes('__schema');
|
|
13
13
|
}
|
|
14
14
|
function getSubscribeArgs(args) {
|
|
15
15
|
return args.length === 1
|
|
@@ -83,9 +83,7 @@ function handleStreamOrSingleExecutionResult(payload, fn) {
|
|
|
83
83
|
function finalAsyncIterator(source, onFinal) {
|
|
84
84
|
let iterator;
|
|
85
85
|
function ensureIterator() {
|
|
86
|
-
|
|
87
|
-
iterator = source[Symbol.asyncIterator]();
|
|
88
|
-
}
|
|
86
|
+
iterator ||= source[Symbol.asyncIterator]();
|
|
89
87
|
return iterator;
|
|
90
88
|
}
|
|
91
89
|
let isDone = false;
|
|
@@ -131,9 +129,7 @@ function finalAsyncIterator(source, onFinal) {
|
|
|
131
129
|
function errorAsyncIterator(source, onError) {
|
|
132
130
|
let iterator;
|
|
133
131
|
function ensureIterator() {
|
|
134
|
-
|
|
135
|
-
iterator = source[Symbol.asyncIterator]();
|
|
136
|
-
}
|
|
132
|
+
iterator ||= source[Symbol.asyncIterator]();
|
|
137
133
|
return iterator;
|
|
138
134
|
}
|
|
139
135
|
return {
|
package/esm/index.js
CHANGED
package/esm/orchestrator.js
CHANGED
|
@@ -40,7 +40,7 @@ export function createEnvelopOrchestrator({ plugins, }) {
|
|
|
40
40
|
for (let i = 0; i < plugins.length; i++) {
|
|
41
41
|
const plugin = plugins[i];
|
|
42
42
|
const pluginsToAdd = [];
|
|
43
|
-
plugin
|
|
43
|
+
plugin?.onPluginInit?.({
|
|
44
44
|
plugins,
|
|
45
45
|
addPlugin: newPlugin => {
|
|
46
46
|
pluginsToAdd.push(newPlugin);
|
|
@@ -164,9 +164,7 @@ export function createEnvelopOrchestrator({ plugins, }) {
|
|
|
164
164
|
},
|
|
165
165
|
validateFn,
|
|
166
166
|
addValidationRule: rule => {
|
|
167
|
-
|
|
168
|
-
actualRules = [];
|
|
169
|
-
}
|
|
167
|
+
actualRules ||= [];
|
|
170
168
|
actualRules.push(rule);
|
|
171
169
|
},
|
|
172
170
|
setValidationFn: newFn => {
|
|
@@ -178,9 +176,7 @@ export function createEnvelopOrchestrator({ plugins, }) {
|
|
|
178
176
|
});
|
|
179
177
|
afterFn && afterCalls.push(afterFn);
|
|
180
178
|
}
|
|
181
|
-
|
|
182
|
-
result = validateFn(schema, documentAST, actualRules, typeInfo, validationOptions);
|
|
183
|
-
}
|
|
179
|
+
result ||= validateFn(schema, documentAST, actualRules, typeInfo, validationOptions);
|
|
184
180
|
if (!result) {
|
|
185
181
|
return;
|
|
186
182
|
}
|
package/esm/plugin-with-state.js
CHANGED
|
@@ -3,8 +3,7 @@ export function withState(pluginFactory) {
|
|
|
3
3
|
function getProp(scope, key) {
|
|
4
4
|
return {
|
|
5
5
|
get() {
|
|
6
|
-
|
|
7
|
-
states[scope] = new WeakMap();
|
|
6
|
+
states[scope] ||= new WeakMap();
|
|
8
7
|
let value = states[scope].get(key);
|
|
9
8
|
if (!value)
|
|
10
9
|
states[scope].set(key, (value = {}));
|
|
@@ -43,14 +42,7 @@ export function withState(pluginFactory) {
|
|
|
43
42
|
const properties = Object.entries(Object.getOwnPropertyDescriptors(src));
|
|
44
43
|
for (const [hookName, descriptor] of properties) {
|
|
45
44
|
const hook = descriptor.value;
|
|
46
|
-
if (typeof hook
|
|
47
|
-
descriptor.get &&= () => src[hookName];
|
|
48
|
-
descriptor.set &&= value => {
|
|
49
|
-
src[hookName] = value;
|
|
50
|
-
};
|
|
51
|
-
Object.defineProperty(result, hookName, descriptor);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
45
|
+
if (typeof hook === 'function') {
|
|
54
46
|
result[hookName] = {
|
|
55
47
|
[hook.name](payload, ...args) {
|
|
56
48
|
if (payload && (payload.request || payload.context || payload.executionRequest)) {
|
|
@@ -61,12 +53,17 @@ export function withState(pluginFactory) {
|
|
|
61
53
|
},
|
|
62
54
|
}, ...args);
|
|
63
55
|
}
|
|
64
|
-
|
|
65
|
-
return hook(payload, ...args);
|
|
66
|
-
}
|
|
56
|
+
return hook(payload, ...args);
|
|
67
57
|
},
|
|
68
58
|
}[hook.name];
|
|
69
59
|
}
|
|
60
|
+
else {
|
|
61
|
+
descriptor.get &&= () => src[hookName];
|
|
62
|
+
descriptor.set &&= value => {
|
|
63
|
+
src[hookName] = value;
|
|
64
|
+
};
|
|
65
|
+
Object.defineProperty(result, hookName, descriptor);
|
|
66
|
+
}
|
|
70
67
|
}
|
|
71
68
|
return result;
|
|
72
69
|
}
|
|
@@ -41,7 +41,7 @@ export const createDefaultMaskError = (isDev) => (error, message) => {
|
|
|
41
41
|
}
|
|
42
42
|
return createSerializableGraphQLError(message, error, isDev);
|
|
43
43
|
};
|
|
44
|
-
const isDev = globalThis.process?.env?.NODE_ENV === 'development';
|
|
44
|
+
const isDev = globalThis.process?.env?.['NODE_ENV'] === 'development';
|
|
45
45
|
export const defaultMaskError = createDefaultMaskError(isDev);
|
|
46
46
|
const makeHandleResult = (maskError, message) => ({ result, setResult, }) => {
|
|
47
47
|
if (result.errors != null) {
|
package/esm/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fakePromise } from '@whatwg-node/promise-helpers';
|
|
2
2
|
export const envelopIsIntrospectionSymbol = Symbol('ENVELOP_IS_INTROSPECTION');
|
|
3
3
|
export function isIntrospectionOperationString(operation) {
|
|
4
|
-
return (typeof operation === 'string' ? operation : operation.body).
|
|
4
|
+
return (typeof operation === 'string' ? operation : operation.body).includes('__schema');
|
|
5
5
|
}
|
|
6
6
|
function getSubscribeArgs(args) {
|
|
7
7
|
return args.length === 1
|
|
@@ -72,9 +72,7 @@ export function handleStreamOrSingleExecutionResult(payload, fn) {
|
|
|
72
72
|
export function finalAsyncIterator(source, onFinal) {
|
|
73
73
|
let iterator;
|
|
74
74
|
function ensureIterator() {
|
|
75
|
-
|
|
76
|
-
iterator = source[Symbol.asyncIterator]();
|
|
77
|
-
}
|
|
75
|
+
iterator ||= source[Symbol.asyncIterator]();
|
|
78
76
|
return iterator;
|
|
79
77
|
}
|
|
80
78
|
let isDone = false;
|
|
@@ -120,9 +118,7 @@ export function finalAsyncIterator(source, onFinal) {
|
|
|
120
118
|
export function errorAsyncIterator(source, onError) {
|
|
121
119
|
let iterator;
|
|
122
120
|
function ensureIterator() {
|
|
123
|
-
|
|
124
|
-
iterator = source[Symbol.asyncIterator]();
|
|
125
|
-
}
|
|
121
|
+
iterator ||= source[Symbol.asyncIterator]();
|
|
126
122
|
return iterator;
|
|
127
123
|
}
|
|
128
124
|
return {
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@whatwg-node/promise-helpers": "^1.2.4",
|
|
7
7
|
"tslib": "^2.5.0",
|
|
8
|
-
"@envelop/instrumentation": "^1.0.
|
|
9
|
-
"@envelop/types": "^5.2.
|
|
8
|
+
"@envelop/instrumentation": "^1.0.1",
|
|
9
|
+
"@envelop/types": "^5.2.2"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/graphql-hive/
|
|
14
|
-
"directory": "packages/core"
|
|
13
|
+
"url": "https://github.com/graphql-hive/graphql-yoga.git",
|
|
14
|
+
"directory": "packages/envelop/core"
|
|
15
15
|
},
|
|
16
|
+
"homepage": "https://github.com/graphql-hive/graphql-yoga/tree/main/packages/envelop/core#readme",
|
|
16
17
|
"keywords": [
|
|
17
18
|
"gql",
|
|
18
19
|
"graphql",
|
package/typings/create.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComposeContext, GetEnvelopedFn, Optional, Plugin } from '@envelop/types';
|
|
1
|
+
import type { ComposeContext, GetEnvelopedFn, Optional, Plugin } from '@envelop/types';
|
|
2
2
|
type ExcludeFalsy<TArray extends any[]> = Exclude<TArray[0], null | undefined | false>[];
|
|
3
3
|
export declare function envelop<PluginsType extends Optional<Plugin<any>>[]>(options: {
|
|
4
4
|
plugins: PluginsType;
|
package/typings/create.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComposeContext, GetEnvelopedFn, Optional, Plugin } from '@envelop/types';
|
|
1
|
+
import type { ComposeContext, GetEnvelopedFn, Optional, Plugin } from '@envelop/types';
|
|
2
2
|
type ExcludeFalsy<TArray extends any[]> = Exclude<TArray[0], null | undefined | false>[];
|
|
3
3
|
export declare function envelop<PluginsType extends Optional<Plugin<any>>[]>(options: {
|
|
4
4
|
plugins: PluginsType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArbitraryObject, DefaultContext, EnvelopContextFnWrapper, GetEnvelopedFn, Instrumentation, Maybe, Plugin } from '@envelop/types';
|
|
1
|
+
import type { ArbitraryObject, DefaultContext, EnvelopContextFnWrapper, GetEnvelopedFn, Instrumentation, Maybe, Plugin } from '@envelop/types';
|
|
2
2
|
export type EnvelopOrchestrator<InitialContext extends ArbitraryObject = ArbitraryObject, PluginsContext extends ArbitraryObject = ArbitraryObject> = {
|
|
3
3
|
init: (initialContext?: Maybe<InitialContext>) => void;
|
|
4
4
|
parse: EnvelopContextFnWrapper<ReturnType<GetEnvelopedFn<PluginsContext>>['parse'], InitialContext>;
|
|
@@ -12,5 +12,5 @@ export type EnvelopOrchestrator<InitialContext extends ArbitraryObject = Arbitra
|
|
|
12
12
|
type EnvelopOrchestratorOptions = {
|
|
13
13
|
plugins: Plugin[];
|
|
14
14
|
};
|
|
15
|
-
export declare function createEnvelopOrchestrator<PluginsContext extends DefaultContext>({ plugins
|
|
15
|
+
export declare function createEnvelopOrchestrator<PluginsContext extends DefaultContext>({ plugins }: EnvelopOrchestratorOptions): EnvelopOrchestrator<any, PluginsContext>;
|
|
16
16
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArbitraryObject, DefaultContext, EnvelopContextFnWrapper, GetEnvelopedFn, Instrumentation, Maybe, Plugin } from '@envelop/types';
|
|
1
|
+
import type { ArbitraryObject, DefaultContext, EnvelopContextFnWrapper, GetEnvelopedFn, Instrumentation, Maybe, Plugin } from '@envelop/types';
|
|
2
2
|
export type EnvelopOrchestrator<InitialContext extends ArbitraryObject = ArbitraryObject, PluginsContext extends ArbitraryObject = ArbitraryObject> = {
|
|
3
3
|
init: (initialContext?: Maybe<InitialContext>) => void;
|
|
4
4
|
parse: EnvelopContextFnWrapper<ReturnType<GetEnvelopedFn<PluginsContext>>['parse'], InitialContext>;
|
|
@@ -12,5 +12,5 @@ export type EnvelopOrchestrator<InitialContext extends ArbitraryObject = Arbitra
|
|
|
12
12
|
type EnvelopOrchestratorOptions = {
|
|
13
13
|
plugins: Plugin[];
|
|
14
14
|
};
|
|
15
|
-
export declare function createEnvelopOrchestrator<PluginsContext extends DefaultContext>({ plugins
|
|
15
|
+
export declare function createEnvelopOrchestrator<PluginsContext extends DefaultContext>({ plugins }: EnvelopOrchestratorOptions): EnvelopOrchestrator<any, PluginsContext>;
|
|
16
16
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
1
|
+
import type { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
2
2
|
export declare function withState<P extends {
|
|
3
3
|
instrumentation?: GenericInstrumentation;
|
|
4
4
|
}, State = object>(pluginFactory: (getState: <SP extends {}>(payload: SP) => PayloadWithState<SP, State, State, State>['state']) => PluginWithState<P, State, State, State>): P;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
1
|
+
import type { MaybePromise } from '@whatwg-node/promise-helpers';
|
|
2
2
|
export declare function withState<P extends {
|
|
3
3
|
instrumentation?: GenericInstrumentation;
|
|
4
4
|
}, State = object>(pluginFactory: (getState: <SP extends {}>(payload: SP) => PayloadWithState<SP, State, State, State>['state']) => PluginWithState<P, State, State, State>): P;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExecuteFunction, ParseFunction, Plugin, SubscribeFunction, ValidateFunction } from '@envelop/types';
|
|
1
|
+
import type { ExecuteFunction, ParseFunction, Plugin, SubscribeFunction, ValidateFunction } from '@envelop/types';
|
|
2
2
|
type UseEngineOptions = {
|
|
3
3
|
execute?: ExecuteFunction;
|
|
4
4
|
parse?: ParseFunction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExecuteFunction, ParseFunction, Plugin, SubscribeFunction, ValidateFunction } from '@envelop/types';
|
|
1
|
+
import type { ExecuteFunction, ParseFunction, Plugin, SubscribeFunction, ValidateFunction } from '@envelop/types';
|
|
2
2
|
type UseEngineOptions = {
|
|
3
3
|
execute?: ExecuteFunction;
|
|
4
4
|
parse?: ParseFunction;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { GetEnvelopedFn, Plugin } from '@envelop/types';
|
|
1
|
+
import type { GetEnvelopedFn, Plugin } from '@envelop/types';
|
|
2
2
|
export declare const useEnvelop: (envelop: GetEnvelopedFn<any>) => Plugin<any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { GetEnvelopedFn, Plugin } from '@envelop/types';
|
|
1
|
+
import type { GetEnvelopedFn, Plugin } from '@envelop/types';
|
|
2
2
|
export declare const useEnvelop: (envelop: GetEnvelopedFn<any>) => Plugin<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DefaultContext, Plugin } from '@envelop/types';
|
|
2
|
-
import { SerializableGraphQLErrorLike } from './use-masked-errors.cjs';
|
|
3
|
-
export type ErrorHandler = ({ errors, context, phase
|
|
1
|
+
import type { DefaultContext, Plugin } from '@envelop/types';
|
|
2
|
+
import type { SerializableGraphQLErrorLike } from './use-masked-errors.cjs';
|
|
3
|
+
export type ErrorHandler = ({ errors, context, phase }: {
|
|
4
4
|
errors: readonly Error[] | readonly SerializableGraphQLErrorLike[];
|
|
5
5
|
context: Readonly<DefaultContext>;
|
|
6
6
|
phase: 'parse' | 'validate' | 'context' | 'execution';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DefaultContext, Plugin } from '@envelop/types';
|
|
2
|
-
import { SerializableGraphQLErrorLike } from './use-masked-errors.js';
|
|
3
|
-
export type ErrorHandler = ({ errors, context, phase
|
|
1
|
+
import type { DefaultContext, Plugin } from '@envelop/types';
|
|
2
|
+
import type { SerializableGraphQLErrorLike } from './use-masked-errors.js';
|
|
3
|
+
export type ErrorHandler = ({ errors, context, phase }: {
|
|
4
4
|
errors: readonly Error[] | readonly SerializableGraphQLErrorLike[];
|
|
5
5
|
context: Readonly<DefaultContext>;
|
|
6
6
|
phase: 'parse' | 'validate' | 'context' | 'execution';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from '@envelop/types';
|
|
1
|
+
import type { Plugin } from '@envelop/types';
|
|
2
2
|
export type ContextFactoryFn<TResult = unknown, TCurrent = unknown> = (currentContext: TCurrent) => TResult | Promise<TResult>;
|
|
3
3
|
type UnwrapAsync<T> = T extends Promise<infer U> ? U : T;
|
|
4
4
|
export declare const useExtendContext: <TContextFactory extends (...args: any[]) => any>(contextFactory: TContextFactory) => Plugin<UnwrapAsync<ReturnType<TContextFactory>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from '@envelop/types';
|
|
1
|
+
import type { Plugin } from '@envelop/types';
|
|
2
2
|
export type ContextFactoryFn<TResult = unknown, TCurrent = unknown> = (currentContext: TCurrent) => TResult | Promise<TResult>;
|
|
3
3
|
type UnwrapAsync<T> = T extends Promise<infer U> ? U : T;
|
|
4
4
|
export declare const useExtendContext: <TContextFactory extends (...args: any[]) => any>(contextFactory: TContextFactory) => Plugin<UnwrapAsync<ReturnType<TContextFactory>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from '@envelop/types';
|
|
1
|
+
import type { Plugin } from '@envelop/types';
|
|
2
2
|
export declare const DEFAULT_ERROR_MESSAGE = "Unexpected error.";
|
|
3
3
|
export type MaskError = (error: unknown, message: string) => Error;
|
|
4
4
|
export type SerializableGraphQLErrorLike = Error & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Plugin } from '@envelop/types';
|
|
1
|
+
import type { Plugin } from '@envelop/types';
|
|
2
2
|
export declare const DEFAULT_ERROR_MESSAGE = "Unexpected error.";
|
|
3
3
|
export type MaskError = (error: unknown, message: string) => Error;
|
|
4
4
|
export type SerializableGraphQLErrorLike = Error & {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ExecutionResult, Plugin, TypedExecutionArgs } from '@envelop/types';
|
|
1
|
+
import type { ExecutionResult, Plugin, TypedExecutionArgs } from '@envelop/types';
|
|
2
2
|
export type FormatterFunction = (result: ExecutionResult<any, any>, args: TypedExecutionArgs<any>) => false | ExecutionResult<any, any>;
|
|
3
3
|
export declare const usePayloadFormatter: (formatter: FormatterFunction) => Plugin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ExecutionResult, Plugin, TypedExecutionArgs } from '@envelop/types';
|
|
1
|
+
import type { ExecutionResult, Plugin, TypedExecutionArgs } from '@envelop/types';
|
|
2
2
|
export type FormatterFunction = (result: ExecutionResult<any, any>, args: TypedExecutionArgs<any>) => false | ExecutionResult<any, any>;
|
|
3
3
|
export declare const usePayloadFormatter: (formatter: FormatterFunction) => Plugin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DefaultContext, Maybe, Plugin } from '@envelop/types';
|
|
1
|
+
import type { DefaultContext, Maybe, Plugin } from '@envelop/types';
|
|
2
2
|
export declare const useSchema: (schema: any) => Plugin;
|
|
3
3
|
export declare const useSchemaByContext: (schemaLoader: (context: Maybe<DefaultContext>) => any) => Plugin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DefaultContext, Maybe, Plugin } from '@envelop/types';
|
|
1
|
+
import type { DefaultContext, Maybe, Plugin } from '@envelop/types';
|
|
2
2
|
export declare const useSchema: (schema: any) => Plugin;
|
|
3
3
|
export declare const useSchemaByContext: (schemaLoader: (context: Maybe<DefaultContext>) => any) => Plugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Plugin } from '@envelop/types';
|
|
1
|
+
import type { Plugin } from '@envelop/types';
|
|
2
2
|
export declare const useValidationRule: (rule: any) => Plugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Plugin } from '@envelop/types';
|
|
1
|
+
import type { Plugin } from '@envelop/types';
|
|
2
2
|
export declare const useValidationRule: (rule: any) => Plugin;
|
package/typings/utils.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncIterableIteratorOrValue, DefaultContext, ExecuteFunction, ExecutionArgs, OnExecuteDoneEventPayload, OnExecuteDoneHookResult, OnExecuteDoneHookResultOnNextHook, PromiseOrValue, SubscribeFunction } from '@envelop/types';
|
|
1
|
+
import type { AsyncIterableIteratorOrValue, DefaultContext, ExecuteFunction, ExecutionArgs, OnExecuteDoneEventPayload, OnExecuteDoneHookResult, OnExecuteDoneHookResultOnNextHook, PromiseOrValue, SubscribeFunction } from '@envelop/types';
|
|
2
2
|
export declare const envelopIsIntrospectionSymbol: unique symbol;
|
|
3
3
|
export declare function isIntrospectionOperationString(operation: string | any): boolean;
|
|
4
4
|
/**
|
package/typings/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncIterableIteratorOrValue, DefaultContext, ExecuteFunction, ExecutionArgs, OnExecuteDoneEventPayload, OnExecuteDoneHookResult, OnExecuteDoneHookResultOnNextHook, PromiseOrValue, SubscribeFunction } from '@envelop/types';
|
|
1
|
+
import type { AsyncIterableIteratorOrValue, DefaultContext, ExecuteFunction, ExecutionArgs, OnExecuteDoneEventPayload, OnExecuteDoneHookResult, OnExecuteDoneHookResultOnNextHook, PromiseOrValue, SubscribeFunction } from '@envelop/types';
|
|
2
2
|
export declare const envelopIsIntrospectionSymbol: unique symbol;
|
|
3
3
|
export declare function isIntrospectionOperationString(operation: string | any): boolean;
|
|
4
4
|
/**
|