@graphql-tools/executor-http 2.0.0 → 2.1.0-alpha-ba674329a112eb8f0050a56cfdf3bd400af7dc30
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 +6 -0
- package/dist/index.cjs +20 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @graphql-tools/executor-http
|
|
2
2
|
|
|
3
|
+
## 2.1.0-alpha-ba674329a112eb8f0050a56cfdf3bd400af7dc30
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1017](https://github.com/graphql-hive/gateway/pull/1017) [`020ed94`](https://github.com/graphql-hive/gateway/commit/020ed945602b9de66dd3b62abe17f5c662241129) Thanks [@ardatan](https://github.com/ardatan)! - Support dynamic values in GraphQL HTTP Transport as in other transports GraphQL Mesh has since v0. So `endpoint` can be `{env.SOME_ENDPOINT}` can dynamically be filled
|
|
8
|
+
|
|
3
9
|
## 2.0.0
|
|
4
10
|
|
|
5
11
|
### Major Changes
|
package/dist/index.cjs
CHANGED
|
@@ -541,7 +541,26 @@ function buildHTTPExecutor(options) {
|
|
|
541
541
|
} else {
|
|
542
542
|
method ||= "POST";
|
|
543
543
|
}
|
|
544
|
-
|
|
544
|
+
let endpoint;
|
|
545
|
+
if (request.extensions?.endpoint) {
|
|
546
|
+
if (typeof request.extensions.endpoint === "string") {
|
|
547
|
+
endpoint = request.extensions.endpoint;
|
|
548
|
+
}
|
|
549
|
+
if (typeof request.extensions.endpoint === "function") {
|
|
550
|
+
endpoint = request.extensions.endpoint(request);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (!endpoint) {
|
|
554
|
+
if (typeof options?.endpoint === "string") {
|
|
555
|
+
endpoint = options.endpoint;
|
|
556
|
+
}
|
|
557
|
+
if (typeof options?.endpoint === "function") {
|
|
558
|
+
endpoint = options.endpoint(request);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (!endpoint) {
|
|
562
|
+
endpoint = "/graphql";
|
|
563
|
+
}
|
|
545
564
|
const headers = { accept };
|
|
546
565
|
if (options?.headers) {
|
|
547
566
|
Object.assign(
|
package/dist/index.d.cts
CHANGED
|
@@ -18,7 +18,7 @@ interface HTTPExecutorOptions {
|
|
|
18
18
|
* The endpoint to use when querying the upstream API
|
|
19
19
|
* @default '/graphql'
|
|
20
20
|
*/
|
|
21
|
-
endpoint?: string;
|
|
21
|
+
endpoint?: string | ((executorRequest?: ExecutionRequest) => string);
|
|
22
22
|
/**
|
|
23
23
|
* The WHATWG compatible fetch implementation to use
|
|
24
24
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ interface HTTPExecutorOptions {
|
|
|
18
18
|
* The endpoint to use when querying the upstream API
|
|
19
19
|
* @default '/graphql'
|
|
20
20
|
*/
|
|
21
|
-
endpoint?: string;
|
|
21
|
+
endpoint?: string | ((executorRequest?: ExecutionRequest) => string);
|
|
22
22
|
/**
|
|
23
23
|
* The WHATWG compatible fetch implementation to use
|
|
24
24
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
package/dist/index.js
CHANGED
|
@@ -539,7 +539,26 @@ function buildHTTPExecutor(options) {
|
|
|
539
539
|
} else {
|
|
540
540
|
method ||= "POST";
|
|
541
541
|
}
|
|
542
|
-
|
|
542
|
+
let endpoint;
|
|
543
|
+
if (request.extensions?.endpoint) {
|
|
544
|
+
if (typeof request.extensions.endpoint === "string") {
|
|
545
|
+
endpoint = request.extensions.endpoint;
|
|
546
|
+
}
|
|
547
|
+
if (typeof request.extensions.endpoint === "function") {
|
|
548
|
+
endpoint = request.extensions.endpoint(request);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (!endpoint) {
|
|
552
|
+
if (typeof options?.endpoint === "string") {
|
|
553
|
+
endpoint = options.endpoint;
|
|
554
|
+
}
|
|
555
|
+
if (typeof options?.endpoint === "function") {
|
|
556
|
+
endpoint = options.endpoint(request);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (!endpoint) {
|
|
560
|
+
endpoint = "/graphql";
|
|
561
|
+
}
|
|
543
562
|
const headers = { accept };
|
|
544
563
|
if (options?.headers) {
|
|
545
564
|
Object.assign(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/executor-http",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0-alpha-ba674329a112eb8f0050a56cfdf3bd400af7dc30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"extract-files": "13.0.0",
|
|
57
57
|
"graphql": "^16.9.0",
|
|
58
58
|
"graphql-yoga": "^5.13.4",
|
|
59
|
-
"pkgroll": "2.12.
|
|
59
|
+
"pkgroll": "2.12.2"
|
|
60
60
|
},
|
|
61
61
|
"sideEffects": false
|
|
62
62
|
}
|