Initial Sample.
This commit is contained in:
7
graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.d.ts
generated
vendored
Normal file
7
graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { ApolloLink } from "../core/index.js";
|
||||
import type { HttpOptions } from "./selectHttpOptionsAndBody.js";
|
||||
export declare class HttpLink extends ApolloLink {
|
||||
options: HttpOptions;
|
||||
constructor(options?: HttpOptions);
|
||||
}
|
||||
//# sourceMappingURL=HttpLink.d.ts.map
|
||||
15
graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js
generated
vendored
Normal file
15
graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { __extends } from "tslib";
|
||||
import { ApolloLink } from "../core/index.js";
|
||||
import { createHttpLink } from "./createHttpLink.js";
|
||||
var HttpLink = /** @class */ (function (_super) {
|
||||
__extends(HttpLink, _super);
|
||||
function HttpLink(options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var _this = _super.call(this, createHttpLink(options).request) || this;
|
||||
_this.options = options;
|
||||
return _this;
|
||||
}
|
||||
return HttpLink;
|
||||
}(ApolloLink));
|
||||
export { HttpLink };
|
||||
//# sourceMappingURL=HttpLink.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/HttpLink.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"HttpLink.js","sourceRoot":"","sources":["../../../src/link/http/HttpLink.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;IAA8B,4BAAU;IACtC,kBAAmB,OAAyB;QAAzB,wBAAA,EAAA,YAAyB;QAC1C,YAAA,MAAK,YAAC,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,SAAC;QADtB,aAAO,GAAP,OAAO,CAAkB;;IAE5C,CAAC;IACH,eAAC;AAAD,CAAC,AAJD,CAA8B,UAAU,GAIvC","sourcesContent":["import { ApolloLink } from \"../core/index.js\";\nimport type { HttpOptions } from \"./selectHttpOptionsAndBody.js\";\nimport { createHttpLink } from \"./createHttpLink.js\";\n\nexport class HttpLink extends ApolloLink {\n constructor(public options: HttpOptions = {}) {\n super(createHttpLink(options).request);\n }\n}\n"]}
|
||||
2
graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.d.ts
generated
vendored
Normal file
2
graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const checkFetcher: (fetcher: typeof fetch | undefined) => void;
|
||||
//# sourceMappingURL=checkFetcher.d.ts.map
|
||||
7
graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js
generated
vendored
Normal file
7
graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { newInvariantError } from "../../utilities/globals/index.js";
|
||||
export var checkFetcher = function (fetcher) {
|
||||
if (!fetcher && typeof fetch === "undefined") {
|
||||
throw newInvariantError(37);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=checkFetcher.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/checkFetcher.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"checkFetcher.js","sourceRoot":"","sources":["../../../src/link/http/checkFetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,OAAiC;IAC5D,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QAC7C,MAAM,iBAAiB,CAAC,obAWvB,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { newInvariantError } from \"../../utilities/globals/index.js\";\n\nexport const checkFetcher = (fetcher: typeof fetch | undefined) => {\n if (!fetcher && typeof fetch === \"undefined\") {\n throw newInvariantError(`\n\"fetch\" has not been found globally and no fetcher has been \\\nconfigured. To fix this, install a fetch package (like \\\nhttps://www.npmjs.com/package/cross-fetch), instantiate the \\\nfetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n `);\n }\n};\n"]}
|
||||
4
graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.d.ts
generated
vendored
Normal file
4
graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { ApolloLink } from "../core/index.js";
|
||||
import type { HttpOptions } from "./selectHttpOptionsAndBody.js";
|
||||
export declare const createHttpLink: (linkOptions?: HttpOptions) => ApolloLink;
|
||||
//# sourceMappingURL=createHttpLink.d.ts.map
|
||||
156
graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js
generated
vendored
Normal file
156
graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
import { __assign, __rest } from "tslib";
|
||||
import { invariant } from "../../utilities/globals/index.js";
|
||||
import { ApolloLink } from "../core/index.js";
|
||||
import { Observable, hasDirectives } from "../../utilities/index.js";
|
||||
import { serializeFetchParameter } from "./serializeFetchParameter.js";
|
||||
import { selectURI } from "./selectURI.js";
|
||||
import { handleError, readMultipartBody, parseAndCheckHttpResponse, } from "./parseAndCheckHttpResponse.js";
|
||||
import { checkFetcher } from "./checkFetcher.js";
|
||||
import { selectHttpOptionsAndBodyInternal, defaultPrinter, fallbackHttpConfig, } from "./selectHttpOptionsAndBody.js";
|
||||
import { rewriteURIForGET } from "./rewriteURIForGET.js";
|
||||
import { fromError, filterOperationVariables } from "../utils/index.js";
|
||||
import { maybe, getMainDefinition, removeClientSetsFromDocument, } from "../../utilities/index.js";
|
||||
var backupFetch = maybe(function () { return fetch; });
|
||||
export var createHttpLink = function (linkOptions) {
|
||||
if (linkOptions === void 0) { linkOptions = {}; }
|
||||
var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a,
|
||||
// use default global fetch if nothing passed in
|
||||
preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = __rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]);
|
||||
if (globalThis.__DEV__ !== false) {
|
||||
// Make sure at least one of preferredFetch, window.fetch, or backupFetch is
|
||||
// defined, so requests won't fail at runtime.
|
||||
checkFetcher(preferredFetch || backupFetch);
|
||||
}
|
||||
var linkConfig = {
|
||||
http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase },
|
||||
options: requestOptions.fetchOptions,
|
||||
credentials: requestOptions.credentials,
|
||||
headers: requestOptions.headers,
|
||||
};
|
||||
return new ApolloLink(function (operation) {
|
||||
var chosenURI = selectURI(operation, uri);
|
||||
var context = operation.getContext();
|
||||
// `apollographql-client-*` headers are automatically set if a
|
||||
// `clientAwareness` object is found in the context. These headers are
|
||||
// set first, followed by the rest of the headers pulled from
|
||||
// `context.headers`. If desired, `apollographql-client-*` headers set by
|
||||
// the `clientAwareness` object can be overridden by
|
||||
// `apollographql-client-*` headers set in `context.headers`.
|
||||
var clientAwarenessHeaders = {};
|
||||
if (context.clientAwareness) {
|
||||
var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;
|
||||
if (name_1) {
|
||||
clientAwarenessHeaders["apollographql-client-name"] = name_1;
|
||||
}
|
||||
if (version) {
|
||||
clientAwarenessHeaders["apollographql-client-version"] = version;
|
||||
}
|
||||
}
|
||||
var contextHeaders = __assign(__assign({}, clientAwarenessHeaders), context.headers);
|
||||
var contextConfig = {
|
||||
http: context.http,
|
||||
options: context.fetchOptions,
|
||||
credentials: context.credentials,
|
||||
headers: contextHeaders,
|
||||
};
|
||||
if (hasDirectives(["client"], operation.query)) {
|
||||
var transformedQuery = removeClientSetsFromDocument(operation.query);
|
||||
if (!transformedQuery) {
|
||||
return fromError(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));
|
||||
}
|
||||
operation.query = transformedQuery;
|
||||
}
|
||||
//uses fallback, link, and then context to build options
|
||||
var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
||||
if (body.variables && !includeUnusedVariables) {
|
||||
body.variables = filterOperationVariables(body.variables, operation.query);
|
||||
}
|
||||
var controller;
|
||||
if (!options.signal && typeof AbortController !== "undefined") {
|
||||
controller = new AbortController();
|
||||
options.signal = controller.signal;
|
||||
}
|
||||
// If requested, set method to GET if there are no mutations.
|
||||
var definitionIsMutation = function (d) {
|
||||
return d.kind === "OperationDefinition" && d.operation === "mutation";
|
||||
};
|
||||
var definitionIsSubscription = function (d) {
|
||||
return d.kind === "OperationDefinition" && d.operation === "subscription";
|
||||
};
|
||||
var isSubscription = definitionIsSubscription(getMainDefinition(operation.query));
|
||||
// does not match custom directives beginning with @defer
|
||||
var hasDefer = hasDirectives(["defer"], operation.query);
|
||||
if (useGETForQueries &&
|
||||
!operation.query.definitions.some(definitionIsMutation)) {
|
||||
options.method = "GET";
|
||||
}
|
||||
if (hasDefer || isSubscription) {
|
||||
options.headers = options.headers || {};
|
||||
var acceptHeader = "multipart/mixed;";
|
||||
// Omit defer-specific headers if the user attempts to defer a selection
|
||||
// set on a subscription and log a warning.
|
||||
if (isSubscription && hasDefer) {
|
||||
globalThis.__DEV__ !== false && invariant.warn(38);
|
||||
}
|
||||
if (isSubscription) {
|
||||
acceptHeader +=
|
||||
"boundary=graphql;subscriptionSpec=1.0,application/json";
|
||||
}
|
||||
else if (hasDefer) {
|
||||
acceptHeader += "deferSpec=20220824,application/json";
|
||||
}
|
||||
options.headers.accept = acceptHeader;
|
||||
}
|
||||
if (options.method === "GET") {
|
||||
var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError;
|
||||
if (parseError) {
|
||||
return fromError(parseError);
|
||||
}
|
||||
chosenURI = newURI;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
options.body = serializeFetchParameter(body, "Payload");
|
||||
}
|
||||
catch (parseError) {
|
||||
return fromError(parseError);
|
||||
}
|
||||
}
|
||||
return new Observable(function (observer) {
|
||||
// Prefer linkOptions.fetch (preferredFetch) if provided, and otherwise
|
||||
// fall back to the *current* global window.fetch function (see issue
|
||||
// #7832), or (if all else fails) the backupFetch function we saved when
|
||||
// this module was first evaluated. This last option protects against the
|
||||
// removal of window.fetch, which is unlikely but not impossible.
|
||||
var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch;
|
||||
var observerNext = observer.next.bind(observer);
|
||||
currentFetch(chosenURI, options)
|
||||
.then(function (response) {
|
||||
var _a;
|
||||
operation.setContext({ response: response });
|
||||
var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type");
|
||||
if (ctype !== null && /^multipart\/mixed/i.test(ctype)) {
|
||||
return readMultipartBody(response, observerNext);
|
||||
}
|
||||
else {
|
||||
return parseAndCheckHttpResponse(operation)(response).then(observerNext);
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
controller = undefined;
|
||||
observer.complete();
|
||||
})
|
||||
.catch(function (err) {
|
||||
controller = undefined;
|
||||
handleError(err, observer);
|
||||
});
|
||||
return function () {
|
||||
// XXX support canceling this request
|
||||
// https://developers.google.com/web/updates/2017/09/abortable-fetch
|
||||
if (controller)
|
||||
controller.abort();
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=createHttpLink.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/createHttpLink.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.d.ts
generated
vendored
Normal file
13
graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @deprecated
|
||||
* This is not used internally any more and will be removed in
|
||||
* the next major version of Apollo Client.
|
||||
*/
|
||||
export declare const createSignalIfSupported: () => {
|
||||
controller: boolean;
|
||||
signal: boolean;
|
||||
} | {
|
||||
controller: AbortController;
|
||||
signal: AbortSignal;
|
||||
};
|
||||
//# sourceMappingURL=createSignalIfSupported.d.ts.map
|
||||
13
graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js
generated
vendored
Normal file
13
graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @deprecated
|
||||
* This is not used internally any more and will be removed in
|
||||
* the next major version of Apollo Client.
|
||||
*/
|
||||
export var createSignalIfSupported = function () {
|
||||
if (typeof AbortController === "undefined")
|
||||
return { controller: false, signal: false };
|
||||
var controller = new AbortController();
|
||||
var signal = controller.signal;
|
||||
return { controller: controller, signal: signal };
|
||||
};
|
||||
//# sourceMappingURL=createSignalIfSupported.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/createSignalIfSupported.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"createSignalIfSupported.js","sourceRoot":"","sources":["../../../src/link/http/createSignalIfSupported.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAG;IACrC,IAAI,OAAO,eAAe,KAAK,WAAW;QACxC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAE9C,IAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,IAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,UAAU,YAAA,EAAE,MAAM,QAAA,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["/**\n * @deprecated\n * This is not used internally any more and will be removed in\n * the next major version of Apollo Client.\n */\nexport const createSignalIfSupported = () => {\n if (typeof AbortController === \"undefined\")\n return { controller: false, signal: false };\n\n const controller = new AbortController();\n const signal = controller.signal;\n return { controller, signal };\n};\n"]}
|
||||
631
graphql-subscription/node_modules/@apollo/client/link/http/http.cjs
generated
vendored
Normal file
631
graphql-subscription/node_modules/@apollo/client/link/http/http.cjs
generated
vendored
Normal file
@@ -0,0 +1,631 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var globals = require('../../utilities/globals');
|
||||
var tslib = require('tslib');
|
||||
var utilities = require('../../utilities');
|
||||
var utils = require('../utils');
|
||||
var errors = require('../../errors');
|
||||
var core = require('../core');
|
||||
|
||||
function asyncIterator(source) {
|
||||
var _a;
|
||||
var iterator = source[Symbol.asyncIterator]();
|
||||
return _a = {
|
||||
next: function () {
|
||||
return iterator.next();
|
||||
}
|
||||
},
|
||||
_a[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
},
|
||||
_a;
|
||||
}
|
||||
|
||||
function nodeStreamIterator(stream) {
|
||||
var cleanup = null;
|
||||
var error = null;
|
||||
var done = false;
|
||||
var data = [];
|
||||
var waiting = [];
|
||||
function onData(chunk) {
|
||||
if (error)
|
||||
return;
|
||||
if (waiting.length) {
|
||||
var shiftedArr = waiting.shift();
|
||||
if (Array.isArray(shiftedArr) && shiftedArr[0]) {
|
||||
return shiftedArr[0]({ value: chunk, done: false });
|
||||
}
|
||||
}
|
||||
data.push(chunk);
|
||||
}
|
||||
function onError(err) {
|
||||
error = err;
|
||||
var all = waiting.slice();
|
||||
all.forEach(function (pair) {
|
||||
pair[1](err);
|
||||
});
|
||||
!cleanup || cleanup();
|
||||
}
|
||||
function onEnd() {
|
||||
done = true;
|
||||
var all = waiting.slice();
|
||||
all.forEach(function (pair) {
|
||||
pair[0]({ value: undefined, done: true });
|
||||
});
|
||||
!cleanup || cleanup();
|
||||
}
|
||||
cleanup = function () {
|
||||
cleanup = null;
|
||||
stream.removeListener("data", onData);
|
||||
stream.removeListener("error", onError);
|
||||
stream.removeListener("end", onEnd);
|
||||
stream.removeListener("finish", onEnd);
|
||||
stream.removeListener("close", onEnd);
|
||||
};
|
||||
stream.on("data", onData);
|
||||
stream.on("error", onError);
|
||||
stream.on("end", onEnd);
|
||||
stream.on("finish", onEnd);
|
||||
stream.on("close", onEnd);
|
||||
function getNext() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (error)
|
||||
return reject(error);
|
||||
if (data.length)
|
||||
return resolve({ value: data.shift(), done: false });
|
||||
if (done)
|
||||
return resolve({ value: undefined, done: true });
|
||||
waiting.push([resolve, reject]);
|
||||
});
|
||||
}
|
||||
var iterator = {
|
||||
next: function () {
|
||||
return getNext();
|
||||
},
|
||||
};
|
||||
if (utilities.canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
|
||||
function promiseIterator(promise) {
|
||||
var resolved = false;
|
||||
var iterator = {
|
||||
next: function () {
|
||||
if (resolved)
|
||||
return Promise.resolve({
|
||||
value: undefined,
|
||||
done: true,
|
||||
});
|
||||
resolved = true;
|
||||
return new Promise(function (resolve, reject) {
|
||||
promise
|
||||
.then(function (value) {
|
||||
resolve({ value: value, done: false });
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
},
|
||||
};
|
||||
if (utilities.canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
|
||||
function readerIterator(reader) {
|
||||
var iterator = {
|
||||
next: function () {
|
||||
return reader.read();
|
||||
},
|
||||
};
|
||||
if (utilities.canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
|
||||
function isNodeResponse(value) {
|
||||
return !!value.body;
|
||||
}
|
||||
function isReadableStream(value) {
|
||||
return !!value.getReader;
|
||||
}
|
||||
function isAsyncIterableIterator(value) {
|
||||
return !!(utilities.canUseAsyncIteratorSymbol &&
|
||||
value[Symbol.asyncIterator]);
|
||||
}
|
||||
function isStreamableBlob(value) {
|
||||
return !!value.stream;
|
||||
}
|
||||
function isBlob(value) {
|
||||
return !!value.arrayBuffer;
|
||||
}
|
||||
function isNodeReadableStream(value) {
|
||||
return !!value.pipe;
|
||||
}
|
||||
function responseIterator(response) {
|
||||
var body = response;
|
||||
if (isNodeResponse(response))
|
||||
body = response.body;
|
||||
if (isAsyncIterableIterator(body))
|
||||
return asyncIterator(body);
|
||||
if (isReadableStream(body))
|
||||
return readerIterator(body.getReader());
|
||||
if (isStreamableBlob(body)) {
|
||||
return readerIterator(body.stream().getReader());
|
||||
}
|
||||
if (isBlob(body))
|
||||
return promiseIterator(body.arrayBuffer());
|
||||
if (isNodeReadableStream(body))
|
||||
return nodeStreamIterator(body);
|
||||
throw new Error("Unknown body type for responseIterator. Please pass a streamable response.");
|
||||
}
|
||||
|
||||
function isNonNullObject(obj) {
|
||||
return obj !== null && typeof obj === "object";
|
||||
}
|
||||
|
||||
function isApolloPayloadResult(value) {
|
||||
return isNonNullObject(value) && "payload" in value;
|
||||
}
|
||||
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
function readMultipartBody(response, nextValue) {
|
||||
var _a;
|
||||
return tslib.__awaiter(this, void 0, void 0, function () {
|
||||
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;
|
||||
var _c, _d;
|
||||
return tslib.__generator(this, function (_e) {
|
||||
switch (_e.label) {
|
||||
case 0:
|
||||
if (TextDecoder === undefined) {
|
||||
throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");
|
||||
}
|
||||
decoder = new TextDecoder("utf-8");
|
||||
contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type");
|
||||
delimiter = "boundary=";
|
||||
boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?
|
||||
contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim()
|
||||
: "-";
|
||||
boundary = "\r\n--".concat(boundaryVal);
|
||||
buffer = "";
|
||||
iterator = responseIterator(response);
|
||||
running = true;
|
||||
_e.label = 1;
|
||||
case 1:
|
||||
if (!running) return [3 , 3];
|
||||
return [4 , iterator.next()];
|
||||
case 2:
|
||||
_b = _e.sent(), value = _b.value, done = _b.done;
|
||||
chunk = typeof value === "string" ? value : decoder.decode(value);
|
||||
searchFrom = buffer.length - boundary.length + 1;
|
||||
running = !done;
|
||||
buffer += chunk;
|
||||
bi = buffer.indexOf(boundary, searchFrom);
|
||||
while (bi > -1) {
|
||||
message = void 0;
|
||||
_c = [
|
||||
buffer.slice(0, bi),
|
||||
buffer.slice(bi + boundary.length),
|
||||
], message = _c[0], buffer = _c[1];
|
||||
i = message.indexOf("\r\n\r\n");
|
||||
headers = parseHeaders(message.slice(0, i));
|
||||
contentType_1 = headers["content-type"];
|
||||
if (contentType_1 &&
|
||||
contentType_1.toLowerCase().indexOf("application/json") === -1) {
|
||||
throw new Error("Unsupported patch content type: application/json is required.");
|
||||
}
|
||||
body = message.slice(i);
|
||||
if (body) {
|
||||
result = parseJsonBody(response, body);
|
||||
if (Object.keys(result).length > 1 ||
|
||||
"data" in result ||
|
||||
"incremental" in result ||
|
||||
"errors" in result ||
|
||||
"payload" in result) {
|
||||
if (isApolloPayloadResult(result)) {
|
||||
next = {};
|
||||
if ("payload" in result) {
|
||||
next = tslib.__assign({}, result.payload);
|
||||
}
|
||||
if ("errors" in result) {
|
||||
next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[errors.PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) });
|
||||
}
|
||||
nextValue(next);
|
||||
}
|
||||
else {
|
||||
nextValue(result);
|
||||
}
|
||||
}
|
||||
else if (
|
||||
Object.keys(result).length === 1 &&
|
||||
"hasNext" in result &&
|
||||
!result.hasNext) {
|
||||
return [2 ];
|
||||
}
|
||||
}
|
||||
bi = buffer.indexOf(boundary);
|
||||
}
|
||||
return [3 , 1];
|
||||
case 3: return [2 ];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function parseHeaders(headerText) {
|
||||
var headersInit = {};
|
||||
headerText.split("\n").forEach(function (line) {
|
||||
var i = line.indexOf(":");
|
||||
if (i > -1) {
|
||||
var name_1 = line.slice(0, i).trim().toLowerCase();
|
||||
var value = line.slice(i + 1).trim();
|
||||
headersInit[name_1] = value;
|
||||
}
|
||||
});
|
||||
return headersInit;
|
||||
}
|
||||
function parseJsonBody(response, bodyText) {
|
||||
if (response.status >= 300) {
|
||||
var getResult = function () {
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
return bodyText;
|
||||
}
|
||||
};
|
||||
utils.throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status));
|
||||
}
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
var parseError = err;
|
||||
parseError.name = "ServerParseError";
|
||||
parseError.response = response;
|
||||
parseError.statusCode = response.status;
|
||||
parseError.bodyText = bodyText;
|
||||
throw parseError;
|
||||
}
|
||||
}
|
||||
function handleError(err, observer) {
|
||||
if (err.result && err.result.errors && err.result.data) {
|
||||
observer.next(err.result);
|
||||
}
|
||||
observer.error(err);
|
||||
}
|
||||
function parseAndCheckHttpResponse(operations) {
|
||||
return function (response) {
|
||||
return response
|
||||
.text()
|
||||
.then(function (bodyText) { return parseJsonBody(response, bodyText); })
|
||||
.then(function (result) {
|
||||
if (!Array.isArray(result) &&
|
||||
!hasOwnProperty.call(result, "data") &&
|
||||
!hasOwnProperty.call(result, "errors")) {
|
||||
utils.throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ?
|
||||
operations.map(function (op) { return op.operationName; })
|
||||
: operations.operationName, "'."));
|
||||
}
|
||||
return result;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
var serializeFetchParameter = function (p, label) {
|
||||
var serialized;
|
||||
try {
|
||||
serialized = JSON.stringify(p);
|
||||
}
|
||||
catch (e) {
|
||||
var parseError = globals.newInvariantError(39, label, e.message);
|
||||
parseError.parseError = e;
|
||||
throw parseError;
|
||||
}
|
||||
return serialized;
|
||||
};
|
||||
|
||||
var defaultHttpOptions = {
|
||||
includeQuery: true,
|
||||
includeExtensions: false,
|
||||
preserveHeaderCase: false,
|
||||
};
|
||||
var defaultHeaders = {
|
||||
accept: "*/*",
|
||||
"content-type": "application/json",
|
||||
};
|
||||
var defaultOptions = {
|
||||
method: "POST",
|
||||
};
|
||||
var fallbackHttpConfig = {
|
||||
http: defaultHttpOptions,
|
||||
headers: defaultHeaders,
|
||||
options: defaultOptions,
|
||||
};
|
||||
var defaultPrinter = function (ast, printer) { return printer(ast); };
|
||||
function selectHttpOptionsAndBody(operation, fallbackConfig) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
configs.unshift(fallbackConfig);
|
||||
return selectHttpOptionsAndBodyInternal.apply(void 0, tslib.__spreadArray([operation,
|
||||
defaultPrinter], configs, false));
|
||||
}
|
||||
function selectHttpOptionsAndBodyInternal(operation, printer) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
var options = {};
|
||||
var http = {};
|
||||
configs.forEach(function (config) {
|
||||
options = tslib.__assign(tslib.__assign(tslib.__assign({}, options), config.options), { headers: tslib.__assign(tslib.__assign({}, options.headers), config.headers) });
|
||||
if (config.credentials) {
|
||||
options.credentials = config.credentials;
|
||||
}
|
||||
http = tslib.__assign(tslib.__assign({}, http), config.http);
|
||||
});
|
||||
if (options.headers) {
|
||||
options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
|
||||
}
|
||||
var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
|
||||
var body = { operationName: operationName, variables: variables };
|
||||
if (http.includeExtensions)
|
||||
body.extensions = extensions;
|
||||
if (http.includeQuery)
|
||||
body.query = printer(query, utilities.print);
|
||||
return {
|
||||
options: options,
|
||||
body: body,
|
||||
};
|
||||
}
|
||||
function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
||||
if (!preserveHeaderCase) {
|
||||
var normalizedHeaders_1 = Object.create(null);
|
||||
Object.keys(Object(headers)).forEach(function (name) {
|
||||
normalizedHeaders_1[name.toLowerCase()] = headers[name];
|
||||
});
|
||||
return normalizedHeaders_1;
|
||||
}
|
||||
var headerData = Object.create(null);
|
||||
Object.keys(Object(headers)).forEach(function (name) {
|
||||
headerData[name.toLowerCase()] = {
|
||||
originalName: name,
|
||||
value: headers[name],
|
||||
};
|
||||
});
|
||||
var normalizedHeaders = Object.create(null);
|
||||
Object.keys(headerData).forEach(function (name) {
|
||||
normalizedHeaders[headerData[name].originalName] = headerData[name].value;
|
||||
});
|
||||
return normalizedHeaders;
|
||||
}
|
||||
|
||||
var checkFetcher = function (fetcher) {
|
||||
if (!fetcher && typeof fetch === "undefined") {
|
||||
throw globals.newInvariantError(37);
|
||||
}
|
||||
};
|
||||
|
||||
var createSignalIfSupported = function () {
|
||||
if (typeof AbortController === "undefined")
|
||||
return { controller: false, signal: false };
|
||||
var controller = new AbortController();
|
||||
var signal = controller.signal;
|
||||
return { controller: controller, signal: signal };
|
||||
};
|
||||
|
||||
var selectURI = function (operation, fallbackURI) {
|
||||
var context = operation.getContext();
|
||||
var contextURI = context.uri;
|
||||
if (contextURI) {
|
||||
return contextURI;
|
||||
}
|
||||
else if (typeof fallbackURI === "function") {
|
||||
return fallbackURI(operation);
|
||||
}
|
||||
else {
|
||||
return fallbackURI || "/graphql";
|
||||
}
|
||||
};
|
||||
|
||||
function rewriteURIForGET(chosenURI, body) {
|
||||
var queryParams = [];
|
||||
var addQueryParam = function (key, value) {
|
||||
queryParams.push("".concat(key, "=").concat(encodeURIComponent(value)));
|
||||
};
|
||||
if ("query" in body) {
|
||||
addQueryParam("query", body.query);
|
||||
}
|
||||
if (body.operationName) {
|
||||
addQueryParam("operationName", body.operationName);
|
||||
}
|
||||
if (body.variables) {
|
||||
var serializedVariables = void 0;
|
||||
try {
|
||||
serializedVariables = serializeFetchParameter(body.variables, "Variables map");
|
||||
}
|
||||
catch (parseError) {
|
||||
return { parseError: parseError };
|
||||
}
|
||||
addQueryParam("variables", serializedVariables);
|
||||
}
|
||||
if (body.extensions) {
|
||||
var serializedExtensions = void 0;
|
||||
try {
|
||||
serializedExtensions = serializeFetchParameter(body.extensions, "Extensions map");
|
||||
}
|
||||
catch (parseError) {
|
||||
return { parseError: parseError };
|
||||
}
|
||||
addQueryParam("extensions", serializedExtensions);
|
||||
}
|
||||
var fragment = "", preFragment = chosenURI;
|
||||
var fragmentStart = chosenURI.indexOf("#");
|
||||
if (fragmentStart !== -1) {
|
||||
fragment = chosenURI.substr(fragmentStart);
|
||||
preFragment = chosenURI.substr(0, fragmentStart);
|
||||
}
|
||||
var queryParamsPrefix = preFragment.indexOf("?") === -1 ? "?" : "&";
|
||||
var newURI = preFragment + queryParamsPrefix + queryParams.join("&") + fragment;
|
||||
return { newURI: newURI };
|
||||
}
|
||||
|
||||
var backupFetch = utilities.maybe(function () { return fetch; });
|
||||
var createHttpLink = function (linkOptions) {
|
||||
if (linkOptions === void 0) { linkOptions = {}; }
|
||||
var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a,
|
||||
preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]);
|
||||
if (globalThis.__DEV__ !== false) {
|
||||
checkFetcher(preferredFetch || backupFetch);
|
||||
}
|
||||
var linkConfig = {
|
||||
http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase },
|
||||
options: requestOptions.fetchOptions,
|
||||
credentials: requestOptions.credentials,
|
||||
headers: requestOptions.headers,
|
||||
};
|
||||
return new core.ApolloLink(function (operation) {
|
||||
var chosenURI = selectURI(operation, uri);
|
||||
var context = operation.getContext();
|
||||
var clientAwarenessHeaders = {};
|
||||
if (context.clientAwareness) {
|
||||
var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;
|
||||
if (name_1) {
|
||||
clientAwarenessHeaders["apollographql-client-name"] = name_1;
|
||||
}
|
||||
if (version) {
|
||||
clientAwarenessHeaders["apollographql-client-version"] = version;
|
||||
}
|
||||
}
|
||||
var contextHeaders = tslib.__assign(tslib.__assign({}, clientAwarenessHeaders), context.headers);
|
||||
var contextConfig = {
|
||||
http: context.http,
|
||||
options: context.fetchOptions,
|
||||
credentials: context.credentials,
|
||||
headers: contextHeaders,
|
||||
};
|
||||
if (utilities.hasDirectives(["client"], operation.query)) {
|
||||
var transformedQuery = utilities.removeClientSetsFromDocument(operation.query);
|
||||
if (!transformedQuery) {
|
||||
return utils.fromError(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));
|
||||
}
|
||||
operation.query = transformedQuery;
|
||||
}
|
||||
var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
||||
if (body.variables && !includeUnusedVariables) {
|
||||
body.variables = utils.filterOperationVariables(body.variables, operation.query);
|
||||
}
|
||||
var controller;
|
||||
if (!options.signal && typeof AbortController !== "undefined") {
|
||||
controller = new AbortController();
|
||||
options.signal = controller.signal;
|
||||
}
|
||||
var definitionIsMutation = function (d) {
|
||||
return d.kind === "OperationDefinition" && d.operation === "mutation";
|
||||
};
|
||||
var definitionIsSubscription = function (d) {
|
||||
return d.kind === "OperationDefinition" && d.operation === "subscription";
|
||||
};
|
||||
var isSubscription = definitionIsSubscription(utilities.getMainDefinition(operation.query));
|
||||
var hasDefer = utilities.hasDirectives(["defer"], operation.query);
|
||||
if (useGETForQueries &&
|
||||
!operation.query.definitions.some(definitionIsMutation)) {
|
||||
options.method = "GET";
|
||||
}
|
||||
if (hasDefer || isSubscription) {
|
||||
options.headers = options.headers || {};
|
||||
var acceptHeader = "multipart/mixed;";
|
||||
if (isSubscription && hasDefer) {
|
||||
globalThis.__DEV__ !== false && globals.invariant.warn(38);
|
||||
}
|
||||
if (isSubscription) {
|
||||
acceptHeader +=
|
||||
"boundary=graphql;subscriptionSpec=1.0,application/json";
|
||||
}
|
||||
else if (hasDefer) {
|
||||
acceptHeader += "deferSpec=20220824,application/json";
|
||||
}
|
||||
options.headers.accept = acceptHeader;
|
||||
}
|
||||
if (options.method === "GET") {
|
||||
var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError;
|
||||
if (parseError) {
|
||||
return utils.fromError(parseError);
|
||||
}
|
||||
chosenURI = newURI;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
options.body = serializeFetchParameter(body, "Payload");
|
||||
}
|
||||
catch (parseError) {
|
||||
return utils.fromError(parseError);
|
||||
}
|
||||
}
|
||||
return new utilities.Observable(function (observer) {
|
||||
var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch;
|
||||
var observerNext = observer.next.bind(observer);
|
||||
currentFetch(chosenURI, options)
|
||||
.then(function (response) {
|
||||
var _a;
|
||||
operation.setContext({ response: response });
|
||||
var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type");
|
||||
if (ctype !== null && /^multipart\/mixed/i.test(ctype)) {
|
||||
return readMultipartBody(response, observerNext);
|
||||
}
|
||||
else {
|
||||
return parseAndCheckHttpResponse(operation)(response).then(observerNext);
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
controller = undefined;
|
||||
observer.complete();
|
||||
})
|
||||
.catch(function (err) {
|
||||
controller = undefined;
|
||||
handleError(err, observer);
|
||||
});
|
||||
return function () {
|
||||
if (controller)
|
||||
controller.abort();
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var HttpLink = (function (_super) {
|
||||
tslib.__extends(HttpLink, _super);
|
||||
function HttpLink(options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var _this = _super.call(this, createHttpLink(options).request) || this;
|
||||
_this.options = options;
|
||||
return _this;
|
||||
}
|
||||
return HttpLink;
|
||||
}(core.ApolloLink));
|
||||
|
||||
exports.HttpLink = HttpLink;
|
||||
exports.checkFetcher = checkFetcher;
|
||||
exports.createHttpLink = createHttpLink;
|
||||
exports.createSignalIfSupported = createSignalIfSupported;
|
||||
exports.defaultPrinter = defaultPrinter;
|
||||
exports.fallbackHttpConfig = fallbackHttpConfig;
|
||||
exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
|
||||
exports.rewriteURIForGET = rewriteURIForGET;
|
||||
exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
|
||||
exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal;
|
||||
exports.selectURI = selectURI;
|
||||
exports.serializeFetchParameter = serializeFetchParameter;
|
||||
//# sourceMappingURL=http.cjs.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
631
graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.native.js
generated
vendored
Normal file
631
graphql-subscription/node_modules/@apollo/client/link/http/http.cjs.native.js
generated
vendored
Normal file
@@ -0,0 +1,631 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var globals = require('../../utilities/globals');
|
||||
var tslib = require('tslib');
|
||||
var utilities = require('../../utilities');
|
||||
var utils = require('../utils');
|
||||
var errors = require('../../errors');
|
||||
var core = require('../core');
|
||||
|
||||
function asyncIterator(source) {
|
||||
var _a;
|
||||
var iterator = source[Symbol.asyncIterator]();
|
||||
return _a = {
|
||||
next: function () {
|
||||
return iterator.next();
|
||||
}
|
||||
},
|
||||
_a[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
},
|
||||
_a;
|
||||
}
|
||||
|
||||
function nodeStreamIterator(stream) {
|
||||
var cleanup = null;
|
||||
var error = null;
|
||||
var done = false;
|
||||
var data = [];
|
||||
var waiting = [];
|
||||
function onData(chunk) {
|
||||
if (error)
|
||||
return;
|
||||
if (waiting.length) {
|
||||
var shiftedArr = waiting.shift();
|
||||
if (Array.isArray(shiftedArr) && shiftedArr[0]) {
|
||||
return shiftedArr[0]({ value: chunk, done: false });
|
||||
}
|
||||
}
|
||||
data.push(chunk);
|
||||
}
|
||||
function onError(err) {
|
||||
error = err;
|
||||
var all = waiting.slice();
|
||||
all.forEach(function (pair) {
|
||||
pair[1](err);
|
||||
});
|
||||
!cleanup || cleanup();
|
||||
}
|
||||
function onEnd() {
|
||||
done = true;
|
||||
var all = waiting.slice();
|
||||
all.forEach(function (pair) {
|
||||
pair[0]({ value: undefined, done: true });
|
||||
});
|
||||
!cleanup || cleanup();
|
||||
}
|
||||
cleanup = function () {
|
||||
cleanup = null;
|
||||
stream.removeListener("data", onData);
|
||||
stream.removeListener("error", onError);
|
||||
stream.removeListener("end", onEnd);
|
||||
stream.removeListener("finish", onEnd);
|
||||
stream.removeListener("close", onEnd);
|
||||
};
|
||||
stream.on("data", onData);
|
||||
stream.on("error", onError);
|
||||
stream.on("end", onEnd);
|
||||
stream.on("finish", onEnd);
|
||||
stream.on("close", onEnd);
|
||||
function getNext() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (error)
|
||||
return reject(error);
|
||||
if (data.length)
|
||||
return resolve({ value: data.shift(), done: false });
|
||||
if (done)
|
||||
return resolve({ value: undefined, done: true });
|
||||
waiting.push([resolve, reject]);
|
||||
});
|
||||
}
|
||||
var iterator = {
|
||||
next: function () {
|
||||
return getNext();
|
||||
},
|
||||
};
|
||||
if (utilities.canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
|
||||
function promiseIterator(promise) {
|
||||
var resolved = false;
|
||||
var iterator = {
|
||||
next: function () {
|
||||
if (resolved)
|
||||
return Promise.resolve({
|
||||
value: undefined,
|
||||
done: true,
|
||||
});
|
||||
resolved = true;
|
||||
return new Promise(function (resolve, reject) {
|
||||
promise
|
||||
.then(function (value) {
|
||||
resolve({ value: value, done: false });
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
},
|
||||
};
|
||||
if (utilities.canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
|
||||
function readerIterator(reader) {
|
||||
var iterator = {
|
||||
next: function () {
|
||||
return reader.read();
|
||||
},
|
||||
};
|
||||
if (utilities.canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
|
||||
function isNodeResponse(value) {
|
||||
return !!value.body;
|
||||
}
|
||||
function isReadableStream(value) {
|
||||
return !!value.getReader;
|
||||
}
|
||||
function isAsyncIterableIterator(value) {
|
||||
return !!(utilities.canUseAsyncIteratorSymbol &&
|
||||
value[Symbol.asyncIterator]);
|
||||
}
|
||||
function isStreamableBlob(value) {
|
||||
return !!value.stream;
|
||||
}
|
||||
function isBlob(value) {
|
||||
return !!value.arrayBuffer;
|
||||
}
|
||||
function isNodeReadableStream(value) {
|
||||
return !!value.pipe;
|
||||
}
|
||||
function responseIterator(response) {
|
||||
var body = response;
|
||||
if (isNodeResponse(response))
|
||||
body = response.body;
|
||||
if (isAsyncIterableIterator(body))
|
||||
return asyncIterator(body);
|
||||
if (isReadableStream(body))
|
||||
return readerIterator(body.getReader());
|
||||
if (isStreamableBlob(body)) {
|
||||
return readerIterator(body.stream().getReader());
|
||||
}
|
||||
if (isBlob(body))
|
||||
return promiseIterator(body.arrayBuffer());
|
||||
if (isNodeReadableStream(body))
|
||||
return nodeStreamIterator(body);
|
||||
throw new Error("Unknown body type for responseIterator. Please pass a streamable response.");
|
||||
}
|
||||
|
||||
function isNonNullObject(obj) {
|
||||
return obj !== null && typeof obj === "object";
|
||||
}
|
||||
|
||||
function isApolloPayloadResult(value) {
|
||||
return isNonNullObject(value) && "payload" in value;
|
||||
}
|
||||
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
function readMultipartBody(response, nextValue) {
|
||||
var _a;
|
||||
return tslib.__awaiter(this, void 0, void 0, function () {
|
||||
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;
|
||||
var _c, _d;
|
||||
return tslib.__generator(this, function (_e) {
|
||||
switch (_e.label) {
|
||||
case 0:
|
||||
if (TextDecoder === undefined) {
|
||||
throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");
|
||||
}
|
||||
decoder = new TextDecoder("utf-8");
|
||||
contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type");
|
||||
delimiter = "boundary=";
|
||||
boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?
|
||||
contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim()
|
||||
: "-";
|
||||
boundary = "\r\n--".concat(boundaryVal);
|
||||
buffer = "";
|
||||
iterator = responseIterator(response);
|
||||
running = true;
|
||||
_e.label = 1;
|
||||
case 1:
|
||||
if (!running) return [3 , 3];
|
||||
return [4 , iterator.next()];
|
||||
case 2:
|
||||
_b = _e.sent(), value = _b.value, done = _b.done;
|
||||
chunk = typeof value === "string" ? value : decoder.decode(value);
|
||||
searchFrom = buffer.length - boundary.length + 1;
|
||||
running = !done;
|
||||
buffer += chunk;
|
||||
bi = buffer.indexOf(boundary, searchFrom);
|
||||
while (bi > -1) {
|
||||
message = void 0;
|
||||
_c = [
|
||||
buffer.slice(0, bi),
|
||||
buffer.slice(bi + boundary.length),
|
||||
], message = _c[0], buffer = _c[1];
|
||||
i = message.indexOf("\r\n\r\n");
|
||||
headers = parseHeaders(message.slice(0, i));
|
||||
contentType_1 = headers["content-type"];
|
||||
if (contentType_1 &&
|
||||
contentType_1.toLowerCase().indexOf("application/json") === -1) {
|
||||
throw new Error("Unsupported patch content type: application/json is required.");
|
||||
}
|
||||
body = message.slice(i);
|
||||
if (body) {
|
||||
result = parseJsonBody(response, body);
|
||||
if (Object.keys(result).length > 1 ||
|
||||
"data" in result ||
|
||||
"incremental" in result ||
|
||||
"errors" in result ||
|
||||
"payload" in result) {
|
||||
if (isApolloPayloadResult(result)) {
|
||||
next = {};
|
||||
if ("payload" in result) {
|
||||
next = tslib.__assign({}, result.payload);
|
||||
}
|
||||
if ("errors" in result) {
|
||||
next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[errors.PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) });
|
||||
}
|
||||
nextValue(next);
|
||||
}
|
||||
else {
|
||||
nextValue(result);
|
||||
}
|
||||
}
|
||||
else if (
|
||||
Object.keys(result).length === 1 &&
|
||||
"hasNext" in result &&
|
||||
!result.hasNext) {
|
||||
return [2 ];
|
||||
}
|
||||
}
|
||||
bi = buffer.indexOf(boundary);
|
||||
}
|
||||
return [3 , 1];
|
||||
case 3: return [2 ];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function parseHeaders(headerText) {
|
||||
var headersInit = {};
|
||||
headerText.split("\n").forEach(function (line) {
|
||||
var i = line.indexOf(":");
|
||||
if (i > -1) {
|
||||
var name_1 = line.slice(0, i).trim().toLowerCase();
|
||||
var value = line.slice(i + 1).trim();
|
||||
headersInit[name_1] = value;
|
||||
}
|
||||
});
|
||||
return headersInit;
|
||||
}
|
||||
function parseJsonBody(response, bodyText) {
|
||||
if (response.status >= 300) {
|
||||
var getResult = function () {
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
return bodyText;
|
||||
}
|
||||
};
|
||||
utils.throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status));
|
||||
}
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
var parseError = err;
|
||||
parseError.name = "ServerParseError";
|
||||
parseError.response = response;
|
||||
parseError.statusCode = response.status;
|
||||
parseError.bodyText = bodyText;
|
||||
throw parseError;
|
||||
}
|
||||
}
|
||||
function handleError(err, observer) {
|
||||
if (err.result && err.result.errors && err.result.data) {
|
||||
observer.next(err.result);
|
||||
}
|
||||
observer.error(err);
|
||||
}
|
||||
function parseAndCheckHttpResponse(operations) {
|
||||
return function (response) {
|
||||
return response
|
||||
.text()
|
||||
.then(function (bodyText) { return parseJsonBody(response, bodyText); })
|
||||
.then(function (result) {
|
||||
if (!Array.isArray(result) &&
|
||||
!hasOwnProperty.call(result, "data") &&
|
||||
!hasOwnProperty.call(result, "errors")) {
|
||||
utils.throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ?
|
||||
operations.map(function (op) { return op.operationName; })
|
||||
: operations.operationName, "'."));
|
||||
}
|
||||
return result;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
var serializeFetchParameter = function (p, label) {
|
||||
var serialized;
|
||||
try {
|
||||
serialized = JSON.stringify(p);
|
||||
}
|
||||
catch (e) {
|
||||
var parseError = globals.newInvariantError(39, label, e.message);
|
||||
parseError.parseError = e;
|
||||
throw parseError;
|
||||
}
|
||||
return serialized;
|
||||
};
|
||||
|
||||
var defaultHttpOptions = {
|
||||
includeQuery: true,
|
||||
includeExtensions: false,
|
||||
preserveHeaderCase: false,
|
||||
};
|
||||
var defaultHeaders = {
|
||||
accept: "*/*",
|
||||
"content-type": "application/json",
|
||||
};
|
||||
var defaultOptions = {
|
||||
method: "POST",
|
||||
};
|
||||
var fallbackHttpConfig = {
|
||||
http: defaultHttpOptions,
|
||||
headers: defaultHeaders,
|
||||
options: defaultOptions,
|
||||
};
|
||||
var defaultPrinter = function (ast, printer) { return printer(ast); };
|
||||
function selectHttpOptionsAndBody(operation, fallbackConfig) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
configs.unshift(fallbackConfig);
|
||||
return selectHttpOptionsAndBodyInternal.apply(void 0, tslib.__spreadArray([operation,
|
||||
defaultPrinter], configs, false));
|
||||
}
|
||||
function selectHttpOptionsAndBodyInternal(operation, printer) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
var options = {};
|
||||
var http = {};
|
||||
configs.forEach(function (config) {
|
||||
options = tslib.__assign(tslib.__assign(tslib.__assign({}, options), config.options), { headers: tslib.__assign(tslib.__assign({}, options.headers), config.headers) });
|
||||
if (config.credentials) {
|
||||
options.credentials = config.credentials;
|
||||
}
|
||||
http = tslib.__assign(tslib.__assign({}, http), config.http);
|
||||
});
|
||||
if (options.headers) {
|
||||
options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
|
||||
}
|
||||
var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
|
||||
var body = { operationName: operationName, variables: variables };
|
||||
if (http.includeExtensions)
|
||||
body.extensions = extensions;
|
||||
if (http.includeQuery)
|
||||
body.query = printer(query, utilities.print);
|
||||
return {
|
||||
options: options,
|
||||
body: body,
|
||||
};
|
||||
}
|
||||
function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
||||
if (!preserveHeaderCase) {
|
||||
var normalizedHeaders_1 = Object.create(null);
|
||||
Object.keys(Object(headers)).forEach(function (name) {
|
||||
normalizedHeaders_1[name.toLowerCase()] = headers[name];
|
||||
});
|
||||
return normalizedHeaders_1;
|
||||
}
|
||||
var headerData = Object.create(null);
|
||||
Object.keys(Object(headers)).forEach(function (name) {
|
||||
headerData[name.toLowerCase()] = {
|
||||
originalName: name,
|
||||
value: headers[name],
|
||||
};
|
||||
});
|
||||
var normalizedHeaders = Object.create(null);
|
||||
Object.keys(headerData).forEach(function (name) {
|
||||
normalizedHeaders[headerData[name].originalName] = headerData[name].value;
|
||||
});
|
||||
return normalizedHeaders;
|
||||
}
|
||||
|
||||
var checkFetcher = function (fetcher) {
|
||||
if (!fetcher && typeof fetch === "undefined") {
|
||||
throw globals.newInvariantError(37);
|
||||
}
|
||||
};
|
||||
|
||||
var createSignalIfSupported = function () {
|
||||
if (typeof AbortController === "undefined")
|
||||
return { controller: false, signal: false };
|
||||
var controller = new AbortController();
|
||||
var signal = controller.signal;
|
||||
return { controller: controller, signal: signal };
|
||||
};
|
||||
|
||||
var selectURI = function (operation, fallbackURI) {
|
||||
var context = operation.getContext();
|
||||
var contextURI = context.uri;
|
||||
if (contextURI) {
|
||||
return contextURI;
|
||||
}
|
||||
else if (typeof fallbackURI === "function") {
|
||||
return fallbackURI(operation);
|
||||
}
|
||||
else {
|
||||
return fallbackURI || "/graphql";
|
||||
}
|
||||
};
|
||||
|
||||
function rewriteURIForGET(chosenURI, body) {
|
||||
var queryParams = [];
|
||||
var addQueryParam = function (key, value) {
|
||||
queryParams.push("".concat(key, "=").concat(encodeURIComponent(value)));
|
||||
};
|
||||
if ("query" in body) {
|
||||
addQueryParam("query", body.query);
|
||||
}
|
||||
if (body.operationName) {
|
||||
addQueryParam("operationName", body.operationName);
|
||||
}
|
||||
if (body.variables) {
|
||||
var serializedVariables = void 0;
|
||||
try {
|
||||
serializedVariables = serializeFetchParameter(body.variables, "Variables map");
|
||||
}
|
||||
catch (parseError) {
|
||||
return { parseError: parseError };
|
||||
}
|
||||
addQueryParam("variables", serializedVariables);
|
||||
}
|
||||
if (body.extensions) {
|
||||
var serializedExtensions = void 0;
|
||||
try {
|
||||
serializedExtensions = serializeFetchParameter(body.extensions, "Extensions map");
|
||||
}
|
||||
catch (parseError) {
|
||||
return { parseError: parseError };
|
||||
}
|
||||
addQueryParam("extensions", serializedExtensions);
|
||||
}
|
||||
var fragment = "", preFragment = chosenURI;
|
||||
var fragmentStart = chosenURI.indexOf("#");
|
||||
if (fragmentStart !== -1) {
|
||||
fragment = chosenURI.substr(fragmentStart);
|
||||
preFragment = chosenURI.substr(0, fragmentStart);
|
||||
}
|
||||
var queryParamsPrefix = preFragment.indexOf("?") === -1 ? "?" : "&";
|
||||
var newURI = preFragment + queryParamsPrefix + queryParams.join("&") + fragment;
|
||||
return { newURI: newURI };
|
||||
}
|
||||
|
||||
var backupFetch = utilities.maybe(function () { return fetch; });
|
||||
var createHttpLink = function (linkOptions) {
|
||||
if (linkOptions === void 0) { linkOptions = {}; }
|
||||
var _a = linkOptions.uri, uri = _a === void 0 ? "/graphql" : _a,
|
||||
preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]);
|
||||
if (globalThis.__DEV__ !== false) {
|
||||
checkFetcher(preferredFetch || backupFetch);
|
||||
}
|
||||
var linkConfig = {
|
||||
http: { includeExtensions: includeExtensions, preserveHeaderCase: preserveHeaderCase },
|
||||
options: requestOptions.fetchOptions,
|
||||
credentials: requestOptions.credentials,
|
||||
headers: requestOptions.headers,
|
||||
};
|
||||
return new core.ApolloLink(function (operation) {
|
||||
var chosenURI = selectURI(operation, uri);
|
||||
var context = operation.getContext();
|
||||
var clientAwarenessHeaders = {};
|
||||
if (context.clientAwareness) {
|
||||
var _a = context.clientAwareness, name_1 = _a.name, version = _a.version;
|
||||
if (name_1) {
|
||||
clientAwarenessHeaders["apollographql-client-name"] = name_1;
|
||||
}
|
||||
if (version) {
|
||||
clientAwarenessHeaders["apollographql-client-version"] = version;
|
||||
}
|
||||
}
|
||||
var contextHeaders = tslib.__assign(tslib.__assign({}, clientAwarenessHeaders), context.headers);
|
||||
var contextConfig = {
|
||||
http: context.http,
|
||||
options: context.fetchOptions,
|
||||
credentials: context.credentials,
|
||||
headers: contextHeaders,
|
||||
};
|
||||
if (utilities.hasDirectives(["client"], operation.query)) {
|
||||
var transformedQuery = utilities.removeClientSetsFromDocument(operation.query);
|
||||
if (!transformedQuery) {
|
||||
return utils.fromError(new Error("HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`."));
|
||||
}
|
||||
operation.query = transformedQuery;
|
||||
}
|
||||
var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
||||
if (body.variables && !includeUnusedVariables) {
|
||||
body.variables = utils.filterOperationVariables(body.variables, operation.query);
|
||||
}
|
||||
var controller;
|
||||
if (!options.signal && typeof AbortController !== "undefined") {
|
||||
controller = new AbortController();
|
||||
options.signal = controller.signal;
|
||||
}
|
||||
var definitionIsMutation = function (d) {
|
||||
return d.kind === "OperationDefinition" && d.operation === "mutation";
|
||||
};
|
||||
var definitionIsSubscription = function (d) {
|
||||
return d.kind === "OperationDefinition" && d.operation === "subscription";
|
||||
};
|
||||
var isSubscription = definitionIsSubscription(utilities.getMainDefinition(operation.query));
|
||||
var hasDefer = utilities.hasDirectives(["defer"], operation.query);
|
||||
if (useGETForQueries &&
|
||||
!operation.query.definitions.some(definitionIsMutation)) {
|
||||
options.method = "GET";
|
||||
}
|
||||
if (hasDefer || isSubscription) {
|
||||
options.headers = options.headers || {};
|
||||
var acceptHeader = "multipart/mixed;";
|
||||
if (isSubscription && hasDefer) {
|
||||
globalThis.__DEV__ !== false && globals.invariant.warn(38);
|
||||
}
|
||||
if (isSubscription) {
|
||||
acceptHeader +=
|
||||
"boundary=graphql;subscriptionSpec=1.0,application/json";
|
||||
}
|
||||
else if (hasDefer) {
|
||||
acceptHeader += "deferSpec=20220824,application/json";
|
||||
}
|
||||
options.headers.accept = acceptHeader;
|
||||
}
|
||||
if (options.method === "GET") {
|
||||
var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError;
|
||||
if (parseError) {
|
||||
return utils.fromError(parseError);
|
||||
}
|
||||
chosenURI = newURI;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
options.body = serializeFetchParameter(body, "Payload");
|
||||
}
|
||||
catch (parseError) {
|
||||
return utils.fromError(parseError);
|
||||
}
|
||||
}
|
||||
return new utilities.Observable(function (observer) {
|
||||
var currentFetch = preferredFetch || utilities.maybe(function () { return fetch; }) || backupFetch;
|
||||
var observerNext = observer.next.bind(observer);
|
||||
currentFetch(chosenURI, options)
|
||||
.then(function (response) {
|
||||
var _a;
|
||||
operation.setContext({ response: response });
|
||||
var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type");
|
||||
if (ctype !== null && /^multipart\/mixed/i.test(ctype)) {
|
||||
return readMultipartBody(response, observerNext);
|
||||
}
|
||||
else {
|
||||
return parseAndCheckHttpResponse(operation)(response).then(observerNext);
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
controller = undefined;
|
||||
observer.complete();
|
||||
})
|
||||
.catch(function (err) {
|
||||
controller = undefined;
|
||||
handleError(err, observer);
|
||||
});
|
||||
return function () {
|
||||
if (controller)
|
||||
controller.abort();
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var HttpLink = (function (_super) {
|
||||
tslib.__extends(HttpLink, _super);
|
||||
function HttpLink(options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var _this = _super.call(this, createHttpLink(options).request) || this;
|
||||
_this.options = options;
|
||||
return _this;
|
||||
}
|
||||
return HttpLink;
|
||||
}(core.ApolloLink));
|
||||
|
||||
exports.HttpLink = HttpLink;
|
||||
exports.checkFetcher = checkFetcher;
|
||||
exports.createHttpLink = createHttpLink;
|
||||
exports.createSignalIfSupported = createSignalIfSupported;
|
||||
exports.defaultPrinter = defaultPrinter;
|
||||
exports.fallbackHttpConfig = fallbackHttpConfig;
|
||||
exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
|
||||
exports.rewriteURIForGET = rewriteURIForGET;
|
||||
exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
|
||||
exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal;
|
||||
exports.selectURI = selectURI;
|
||||
exports.serializeFetchParameter = serializeFetchParameter;
|
||||
//# sourceMappingURL=http.cjs.map
|
||||
14
graphql-subscription/node_modules/@apollo/client/link/http/index.d.ts
generated
vendored
Normal file
14
graphql-subscription/node_modules/@apollo/client/link/http/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import "../../utilities/globals/index.js";
|
||||
export type { ServerParseError } from "./parseAndCheckHttpResponse.js";
|
||||
export { parseAndCheckHttpResponse } from "./parseAndCheckHttpResponse.js";
|
||||
export type { ClientParseError } from "./serializeFetchParameter.js";
|
||||
export { serializeFetchParameter } from "./serializeFetchParameter.js";
|
||||
export type { HttpOptions, UriFunction } from "./selectHttpOptionsAndBody.js";
|
||||
export { fallbackHttpConfig, defaultPrinter, selectHttpOptionsAndBody, selectHttpOptionsAndBodyInternal, } from "./selectHttpOptionsAndBody.js";
|
||||
export { checkFetcher } from "./checkFetcher.js";
|
||||
export { createSignalIfSupported } from "./createSignalIfSupported.js";
|
||||
export { selectURI } from "./selectURI.js";
|
||||
export { createHttpLink } from "./createHttpLink.js";
|
||||
export { HttpLink } from "./HttpLink.js";
|
||||
export { rewriteURIForGET } from "./rewriteURIForGET.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
12
graphql-subscription/node_modules/@apollo/client/link/http/index.js
generated
vendored
Normal file
12
graphql-subscription/node_modules/@apollo/client/link/http/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import "../../utilities/globals/index.js";
|
||||
export { parseAndCheckHttpResponse } from "./parseAndCheckHttpResponse.js";
|
||||
export { serializeFetchParameter } from "./serializeFetchParameter.js";
|
||||
export { fallbackHttpConfig, defaultPrinter, selectHttpOptionsAndBody, selectHttpOptionsAndBodyInternal, // needed by ../batch-http but not public
|
||||
} from "./selectHttpOptionsAndBody.js";
|
||||
export { checkFetcher } from "./checkFetcher.js";
|
||||
export { createSignalIfSupported } from "./createSignalIfSupported.js";
|
||||
export { selectURI } from "./selectURI.js";
|
||||
export { createHttpLink } from "./createHttpLink.js";
|
||||
export { HttpLink } from "./HttpLink.js";
|
||||
export { rewriteURIForGET } from "./rewriteURIForGET.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/index.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAG1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,gCAAgC,EAAE,yCAAyC;EAC5E,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["import \"../../utilities/globals/index.js\";\n\nexport type { ServerParseError } from \"./parseAndCheckHttpResponse.js\";\nexport { parseAndCheckHttpResponse } from \"./parseAndCheckHttpResponse.js\";\nexport type { ClientParseError } from \"./serializeFetchParameter.js\";\nexport { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nexport type { HttpOptions, UriFunction } from \"./selectHttpOptionsAndBody.js\";\nexport {\n fallbackHttpConfig,\n defaultPrinter,\n selectHttpOptionsAndBody,\n selectHttpOptionsAndBodyInternal, // needed by ../batch-http but not public\n} from \"./selectHttpOptionsAndBody.js\";\nexport { checkFetcher } from \"./checkFetcher.js\";\nexport { createSignalIfSupported } from \"./createSignalIfSupported.js\";\nexport { selectURI } from \"./selectURI.js\";\nexport { createHttpLink } from \"./createHttpLink.js\";\nexport { HttpLink } from \"./HttpLink.js\";\nexport { rewriteURIForGET } from \"./rewriteURIForGET.js\";\n"]}
|
||||
6
graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.d.ts
generated
vendored
Normal file
6
graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts
|
||||
*/
|
||||
export default function asyncIterator<T>(source: AsyncIterableIterator<T>): AsyncIterableIterator<T>;
|
||||
//# sourceMappingURL=async.d.ts.map
|
||||
18
graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js
generated
vendored
Normal file
18
graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts
|
||||
*/
|
||||
export default function asyncIterator(source) {
|
||||
var _a;
|
||||
var iterator = source[Symbol.asyncIterator]();
|
||||
return _a = {
|
||||
next: function () {
|
||||
return iterator.next();
|
||||
}
|
||||
},
|
||||
_a[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
},
|
||||
_a;
|
||||
}
|
||||
//# sourceMappingURL=async.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/iterators/async.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../src/link/http/iterators/async.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,MAAgC;;IAEhC,IAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;IAChD;YACE,IAAI;gBACF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;YACzB,CAAC;;QACD,GAAC,MAAM,CAAC,aAAa,IAArB;YACE,OAAO,IAAI,CAAC;QACd,CAAC;WACD;AACJ,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/async.ts\n */\n\nexport default function asyncIterator<T>(\n source: AsyncIterableIterator<T>\n): AsyncIterableIterator<T> {\n const iterator = source[Symbol.asyncIterator]();\n return {\n next(): Promise<IteratorResult<T, boolean>> {\n return iterator.next();\n },\n [Symbol.asyncIterator](): AsyncIterableIterator<T> {\n return this;\n },\n };\n}\n"]}
|
||||
8
graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.d.ts
generated
vendored
Normal file
8
graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts
|
||||
*/
|
||||
/// <reference types="node" />
|
||||
import type { Readable as NodeReadableStream } from "stream";
|
||||
export default function nodeStreamIterator<T>(stream: NodeReadableStream): AsyncIterableIterator<T>;
|
||||
//# sourceMappingURL=nodeStream.d.ts.map
|
||||
75
graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js
generated
vendored
Normal file
75
graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/nodeStream.ts
|
||||
*/
|
||||
import { canUseAsyncIteratorSymbol } from "../../../utilities/index.js";
|
||||
export default function nodeStreamIterator(stream) {
|
||||
var cleanup = null;
|
||||
var error = null;
|
||||
var done = false;
|
||||
var data = [];
|
||||
var waiting = [];
|
||||
function onData(chunk) {
|
||||
if (error)
|
||||
return;
|
||||
if (waiting.length) {
|
||||
var shiftedArr = waiting.shift();
|
||||
if (Array.isArray(shiftedArr) && shiftedArr[0]) {
|
||||
return shiftedArr[0]({ value: chunk, done: false });
|
||||
}
|
||||
}
|
||||
data.push(chunk);
|
||||
}
|
||||
function onError(err) {
|
||||
error = err;
|
||||
var all = waiting.slice();
|
||||
all.forEach(function (pair) {
|
||||
pair[1](err);
|
||||
});
|
||||
!cleanup || cleanup();
|
||||
}
|
||||
function onEnd() {
|
||||
done = true;
|
||||
var all = waiting.slice();
|
||||
all.forEach(function (pair) {
|
||||
pair[0]({ value: undefined, done: true });
|
||||
});
|
||||
!cleanup || cleanup();
|
||||
}
|
||||
cleanup = function () {
|
||||
cleanup = null;
|
||||
stream.removeListener("data", onData);
|
||||
stream.removeListener("error", onError);
|
||||
stream.removeListener("end", onEnd);
|
||||
stream.removeListener("finish", onEnd);
|
||||
stream.removeListener("close", onEnd);
|
||||
};
|
||||
stream.on("data", onData);
|
||||
stream.on("error", onError);
|
||||
stream.on("end", onEnd);
|
||||
stream.on("finish", onEnd);
|
||||
stream.on("close", onEnd);
|
||||
function getNext() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (error)
|
||||
return reject(error);
|
||||
if (data.length)
|
||||
return resolve({ value: data.shift(), done: false });
|
||||
if (done)
|
||||
return resolve({ value: undefined, done: true });
|
||||
waiting.push([resolve, reject]);
|
||||
});
|
||||
}
|
||||
var iterator = {
|
||||
next: function () {
|
||||
return getNext();
|
||||
},
|
||||
};
|
||||
if (canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
//# sourceMappingURL=nodeStream.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/iterators/nodeStream.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.d.ts
generated
vendored
Normal file
6
graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts
|
||||
*/
|
||||
export default function promiseIterator<T = ArrayBuffer>(promise: Promise<ArrayBuffer>): AsyncIterableIterator<T>;
|
||||
//# sourceMappingURL=promise.d.ts.map
|
||||
32
graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js
generated
vendored
Normal file
32
graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts
|
||||
*/
|
||||
import { canUseAsyncIteratorSymbol } from "../../../utilities/index.js";
|
||||
export default function promiseIterator(promise) {
|
||||
var resolved = false;
|
||||
var iterator = {
|
||||
next: function () {
|
||||
if (resolved)
|
||||
return Promise.resolve({
|
||||
value: undefined,
|
||||
done: true,
|
||||
});
|
||||
resolved = true;
|
||||
return new Promise(function (resolve, reject) {
|
||||
promise
|
||||
.then(function (value) {
|
||||
resolve({ value: value, done: false });
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
},
|
||||
};
|
||||
if (canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
//# sourceMappingURL=promise.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/iterators/promise.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../../../../src/link/http/iterators/promise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAOxE,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,OAA6B;IAE7B,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,IAAM,QAAQ,GAAuB;QACnC,IAAI;YACF,IAAI,QAAQ;gBACV,OAAO,OAAO,CAAC,OAAO,CAAC;oBACrB,KAAK,EAAE,SAAS;oBAChB,IAAI,EAAE,IAAI;iBACX,CAAC,CAAC;YACL,QAAQ,GAAG,IAAI,CAAC;YAChB,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;gBAC1C,OAAO;qBACJ,IAAI,CAAC,UAAU,KAAK;oBACnB,OAAO,CAAC,EAAE,KAAK,EAAE,KAAqB,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;gBACzD,CAAC,CAAC;qBACD,KAAK,CAAC,MAAM,CAAC,CAAC;YACnB,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,IAAI,yBAAyB,EAAE,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG;YAC/B,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,QAAoC,CAAC;AAC9C,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/promise.ts\n */\n\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\n\ninterface PromiseIterator<T> {\n next(): Promise<IteratorResult<T, ArrayBuffer | undefined>>;\n [Symbol.asyncIterator]?(): AsyncIterator<T>;\n}\n\nexport default function promiseIterator<T = ArrayBuffer>(\n promise: Promise<ArrayBuffer>\n): AsyncIterableIterator<T> {\n let resolved = false;\n\n const iterator: PromiseIterator<T> = {\n next(): Promise<IteratorResult<T, ArrayBuffer | undefined>> {\n if (resolved)\n return Promise.resolve({\n value: undefined,\n done: true,\n });\n resolved = true;\n return new Promise(function (resolve, reject) {\n promise\n .then(function (value) {\n resolve({ value: value as unknown as T, done: false });\n })\n .catch(reject);\n });\n },\n };\n\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator<T> {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator<T>;\n}\n"]}
|
||||
6
graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.d.ts
generated
vendored
Normal file
6
graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts
|
||||
*/
|
||||
export default function readerIterator<T>(reader: ReadableStreamDefaultReader<T>): AsyncIterableIterator<T>;
|
||||
//# sourceMappingURL=reader.d.ts.map
|
||||
19
graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js
generated
vendored
Normal file
19
graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts
|
||||
*/
|
||||
import { canUseAsyncIteratorSymbol } from "../../../utilities/index.js";
|
||||
export default function readerIterator(reader) {
|
||||
var iterator = {
|
||||
next: function () {
|
||||
return reader.read();
|
||||
},
|
||||
};
|
||||
if (canUseAsyncIteratorSymbol) {
|
||||
iterator[Symbol.asyncIterator] = function () {
|
||||
return this;
|
||||
};
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
//# sourceMappingURL=reader.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/iterators/reader.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../../../src/link/http/iterators/reader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAOxE,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,MAAsC;IAEtC,IAAM,QAAQ,GAAsB;QAClC,IAAI;YACF,OAAO,MAAM,CAAC,IAAI,EAKjB,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,IAAI,yBAAyB,EAAE,CAAC;QAC9B,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG;YAI/B,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,QAAoC,CAAC;AAC9C,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/iterators/reader.ts\n */\n\nimport { canUseAsyncIteratorSymbol } from \"../../../utilities/index.js\";\n\ninterface ReaderIterator<T> {\n next(): Promise<IteratorResult<T, T | undefined>>;\n [Symbol.asyncIterator]?(): AsyncIterator<T>;\n}\n\nexport default function readerIterator<T>(\n reader: ReadableStreamDefaultReader<T>\n): AsyncIterableIterator<T> {\n const iterator: ReaderIterator<T> = {\n next() {\n return reader.read() as Promise<\n | ReadableStreamReadValueResult<T>\n // DoneResult has `value` optional, which doesn't comply with an\n // `IteratorResult`, so we assert it to `T | undefined` instead\n | Required<ReadableStreamReadDoneResult<T | undefined>>\n >;\n },\n };\n\n if (canUseAsyncIteratorSymbol) {\n iterator[Symbol.asyncIterator] = function (): AsyncIterator<\n T,\n T | undefined\n > {\n return this;\n };\n }\n\n return iterator as AsyncIterableIterator<T>;\n}\n"]}
|
||||
8
graphql-subscription/node_modules/@apollo/client/link/http/package.json
generated
vendored
Normal file
8
graphql-subscription/node_modules/@apollo/client/link/http/package.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@apollo/client/link/http",
|
||||
"type": "module",
|
||||
"main": "http.cjs",
|
||||
"module": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"sideEffects": false
|
||||
}
|
||||
13
graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.d.ts
generated
vendored
Normal file
13
graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { Operation } from "../core/index.js";
|
||||
import type { SubscriptionObserver } from "zen-observable-ts";
|
||||
export type ServerParseError = Error & {
|
||||
response: Response;
|
||||
statusCode: number;
|
||||
bodyText: string;
|
||||
};
|
||||
export declare function readMultipartBody<T extends object = Record<string, unknown>>(response: Response, nextValue: (value: T) => void): Promise<void>;
|
||||
export declare function parseHeaders(headerText: string): Record<string, string>;
|
||||
export declare function parseJsonBody<T>(response: Response, bodyText: string): T;
|
||||
export declare function handleError(err: any, observer: SubscriptionObserver<any>): void;
|
||||
export declare function parseAndCheckHttpResponse(operations: Operation | Operation[]): (response: Response) => Promise<any>;
|
||||
//# sourceMappingURL=parseAndCheckHttpResponse.d.ts.map
|
||||
187
graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js
generated
vendored
Normal file
187
graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
import { __assign, __awaiter, __generator } from "tslib";
|
||||
import { responseIterator } from "./responseIterator.js";
|
||||
import { throwServerError } from "../utils/index.js";
|
||||
import { PROTOCOL_ERRORS_SYMBOL } from "../../errors/index.js";
|
||||
import { isApolloPayloadResult } from "../../utilities/common/incrementalResult.js";
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
export function readMultipartBody(response, nextValue) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;
|
||||
var _c, _d;
|
||||
return __generator(this, function (_e) {
|
||||
switch (_e.label) {
|
||||
case 0:
|
||||
if (TextDecoder === undefined) {
|
||||
throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");
|
||||
}
|
||||
decoder = new TextDecoder("utf-8");
|
||||
contentType = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get("content-type");
|
||||
delimiter = "boundary=";
|
||||
boundaryVal = (contentType === null || contentType === void 0 ? void 0 : contentType.includes(delimiter)) ?
|
||||
contentType === null || contentType === void 0 ? void 0 : contentType.substring((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(delimiter)) + delimiter.length).replace(/['"]/g, "").replace(/\;(.*)/gm, "").trim()
|
||||
: "-";
|
||||
boundary = "\r\n--".concat(boundaryVal);
|
||||
buffer = "";
|
||||
iterator = responseIterator(response);
|
||||
running = true;
|
||||
_e.label = 1;
|
||||
case 1:
|
||||
if (!running) return [3 /*break*/, 3];
|
||||
return [4 /*yield*/, iterator.next()];
|
||||
case 2:
|
||||
_b = _e.sent(), value = _b.value, done = _b.done;
|
||||
chunk = typeof value === "string" ? value : decoder.decode(value);
|
||||
searchFrom = buffer.length - boundary.length + 1;
|
||||
running = !done;
|
||||
buffer += chunk;
|
||||
bi = buffer.indexOf(boundary, searchFrom);
|
||||
while (bi > -1) {
|
||||
message = void 0;
|
||||
_c = [
|
||||
buffer.slice(0, bi),
|
||||
buffer.slice(bi + boundary.length),
|
||||
], message = _c[0], buffer = _c[1];
|
||||
i = message.indexOf("\r\n\r\n");
|
||||
headers = parseHeaders(message.slice(0, i));
|
||||
contentType_1 = headers["content-type"];
|
||||
if (contentType_1 &&
|
||||
contentType_1.toLowerCase().indexOf("application/json") === -1) {
|
||||
throw new Error("Unsupported patch content type: application/json is required.");
|
||||
}
|
||||
body = message.slice(i);
|
||||
if (body) {
|
||||
result = parseJsonBody(response, body);
|
||||
if (Object.keys(result).length > 1 ||
|
||||
"data" in result ||
|
||||
"incremental" in result ||
|
||||
"errors" in result ||
|
||||
"payload" in result) {
|
||||
if (isApolloPayloadResult(result)) {
|
||||
next = {};
|
||||
if ("payload" in result) {
|
||||
next = __assign({}, result.payload);
|
||||
}
|
||||
if ("errors" in result) {
|
||||
next = __assign(__assign({}, next), { extensions: __assign(__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) });
|
||||
}
|
||||
nextValue(next);
|
||||
}
|
||||
else {
|
||||
// for the last chunk with only `hasNext: false`
|
||||
// we don't need to call observer.next as there is no data/errors
|
||||
nextValue(result);
|
||||
}
|
||||
}
|
||||
else if (
|
||||
// If the chunk contains only a "hasNext: false", we can call
|
||||
// observer.complete() immediately.
|
||||
Object.keys(result).length === 1 &&
|
||||
"hasNext" in result &&
|
||||
!result.hasNext) {
|
||||
return [2 /*return*/];
|
||||
}
|
||||
}
|
||||
bi = buffer.indexOf(boundary);
|
||||
}
|
||||
return [3 /*break*/, 1];
|
||||
case 3: return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
export function parseHeaders(headerText) {
|
||||
var headersInit = {};
|
||||
headerText.split("\n").forEach(function (line) {
|
||||
var i = line.indexOf(":");
|
||||
if (i > -1) {
|
||||
// normalize headers to lowercase
|
||||
var name_1 = line.slice(0, i).trim().toLowerCase();
|
||||
var value = line.slice(i + 1).trim();
|
||||
headersInit[name_1] = value;
|
||||
}
|
||||
});
|
||||
return headersInit;
|
||||
}
|
||||
export function parseJsonBody(response, bodyText) {
|
||||
if (response.status >= 300) {
|
||||
// Network error
|
||||
var getResult = function () {
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
return bodyText;
|
||||
}
|
||||
};
|
||||
throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status));
|
||||
}
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
var parseError = err;
|
||||
parseError.name = "ServerParseError";
|
||||
parseError.response = response;
|
||||
parseError.statusCode = response.status;
|
||||
parseError.bodyText = bodyText;
|
||||
throw parseError;
|
||||
}
|
||||
}
|
||||
export function handleError(err, observer) {
|
||||
// if it is a network error, BUT there is graphql result info fire
|
||||
// the next observer before calling error this gives apollo-client
|
||||
// (and react-apollo) the `graphqlErrors` and `networkErrors` to
|
||||
// pass to UI this should only happen if we *also* have data as
|
||||
// part of the response key per the spec
|
||||
if (err.result && err.result.errors && err.result.data) {
|
||||
// if we don't call next, the UI can only show networkError
|
||||
// because AC didn't get any graphqlErrors this is graphql
|
||||
// execution result info (i.e errors and possibly data) this is
|
||||
// because there is no formal spec how errors should translate to
|
||||
// http status codes. So an auth error (401) could have both data
|
||||
// from a public field, errors from a private field, and a status
|
||||
// of 401
|
||||
// {
|
||||
// user { // this will have errors
|
||||
// firstName
|
||||
// }
|
||||
// products { // this is public so will have data
|
||||
// cost
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// the result of above *could* look like this:
|
||||
// {
|
||||
// data: { products: [{ cost: "$10" }] },
|
||||
// errors: [{
|
||||
// message: 'your session has timed out',
|
||||
// path: []
|
||||
// }]
|
||||
// }
|
||||
// status code of above would be a 401
|
||||
// in the UI you want to show data where you can, errors as data where you can
|
||||
// and use correct http status codes
|
||||
observer.next(err.result);
|
||||
}
|
||||
observer.error(err);
|
||||
}
|
||||
export function parseAndCheckHttpResponse(operations) {
|
||||
return function (response) {
|
||||
return response
|
||||
.text()
|
||||
.then(function (bodyText) { return parseJsonBody(response, bodyText); })
|
||||
.then(function (result) {
|
||||
if (!Array.isArray(result) &&
|
||||
!hasOwnProperty.call(result, "data") &&
|
||||
!hasOwnProperty.call(result, "errors")) {
|
||||
// Data error
|
||||
throwServerError(response, result, "Server response was missing for query '".concat(Array.isArray(operations) ?
|
||||
operations.map(function (op) { return op.operationName; })
|
||||
: operations.operationName, "'."));
|
||||
}
|
||||
return result;
|
||||
});
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=parseAndCheckHttpResponse.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.d.ts
generated
vendored
Normal file
7
graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts
|
||||
*/
|
||||
import type { Response as NodeResponse } from "node-fetch";
|
||||
export declare function responseIterator<T>(response: Response | NodeResponse): AsyncIterableIterator<T>;
|
||||
//# sourceMappingURL=responseIterator.d.ts.map
|
||||
48
graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js
generated
vendored
Normal file
48
graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Original source:
|
||||
* https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts
|
||||
*/
|
||||
import { canUseAsyncIteratorSymbol } from "../../utilities/index.js";
|
||||
import asyncIterator from "./iterators/async.js";
|
||||
import nodeStreamIterator from "./iterators/nodeStream.js";
|
||||
import promiseIterator from "./iterators/promise.js";
|
||||
import readerIterator from "./iterators/reader.js";
|
||||
function isNodeResponse(value) {
|
||||
return !!value.body;
|
||||
}
|
||||
function isReadableStream(value) {
|
||||
return !!value.getReader;
|
||||
}
|
||||
function isAsyncIterableIterator(value) {
|
||||
return !!(canUseAsyncIteratorSymbol &&
|
||||
value[Symbol.asyncIterator]);
|
||||
}
|
||||
function isStreamableBlob(value) {
|
||||
return !!value.stream;
|
||||
}
|
||||
function isBlob(value) {
|
||||
return !!value.arrayBuffer;
|
||||
}
|
||||
function isNodeReadableStream(value) {
|
||||
return !!value.pipe;
|
||||
}
|
||||
export function responseIterator(response) {
|
||||
var body = response;
|
||||
if (isNodeResponse(response))
|
||||
body = response.body;
|
||||
if (isAsyncIterableIterator(body))
|
||||
return asyncIterator(body);
|
||||
if (isReadableStream(body))
|
||||
return readerIterator(body.getReader());
|
||||
// this errors without casting to ReadableStream<T>
|
||||
// because Blob.stream() returns a NodeJS ReadableStream
|
||||
if (isStreamableBlob(body)) {
|
||||
return readerIterator(body.stream().getReader());
|
||||
}
|
||||
if (isBlob(body))
|
||||
return promiseIterator(body.arrayBuffer());
|
||||
if (isNodeReadableStream(body))
|
||||
return nodeStreamIterator(body);
|
||||
throw new Error("Unknown body type for responseIterator. Please pass a streamable response.");
|
||||
}
|
||||
//# sourceMappingURL=responseIterator.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/responseIterator.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"responseIterator.js","sourceRoot":"","sources":["../../../src/link/http/responseIterator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,cAAc,MAAM,uBAAuB,CAAC;AAEnD,SAAS,cAAc,CAAC,KAAU;IAChC,OAAO,CAAC,CAAE,KAAsB,CAAC,IAAI,CAAC;AACxC,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAU;IAClC,OAAO,CAAC,CAAE,KAA6B,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAU;IAEV,OAAO,CAAC,CAAC,CACP,yBAAyB;QACxB,KAAoC,CAAC,MAAM,CAAC,aAAa,CAAC,CAC5D,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAU;IAClC,OAAO,CAAC,CAAE,KAAc,CAAC,MAAM,CAAC;AAClC,CAAC;AAED,SAAS,MAAM,CAAC,KAAU;IACxB,OAAO,CAAC,CAAE,KAAc,CAAC,WAAW,CAAC;AACvC,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAU;IACtC,OAAO,CAAC,CAAE,KAA4B,CAAC,IAAI,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,QAAiC;IAEjC,IAAI,IAAI,GAAY,QAAQ,CAAC;IAE7B,IAAI,cAAc,CAAC,QAAQ,CAAC;QAAE,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAEnD,IAAI,uBAAuB,CAAC,IAAI,CAAC;QAAE,OAAO,aAAa,CAAI,IAAI,CAAC,CAAC;IAEjE,IAAI,gBAAgB,CAAC,IAAI,CAAC;QAAE,OAAO,cAAc,CAAI,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAEvE,mDAAmD;IACnD,wDAAwD;IACxD,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,cAAc,CAClB,IAAI,CAAC,MAAM,EAAmC,CAAC,SAAS,EAAE,CAC5D,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,eAAe,CAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAEhE,IAAI,oBAAoB,CAAC,IAAI,CAAC;QAAE,OAAO,kBAAkB,CAAI,IAAI,CAAC,CAAC;IAEnE,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Original source:\n * https://github.com/kmalakoff/response-iterator/blob/master/src/index.ts\n */\n\nimport type { Response as NodeResponse } from \"node-fetch\";\nimport type { Readable as NodeReadableStream } from \"stream\";\nimport { canUseAsyncIteratorSymbol } from \"../../utilities/index.js\";\n\nimport asyncIterator from \"./iterators/async.js\";\nimport nodeStreamIterator from \"./iterators/nodeStream.js\";\nimport promiseIterator from \"./iterators/promise.js\";\nimport readerIterator from \"./iterators/reader.js\";\n\nfunction isNodeResponse(value: any): value is NodeResponse {\n return !!(value as NodeResponse).body;\n}\n\nfunction isReadableStream(value: any): value is ReadableStream<any> {\n return !!(value as ReadableStream<any>).getReader;\n}\n\nfunction isAsyncIterableIterator(\n value: any\n): value is AsyncIterableIterator<any> {\n return !!(\n canUseAsyncIteratorSymbol &&\n (value as AsyncIterableIterator<any>)[Symbol.asyncIterator]\n );\n}\n\nfunction isStreamableBlob(value: any): value is Blob {\n return !!(value as Blob).stream;\n}\n\nfunction isBlob(value: any): value is Blob {\n return !!(value as Blob).arrayBuffer;\n}\n\nfunction isNodeReadableStream(value: any): value is NodeReadableStream {\n return !!(value as NodeReadableStream).pipe;\n}\n\nexport function responseIterator<T>(\n response: Response | NodeResponse\n): AsyncIterableIterator<T> {\n let body: unknown = response;\n\n if (isNodeResponse(response)) body = response.body;\n\n if (isAsyncIterableIterator(body)) return asyncIterator<T>(body);\n\n if (isReadableStream(body)) return readerIterator<T>(body.getReader());\n\n // this errors without casting to ReadableStream<T>\n // because Blob.stream() returns a NodeJS ReadableStream\n if (isStreamableBlob(body)) {\n return readerIterator<T>(\n (body.stream() as unknown as ReadableStream<T>).getReader()\n );\n }\n\n if (isBlob(body)) return promiseIterator<T>(body.arrayBuffer());\n\n if (isNodeReadableStream(body)) return nodeStreamIterator<T>(body);\n\n throw new Error(\n \"Unknown body type for responseIterator. Please pass a streamable response.\"\n );\n}\n"]}
|
||||
9
graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.d.ts
generated
vendored
Normal file
9
graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { Body } from "./selectHttpOptionsAndBody.js";
|
||||
export declare function rewriteURIForGET(chosenURI: string, body: Body): {
|
||||
parseError: unknown;
|
||||
newURI?: undefined;
|
||||
} | {
|
||||
newURI: string;
|
||||
parseError?: undefined;
|
||||
};
|
||||
//# sourceMappingURL=rewriteURIForGET.d.ts.map
|
||||
53
graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js
generated
vendored
Normal file
53
graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import { serializeFetchParameter } from "./serializeFetchParameter.js";
|
||||
// For GET operations, returns the given URI rewritten with parameters, or a
|
||||
// parse error.
|
||||
export function rewriteURIForGET(chosenURI, body) {
|
||||
// Implement the standard HTTP GET serialization, plus 'extensions'. Note
|
||||
// the extra level of JSON serialization!
|
||||
var queryParams = [];
|
||||
var addQueryParam = function (key, value) {
|
||||
queryParams.push("".concat(key, "=").concat(encodeURIComponent(value)));
|
||||
};
|
||||
if ("query" in body) {
|
||||
addQueryParam("query", body.query);
|
||||
}
|
||||
if (body.operationName) {
|
||||
addQueryParam("operationName", body.operationName);
|
||||
}
|
||||
if (body.variables) {
|
||||
var serializedVariables = void 0;
|
||||
try {
|
||||
serializedVariables = serializeFetchParameter(body.variables, "Variables map");
|
||||
}
|
||||
catch (parseError) {
|
||||
return { parseError: parseError };
|
||||
}
|
||||
addQueryParam("variables", serializedVariables);
|
||||
}
|
||||
if (body.extensions) {
|
||||
var serializedExtensions = void 0;
|
||||
try {
|
||||
serializedExtensions = serializeFetchParameter(body.extensions, "Extensions map");
|
||||
}
|
||||
catch (parseError) {
|
||||
return { parseError: parseError };
|
||||
}
|
||||
addQueryParam("extensions", serializedExtensions);
|
||||
}
|
||||
// Reconstruct the URI with added query params.
|
||||
// XXX This assumes that the URI is well-formed and that it doesn't
|
||||
// already contain any of these query params. We could instead use the
|
||||
// URL API and take a polyfill (whatwg-url@6) for older browsers that
|
||||
// don't support URLSearchParams. Note that some browsers (and
|
||||
// versions of whatwg-url) support URL but not URLSearchParams!
|
||||
var fragment = "", preFragment = chosenURI;
|
||||
var fragmentStart = chosenURI.indexOf("#");
|
||||
if (fragmentStart !== -1) {
|
||||
fragment = chosenURI.substr(fragmentStart);
|
||||
preFragment = chosenURI.substr(0, fragmentStart);
|
||||
}
|
||||
var queryParamsPrefix = preFragment.indexOf("?") === -1 ? "?" : "&";
|
||||
var newURI = preFragment + queryParamsPrefix + queryParams.join("&") + fragment;
|
||||
return { newURI: newURI };
|
||||
}
|
||||
//# sourceMappingURL=rewriteURIForGET.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/rewriteURIForGET.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rewriteURIForGET.js","sourceRoot":"","sources":["../../../src/link/http/rewriteURIForGET.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,4EAA4E;AAC5E,eAAe;AACf,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,IAAU;IAC5D,yEAAyE;IACzE,yCAAyC;IACzC,IAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAM,aAAa,GAAG,UAAC,GAAW,EAAE,KAAa;QAC/C,WAAW,CAAC,IAAI,CAAC,UAAG,GAAG,cAAI,kBAAkB,CAAC,KAAK,CAAC,CAAE,CAAC,CAAC;IAC1D,CAAC,CAAC;IAEF,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,KAAM,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,aAAa,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,IAAI,mBAAmB,SAAA,CAAC;QACxB,IAAI,CAAC;YACH,mBAAmB,GAAG,uBAAuB,CAC3C,IAAI,CAAC,SAAS,EACd,eAAe,CAChB,CAAC;QACJ,CAAC;QAAC,OAAO,UAAU,EAAE,CAAC;YACpB,OAAO,EAAE,UAAU,YAAA,EAAE,CAAC;QACxB,CAAC;QACD,aAAa,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,IAAI,oBAAoB,SAAA,CAAC;QACzB,IAAI,CAAC;YACH,oBAAoB,GAAG,uBAAuB,CAC5C,IAAI,CAAC,UAAU,EACf,gBAAgB,CACjB,CAAC;QACJ,CAAC;QAAC,OAAO,UAAU,EAAE,CAAC;YACpB,OAAO,EAAE,UAAU,YAAA,EAAE,CAAC;QACxB,CAAC;QACD,aAAa,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IACpD,CAAC;IAED,+CAA+C;IAC/C,mEAAmE;IACnE,0EAA0E;IAC1E,yEAAyE;IACzE,kEAAkE;IAClE,mEAAmE;IACnE,IAAI,QAAQ,GAAG,EAAE,EACf,WAAW,GAAG,SAAS,CAAC;IAC1B,IAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QACzB,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC3C,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC;IACD,IAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACtE,IAAM,MAAM,GACV,WAAW,GAAG,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IACrE,OAAO,EAAE,MAAM,QAAA,EAAE,CAAC;AACpB,CAAC","sourcesContent":["import { serializeFetchParameter } from \"./serializeFetchParameter.js\";\nimport type { Body } from \"./selectHttpOptionsAndBody.js\";\n\n// For GET operations, returns the given URI rewritten with parameters, or a\n// parse error.\nexport function rewriteURIForGET(chosenURI: string, body: Body) {\n // Implement the standard HTTP GET serialization, plus 'extensions'. Note\n // the extra level of JSON serialization!\n const queryParams: string[] = [];\n const addQueryParam = (key: string, value: string) => {\n queryParams.push(`${key}=${encodeURIComponent(value)}`);\n };\n\n if (\"query\" in body) {\n addQueryParam(\"query\", body.query!);\n }\n if (body.operationName) {\n addQueryParam(\"operationName\", body.operationName);\n }\n if (body.variables) {\n let serializedVariables;\n try {\n serializedVariables = serializeFetchParameter(\n body.variables,\n \"Variables map\"\n );\n } catch (parseError) {\n return { parseError };\n }\n addQueryParam(\"variables\", serializedVariables);\n }\n if (body.extensions) {\n let serializedExtensions;\n try {\n serializedExtensions = serializeFetchParameter(\n body.extensions,\n \"Extensions map\"\n );\n } catch (parseError) {\n return { parseError };\n }\n addQueryParam(\"extensions\", serializedExtensions);\n }\n\n // Reconstruct the URI with added query params.\n // XXX This assumes that the URI is well-formed and that it doesn't\n // already contain any of these query params. We could instead use the\n // URL API and take a polyfill (whatwg-url@6) for older browsers that\n // don't support URLSearchParams. Note that some browsers (and\n // versions of whatwg-url) support URL but not URLSearchParams!\n let fragment = \"\",\n preFragment = chosenURI;\n const fragmentStart = chosenURI.indexOf(\"#\");\n if (fragmentStart !== -1) {\n fragment = chosenURI.substr(fragmentStart);\n preFragment = chosenURI.substr(0, fragmentStart);\n }\n const queryParamsPrefix = preFragment.indexOf(\"?\") === -1 ? \"?\" : \"&\";\n const newURI =\n preFragment + queryParamsPrefix + queryParams.join(\"&\") + fragment;\n return { newURI };\n}\n"]}
|
||||
103
graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.d.ts
generated
vendored
Normal file
103
graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.d.ts
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
import type { ASTNode } from "graphql";
|
||||
import { print } from "../../utilities/index.js";
|
||||
import type { Operation } from "../core/index.js";
|
||||
export interface Printer {
|
||||
(node: ASTNode, originalPrint: typeof print): string;
|
||||
}
|
||||
export interface UriFunction {
|
||||
(operation: Operation): string;
|
||||
}
|
||||
export interface Body {
|
||||
query?: string;
|
||||
operationName?: string;
|
||||
variables?: Record<string, any>;
|
||||
extensions?: Record<string, any>;
|
||||
}
|
||||
export interface HttpOptions {
|
||||
/**
|
||||
* The URI to use when fetching operations.
|
||||
*
|
||||
* Defaults to '/graphql'.
|
||||
*/
|
||||
uri?: string | UriFunction;
|
||||
/**
|
||||
* Passes the extensions field to your graphql server.
|
||||
*
|
||||
* Defaults to false.
|
||||
*/
|
||||
includeExtensions?: boolean;
|
||||
/**
|
||||
* A `fetch`-compatible API to use when making requests.
|
||||
*/
|
||||
fetch?: typeof fetch;
|
||||
/**
|
||||
* An object representing values to be sent as headers on the request.
|
||||
*/
|
||||
headers?: Record<string, string>;
|
||||
/**
|
||||
* If set to true, header names won't be automatically normalized to
|
||||
* lowercase. This allows for non-http-spec-compliant servers that might
|
||||
* expect capitalized header names.
|
||||
*/
|
||||
preserveHeaderCase?: boolean;
|
||||
/**
|
||||
* The credentials policy you want to use for the fetch call.
|
||||
*/
|
||||
credentials?: string;
|
||||
/**
|
||||
* Any overrides of the fetch options argument to pass to the fetch call.
|
||||
*/
|
||||
fetchOptions?: any;
|
||||
/**
|
||||
* If set to true, use the HTTP GET method for query operations. Mutations
|
||||
* will still use the method specified in fetchOptions.method (which defaults
|
||||
* to POST).
|
||||
*/
|
||||
useGETForQueries?: boolean;
|
||||
/**
|
||||
* If set to true, the default behavior of stripping unused variables
|
||||
* from the request will be disabled.
|
||||
*
|
||||
* Unused variables are likely to trigger server-side validation errors,
|
||||
* per https://spec.graphql.org/draft/#sec-All-Variables-Used, but this
|
||||
* includeUnusedVariables option can be useful if your server deviates
|
||||
* from the GraphQL specification by not strictly enforcing that rule.
|
||||
*/
|
||||
includeUnusedVariables?: boolean;
|
||||
/**
|
||||
* A function to substitute for the default query print function. Can be
|
||||
* used to apply changes to the results of the print function.
|
||||
*/
|
||||
print?: Printer;
|
||||
}
|
||||
export interface HttpQueryOptions {
|
||||
includeQuery?: boolean;
|
||||
includeExtensions?: boolean;
|
||||
preserveHeaderCase?: boolean;
|
||||
}
|
||||
export interface HttpConfig {
|
||||
http?: HttpQueryOptions;
|
||||
options?: any;
|
||||
headers?: Record<string, string>;
|
||||
credentials?: any;
|
||||
}
|
||||
export declare const fallbackHttpConfig: {
|
||||
http: HttpQueryOptions;
|
||||
headers: {
|
||||
accept: string;
|
||||
"content-type": string;
|
||||
};
|
||||
options: {
|
||||
method: string;
|
||||
};
|
||||
};
|
||||
export declare const defaultPrinter: Printer;
|
||||
export declare function selectHttpOptionsAndBody(operation: Operation, fallbackConfig: HttpConfig, ...configs: Array<HttpConfig>): {
|
||||
options: HttpConfig & Record<string, any>;
|
||||
body: Body;
|
||||
};
|
||||
export declare function selectHttpOptionsAndBodyInternal(operation: Operation, printer: Printer, ...configs: HttpConfig[]): {
|
||||
options: HttpConfig & Record<string, any>;
|
||||
body: Body;
|
||||
};
|
||||
//# sourceMappingURL=selectHttpOptionsAndBody.d.ts.map
|
||||
102
graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js
generated
vendored
Normal file
102
graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
import { __assign, __spreadArray } from "tslib";
|
||||
import { print } from "../../utilities/index.js";
|
||||
var defaultHttpOptions = {
|
||||
includeQuery: true,
|
||||
includeExtensions: false,
|
||||
preserveHeaderCase: false,
|
||||
};
|
||||
var defaultHeaders = {
|
||||
// headers are case insensitive (https://stackoverflow.com/a/5259004)
|
||||
accept: "*/*",
|
||||
// The content-type header describes the type of the body of the request, and
|
||||
// so it typically only is sent with requests that actually have bodies. One
|
||||
// could imagine that Apollo Client would remove this header when constructing
|
||||
// a GET request (which has no body), but we historically have not done that.
|
||||
// This means that browsers will preflight all Apollo Client requests (even
|
||||
// GET requests). Apollo Server's CSRF prevention feature (introduced in
|
||||
// AS3.7) takes advantage of this fact and does not block requests with this
|
||||
// header. If you want to drop this header from GET requests, then you should
|
||||
// probably replace it with a `apollo-require-preflight` header, or servers
|
||||
// with CSRF prevention enabled might block your GET request. See
|
||||
// https://www.apollographql.com/docs/apollo-server/security/cors/#preventing-cross-site-request-forgery-csrf
|
||||
// for more details.
|
||||
"content-type": "application/json",
|
||||
};
|
||||
var defaultOptions = {
|
||||
method: "POST",
|
||||
};
|
||||
export var fallbackHttpConfig = {
|
||||
http: defaultHttpOptions,
|
||||
headers: defaultHeaders,
|
||||
options: defaultOptions,
|
||||
};
|
||||
export var defaultPrinter = function (ast, printer) { return printer(ast); };
|
||||
export function selectHttpOptionsAndBody(operation, fallbackConfig) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
configs.unshift(fallbackConfig);
|
||||
return selectHttpOptionsAndBodyInternal.apply(void 0, __spreadArray([operation,
|
||||
defaultPrinter], configs, false));
|
||||
}
|
||||
export function selectHttpOptionsAndBodyInternal(operation, printer) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
var options = {};
|
||||
var http = {};
|
||||
configs.forEach(function (config) {
|
||||
options = __assign(__assign(__assign({}, options), config.options), { headers: __assign(__assign({}, options.headers), config.headers) });
|
||||
if (config.credentials) {
|
||||
options.credentials = config.credentials;
|
||||
}
|
||||
http = __assign(__assign({}, http), config.http);
|
||||
});
|
||||
if (options.headers) {
|
||||
options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
|
||||
}
|
||||
//The body depends on the http options
|
||||
var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
|
||||
var body = { operationName: operationName, variables: variables };
|
||||
if (http.includeExtensions)
|
||||
body.extensions = extensions;
|
||||
// not sending the query (i.e persisted queries)
|
||||
if (http.includeQuery)
|
||||
body.query = printer(query, print);
|
||||
return {
|
||||
options: options,
|
||||
body: body,
|
||||
};
|
||||
}
|
||||
// Remove potential duplicate header names, preserving last (by insertion order).
|
||||
// This is done to prevent unintentionally duplicating a header instead of
|
||||
// overwriting it (See #8447 and #8449).
|
||||
function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
||||
// If we're not preserving the case, just remove duplicates w/ normalization.
|
||||
if (!preserveHeaderCase) {
|
||||
var normalizedHeaders_1 = Object.create(null);
|
||||
Object.keys(Object(headers)).forEach(function (name) {
|
||||
normalizedHeaders_1[name.toLowerCase()] = headers[name];
|
||||
});
|
||||
return normalizedHeaders_1;
|
||||
}
|
||||
// If we are preserving the case, remove duplicates w/ normalization,
|
||||
// preserving the original name.
|
||||
// This allows for non-http-spec-compliant servers that expect intentionally
|
||||
// capitalized header names (See #6741).
|
||||
var headerData = Object.create(null);
|
||||
Object.keys(Object(headers)).forEach(function (name) {
|
||||
headerData[name.toLowerCase()] = {
|
||||
originalName: name,
|
||||
value: headers[name],
|
||||
};
|
||||
});
|
||||
var normalizedHeaders = Object.create(null);
|
||||
Object.keys(headerData).forEach(function (name) {
|
||||
normalizedHeaders[headerData[name].originalName] = headerData[name].value;
|
||||
});
|
||||
return normalizedHeaders;
|
||||
}
|
||||
//# sourceMappingURL=selectHttpOptionsAndBody.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
graphql-subscription/node_modules/@apollo/client/link/http/selectURI.d.ts
generated
vendored
Normal file
3
graphql-subscription/node_modules/@apollo/client/link/http/selectURI.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Operation } from "../core/index.js";
|
||||
export declare const selectURI: (operation: Operation, fallbackURI?: string | ((operation: Operation) => string) | undefined) => any;
|
||||
//# sourceMappingURL=selectURI.d.ts.map
|
||||
14
graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js
generated
vendored
Normal file
14
graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export var selectURI = function (operation, fallbackURI) {
|
||||
var context = operation.getContext();
|
||||
var contextURI = context.uri;
|
||||
if (contextURI) {
|
||||
return contextURI;
|
||||
}
|
||||
else if (typeof fallbackURI === "function") {
|
||||
return fallbackURI(operation);
|
||||
}
|
||||
else {
|
||||
return fallbackURI || "/graphql";
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=selectURI.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/selectURI.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"selectURI.js","sourceRoot":"","sources":["../../../src/link/http/selectURI.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,SAAS,GAAG,UACvB,SAAoB,EACpB,WAAyD;IAEzD,IAAM,OAAO,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;IACvC,IAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAE/B,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC;IACpB,CAAC;SAAM,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAQ,WAAsB,IAAI,UAAU,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { Operation } from \"../core/index.js\";\n\nexport const selectURI = (\n operation: Operation,\n fallbackURI?: string | ((operation: Operation) => string)\n) => {\n const context = operation.getContext();\n const contextURI = context.uri;\n\n if (contextURI) {\n return contextURI;\n } else if (typeof fallbackURI === \"function\") {\n return fallbackURI(operation);\n } else {\n return (fallbackURI as string) || \"/graphql\";\n }\n};\n"]}
|
||||
6
graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.d.ts
generated
vendored
Normal file
6
graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { InvariantError } from "../../utilities/globals/index.js";
|
||||
export type ClientParseError = InvariantError & {
|
||||
parseError: Error;
|
||||
};
|
||||
export declare const serializeFetchParameter: (p: any, label: string) => string;
|
||||
//# sourceMappingURL=serializeFetchParameter.d.ts.map
|
||||
14
graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js
generated
vendored
Normal file
14
graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { newInvariantError } from "../../utilities/globals/index.js";
|
||||
export var serializeFetchParameter = function (p, label) {
|
||||
var serialized;
|
||||
try {
|
||||
serialized = JSON.stringify(p);
|
||||
}
|
||||
catch (e) {
|
||||
var parseError = newInvariantError(39, label, e.message);
|
||||
parseError.parseError = e;
|
||||
throw parseError;
|
||||
}
|
||||
return serialized;
|
||||
};
|
||||
//# sourceMappingURL=serializeFetchParameter.js.map
|
||||
1
graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js.map
generated
vendored
Normal file
1
graphql-subscription/node_modules/@apollo/client/link/http/serializeFetchParameter.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"serializeFetchParameter.js","sourceRoot":"","sources":["../../../src/link/http/serializeFetchParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAOrE,MAAM,CAAC,IAAM,uBAAuB,GAAG,UAAC,CAAM,EAAE,KAAa;IAC3D,IAAI,UAAU,CAAC;IACf,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAM,UAAU,GAAG,iBAAiB,CAClC,oDAAoD,EACpD,KAAK,EACL,CAAC,CAAC,OAAO,CACU,CAAC;QACtB,UAAU,CAAC,UAAU,GAAG,CAAC,CAAC;QAC1B,MAAM,UAAU,CAAC;IACnB,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","sourcesContent":["import { newInvariantError } from \"../../utilities/globals/index.js\";\nimport type { InvariantError } from \"../../utilities/globals/index.js\";\n\nexport type ClientParseError = InvariantError & {\n parseError: Error;\n};\n\nexport const serializeFetchParameter = (p: any, label: string) => {\n let serialized;\n try {\n serialized = JSON.stringify(p);\n } catch (e: any) {\n const parseError = newInvariantError(\n `Network request failed. %s is not serializable: %s`,\n label,\n e.message\n ) as ClientParseError;\n parseError.parseError = e;\n throw parseError;\n }\n return serialized;\n};\n"]}
|
||||
Reference in New Issue
Block a user