@graphql-tools/links 10.0.5 → 10.0.6-alpha-20251202002629-24f3be16a0bd42410a1d46779fa2b73cffa89919
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.
|
@@ -14,6 +14,12 @@ function getFinalPromise(object) {
|
|
|
14
14
|
return Promise.all(resolvedObject.map(o => getFinalPromise(o)));
|
|
15
15
|
}
|
|
16
16
|
else if (typeof resolvedObject === 'object') {
|
|
17
|
+
if (resolvedObject?.createReadStream != null) {
|
|
18
|
+
const readable = resolvedObject.createReadStream();
|
|
19
|
+
return readable
|
|
20
|
+
.toArray()
|
|
21
|
+
.then(chunks => new File(chunks, resolvedObject.filename, { type: resolvedObject.mimetype }));
|
|
22
|
+
}
|
|
17
23
|
const keys = Object.keys(resolvedObject);
|
|
18
24
|
return Promise.all(keys.map(key => getFinalPromise(resolvedObject[key]))).then(awaitedValues => {
|
|
19
25
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -2,29 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createServerHttpLink = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const formDataAppendFile_mjs_1 = tslib_1.__importDefault(require("apollo-upload-client/formDataAppendFile.mjs"));
|
|
6
|
-
const isExtractableFile_mjs_1 = tslib_1.__importDefault(require("apollo-upload-client/isExtractableFile.mjs"));
|
|
7
5
|
const UploadHttpLink_mjs_1 = tslib_1.__importDefault(require("apollo-upload-client/UploadHttpLink.mjs"));
|
|
8
|
-
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
9
|
-
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
10
6
|
const apolloImport = tslib_1.__importStar(require("@apollo/client"));
|
|
11
7
|
const AwaitVariablesLink_js_1 = require("./AwaitVariablesLink.js");
|
|
12
8
|
const apollo = apolloImport?.default ?? apolloImport;
|
|
13
|
-
const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink_js_1.AwaitVariablesLink(), new UploadHttpLink_mjs_1.default(
|
|
14
|
-
...options,
|
|
15
|
-
fetch: node_fetch_1.default,
|
|
16
|
-
FormData: form_data_1.default,
|
|
17
|
-
isExtractableFile: (value) => (0, isExtractableFile_mjs_1.default)(value) || value?.createReadStream,
|
|
18
|
-
formDataAppendFile: (form, index, file) => {
|
|
19
|
-
if (file.createReadStream != null) {
|
|
20
|
-
form.append(index, file.createReadStream(), {
|
|
21
|
-
filename: file.filename,
|
|
22
|
-
contentType: file.mimetype,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
(0, formDataAppendFile_mjs_1.default)(form, index, file);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
}));
|
|
9
|
+
const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink_js_1.AwaitVariablesLink(), new UploadHttpLink_mjs_1.default(options));
|
|
30
10
|
exports.createServerHttpLink = createServerHttpLink;
|
|
@@ -10,6 +10,12 @@ function getFinalPromise(object) {
|
|
|
10
10
|
return Promise.all(resolvedObject.map(o => getFinalPromise(o)));
|
|
11
11
|
}
|
|
12
12
|
else if (typeof resolvedObject === 'object') {
|
|
13
|
+
if (resolvedObject?.createReadStream != null) {
|
|
14
|
+
const readable = resolvedObject.createReadStream();
|
|
15
|
+
return readable
|
|
16
|
+
.toArray()
|
|
17
|
+
.then(chunks => new File(chunks, resolvedObject.filename, { type: resolvedObject.mimetype }));
|
|
18
|
+
}
|
|
13
19
|
const keys = Object.keys(resolvedObject);
|
|
14
20
|
return Promise.all(keys.map(key => getFinalPromise(resolvedObject[key]))).then(awaitedValues => {
|
|
15
21
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
import formDataAppendFile from 'apollo-upload-client/formDataAppendFile.mjs';
|
|
2
|
-
import isExtractableFile from 'apollo-upload-client/isExtractableFile.mjs';
|
|
3
1
|
import UploadHttpLink from 'apollo-upload-client/UploadHttpLink.mjs';
|
|
4
|
-
import FormData from 'form-data';
|
|
5
|
-
import fetch from 'node-fetch';
|
|
6
2
|
import * as apolloImport from '@apollo/client';
|
|
7
3
|
import { AwaitVariablesLink } from './AwaitVariablesLink.js';
|
|
8
4
|
const apollo = apolloImport?.default ?? apolloImport;
|
|
9
|
-
export const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink(), new UploadHttpLink(
|
|
10
|
-
...options,
|
|
11
|
-
fetch,
|
|
12
|
-
FormData,
|
|
13
|
-
isExtractableFile: (value) => isExtractableFile(value) || value?.createReadStream,
|
|
14
|
-
formDataAppendFile: (form, index, file) => {
|
|
15
|
-
if (file.createReadStream != null) {
|
|
16
|
-
form.append(index, file.createReadStream(), {
|
|
17
|
-
filename: file.filename,
|
|
18
|
-
contentType: file.mimetype,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
formDataAppendFile(form, index, file);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
}));
|
|
5
|
+
export const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink(), new UploadHttpLink(options));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/links",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.6-alpha-20251202002629-24f3be16a0bd42410a1d46779fa2b73cffa89919",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
@@ -8,11 +8,8 @@
|
|
|
8
8
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@graphql-tools/delegate": "^11.1.2",
|
|
12
11
|
"@graphql-tools/utils": "^10.11.0",
|
|
13
12
|
"apollo-upload-client": "^19.0.0",
|
|
14
|
-
"form-data": "^4.0.0",
|
|
15
|
-
"node-fetch": "^2.6.5",
|
|
16
13
|
"tslib": "^2.4.0"
|
|
17
14
|
},
|
|
18
15
|
"repository": {
|