This commit is contained in:
31
node_modules/apollo-link-http-common/CHANGELOG.md
generated
vendored
Normal file
31
node_modules/apollo-link-http-common/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# Change log
|
||||
|
||||
----
|
||||
|
||||
**NOTE:** This changelog is no longer maintained. Changes are now tracked in
|
||||
the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-link/blob/master/CHANGELOG.md).
|
||||
|
||||
----
|
||||
|
||||
### 0.2.6
|
||||
|
||||
- No changes
|
||||
|
||||
### 0.2.5
|
||||
- Added `graphql` 14 to peer and dev deps; Updated `@types/graphql` to 14 <br/>
|
||||
[@hwillson](http://github.com/hwillson) in [#789](https://github.com/apollographql/apollo-link/pull/789)
|
||||
|
||||
### 0.2.4
|
||||
- Update apollo-link [#559](https://github.com/apollographql/apollo-link/pull/559)
|
||||
|
||||
### v0.2.3
|
||||
- correct the warning message on no fetch found to node-fetch[PR#526](https://github.com/apollographql/apollo-link/pull/526)
|
||||
|
||||
### v0.2.2
|
||||
- update apollo link with zen-observable-ts [PR#515](https://github.com/apollographql/apollo-link/pull/515)
|
||||
|
||||
### v0.2.1
|
||||
- Apollo link upgrade
|
||||
|
||||
### v0.2.0
|
||||
- rename serializeFetchBody to serializeFetchParameter and take a label argument
|
||||
21
node_modules/apollo-link-http-common/LICENSE
generated
vendored
Normal file
21
node_modules/apollo-link-http-common/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 - 2017 Meteor Development Group, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
9
node_modules/apollo-link-http-common/README.md
generated
vendored
Normal file
9
node_modules/apollo-link-http-common/README.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
title: apollo-link-http-common
|
||||
description: Http utilities shared across Apollo Links
|
||||
---
|
||||
|
||||
This repository is used in apollo-link-http and apollo-link-http-batch. The
|
||||
package is public to allow easier development of links that will be a part of
|
||||
the main repository. Developers using this package should know that the api
|
||||
will change and versions may not follow SemVer.
|
||||
136
node_modules/apollo-link-http-common/lib/bundle.cjs.js
generated
vendored
Normal file
136
node_modules/apollo-link-http-common/lib/bundle.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var tslib = require('tslib');
|
||||
var printer = require('graphql/language/printer');
|
||||
var tsInvariant = require('ts-invariant');
|
||||
|
||||
var defaultHttpOptions = {
|
||||
includeQuery: true,
|
||||
includeExtensions: false,
|
||||
};
|
||||
var defaultHeaders = {
|
||||
accept: '*/*',
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
var defaultOptions = {
|
||||
method: 'POST',
|
||||
};
|
||||
var fallbackHttpConfig = {
|
||||
http: defaultHttpOptions,
|
||||
headers: defaultHeaders,
|
||||
options: defaultOptions,
|
||||
};
|
||||
var throwServerError = function (response, result, message) {
|
||||
var error = new Error(message);
|
||||
error.name = 'ServerError';
|
||||
error.response = response;
|
||||
error.statusCode = response.status;
|
||||
error.result = result;
|
||||
throw error;
|
||||
};
|
||||
var parseAndCheckHttpResponse = function (operations) { return function (response) {
|
||||
return (response
|
||||
.text()
|
||||
.then(function (bodyText) {
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
var parseError = err;
|
||||
parseError.name = 'ServerParseError';
|
||||
parseError.response = response;
|
||||
parseError.statusCode = response.status;
|
||||
parseError.bodyText = bodyText;
|
||||
return Promise.reject(parseError);
|
||||
}
|
||||
})
|
||||
.then(function (result) {
|
||||
if (response.status >= 300) {
|
||||
throwServerError(response, result, "Response not successful: Received status code " + response.status);
|
||||
}
|
||||
if (!Array.isArray(result) &&
|
||||
!result.hasOwnProperty('data') &&
|
||||
!result.hasOwnProperty('errors')) {
|
||||
throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations)
|
||||
? operations.map(function (op) { return op.operationName; })
|
||||
: operations.operationName) + "'.");
|
||||
}
|
||||
return result;
|
||||
}));
|
||||
}; };
|
||||
var checkFetcher = function (fetcher) {
|
||||
if (!fetcher && typeof fetch === 'undefined') {
|
||||
var library = 'unfetch';
|
||||
if (typeof window === 'undefined')
|
||||
library = 'node-fetch';
|
||||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(1) : new tsInvariant.InvariantError("\nfetch is not found globally and no fetcher passed, to fix pass a fetch for\nyour environment like https://www.npmjs.com/package/" + library + ".\n\nFor example:\nimport fetch from '" + library + "';\nimport { createHttpLink } from 'apollo-link-http';\n\nconst link = createHttpLink({ uri: '/graphql', fetch: fetch });");
|
||||
}
|
||||
};
|
||||
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 selectHttpOptionsAndBody = function (operation, fallbackConfig) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
var options = tslib.__assign({}, fallbackConfig.options, { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials });
|
||||
var http = fallbackConfig.http;
|
||||
configs.forEach(function (config) {
|
||||
options = tslib.__assign({}, options, config.options, { headers: tslib.__assign({}, options.headers, config.headers) });
|
||||
if (config.credentials)
|
||||
options.credentials = config.credentials;
|
||||
http = tslib.__assign({}, http, config.http);
|
||||
});
|
||||
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.print(query);
|
||||
return {
|
||||
options: options,
|
||||
body: body,
|
||||
};
|
||||
};
|
||||
var serializeFetchParameter = function (p, label) {
|
||||
var serialized;
|
||||
try {
|
||||
serialized = JSON.stringify(p);
|
||||
}
|
||||
catch (e) {
|
||||
var parseError = process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(2) : new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message);
|
||||
parseError.parseError = e;
|
||||
throw parseError;
|
||||
}
|
||||
return serialized;
|
||||
};
|
||||
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';
|
||||
}
|
||||
};
|
||||
|
||||
exports.checkFetcher = checkFetcher;
|
||||
exports.createSignalIfSupported = createSignalIfSupported;
|
||||
exports.fallbackHttpConfig = fallbackHttpConfig;
|
||||
exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
|
||||
exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
|
||||
exports.selectURI = selectURI;
|
||||
exports.serializeFetchParameter = serializeFetchParameter;
|
||||
exports.throwServerError = throwServerError;
|
||||
//# sourceMappingURL=bundle.cjs.js.map
|
||||
1
node_modules/apollo-link-http-common/lib/bundle.cjs.js.map
generated
vendored
Normal file
1
node_modules/apollo-link-http-common/lib/bundle.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
125
node_modules/apollo-link-http-common/lib/bundle.esm.js
generated
vendored
Normal file
125
node_modules/apollo-link-http-common/lib/bundle.esm.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
import { __assign } from 'tslib';
|
||||
import { print } from 'graphql/language/printer';
|
||||
import { InvariantError } from 'ts-invariant';
|
||||
|
||||
var defaultHttpOptions = {
|
||||
includeQuery: true,
|
||||
includeExtensions: false,
|
||||
};
|
||||
var defaultHeaders = {
|
||||
accept: '*/*',
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
var defaultOptions = {
|
||||
method: 'POST',
|
||||
};
|
||||
var fallbackHttpConfig = {
|
||||
http: defaultHttpOptions,
|
||||
headers: defaultHeaders,
|
||||
options: defaultOptions,
|
||||
};
|
||||
var throwServerError = function (response, result, message) {
|
||||
var error = new Error(message);
|
||||
error.name = 'ServerError';
|
||||
error.response = response;
|
||||
error.statusCode = response.status;
|
||||
error.result = result;
|
||||
throw error;
|
||||
};
|
||||
var parseAndCheckHttpResponse = function (operations) { return function (response) {
|
||||
return (response
|
||||
.text()
|
||||
.then(function (bodyText) {
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
var parseError = err;
|
||||
parseError.name = 'ServerParseError';
|
||||
parseError.response = response;
|
||||
parseError.statusCode = response.status;
|
||||
parseError.bodyText = bodyText;
|
||||
return Promise.reject(parseError);
|
||||
}
|
||||
})
|
||||
.then(function (result) {
|
||||
if (response.status >= 300) {
|
||||
throwServerError(response, result, "Response not successful: Received status code " + response.status);
|
||||
}
|
||||
if (!Array.isArray(result) &&
|
||||
!result.hasOwnProperty('data') &&
|
||||
!result.hasOwnProperty('errors')) {
|
||||
throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations)
|
||||
? operations.map(function (op) { return op.operationName; })
|
||||
: operations.operationName) + "'.");
|
||||
}
|
||||
return result;
|
||||
}));
|
||||
}; };
|
||||
var checkFetcher = function (fetcher) {
|
||||
if (!fetcher && typeof fetch === 'undefined') {
|
||||
var library = 'unfetch';
|
||||
if (typeof window === 'undefined')
|
||||
library = 'node-fetch';
|
||||
throw process.env.NODE_ENV === "production" ? new InvariantError(1) : new InvariantError("\nfetch is not found globally and no fetcher passed, to fix pass a fetch for\nyour environment like https://www.npmjs.com/package/" + library + ".\n\nFor example:\nimport fetch from '" + library + "';\nimport { createHttpLink } from 'apollo-link-http';\n\nconst link = createHttpLink({ uri: '/graphql', fetch: fetch });");
|
||||
}
|
||||
};
|
||||
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 selectHttpOptionsAndBody = function (operation, fallbackConfig) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
var options = __assign({}, fallbackConfig.options, { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials });
|
||||
var http = fallbackConfig.http;
|
||||
configs.forEach(function (config) {
|
||||
options = __assign({}, options, config.options, { headers: __assign({}, options.headers, config.headers) });
|
||||
if (config.credentials)
|
||||
options.credentials = config.credentials;
|
||||
http = __assign({}, http, config.http);
|
||||
});
|
||||
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 = print(query);
|
||||
return {
|
||||
options: options,
|
||||
body: body,
|
||||
};
|
||||
};
|
||||
var serializeFetchParameter = function (p, label) {
|
||||
var serialized;
|
||||
try {
|
||||
serialized = JSON.stringify(p);
|
||||
}
|
||||
catch (e) {
|
||||
var parseError = process.env.NODE_ENV === "production" ? new InvariantError(2) : new InvariantError("Network request failed. " + label + " is not serializable: " + e.message);
|
||||
parseError.parseError = e;
|
||||
throw parseError;
|
||||
}
|
||||
return serialized;
|
||||
};
|
||||
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';
|
||||
}
|
||||
};
|
||||
|
||||
export { checkFetcher, createSignalIfSupported, fallbackHttpConfig, parseAndCheckHttpResponse, selectHttpOptionsAndBody, selectURI, serializeFetchParameter, throwServerError };
|
||||
//# sourceMappingURL=bundle.esm.js.map
|
||||
1
node_modules/apollo-link-http-common/lib/bundle.esm.js.map
generated
vendored
Normal file
1
node_modules/apollo-link-http-common/lib/bundle.esm.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
138
node_modules/apollo-link-http-common/lib/bundle.umd.js
generated
vendored
Normal file
138
node_modules/apollo-link-http-common/lib/bundle.umd.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('tslib'), require('graphql/language/printer'), require('ts-invariant')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'tslib', 'graphql/language/printer', 'ts-invariant'], factory) :
|
||||
(global = global || self, factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.httpCommon = {}), global.tslib, global.graphql.printer, global.invariant));
|
||||
}(this, (function (exports, tslib_1, printer, tsInvariant) { 'use strict';
|
||||
|
||||
var defaultHttpOptions = {
|
||||
includeQuery: true,
|
||||
includeExtensions: false,
|
||||
};
|
||||
var defaultHeaders = {
|
||||
accept: '*/*',
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
var defaultOptions = {
|
||||
method: 'POST',
|
||||
};
|
||||
var fallbackHttpConfig = {
|
||||
http: defaultHttpOptions,
|
||||
headers: defaultHeaders,
|
||||
options: defaultOptions,
|
||||
};
|
||||
var throwServerError = function (response, result, message) {
|
||||
var error = new Error(message);
|
||||
error.name = 'ServerError';
|
||||
error.response = response;
|
||||
error.statusCode = response.status;
|
||||
error.result = result;
|
||||
throw error;
|
||||
};
|
||||
var parseAndCheckHttpResponse = function (operations) { return function (response) {
|
||||
return (response
|
||||
.text()
|
||||
.then(function (bodyText) {
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
var parseError = err;
|
||||
parseError.name = 'ServerParseError';
|
||||
parseError.response = response;
|
||||
parseError.statusCode = response.status;
|
||||
parseError.bodyText = bodyText;
|
||||
return Promise.reject(parseError);
|
||||
}
|
||||
})
|
||||
.then(function (result) {
|
||||
if (response.status >= 300) {
|
||||
throwServerError(response, result, "Response not successful: Received status code " + response.status);
|
||||
}
|
||||
if (!Array.isArray(result) &&
|
||||
!result.hasOwnProperty('data') &&
|
||||
!result.hasOwnProperty('errors')) {
|
||||
throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations)
|
||||
? operations.map(function (op) { return op.operationName; })
|
||||
: operations.operationName) + "'.");
|
||||
}
|
||||
return result;
|
||||
}));
|
||||
}; };
|
||||
var checkFetcher = function (fetcher) {
|
||||
if (!fetcher && typeof fetch === 'undefined') {
|
||||
var library = 'unfetch';
|
||||
if (typeof window === 'undefined')
|
||||
library = 'node-fetch';
|
||||
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(1) : new tsInvariant.InvariantError("\nfetch is not found globally and no fetcher passed, to fix pass a fetch for\nyour environment like https://www.npmjs.com/package/" + library + ".\n\nFor example:\nimport fetch from '" + library + "';\nimport { createHttpLink } from 'apollo-link-http';\n\nconst link = createHttpLink({ uri: '/graphql', fetch: fetch });");
|
||||
}
|
||||
};
|
||||
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 selectHttpOptionsAndBody = function (operation, fallbackConfig) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
var options = tslib_1.__assign({}, fallbackConfig.options, { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials });
|
||||
var http = fallbackConfig.http;
|
||||
configs.forEach(function (config) {
|
||||
options = tslib_1.__assign({}, options, config.options, { headers: tslib_1.__assign({}, options.headers, config.headers) });
|
||||
if (config.credentials)
|
||||
options.credentials = config.credentials;
|
||||
http = tslib_1.__assign({}, http, config.http);
|
||||
});
|
||||
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.print(query);
|
||||
return {
|
||||
options: options,
|
||||
body: body,
|
||||
};
|
||||
};
|
||||
var serializeFetchParameter = function (p, label) {
|
||||
var serialized;
|
||||
try {
|
||||
serialized = JSON.stringify(p);
|
||||
}
|
||||
catch (e) {
|
||||
var parseError = process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(2) : new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message);
|
||||
parseError.parseError = e;
|
||||
throw parseError;
|
||||
}
|
||||
return serialized;
|
||||
};
|
||||
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';
|
||||
}
|
||||
};
|
||||
|
||||
exports.checkFetcher = checkFetcher;
|
||||
exports.createSignalIfSupported = createSignalIfSupported;
|
||||
exports.fallbackHttpConfig = fallbackHttpConfig;
|
||||
exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
|
||||
exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
|
||||
exports.selectURI = selectURI;
|
||||
exports.serializeFetchParameter = serializeFetchParameter;
|
||||
exports.throwServerError = throwServerError;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=bundle.umd.js.map
|
||||
1
node_modules/apollo-link-http-common/lib/bundle.umd.js.map
generated
vendored
Normal file
1
node_modules/apollo-link-http-common/lib/bundle.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
66
node_modules/apollo-link-http-common/lib/index.d.ts
generated
vendored
Normal file
66
node_modules/apollo-link-http-common/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { Operation } from 'apollo-link';
|
||||
import { InvariantError } from 'ts-invariant';
|
||||
export declare type ServerError = Error & {
|
||||
response: Response;
|
||||
result: Record<string, any>;
|
||||
statusCode: number;
|
||||
};
|
||||
export declare type ServerParseError = Error & {
|
||||
response: Response;
|
||||
statusCode: number;
|
||||
bodyText: string;
|
||||
};
|
||||
export declare type ClientParseError = InvariantError & {
|
||||
parseError: Error;
|
||||
};
|
||||
export interface HttpQueryOptions {
|
||||
includeQuery?: boolean;
|
||||
includeExtensions?: boolean;
|
||||
}
|
||||
export interface HttpConfig {
|
||||
http?: HttpQueryOptions;
|
||||
options?: any;
|
||||
headers?: any;
|
||||
credentials?: any;
|
||||
}
|
||||
export interface UriFunction {
|
||||
(operation: Operation): string;
|
||||
}
|
||||
export interface Body {
|
||||
query?: string;
|
||||
operationName?: string;
|
||||
variables?: Record<string, any>;
|
||||
extensions?: Record<string, any>;
|
||||
}
|
||||
export interface HttpOptions {
|
||||
uri?: string | UriFunction;
|
||||
includeExtensions?: boolean;
|
||||
fetch?: WindowOrWorkerGlobalScope['fetch'];
|
||||
headers?: any;
|
||||
credentials?: string;
|
||||
fetchOptions?: any;
|
||||
}
|
||||
export declare const fallbackHttpConfig: {
|
||||
http: HttpQueryOptions;
|
||||
headers: {
|
||||
accept: string;
|
||||
'content-type': string;
|
||||
};
|
||||
options: {
|
||||
method: string;
|
||||
};
|
||||
};
|
||||
export declare const throwServerError: (response: any, result: any, message: any) => never;
|
||||
export declare const parseAndCheckHttpResponse: (operations: any) => (response: Response) => Promise<any>;
|
||||
export declare const checkFetcher: (fetcher: (input: RequestInfo, init?: RequestInit) => Promise<Response>) => void;
|
||||
export declare const createSignalIfSupported: () => {
|
||||
controller: any;
|
||||
signal: any;
|
||||
};
|
||||
export declare const selectHttpOptionsAndBody: (operation: Operation, fallbackConfig: HttpConfig, ...configs: HttpConfig[]) => {
|
||||
options: HttpConfig & Record<string, any>;
|
||||
body: Body;
|
||||
};
|
||||
export declare const serializeFetchParameter: (p: any, label: any) => any;
|
||||
export declare const selectURI: (operation: any, fallbackURI?: string | ((operation: Operation) => string)) => any;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/apollo-link-http-common/lib/index.d.ts.map
generated
vendored
Normal file
1
node_modules/apollo-link-http-common/lib/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAY9C,oBAAY,WAAW,GAAG,KAAK,GAAG;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,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,MAAM,gBAAgB,qDAS5B,CAAC;AAGF,eAAO,MAAM,yBAAyB,2DA+CrC,CAAC;AAEF,eAAO,MAAM,YAAY,kFAcxB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;CAOnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CA8CpC,CAAC;AAEF,eAAO,MAAM,uBAAuB,6BAYnC,CAAC;AAGF,eAAO,MAAM,SAAS,oFAcrB,CAAC"}
|
||||
124
node_modules/apollo-link-http-common/lib/index.js
generated
vendored
Normal file
124
node_modules/apollo-link-http-common/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var printer_1 = require("graphql/language/printer");
|
||||
var ts_invariant_1 = require("ts-invariant");
|
||||
var defaultHttpOptions = {
|
||||
includeQuery: true,
|
||||
includeExtensions: false,
|
||||
};
|
||||
var defaultHeaders = {
|
||||
accept: '*/*',
|
||||
'content-type': 'application/json',
|
||||
};
|
||||
var defaultOptions = {
|
||||
method: 'POST',
|
||||
};
|
||||
exports.fallbackHttpConfig = {
|
||||
http: defaultHttpOptions,
|
||||
headers: defaultHeaders,
|
||||
options: defaultOptions,
|
||||
};
|
||||
exports.throwServerError = function (response, result, message) {
|
||||
var error = new Error(message);
|
||||
error.name = 'ServerError';
|
||||
error.response = response;
|
||||
error.statusCode = response.status;
|
||||
error.result = result;
|
||||
throw error;
|
||||
};
|
||||
exports.parseAndCheckHttpResponse = function (operations) { return function (response) {
|
||||
return (response
|
||||
.text()
|
||||
.then(function (bodyText) {
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
}
|
||||
catch (err) {
|
||||
var parseError = err;
|
||||
parseError.name = 'ServerParseError';
|
||||
parseError.response = response;
|
||||
parseError.statusCode = response.status;
|
||||
parseError.bodyText = bodyText;
|
||||
return Promise.reject(parseError);
|
||||
}
|
||||
})
|
||||
.then(function (result) {
|
||||
if (response.status >= 300) {
|
||||
exports.throwServerError(response, result, "Response not successful: Received status code " + response.status);
|
||||
}
|
||||
if (!Array.isArray(result) &&
|
||||
!result.hasOwnProperty('data') &&
|
||||
!result.hasOwnProperty('errors')) {
|
||||
exports.throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations)
|
||||
? operations.map(function (op) { return op.operationName; })
|
||||
: operations.operationName) + "'.");
|
||||
}
|
||||
return result;
|
||||
}));
|
||||
}; };
|
||||
exports.checkFetcher = function (fetcher) {
|
||||
if (!fetcher && typeof fetch === 'undefined') {
|
||||
var library = 'unfetch';
|
||||
if (typeof window === 'undefined')
|
||||
library = 'node-fetch';
|
||||
throw new ts_invariant_1.InvariantError("\nfetch is not found globally and no fetcher passed, to fix pass a fetch for\nyour environment like https://www.npmjs.com/package/" + library + ".\n\nFor example:\nimport fetch from '" + library + "';\nimport { createHttpLink } from 'apollo-link-http';\n\nconst link = createHttpLink({ uri: '/graphql', fetch: fetch });");
|
||||
}
|
||||
};
|
||||
exports.createSignalIfSupported = function () {
|
||||
if (typeof AbortController === 'undefined')
|
||||
return { controller: false, signal: false };
|
||||
var controller = new AbortController();
|
||||
var signal = controller.signal;
|
||||
return { controller: controller, signal: signal };
|
||||
};
|
||||
exports.selectHttpOptionsAndBody = function (operation, fallbackConfig) {
|
||||
var configs = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
configs[_i - 2] = arguments[_i];
|
||||
}
|
||||
var options = tslib_1.__assign({}, fallbackConfig.options, { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials });
|
||||
var http = fallbackConfig.http;
|
||||
configs.forEach(function (config) {
|
||||
options = tslib_1.__assign({}, options, config.options, { headers: tslib_1.__assign({}, options.headers, config.headers) });
|
||||
if (config.credentials)
|
||||
options.credentials = config.credentials;
|
||||
http = tslib_1.__assign({}, http, config.http);
|
||||
});
|
||||
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_1.print(query);
|
||||
return {
|
||||
options: options,
|
||||
body: body,
|
||||
};
|
||||
};
|
||||
exports.serializeFetchParameter = function (p, label) {
|
||||
var serialized;
|
||||
try {
|
||||
serialized = JSON.stringify(p);
|
||||
}
|
||||
catch (e) {
|
||||
var parseError = new ts_invariant_1.InvariantError("Network request failed. " + label + " is not serializable: " + e.message);
|
||||
parseError.parseError = e;
|
||||
throw parseError;
|
||||
}
|
||||
return serialized;
|
||||
};
|
||||
exports.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=index.js.map
|
||||
1
node_modules/apollo-link-http-common/lib/index.js.map
generated
vendored
Normal file
1
node_modules/apollo-link-http-common/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,oDAAiD;AACjD,6CAA8C;AAyF9C,IAAM,kBAAkB,GAAqB;IAC3C,YAAY,EAAE,IAAI;IAClB,iBAAiB,EAAE,KAAK;CACzB,CAAC;AAEF,IAAM,cAAc,GAAG;IAErB,MAAM,EAAE,KAAK;IACb,cAAc,EAAE,kBAAkB;CACnC,CAAC;AAEF,IAAM,cAAc,GAAG;IACrB,MAAM,EAAE,MAAM;CACf,CAAC;AAEW,QAAA,kBAAkB,GAAG;IAChC,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;CACxB,CAAC;AAEW,QAAA,gBAAgB,GAAG,UAAC,QAAQ,EAAE,MAAM,EAAE,OAAO;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O,UAAU,CAAC;KACnB;SAAM,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE;QAC5C,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;KAC/B;SAAM;QACL,OAAQ,WAAsB,IAAI,UAAU,CAAC;KAC9C;AACH,CAAC,CAAC"}
|
||||
71
node_modules/apollo-link-http-common/package.json
generated
vendored
Normal file
71
node_modules/apollo-link-http-common/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "apollo-link-http-common",
|
||||
"version": "0.2.16",
|
||||
"description": "Http utilities for Apollo Link shared across all links using http",
|
||||
"main": "./lib/index.js",
|
||||
"module": "./lib/bundle.esm.js",
|
||||
"typings": "./lib/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"build": "tsc && rollup -c",
|
||||
"clean": "rimraf lib/* && rimraf coverage/*",
|
||||
"coverage": "jest --coverage",
|
||||
"filesize": "../../scripts/minify",
|
||||
"lint": "tslint -c \"../../tslint.json\" -p tsconfig.json -c ../../tslint.json src/*.ts",
|
||||
"prebuild": "npm run clean",
|
||||
"prepare": "npm run build",
|
||||
"test": "npm run lint && jest",
|
||||
"watch": "tsc -w -p . & rollup -c -w"
|
||||
},
|
||||
"keywords": [
|
||||
"apollo",
|
||||
"http",
|
||||
"network"
|
||||
],
|
||||
"author": "Evans Hauser",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"apollo-link": "^1.2.14",
|
||||
"ts-invariant": "^0.4.0",
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/graphql": "14.2.3",
|
||||
"@types/jest": "24.9.0",
|
||||
"fetch-mock": "6.5.2",
|
||||
"graphql": "15.0.0",
|
||||
"graphql-tag": "2.10.1",
|
||||
"jest": "24.9.0",
|
||||
"object-to-querystring": "1.0.8",
|
||||
"rimraf": "2.7.1",
|
||||
"rollup": "1.29.1",
|
||||
"ts-jest": "22.4.6",
|
||||
"tslint": "5.20.1",
|
||||
"typescript": "3.0.3"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/apollographql/apollo-link.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-link/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-link#readme",
|
||||
"jest": {
|
||||
"transform": {
|
||||
".(ts|tsx)": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"json"
|
||||
],
|
||||
"testURL": "http://localhost"
|
||||
},
|
||||
"gitHead": "1012934b4fd9ab436c4fdcd5e9b1bb1e4c1b0d98"
|
||||
}
|
||||
Reference in New Issue
Block a user