@graphql-hive/gateway 2.0.0-next-5f0d6548feff805e2f799e83492e0b98253f1622 → 2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
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/CHANGELOG.md +90 -24
- package/dist/bin.cjs +1 -1
- package/dist/bin.js +1 -1
- package/dist/{cli-BQ10GobO.cjs → cli-B4botk_4.cjs} +34 -4
- package/dist/{cli-CpJrCTMy.js → cli-BykXyWTB.js} +34 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +17 -17
package/CHANGELOG.md
CHANGED
@@ -1,35 +1,96 @@
|
|
1
1
|
# @graphql-hive/gateway
|
2
2
|
|
3
|
-
## 2.0.0-next-
|
3
|
+
## 2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
4
4
|
|
5
5
|
### Major Changes
|
6
6
|
|
7
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
7
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`8273fde`](https://github.com/graphql-hive/gateway/commit/8273fde686a666fa7f974ad4f9084f8b9cb0df57) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Drop Node 18 support
|
8
8
|
|
9
9
|
Least supported Node version is now v20.
|
10
10
|
|
11
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
11
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`32fbb7b`](https://github.com/graphql-hive/gateway/commit/32fbb7b3aefe9228c29c6f7b2a785406f21d3e24) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Introduce and use the new Hive Logger
|
12
12
|
- [Read more about it on the Hive Logger documentation here.](https://the-guild.dev/graphql/hive/docs/logger)
|
13
13
|
- If coming from Hive Gateway v1, [read the migration guide here.](https://the-guild.dev/graphql/hive/docs/migration-guides/gateway-v1-v2)
|
14
14
|
|
15
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
15
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`55580af`](https://github.com/graphql-hive/gateway/commit/55580af626e67cfc618b74201ef5ea3f6fd90758) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Disable forking even if NODE_ENV=production
|
16
16
|
|
17
17
|
Forking workers for concurrent processing is a delicate process and if not done carefully can lead to performance degradations. It should be configured with careful consideration by advanced users.
|
18
18
|
|
19
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
19
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`f63ea40`](https://github.com/graphql-hive/gateway/commit/f63ea40d976638557ef72468c8773c71a8f38f8c) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Remove mocking plugin from Hive Gateway built-ins
|
20
20
|
|
21
21
|
There is no need to provide the `useMock` plugin alongside Hive Gateway built-ins. Not only is the mock plugin 2MB in size (minified), but installing and using it is very simple.
|
22
22
|
|
23
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
23
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`3699f15`](https://github.com/graphql-hive/gateway/commit/3699f15d53a26cc3bd5b5f1cec57fc6902d3884e) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Load schema on initialization
|
24
24
|
|
25
25
|
Failing to start if the schema is not loaded for whatever reason.
|
26
26
|
|
27
|
+
### Minor Changes
|
28
|
+
|
29
|
+
- [#1310](https://github.com/graphql-hive/gateway/pull/1310) [`2fa0c8f`](https://github.com/graphql-hive/gateway/commit/2fa0c8f1dd074c9da8e6ac4086eb3009be9fdf07) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - Added new `withState` plugin utility for easy data sharing between hooks.
|
30
|
+
|
31
|
+
## New plugin utility to ease data sharing between hooks
|
32
|
+
|
33
|
+
Sometimes, plugins can grow in complexity and need to share data between its hooks.
|
34
|
+
|
35
|
+
A way to solve this can be to mutate the graphql context, but this context is not always available
|
36
|
+
in all hooks in Yoga or Hive Gateway plugins. Moreover, mutating the context gives access to your
|
37
|
+
internal data to all other plugins and graphql resolvers, without mentioning performance impact on
|
38
|
+
field access on this object.
|
39
|
+
|
40
|
+
The recommended approach to this problem was to use a `WeakMap` with a stable key (often the
|
41
|
+
`context` or `request` object). While it works, it's not very convenient for plugin developers, and
|
42
|
+
is prone to error with the choice of key.
|
43
|
+
|
44
|
+
The new `withState` utility solves this DX issue by providing an easy and straightforward API for
|
45
|
+
data sharing between hooks.
|
46
|
+
|
47
|
+
```ts
|
48
|
+
import { withState } from '@graphql-hive/gateway';
|
49
|
+
|
50
|
+
type State = { foo: string };
|
51
|
+
|
52
|
+
const myPlugin = () =>
|
53
|
+
withState<Plugin, State>(() => ({
|
54
|
+
onParse({ state }) {
|
55
|
+
state.forOperation.foo = 'foo';
|
56
|
+
},
|
57
|
+
onValidate({ state }) {
|
58
|
+
const { foo } = state.forOperation;
|
59
|
+
console.log('foo', foo);
|
60
|
+
},
|
61
|
+
}));
|
62
|
+
```
|
63
|
+
|
64
|
+
The `state` payload field will be available in all relevant hooks, making it easy to access shared
|
65
|
+
data. It also forces the developer to choose the scope for the data:
|
66
|
+
- `forOperation` for a data scoped to GraphQL operation (Envelop, Yoga and Hive Gateway)
|
67
|
+
- `forRequest` for a data scoped to HTTP request (Yoga and Hive Gateway)
|
68
|
+
- `forSubgraphExecution` for a data scoped to the subgraph execution (Hive Gateway)
|
69
|
+
|
70
|
+
Not all scopes are available in all hooks, the type reflects which scopes are available
|
71
|
+
|
72
|
+
Under the hood, those states are kept in memory using `WeakMap`, which avoid any memory leaks.
|
73
|
+
|
74
|
+
It is also possible to manually retrieve the state with the `getState` function:
|
75
|
+
|
76
|
+
```ts
|
77
|
+
const myPlugin = () =>
|
78
|
+
withState((getState) => ({
|
79
|
+
onParse({ context }) {
|
80
|
+
// You can provide a payload, which will dictate which scope you have access to.
|
81
|
+
// The scope can contain `context`, `request` and `executionRequest` fields.
|
82
|
+
const state = getState({ context });
|
83
|
+
// Use the state elsewhere.
|
84
|
+
},
|
85
|
+
}));
|
86
|
+
```
|
87
|
+
|
27
88
|
### Patch Changes
|
28
89
|
|
29
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
90
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`32fbb7b`](https://github.com/graphql-hive/gateway/commit/32fbb7b3aefe9228c29c6f7b2a785406f21d3e24) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
30
91
|
- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
|
31
92
|
|
32
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
93
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`b97d5d7`](https://github.com/graphql-hive/gateway/commit/b97d5d7d086dcaf140da83bf0c279e4a40b50fe2) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
33
94
|
- Added dependency [`@opentelemetry/api@^1.9.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/api/v/1.9.0) (to `dependencies`)
|
34
95
|
- Added dependency [`@opentelemetry/context-zone@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/context-zone/v/2.0.1) (to `dependencies`)
|
35
96
|
- Added dependency [`@opentelemetry/core@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/core/v/2.0.1) (to `dependencies`)
|
@@ -40,7 +101,7 @@
|
|
40
101
|
- Added dependency [`@opentelemetry/sampler-jaeger-remote@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/sampler-jaeger-remote/v/0.202.0) (to `dependencies`)
|
41
102
|
- Added dependency [`@opentelemetry/sdk-metrics@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-metrics/v/2.0.1) (to `dependencies`)
|
42
103
|
|
43
|
-
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`
|
104
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`76b49db`](https://github.com/graphql-hive/gateway/commit/76b49db569d9608af80a635e7cb40b1cc7d3b313) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
44
105
|
- Added dependency [`@opentelemetry/api-logs@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/api-logs/v/0.202.0) (to `dependencies`)
|
45
106
|
- Added dependency [`@opentelemetry/sdk-logs@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-logs/v/0.202.0) (to `dependencies`)
|
46
107
|
|
@@ -55,7 +116,10 @@
|
|
55
116
|
- [#1325](https://github.com/graphql-hive/gateway/pull/1325) [`910ff77`](https://github.com/graphql-hive/gateway/commit/910ff777ce787297cece37ec66c3382bc292412b) Thanks [@dependabot](https://github.com/apps/dependabot)! - dependencies updates:
|
56
117
|
- Updated dependency [`dotenv@^17.2.0` ↗︎](https://www.npmjs.com/package/dotenv/v/17.2.0) (from `^16.4.7`, in `dependencies`)
|
57
118
|
|
58
|
-
- [#
|
119
|
+
- [#1329](https://github.com/graphql-hive/gateway/pull/1329) [`ce99e43`](https://github.com/graphql-hive/gateway/commit/ce99e43b9fec43c665836bd3a282ce6d4302481d) Thanks [@dependabot](https://github.com/apps/dependabot)! - dependencies updates:
|
120
|
+
- Updated dependency [`graphql-ws@^6.0.6` ↗︎](https://www.npmjs.com/package/graphql-ws/v/6.0.6) (from `^6.0.4`, in `dependencies`)
|
121
|
+
|
122
|
+
- [#956](https://github.com/graphql-hive/gateway/pull/956) [`001c24f`](https://github.com/graphql-hive/gateway/commit/001c24fbf6de9c240a00f2cc86fc49ff75542bce) Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
59
123
|
- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
|
60
124
|
- Added dependency [`@opentelemetry/api@^1.9.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/api/v/1.9.0) (to `dependencies`)
|
61
125
|
- Added dependency [`@opentelemetry/api-logs@^0.202.0` ↗︎](https://www.npmjs.com/package/@opentelemetry/api-logs/v/0.202.0) (to `dependencies`)
|
@@ -70,20 +134,22 @@
|
|
70
134
|
- Added dependency [`@opentelemetry/sdk-metrics@^2.0.1` ↗︎](https://www.npmjs.com/package/@opentelemetry/sdk-metrics/v/2.0.1) (to `dependencies`)
|
71
135
|
- Removed dependency [`@graphql-mesh/plugin-mock@^0.105.6` ↗︎](https://www.npmjs.com/package/@graphql-mesh/plugin-mock/v/0.105.6) (from `dependencies`)
|
72
136
|
|
73
|
-
-
|
74
|
-
|
75
|
-
|
76
|
-
- @graphql-
|
77
|
-
- @graphql-
|
78
|
-
- @graphql-mesh/plugin-
|
79
|
-
- @graphql-mesh/
|
80
|
-
- @graphql-mesh/
|
81
|
-
- @graphql-
|
82
|
-
- @graphql-mesh/transport-
|
83
|
-
- @graphql-mesh/
|
84
|
-
- @graphql-hive/
|
85
|
-
- @graphql-
|
86
|
-
- @graphql-hive/
|
137
|
+
- [#1333](https://github.com/graphql-hive/gateway/pull/1333) [`ffa3753`](https://github.com/graphql-hive/gateway/commit/ffa3753ccb9045c5b2d62af05edc7f1d78336cb3) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Isomorphic environment variable getter with truthy value parsing
|
138
|
+
|
139
|
+
- Updated dependencies [[`32fbb7b`](https://github.com/graphql-hive/gateway/commit/32fbb7b3aefe9228c29c6f7b2a785406f21d3e24), [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0), [`6215001`](https://github.com/graphql-hive/gateway/commit/6215001b1d650ad865331661532bcc4f7bad6b40), [`f12f2b7`](https://github.com/graphql-hive/gateway/commit/f12f2b78163fbef797a42b5999a0b5a8ef6b2c98), [`ce99e43`](https://github.com/graphql-hive/gateway/commit/ce99e43b9fec43c665836bd3a282ce6d4302481d), [`001c24f`](https://github.com/graphql-hive/gateway/commit/001c24fbf6de9c240a00f2cc86fc49ff75542bce), [`6215001`](https://github.com/graphql-hive/gateway/commit/6215001b1d650ad865331661532bcc4f7bad6b40), [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0), [`b97d5d7`](https://github.com/graphql-hive/gateway/commit/b97d5d7d086dcaf140da83bf0c279e4a40b50fe2), [`76b49db`](https://github.com/graphql-hive/gateway/commit/76b49db569d9608af80a635e7cb40b1cc7d3b313), [`1d4bcd3`](https://github.com/graphql-hive/gateway/commit/1d4bcd3a417aa603e9b66ebc4b4dd000b25f9781), [`7cbe3f5`](https://github.com/graphql-hive/gateway/commit/7cbe3f5301cbdba1d160153761dfafaefc2aa107), [`eaf4735`](https://github.com/graphql-hive/gateway/commit/eaf4735e06023d2f0e393998a6d2075898bc82fc), [`32fbb7b`](https://github.com/graphql-hive/gateway/commit/32fbb7b3aefe9228c29c6f7b2a785406f21d3e24), [`7dafdeb`](https://github.com/graphql-hive/gateway/commit/7dafdebc803e49373fe9d53997113483e512fdb0), [`001c24f`](https://github.com/graphql-hive/gateway/commit/001c24fbf6de9c240a00f2cc86fc49ff75542bce), [`7287ffa`](https://github.com/graphql-hive/gateway/commit/7287ffa2ac0f08801c3058e96a7c4eba7102c1d0), [`6215001`](https://github.com/graphql-hive/gateway/commit/6215001b1d650ad865331661532bcc4f7bad6b40), [`ce99e43`](https://github.com/graphql-hive/gateway/commit/ce99e43b9fec43c665836bd3a282ce6d4302481d), [`ffa3753`](https://github.com/graphql-hive/gateway/commit/ffa3753ccb9045c5b2d62af05edc7f1d78336cb3), [`8273fde`](https://github.com/graphql-hive/gateway/commit/8273fde686a666fa7f974ad4f9084f8b9cb0df57), [`32fbb7b`](https://github.com/graphql-hive/gateway/commit/32fbb7b3aefe9228c29c6f7b2a785406f21d3e24), [`2fa0c8f`](https://github.com/graphql-hive/gateway/commit/2fa0c8f1dd074c9da8e6ac4086eb3009be9fdf07), [`f212e12`](https://github.com/graphql-hive/gateway/commit/f212e1289d8e0c57cb3d7ace2aca3cbbf8d38889), [`247ecfe`](https://github.com/graphql-hive/gateway/commit/247ecfe81319a4383dd33c9dba5779189e12b15d), [`9b230f3`](https://github.com/graphql-hive/gateway/commit/9b230f35b47afbf3b253e4c21720e836c5a2a8d1), [`b6c1e88`](https://github.com/graphql-hive/gateway/commit/b6c1e8812e817f616d780af4276bd7e2a7f7dbef), [`849db00`](https://github.com/graphql-hive/gateway/commit/849db001c6a8e8efeb25cc314538783a924b090e), [`c03ff30`](https://github.com/graphql-hive/gateway/commit/c03ff30aca8fab824a1e3b896f3c4359b0c84726), [`eaf4735`](https://github.com/graphql-hive/gateway/commit/eaf4735e06023d2f0e393998a6d2075898bc82fc), [`32fbb7b`](https://github.com/graphql-hive/gateway/commit/32fbb7b3aefe9228c29c6f7b2a785406f21d3e24), [`777d90b`](https://github.com/graphql-hive/gateway/commit/777d90b0ed03f113633015e48474231eda2b8398)]:
|
140
|
+
- @graphql-hive/gateway-runtime@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
141
|
+
- @graphql-hive/plugin-aws-sigv4@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
142
|
+
- @graphql-mesh/plugin-jwt-auth@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
143
|
+
- @graphql-mesh/plugin-opentelemetry@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
144
|
+
- @graphql-mesh/plugin-prometheus@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
145
|
+
- @graphql-mesh/transport-http-callback@1.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
146
|
+
- @graphql-mesh/transport-ws@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
147
|
+
- @graphql-mesh/hmac-upstream-signature@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
148
|
+
- @graphql-hive/plugin-deduplicate-request@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
149
|
+
- @graphql-mesh/transport-http@1.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
150
|
+
- @graphql-hive/importer@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
151
|
+
- @graphql-hive/pubsub@2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
152
|
+
- @graphql-hive/logger@1.0.1-next-c8fe4c675533551cd98c6101206b9395a5621f41
|
87
153
|
|
88
154
|
## 1.15.4
|
89
155
|
|
package/dist/bin.cjs
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require('dotenv/config');
|
4
4
|
var module$1 = require('node:module');
|
5
5
|
var logger = require('@graphql-hive/logger');
|
6
|
-
var cli = require('./cli-
|
6
|
+
var cli = require('./cli-B4botk_4.cjs');
|
7
7
|
require('node:cluster');
|
8
8
|
require('node:os');
|
9
9
|
require('node:path');
|
package/dist/bin.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import 'dotenv/config';
|
3
3
|
import module from 'node:module';
|
4
4
|
import { Logger } from '@graphql-hive/logger';
|
5
|
-
import { e as enableModuleCachingIfPossible, h as handleNodeWarnings, r as run } from './cli-
|
5
|
+
import { e as enableModuleCachingIfPossible, h as handleNodeWarnings, r as run } from './cli-BykXyWTB.js';
|
6
6
|
import 'node:cluster';
|
7
7
|
import 'node:os';
|
8
8
|
import 'node:path';
|
@@ -25,6 +25,34 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
25
|
var cluster__default = /*#__PURE__*/_interopDefault(cluster);
|
26
26
|
var module__default = /*#__PURE__*/_interopDefault(module$1);
|
27
27
|
|
28
|
+
function getEnvStr(key, opts = {}) {
|
29
|
+
const globalThat = opts.globalThis ?? globalThis;
|
30
|
+
let variable = globalThat.process?.env?.[key] || // @ts-expect-error can exist in wrangler and maybe other runtimes
|
31
|
+
globalThat.env?.[key] || // @ts-expect-error can exist in deno
|
32
|
+
globalThat.Deno?.env?.get(key) || // @ts-expect-error could be
|
33
|
+
globalThat[key];
|
34
|
+
if (variable != null) {
|
35
|
+
variable += "";
|
36
|
+
} else {
|
37
|
+
variable = void 0;
|
38
|
+
}
|
39
|
+
return variable?.trim();
|
40
|
+
}
|
41
|
+
function getEnvBool(key, opts = {}) {
|
42
|
+
return strToBool(getEnvStr(key, opts));
|
43
|
+
}
|
44
|
+
function getNodeEnv(opts = {}) {
|
45
|
+
return getEnvStr("NODE_ENV", opts);
|
46
|
+
}
|
47
|
+
function strToBool(str) {
|
48
|
+
return ["1", "t", "true", "y", "yes", "on", "enabled"].includes(
|
49
|
+
(str || "").toLowerCase()
|
50
|
+
);
|
51
|
+
}
|
52
|
+
function isDebug() {
|
53
|
+
return getEnvBool("DEBUG");
|
54
|
+
}
|
55
|
+
|
28
56
|
const unit = Object.create(null);
|
29
57
|
const m = 60000, h = m * 60, d = h * 24, y = d * 365.25;
|
30
58
|
|
@@ -1044,7 +1072,7 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1044
1072
|
process.exit(1);
|
1045
1073
|
}
|
1046
1074
|
return runSupergraph(ctx, config);
|
1047
|
-
}).allowUnknownOption(
|
1075
|
+
}).allowUnknownOption(getNodeEnv() === "test").allowExcessArguments(getNodeEnv() === "test");
|
1048
1076
|
async function runSupergraph({ log }, config) {
|
1049
1077
|
let absSchemaPath = null;
|
1050
1078
|
if (typeof config.supergraph === "string" && utils$1.isValidPath(config.supergraph) && !utils.isUrl(config.supergraph)) {
|
@@ -1286,9 +1314,11 @@ let cli = new extraTypings.Command().configureHelp({
|
|
1286
1314
|
).option("--disable-websockets", "Disable WebSockets support").addOption(
|
1287
1315
|
new extraTypings.Option(
|
1288
1316
|
"--jit",
|
1289
|
-
"Enable Just-In-Time compilation of GraphQL documents"
|
1317
|
+
"Enable Just-In-Time compilation of GraphQL documents (env: JIT)"
|
1290
1318
|
).env("JIT")
|
1291
|
-
)
|
1319
|
+
).on("optionEnv:jit", function() {
|
1320
|
+
this.setOptionValueWithSource("jit", getEnvBool("JIT"), "env");
|
1321
|
+
});
|
1292
1322
|
async function run(userCtx) {
|
1293
1323
|
const ctx = {
|
1294
1324
|
log: userCtx.log || new logger.Logger(),
|
@@ -1312,7 +1342,7 @@ async function run(userCtx) {
|
|
1312
1342
|
function handleNodeWarnings() {
|
1313
1343
|
const originalProcessEmitWarning = process.emitWarning.bind(process);
|
1314
1344
|
process.emitWarning = function gatewayEmitWarning(warning, ...opts) {
|
1315
|
-
if (
|
1345
|
+
if (isDebug()) {
|
1316
1346
|
originalProcessEmitWarning(warning, ...opts);
|
1317
1347
|
}
|
1318
1348
|
};
|
@@ -18,6 +18,34 @@ import { CodeFileLoader } from '@graphql-tools/code-file-loader';
|
|
18
18
|
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
|
19
19
|
import { loadTypedefs } from '@graphql-tools/load';
|
20
20
|
|
21
|
+
function getEnvStr(key, opts = {}) {
|
22
|
+
const globalThat = opts.globalThis ?? globalThis;
|
23
|
+
let variable = globalThat.process?.env?.[key] || // @ts-expect-error can exist in wrangler and maybe other runtimes
|
24
|
+
globalThat.env?.[key] || // @ts-expect-error can exist in deno
|
25
|
+
globalThat.Deno?.env?.get(key) || // @ts-expect-error could be
|
26
|
+
globalThat[key];
|
27
|
+
if (variable != null) {
|
28
|
+
variable += "";
|
29
|
+
} else {
|
30
|
+
variable = void 0;
|
31
|
+
}
|
32
|
+
return variable?.trim();
|
33
|
+
}
|
34
|
+
function getEnvBool(key, opts = {}) {
|
35
|
+
return strToBool(getEnvStr(key, opts));
|
36
|
+
}
|
37
|
+
function getNodeEnv(opts = {}) {
|
38
|
+
return getEnvStr("NODE_ENV", opts);
|
39
|
+
}
|
40
|
+
function strToBool(str) {
|
41
|
+
return ["1", "t", "true", "y", "yes", "on", "enabled"].includes(
|
42
|
+
(str || "").toLowerCase()
|
43
|
+
);
|
44
|
+
}
|
45
|
+
function isDebug() {
|
46
|
+
return getEnvBool("DEBUG");
|
47
|
+
}
|
48
|
+
|
21
49
|
const unit = Object.create(null);
|
22
50
|
const m = 60000, h = m * 60, d = h * 24, y = d * 365.25;
|
23
51
|
|
@@ -1037,7 +1065,7 @@ const addCommand = (ctx, cli) => cli.command("supergraph").description(
|
|
1037
1065
|
process.exit(1);
|
1038
1066
|
}
|
1039
1067
|
return runSupergraph(ctx, config);
|
1040
|
-
}).allowUnknownOption(
|
1068
|
+
}).allowUnknownOption(getNodeEnv() === "test").allowExcessArguments(getNodeEnv() === "test");
|
1041
1069
|
async function runSupergraph({ log }, config) {
|
1042
1070
|
let absSchemaPath = null;
|
1043
1071
|
if (typeof config.supergraph === "string" && isValidPath(config.supergraph) && !isUrl(config.supergraph)) {
|
@@ -1279,9 +1307,11 @@ let cli = new Command().configureHelp({
|
|
1279
1307
|
).option("--disable-websockets", "Disable WebSockets support").addOption(
|
1280
1308
|
new Option(
|
1281
1309
|
"--jit",
|
1282
|
-
"Enable Just-In-Time compilation of GraphQL documents"
|
1310
|
+
"Enable Just-In-Time compilation of GraphQL documents (env: JIT)"
|
1283
1311
|
).env("JIT")
|
1284
|
-
)
|
1312
|
+
).on("optionEnv:jit", function() {
|
1313
|
+
this.setOptionValueWithSource("jit", getEnvBool("JIT"), "env");
|
1314
|
+
});
|
1285
1315
|
async function run(userCtx) {
|
1286
1316
|
const ctx = {
|
1287
1317
|
log: userCtx.log || new Logger(),
|
@@ -1305,7 +1335,7 @@ async function run(userCtx) {
|
|
1305
1335
|
function handleNodeWarnings() {
|
1306
1336
|
const originalProcessEmitWarning = process.emitWarning.bind(process);
|
1307
1337
|
process.emitWarning = function gatewayEmitWarning(warning, ...opts) {
|
1308
|
-
if (
|
1338
|
+
if (isDebug()) {
|
1309
1339
|
originalProcessEmitWarning(warning, ...opts);
|
1310
1340
|
}
|
1311
1341
|
};
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
@@ -107,13 +107,13 @@ interface GatewayCLIHiveReportingOptions extends Omit<GatewayHiveReportingOption
|
|
107
107
|
/**
|
108
108
|
* The target to which the usage data should be reported to.
|
109
109
|
*
|
110
|
-
* @default
|
110
|
+
* @default env.HIVE_USAGE_TARGET
|
111
111
|
*/
|
112
112
|
target?: GatewayHiveReportingOptions['target'];
|
113
113
|
/**
|
114
114
|
* Hive registry access token for usage metrics reporting.
|
115
115
|
*
|
116
|
-
* @default
|
116
|
+
* @default env.HIVE_USAGE_ACCESS_TOKEN || env.HIVE_REGISTRY_TOKEN
|
117
117
|
*/
|
118
118
|
token?: GatewayHiveReportingOptions['token'];
|
119
119
|
}
|
package/dist/index.d.ts
CHANGED
@@ -107,13 +107,13 @@ interface GatewayCLIHiveReportingOptions extends Omit<GatewayHiveReportingOption
|
|
107
107
|
/**
|
108
108
|
* The target to which the usage data should be reported to.
|
109
109
|
*
|
110
|
-
* @default
|
110
|
+
* @default env.HIVE_USAGE_TARGET
|
111
111
|
*/
|
112
112
|
target?: GatewayHiveReportingOptions['target'];
|
113
113
|
/**
|
114
114
|
* Hive registry access token for usage metrics reporting.
|
115
115
|
*
|
116
|
-
* @default
|
116
|
+
* @default env.HIVE_USAGE_ACCESS_TOKEN || env.HIVE_REGISTRY_TOKEN
|
117
117
|
*/
|
118
118
|
token?: GatewayHiveReportingOptions['token'];
|
119
119
|
}
|
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { b as defaultOptions, d as defineConfig, e as enableModuleCachingIfPossible, a as getBuiltinPluginsFromConfig, g as getCacheInstanceFromConfig, h as handleNodeWarnings, r as run } from './cli-
|
1
|
+
export { b as defaultOptions, d as defineConfig, e as enableModuleCachingIfPossible, a as getBuiltinPluginsFromConfig, g as getCacheInstanceFromConfig, h as handleNodeWarnings, r as run } from './cli-BykXyWTB.js';
|
2
2
|
export * from '@graphql-hive/logger';
|
3
3
|
export * from '@graphql-hive/gateway-runtime';
|
4
4
|
export { PubSub } from '@graphql-hive/pubsub';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@graphql-hive/gateway",
|
3
|
-
"version": "2.0.0-next-
|
3
|
+
"version": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
4
4
|
"type": "module",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -53,28 +53,28 @@
|
|
53
53
|
"@escape.tech/graphql-armor-block-field-suggestions": "^3.0.0",
|
54
54
|
"@escape.tech/graphql-armor-max-depth": "^2.4.0",
|
55
55
|
"@escape.tech/graphql-armor-max-tokens": "^2.5.0",
|
56
|
-
"@graphql-hive/gateway-runtime": "2.0.0-next-
|
57
|
-
"@graphql-hive/importer": "2.0.0-next-
|
58
|
-
"@graphql-hive/logger": "1.0.1-next-
|
59
|
-
"@graphql-hive/plugin-aws-sigv4": "2.0.0-next-
|
60
|
-
"@graphql-hive/plugin-deduplicate-request": "2.0.0-next-
|
61
|
-
"@graphql-hive/pubsub": "2.0.0-next-
|
56
|
+
"@graphql-hive/gateway-runtime": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
57
|
+
"@graphql-hive/importer": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
58
|
+
"@graphql-hive/logger": "1.0.1-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
59
|
+
"@graphql-hive/plugin-aws-sigv4": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
60
|
+
"@graphql-hive/plugin-deduplicate-request": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
61
|
+
"@graphql-hive/pubsub": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
62
62
|
"@graphql-mesh/cache-cfw-kv": "^0.105.5",
|
63
63
|
"@graphql-mesh/cache-localforage": "^0.105.6",
|
64
64
|
"@graphql-mesh/cache-redis": "^0.104.5",
|
65
65
|
"@graphql-mesh/cache-upstash-redis": "^0.1.5",
|
66
66
|
"@graphql-mesh/cross-helpers": "^0.4.10",
|
67
|
-
"@graphql-mesh/hmac-upstream-signature": "2.0.0-next-
|
67
|
+
"@graphql-mesh/hmac-upstream-signature": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
68
68
|
"@graphql-mesh/plugin-http-cache": "^0.105.6",
|
69
69
|
"@graphql-mesh/plugin-jit": "^0.2.5",
|
70
|
-
"@graphql-mesh/plugin-jwt-auth": "2.0.0-next-
|
71
|
-
"@graphql-mesh/plugin-opentelemetry": "2.0.0-next-
|
72
|
-
"@graphql-mesh/plugin-prometheus": "2.0.0-next-
|
70
|
+
"@graphql-mesh/plugin-jwt-auth": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
71
|
+
"@graphql-mesh/plugin-opentelemetry": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
72
|
+
"@graphql-mesh/plugin-prometheus": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
73
73
|
"@graphql-mesh/plugin-rate-limit": "^0.104.5",
|
74
74
|
"@graphql-mesh/plugin-snapshot": "^0.104.5",
|
75
|
-
"@graphql-mesh/transport-http": "1.0.0-next-
|
76
|
-
"@graphql-mesh/transport-http-callback": "1.0.0-next-
|
77
|
-
"@graphql-mesh/transport-ws": "2.0.0-next-
|
75
|
+
"@graphql-mesh/transport-http": "1.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
76
|
+
"@graphql-mesh/transport-http-callback": "1.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
77
|
+
"@graphql-mesh/transport-ws": "2.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
78
78
|
"@graphql-mesh/types": "^0.104.5",
|
79
79
|
"@graphql-mesh/utils": "^0.104.5",
|
80
80
|
"@graphql-tools/code-file-loader": "^8.1.15",
|
@@ -95,13 +95,13 @@
|
|
95
95
|
"@opentelemetry/sdk-metrics": "^2.0.1",
|
96
96
|
"commander": "^13.1.0",
|
97
97
|
"dotenv": "^17.2.0",
|
98
|
-
"graphql-ws": "^6.0.
|
98
|
+
"graphql-ws": "^6.0.6",
|
99
99
|
"graphql-yoga": "^5.15.1",
|
100
100
|
"tslib": "^2.8.1",
|
101
101
|
"ws": "^8.18.3"
|
102
102
|
},
|
103
103
|
"devDependencies": {
|
104
|
-
"@graphql-mesh/transport-common": "1.0.0-next-
|
104
|
+
"@graphql-mesh/transport-common": "1.0.0-next-c8fe4c675533551cd98c6101206b9395a5621f41",
|
105
105
|
"@graphql-mesh/transport-soap": "^0.10.6",
|
106
106
|
"@graphql-tools/executor": "^1.4.7",
|
107
107
|
"@rollup/plugin-commonjs": "^28.0.0",
|
@@ -112,7 +112,7 @@
|
|
112
112
|
"@types/adm-zip": "^0.5.5",
|
113
113
|
"@types/bun": "1.2.18",
|
114
114
|
"@types/ws": "^8.5.12",
|
115
|
-
"@whatwg-node/fetch": "^0.10.
|
115
|
+
"@whatwg-node/fetch": "^0.10.9",
|
116
116
|
"adm-zip": "^0.5.15",
|
117
117
|
"bun": "^1.2.18",
|
118
118
|
"graphql": "^16.9.0",
|