@graphql-tools/url-loader 7.8.0-alpha-696c179a.0 → 7.8.0
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.d.ts +4 -0
- package/index.js +4 -3
- package/index.mjs +4 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -89,6 +89,10 @@ export interface LoadFromUrlOptions extends BaseLoaderOptions, Partial<Introspec
|
|
|
89
89
|
* Timeout in milliseconds
|
|
90
90
|
*/
|
|
91
91
|
timeout?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Request Credentials
|
|
94
|
+
*/
|
|
95
|
+
credentials?: RequestCredentials;
|
|
92
96
|
}
|
|
93
97
|
/**
|
|
94
98
|
* This loader loads a schema from a URL. The loaded schema is a fully-executable,
|
package/index.js
CHANGED
|
@@ -448,6 +448,7 @@ class UrlLoader {
|
|
|
448
448
|
}
|
|
449
449
|
}, options.timeout);
|
|
450
450
|
}
|
|
451
|
+
const credentials = (options === null || options === void 0 ? void 0 : options.credentials) || 'same-origin';
|
|
451
452
|
return new valueOrPromise.ValueOrPromise(() => {
|
|
452
453
|
switch (method) {
|
|
453
454
|
case 'GET':
|
|
@@ -457,7 +458,7 @@ class UrlLoader {
|
|
|
457
458
|
});
|
|
458
459
|
return fetch(finalUrl, {
|
|
459
460
|
method: 'GET',
|
|
460
|
-
credentials
|
|
461
|
+
credentials,
|
|
461
462
|
headers: {
|
|
462
463
|
accept,
|
|
463
464
|
...headers,
|
|
@@ -469,7 +470,7 @@ class UrlLoader {
|
|
|
469
470
|
return new valueOrPromise.ValueOrPromise(() => this.createFormDataFromVariables(requestBody))
|
|
470
471
|
.then(form => fetch(HTTP_URL, {
|
|
471
472
|
method: 'POST',
|
|
472
|
-
credentials
|
|
473
|
+
credentials,
|
|
473
474
|
body: form,
|
|
474
475
|
headers: {
|
|
475
476
|
accept,
|
|
@@ -482,7 +483,7 @@ class UrlLoader {
|
|
|
482
483
|
else {
|
|
483
484
|
return fetch(HTTP_URL, {
|
|
484
485
|
method: 'POST',
|
|
485
|
-
credentials
|
|
486
|
+
credentials,
|
|
486
487
|
body: JSON.stringify(requestBody),
|
|
487
488
|
headers: {
|
|
488
489
|
accept,
|
package/index.mjs
CHANGED
|
@@ -424,6 +424,7 @@ class UrlLoader {
|
|
|
424
424
|
}
|
|
425
425
|
}, options.timeout);
|
|
426
426
|
}
|
|
427
|
+
const credentials = (options === null || options === void 0 ? void 0 : options.credentials) || 'same-origin';
|
|
427
428
|
return new ValueOrPromise(() => {
|
|
428
429
|
switch (method) {
|
|
429
430
|
case 'GET':
|
|
@@ -433,7 +434,7 @@ class UrlLoader {
|
|
|
433
434
|
});
|
|
434
435
|
return fetch(finalUrl, {
|
|
435
436
|
method: 'GET',
|
|
436
|
-
credentials
|
|
437
|
+
credentials,
|
|
437
438
|
headers: {
|
|
438
439
|
accept,
|
|
439
440
|
...headers,
|
|
@@ -445,7 +446,7 @@ class UrlLoader {
|
|
|
445
446
|
return new ValueOrPromise(() => this.createFormDataFromVariables(requestBody))
|
|
446
447
|
.then(form => fetch(HTTP_URL, {
|
|
447
448
|
method: 'POST',
|
|
448
|
-
credentials
|
|
449
|
+
credentials,
|
|
449
450
|
body: form,
|
|
450
451
|
headers: {
|
|
451
452
|
accept,
|
|
@@ -458,7 +459,7 @@ class UrlLoader {
|
|
|
458
459
|
else {
|
|
459
460
|
return fetch(HTTP_URL, {
|
|
460
461
|
method: 'POST',
|
|
461
|
-
credentials
|
|
462
|
+
credentials,
|
|
462
463
|
body: JSON.stringify(requestBody),
|
|
463
464
|
headers: {
|
|
464
465
|
accept,
|