@graphql-tools/url-loader 7.9.18 → 7.9.21
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/index.js +22 -16
- package/index.mjs +22 -16
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -435,7 +435,7 @@ class UrlLoader {
|
|
|
435
435
|
method = 'GET';
|
|
436
436
|
}
|
|
437
437
|
let accept = 'application/json, multipart/mixed';
|
|
438
|
-
if (operationType === 'subscription') {
|
|
438
|
+
if (operationType === 'subscription' || graphqlLiveQuery.isLiveQueryOperationDefinitionNode(operationAst)) {
|
|
439
439
|
method = 'GET';
|
|
440
440
|
accept = 'text/event-stream';
|
|
441
441
|
}
|
|
@@ -739,23 +739,29 @@ class UrlLoader {
|
|
|
739
739
|
const httpExecutor$ = fetch$.then(fetch => {
|
|
740
740
|
return this.buildHTTPExecutor(endpoint, fetch, options);
|
|
741
741
|
});
|
|
742
|
-
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
742
|
+
if ((options === null || options === void 0 ? void 0 : options.subscriptionsEndpoint) != null || (options === null || options === void 0 ? void 0 : options.subscriptionsProtocol) !== exports.SubscriptionProtocol.SSE) {
|
|
743
|
+
const subscriptionExecutor$ = fetch$.then(fetch => {
|
|
744
|
+
const subscriptionsEndpoint = (options === null || options === void 0 ? void 0 : options.subscriptionsEndpoint) || endpoint;
|
|
745
|
+
return this.buildSubscriptionExecutor(subscriptionsEndpoint, fetch, importFn, options);
|
|
746
|
+
});
|
|
747
|
+
// eslint-disable-next-line no-inner-declarations
|
|
748
|
+
function getExecutorByRequest(request) {
|
|
749
|
+
const operationAst = utils.getOperationASTFromRequest(request);
|
|
750
|
+
if (operationAst.operation === 'subscription' ||
|
|
751
|
+
graphqlLiveQuery.isLiveQueryOperationDefinitionNode(operationAst, request.variables)) {
|
|
752
|
+
return subscriptionExecutor$;
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
return httpExecutor$;
|
|
756
|
+
}
|
|
754
757
|
}
|
|
758
|
+
return request => getExecutorByRequest(request)
|
|
759
|
+
.then(executor => executor(request))
|
|
760
|
+
.resolve();
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
return request => httpExecutor$.then(executor => executor(request)).resolve();
|
|
755
764
|
}
|
|
756
|
-
return request => getExecutorByRequest(request)
|
|
757
|
-
.then(executor => executor(request))
|
|
758
|
-
.resolve();
|
|
759
765
|
}
|
|
760
766
|
getExecutorAsync(endpoint, options) {
|
|
761
767
|
return this.getExecutor(endpoint, asyncImport, options);
|
package/index.mjs
CHANGED
|
@@ -411,7 +411,7 @@ class UrlLoader {
|
|
|
411
411
|
method = 'GET';
|
|
412
412
|
}
|
|
413
413
|
let accept = 'application/json, multipart/mixed';
|
|
414
|
-
if (operationType === 'subscription') {
|
|
414
|
+
if (operationType === 'subscription' || isLiveQueryOperationDefinitionNode(operationAst)) {
|
|
415
415
|
method = 'GET';
|
|
416
416
|
accept = 'text/event-stream';
|
|
417
417
|
}
|
|
@@ -715,23 +715,29 @@ class UrlLoader {
|
|
|
715
715
|
const httpExecutor$ = fetch$.then(fetch => {
|
|
716
716
|
return this.buildHTTPExecutor(endpoint, fetch, options);
|
|
717
717
|
});
|
|
718
|
-
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
718
|
+
if ((options === null || options === void 0 ? void 0 : options.subscriptionsEndpoint) != null || (options === null || options === void 0 ? void 0 : options.subscriptionsProtocol) !== SubscriptionProtocol.SSE) {
|
|
719
|
+
const subscriptionExecutor$ = fetch$.then(fetch => {
|
|
720
|
+
const subscriptionsEndpoint = (options === null || options === void 0 ? void 0 : options.subscriptionsEndpoint) || endpoint;
|
|
721
|
+
return this.buildSubscriptionExecutor(subscriptionsEndpoint, fetch, importFn, options);
|
|
722
|
+
});
|
|
723
|
+
// eslint-disable-next-line no-inner-declarations
|
|
724
|
+
function getExecutorByRequest(request) {
|
|
725
|
+
const operationAst = getOperationASTFromRequest(request);
|
|
726
|
+
if (operationAst.operation === 'subscription' ||
|
|
727
|
+
isLiveQueryOperationDefinitionNode(operationAst, request.variables)) {
|
|
728
|
+
return subscriptionExecutor$;
|
|
729
|
+
}
|
|
730
|
+
else {
|
|
731
|
+
return httpExecutor$;
|
|
732
|
+
}
|
|
730
733
|
}
|
|
734
|
+
return request => getExecutorByRequest(request)
|
|
735
|
+
.then(executor => executor(request))
|
|
736
|
+
.resolve();
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
return request => httpExecutor$.then(executor => executor(request)).resolve();
|
|
731
740
|
}
|
|
732
|
-
return request => getExecutorByRequest(request)
|
|
733
|
-
.then(executor => executor(request))
|
|
734
|
-
.resolve();
|
|
735
741
|
}
|
|
736
742
|
getExecutorAsync(endpoint, options) {
|
|
737
743
|
return this.getExecutor(endpoint, asyncImport, options);
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/url-loader",
|
|
3
|
-
"version": "7.9.
|
|
3
|
+
"version": "7.9.21",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/delegate": "8.7.
|
|
11
|
-
"@graphql-tools/utils": "8.6.
|
|
12
|
-
"@graphql-tools/wrap": "8.4.
|
|
10
|
+
"@graphql-tools/delegate": "8.7.8",
|
|
11
|
+
"@graphql-tools/utils": "8.6.10",
|
|
12
|
+
"@graphql-tools/wrap": "8.4.17",
|
|
13
13
|
"@n1ru4l/graphql-live-query": "^0.9.0",
|
|
14
14
|
"@types/ws": "^8.0.0",
|
|
15
|
-
"cross-undici-fetch": "^0.
|
|
15
|
+
"cross-undici-fetch": "^0.4.0",
|
|
16
16
|
"dset": "^3.1.0",
|
|
17
17
|
"extract-files": "^11.0.0",
|
|
18
18
|
"graphql-ws": "^5.4.1",
|