@graphql-tools/url-loader 7.9.10-alpha-66bd3d52.0 → 7.9.10

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.
@@ -1,3 +1,3 @@
1
- import crossUndiciFetch from 'cross-undici-fetch';
2
- export declare type AsyncFetchFn = typeof crossUndiciFetch.fetch;
1
+ import { fetch } from 'cross-undici-fetch';
2
+ export declare type AsyncFetchFn = typeof fetch;
3
3
  export declare const defaultAsyncFetch: AsyncFetchFn;
package/index.d.ts CHANGED
@@ -124,7 +124,7 @@ export declare class UrlLoader implements Loader<LoadFromUrlOptions> {
124
124
  buildHTTPExecutor(endpoint: string, fetch: AsyncFetchFn, options?: LoadFromUrlOptions): AsyncExecutor<any, ExecutionExtensions>;
125
125
  buildWSExecutor(subscriptionsEndpoint: string, webSocketImpl: typeof WebSocket, connectionParams?: ClientOptions['connectionParams']): Executor;
126
126
  buildWSLegacyExecutor(subscriptionsEndpoint: string, webSocketImpl: typeof WebSocket, connectionParams?: ConnectionParamsOptions): Executor;
127
- buildGraphQLSSEExecutor(url: string, fetchFn: AsyncFetchFn, options?: Omit<LoadFromUrlOptions, 'subscriptionEndpoint'>): AsyncExecutor;
127
+ buildGraphQLSSEExecutor(endpoint: string, fetch: AsyncFetchFn, options?: Omit<LoadFromUrlOptions, 'subscriptionEndpoint'>): AsyncExecutor;
128
128
  getFetch(customFetch: LoadFromUrlOptions['customFetch'], importFn: AsyncImportFn): PromiseLike<AsyncFetchFn> | AsyncFetchFn;
129
129
  getFetch(customFetch: LoadFromUrlOptions['customFetch'], importFn: SyncImportFn): SyncFetchFn;
130
130
  private getDefaultMethodFromOptions;
package/index.js CHANGED
@@ -33,7 +33,7 @@ const extractFiles = require('extract-files');
33
33
  const subscriptionsTransportWs = require('subscriptions-transport-ws');
34
34
  const valueOrPromise = require('value-or-promise');
35
35
  const graphqlLiveQuery = require('@n1ru4l/graphql-live-query');
36
- const crossUndiciFetch = _interopDefault(require('cross-undici-fetch'));
36
+ const crossUndiciFetch = require('cross-undici-fetch');
37
37
  const syncFetchImported = _interopDefault(require('sync-fetch'));
38
38
  const node = require('meros/node');
39
39
  const browser = require('meros/browser');
@@ -598,12 +598,12 @@ class UrlLoader {
598
598
  }));
599
599
  };
600
600
  }
