@envelop/core 2.4.0 → 2.4.1-alpha-72027859.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/cjs/orchestrator.js +3 -2
- package/cjs/plugins/use-masked-errors.js +2 -2
- package/cjs/plugins/use-timing.js +1 -1
- package/cjs/traced-orchestrator.js +3 -1
- package/esm/orchestrator.js +3 -2
- package/esm/plugins/use-masked-errors.js +2 -2
- package/esm/plugins/use-timing.js +1 -1
- package/esm/traced-orchestrator.js +4 -2
- package/package.json +1 -1
package/cjs/orchestrator.js
CHANGED
|
@@ -187,7 +187,8 @@ function createEnvelopOrchestrator(plugins) {
|
|
|
187
187
|
return result;
|
|
188
188
|
}
|
|
189
189
|
: () => graphql_1.validate;
|
|
190
|
-
const customContextFactory = beforeCallbacks.context
|
|
190
|
+
const customContextFactory = beforeCallbacks.context
|
|
191
|
+
.length
|
|
191
192
|
? initialContext => async (orchestratorCtx) => {
|
|
192
193
|
const afterCalls = [];
|
|
193
194
|
// In order to have access to the "last working" context object we keep this outside of the try block:
|
|
@@ -355,7 +356,7 @@ function createEnvelopOrchestrator(plugins) {
|
|
|
355
356
|
extendContext: extension => {
|
|
356
357
|
if (typeof extension === 'object') {
|
|
357
358
|
context = {
|
|
358
|
-
...
|
|
359
|
+
...context,
|
|
359
360
|
...extension,
|
|
360
361
|
};
|
|
361
362
|
}
|
|
@@ -65,7 +65,7 @@ const useMaskedErrors = (opts) => {
|
|
|
65
65
|
: undefined,
|
|
66
66
|
onPluginInit(context) {
|
|
67
67
|
context.registerContextErrorHandler(({ error, setError }) => {
|
|
68
|
-
setError((
|
|
68
|
+
setError(format(error, message, isDev));
|
|
69
69
|
});
|
|
70
70
|
},
|
|
71
71
|
onExecute() {
|
|
@@ -81,7 +81,7 @@ const useMaskedErrors = (opts) => {
|
|
|
81
81
|
return (0, utils_js_1.handleStreamOrSingleExecutionResult)(payload, handleResult);
|
|
82
82
|
},
|
|
83
83
|
onSubscribeError({ error, setError }) {
|
|
84
|
-
setError((
|
|
84
|
+
setError(format(error, message, isDev));
|
|
85
85
|
},
|
|
86
86
|
};
|
|
87
87
|
},
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.traceOrchestrator = void 0;
|
|
5
5
|
const graphql_1 = require("graphql");
|
|
6
6
|
const utils_js_1 = require("./utils.js");
|
|
7
|
-
const getTimestamp = typeof globalThis !== 'undefined' && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.performance) === null || _a === void 0 ? void 0 : _a.now)
|
|
7
|
+
const getTimestamp = typeof globalThis !== 'undefined' && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.performance) === null || _a === void 0 ? void 0 : _a.now)
|
|
8
|
+
? () => globalThis.performance.now()
|
|
9
|
+
: () => Date.now();
|
|
8
10
|
const measure = () => {
|
|
9
11
|
const start = getTimestamp();
|
|
10
12
|
return () => {
|
package/esm/orchestrator.js
CHANGED
|
@@ -184,7 +184,8 @@ export function createEnvelopOrchestrator(plugins) {
|
|
|
184
184
|
return result;
|
|
185
185
|
}
|
|
186
186
|
: () => validate;
|
|
187
|
-
const customContextFactory = beforeCallbacks.context
|
|
187
|
+
const customContextFactory = beforeCallbacks.context
|
|
188
|
+
.length
|
|
188
189
|
? initialContext => async (orchestratorCtx) => {
|
|
189
190
|
const afterCalls = [];
|
|
190
191
|
// In order to have access to the "last working" context object we keep this outside of the try block:
|
|
@@ -352,7 +353,7 @@ export function createEnvelopOrchestrator(plugins) {
|
|
|
352
353
|
extendContext: extension => {
|
|
353
354
|
if (typeof extension === 'object') {
|
|
354
355
|
context = {
|
|
355
|
-
...
|
|
356
|
+
...context,
|
|
356
357
|
...extension,
|
|
357
358
|
};
|
|
358
359
|
}
|
|
@@ -60,7 +60,7 @@ export const useMaskedErrors = (opts) => {
|
|
|
60
60
|
: undefined,
|
|
61
61
|
onPluginInit(context) {
|
|
62
62
|
context.registerContextErrorHandler(({ error, setError }) => {
|
|
63
|
-
setError(
|
|
63
|
+
setError(format(error, message, isDev));
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
66
|
onExecute() {
|
|
@@ -76,7 +76,7 @@ export const useMaskedErrors = (opts) => {
|
|
|
76
76
|
return handleStreamOrSingleExecutionResult(payload, handleResult);
|
|
77
77
|
},
|
|
78
78
|
onSubscribeError({ error, setError }) {
|
|
79
|
-
setError(
|
|
79
|
+
setError(format(error, message, isDev));
|
|
80
80
|
},
|
|
81
81
|
};
|
|
82
82
|
},
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { GraphQLSchema, } from 'graphql';
|
|
3
3
|
import { isAsyncIterable } from './utils.js';
|
|
4
|
-
const getTimestamp = typeof globalThis !== 'undefined' && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.performance) === null || _a === void 0 ? void 0 : _a.now)
|
|
4
|
+
const getTimestamp = typeof globalThis !== 'undefined' && ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.performance) === null || _a === void 0 ? void 0 : _a.now)
|
|
5
|
+
? () => globalThis.performance.now()
|
|
6
|
+
: () => Date.now();
|
|
5
7
|
const measure = () => {
|
|
6
8
|
const start = getTimestamp();
|
|
7
9
|
return () => {
|