@graphql-tools/executor-envelop 3.0.11 → 3.0.12

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/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useExecutor = void 0;
4
+ const core_1 = require("@envelop/core");
4
5
  const utils_1 = require("@graphql-tools/utils");
5
6
  const wrap_1 = require("@graphql-tools/wrap");
6
7
  function useExecutor(executor, opts) {
@@ -70,12 +71,10 @@ function useExecutor(executor, opts) {
70
71
  pluginCtx.schema$ = pluginCtx.schema;
71
72
  }
72
73
  ensureSchema(args.contextValue);
73
- if ((0, utils_1.isPromise)(pluginCtx.schemaSetPromise$)) {
74
- return pluginCtx.schemaSetPromise$.then(() => {
75
- setExecuteFn(executorToExecuteFn);
76
- });
77
- }
78
- setExecuteFn(executorToExecuteFn);
74
+ // @ts-expect-error - Typings are wrong
75
+ return (0, core_1.mapMaybePromise)(pluginCtx.schemaSetPromise$, () => {
76
+ setExecuteFn(executorToExecuteFn);
77
+ });
79
78
  },
80
79
  onSubscribe({ args, setSubscribeFn }) {
81
80
  if (args.schema) {
@@ -83,12 +82,10 @@ function useExecutor(executor, opts) {
83
82
  pluginCtx.schema$ = pluginCtx.schema;
84
83
  }
85
84
  ensureSchema(args.contextValue);
86
- if ((0, utils_1.isPromise)(pluginCtx.schemaSetPromise$)) {
87
- return pluginCtx.schemaSetPromise$.then(() => {
88
- setSubscribeFn(executorToExecuteFn);
89
- });
90
- }
91
- setSubscribeFn(executorToExecuteFn);
85
+ // @ts-expect-error - Typings are wrong
86
+ return (0, core_1.mapMaybePromise)(pluginCtx.schemaSetPromise$, () => {
87
+ setSubscribeFn(executorToExecuteFn);
88
+ });
92
89
  },
93
90
  onValidate({ params, context, setResult }) {
94
91
  if (params.schema) {
package/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { mapMaybePromise } from '@envelop/core';
1
2
  import { isPromise } from '@graphql-tools/utils';
2
3
  import { schemaFromExecutor } from '@graphql-tools/wrap';
3
4
  export function useExecutor(executor, opts) {
@@ -67,12 +68,10 @@ export function useExecutor(executor, opts) {
67
68
  pluginCtx.schema$ = pluginCtx.schema;
68
69
  }
69
70
  ensureSchema(args.contextValue);
70
- if (isPromise(pluginCtx.schemaSetPromise$)) {
71
- return pluginCtx.schemaSetPromise$.then(() => {
72
- setExecuteFn(executorToExecuteFn);
73
- });
74
- }
75
- setExecuteFn(executorToExecuteFn);
71
+ // @ts-expect-error - Typings are wrong
72
+ return mapMaybePromise(pluginCtx.schemaSetPromise$, () => {
73
+ setExecuteFn(executorToExecuteFn);
74
+ });
76
75
  },
77
76
  onSubscribe({ args, setSubscribeFn }) {
78
77
  if (args.schema) {
@@ -80,12 +79,10 @@ export function useExecutor(executor, opts) {
80
79
  pluginCtx.schema$ = pluginCtx.schema;
81
80
  }
82
81
  ensureSchema(args.contextValue);
83
- if (isPromise(pluginCtx.schemaSetPromise$)) {
84
- return pluginCtx.schemaSetPromise$.then(() => {
85
- setSubscribeFn(executorToExecuteFn);
86
- });
87
- }
88
- setSubscribeFn(executorToExecuteFn);
82
+ // @ts-expect-error - Typings are wrong
83
+ return mapMaybePromise(pluginCtx.schemaSetPromise$, () => {
84
+ setSubscribeFn(executorToExecuteFn);
85
+ });
89
86
  },
90
87
  onValidate({ params, context, setResult }) {
91
88
  if (params.schema) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@graphql-tools/executor-envelop",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "@envelop/core": "^3.0.4 || ^4.0.0 || ^5.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-tools/utils": "^10.5.6",
10
+ "@graphql-tools/utils": "^10.6.0",
11
11
  "@graphql-tools/wrap": "^10.0.16",
12
12
  "tslib": "^2.3.1"
13
13
  },