601
- buildGraphQLSSEExecutor(url, fetchFn, options = {}) {
601
+ buildGraphQLSSEExecutor(endpoint, fetch, options = {}) {
602
602
  const { headers } = options;
603
603
  const client = graphqlSse.createClient({
604
604
  ...options.graphqlSseOptions,
605
- url,
606
- fetchFn,
605
+ url: endpoint,
606
+ fetchFn: fetch,
607
607
  abortControllerImpl: crossUndiciFetch.AbortController,
608
608
  headers,
609
609
  });
package/index.mjs CHANGED
@@ -8,14 +8,14 @@ import { extractFiles, isExtractableFile } from 'extract-files';
8
8
  import { SubscriptionClient } from 'subscriptions-transport-ws';
9
9
  import { ValueOrPromise } from 'value-or-promise';
10
10
  import { isLiveQueryOperationDefinitionNode } from '@n1ru4l/graphql-live-query';
11
- import crossUndiciFetch from 'cross-undici-fetch';
11
+ import { fetch, FormData, AbortController, File } from 'cross-undici-fetch';
12
12
  import syncFetchImported from 'sync-fetch';
13
13
  import { meros } from 'meros/node';
14
14
  import { meros as meros$1 } from 'meros/browser';
15
15
  import { dset } from 'dset/merge';
16
16
 
17
17
  const defaultAsyncFetch = async (input, init) => {
18
- return crossUndiciFetch.fetch(input, init);
18
+ return fetch(input, init);
19
19
  };
20
20
 
21
21
  const defaultSyncFetch = (input, init) => {
@@ -309,7 +309,7 @@ class UrlLoader {
309
309
  uploads[currIndex] = file;
310
310
  currIndex++;
311
311
  }
312
- const form = new crossUndiciFetch.FormData();
312
+ const form = new FormData();
313
313
  form.append('operations', JSON.stringify({
314
314
  query,
315
315
  variables: clone,
@@ -327,7 +327,7 @@ class UrlLoader {
327
327
  }
328
328
  else if (isBlob(upload)) {
329
329
  return upload.arrayBuffer().then((arrayBuffer) => {
330
- form.append(indexStr, new crossUndiciFetch.File([arrayBuffer], filename, { type: upload.type }), filename);
330
+ form.append(indexStr, new File([arrayBuffer], filename, { type: upload.type }), filename);
331
331
  });
332
332
  }
333
333
  else if (isGraphQLUpload(upload)) {
@@ -340,11 +340,11 @@ class UrlLoader {
340
340
  }
341
341
  }
342
342
  const blobPart = new Uint8Array(chunks);
343
- form.append(indexStr, new crossUndiciFetch.File([blobPart], filename, { type: upload.mimetype }), filename);
343
+ form.append(indexStr, new File([blobPart], filename, { type: upload.mimetype }), filename);
344
344
  });
345
345
  }
346
346
  else {
347
- form.append(indexStr, new crossUndiciFetch.File([upload], filename), filename);
347
+ form.append(indexStr, new File([upload], filename), filename);
348
348
  }
349
349
  }
350
350
  }
@@ -385,7 +385,7 @@ class UrlLoader {
385
385
  });
386
386
  const executor = (request) => {
387
387
  var _a, _b;
388
- const controller = new crossUndiciFetch.AbortController();
388
+ const controller = new AbortController();
389
389
  let method = defaultMethod;
390
390
  if (options === null || options === void 0 ? void 0 : options.useGETForQueries) {
391
391
  const operationAst = getOperationASTFromRequest(request);
@@ -574,13 +574,13 @@ class UrlLoader {
574
574
  }));
575
575
  };
576
576
  }
577
- buildGraphQLSSEExecutor(url, fetchFn, options = {}) {
577
+ buildGraphQLSSEExecutor(endpoint, fetch, options = {}) {
578
578
  const { headers } = options;
579
579
  const client = createClient$1({
580
580
  ...options.graphqlSseOptions,
581
- url,
582
- fetchFn,
583
- abortControllerImpl: crossUndiciFetch.AbortController,
581
+ url: endpoint,
582
+ fetchFn: fetch,
583
+ abortControllerImpl: AbortController,
584
584
  headers,
585
585
  });
586
586
  return async ({ document, variables, operationName, extensions }) => {
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@graphql-tools/url-loader",
3
- "version": "7.9.10-alpha-66bd3d52.0",
3
+ "version": "7.9.10",
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.3-alpha-66bd3d52.0",
10
+ "@graphql-tools/delegate": "8.7.3",
11
11
  "@graphql-tools/utils": "8.6.6",
12
- "@graphql-tools/wrap": "8.4.12-alpha-66bd3d52.0",
12
+ "@graphql-tools/wrap": "8.4.12",
13
13
  "@n1ru4l/graphql-live-query": "^0.9.0",
14
14
  "@types/websocket": "^1.0.4",
15
15
  "@types/ws": "^8.0.0",
16
- "cross-undici-fetch": "^0.2.0",
16
+ "cross-undici-fetch": "^0.2.4",
17
17
  "dset": "^3.1.0",
18
18
  "extract-files": "^11.0.0",
19
19
  "graphql-sse": "^1.0.1",