@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.
@@ -187,7 +187,8 @@ function createEnvelopOrchestrator(plugins) {
187
187
  return result;
188
188
  }
189
189
  : () => graphql_1.validate;
190
- const customContextFactory = beforeCallbacks.context.length
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
- ...(context || {}),
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((0, exports.formatError)(error, message, isDev));
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((0, exports.formatError)(error, message, isDev));
84
+ setError(format(error, message, isDev));
85
85
  },
86
86
  };
87
87
  },
@@ -26,7 +26,7 @@ const deltaFrom = (hrtime) => {
26
26
  const useTiming = (rawOptions) => {
27
27
  const options = {
28
28
  ...DEFAULT_OPTIONS,
29
- ...(rawOptions || {}),
29
+ ...rawOptions,
30
30
  };
31
31
  const result = {};
32
32
  if (options.onContextBuildingMeasurement) {
@@ -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) ? () => globalThis.performance.now() : () => Date.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 () => {
@@ -184,7 +184,8 @@ export function createEnvelopOrchestrator(plugins) {
184
184
  return result;
185
185
  }
186
186
  : () => validate;
187
- const customContextFactory = beforeCallbacks.context.length
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
- ...(context || {}),
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(formatError(error, message, isDev));
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(formatError(error, message, isDev));
79
+ setError(format(error, message, isDev));
80
80
  },
81
81
  };
82
82
  },
@@ -23,7 +23,7 @@ const deltaFrom = (hrtime) => {
23
23
  export const useTiming = (rawOptions) => {
24
24
  const options = {
25
25
  ...DEFAULT_OPTIONS,
26
- ...(rawOptions || {}),
26
+ ...rawOptions,
27
27
  };
28
28
  const result = {};
29
29
  if (options.onContextBuildingMeasurement) {
@@ -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) ? () => globalThis.performance.now() : () => Date.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 () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envelop/core",
3
- "version": "2.4.0",
3
+ "version": "2.4.1-alpha-72027859.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"