Socket
Socket
Sign inDemoInstall

apollo-link

Package Overview
Dependencies
9
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.9-alpha.1 to 1.2.9

.rpt2_cache/rpt2_0115c93532faf92db1f90cecb97f203e6153ca50/code/cache/3798858604297eff0866e72ddfe9d559b0f06cb9

89

lib/bundle.esm.js
import Observable from 'zen-observable-ts';
export { default as Observable } from 'zen-observable-ts';
import { invariant, InvariantError } from 'ts-invariant';
import { __extends, __assign } from 'tslib';
import { print } from 'graphql/language/printer';
import { getOperationName } from 'apollo-utilities';
export { getOperationName } from 'apollo-utilities';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function getOperationName(doc) {
return (doc.definitions
.filter(function (definition) {
return definition.kind === 'OperationDefinition' && definition.name;
})
.map(function (x) { return x.name.value; })[0] || null);
}
function validateOperation(operation) {

@@ -63,3 +20,3 @@ var OPERATION_FIELDS = [

if (OPERATION_FIELDS.indexOf(key) < 0) {
throw new Error("illegal argument: " + key);
throw process.env.NODE_ENV === "production" ? new InvariantError(2) : new InvariantError("illegal argument: " + key);
}

@@ -87,3 +44,3 @@ }

if (completed) {
console.warn("Promise Wrapper does not support multiple results from Observable");
process.env.NODE_ENV === "production" || invariant.warn("Promise Wrapper does not support multiple results from Observable");
}

@@ -159,18 +116,19 @@ else {

var passthrough = function (op, forward) { return (forward ? forward(op) : Observable.of()); };
var toLink = function (handler) {
function passthrough(op, forward) {
return forward ? forward(op) : Observable.of();
}
function toLink(handler) {
return typeof handler === 'function' ? new ApolloLink(handler) : handler;
};
var empty = function () {
return new ApolloLink(function (op, forward) { return Observable.of(); });
};
var from = function (links) {
}
function empty() {
return new ApolloLink(function () { return Observable.of(); });
}
function from(links) {
if (links.length === 0)
return empty();
return links.map(toLink).reduce(function (x, y) { return x.concat(y); });
};
var split = function (test, left, right) {
if (right === void 0) { right = new ApolloLink(passthrough); }
}
function split(test, left, right) {
var leftLink = toLink(left);
var rightLink = toLink(right);
var rightLink = toLink(right || new ApolloLink(passthrough));
if (isTerminating(leftLink) && isTerminating(rightLink)) {

@@ -190,7 +148,7 @@ return new ApolloLink(function (operation) {

}
};
}
var concat = function (first, second) {
var firstLink = toLink(first);
if (isTerminating(firstLink)) {
console.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink));
process.env.NODE_ENV === "production" || invariant.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink));
return firstLink;

@@ -218,4 +176,3 @@ }

ApolloLink.prototype.split = function (test, left, right) {
if (right === void 0) { right = new ApolloLink(passthrough); }
return this.concat(split(test, left, right));
return this.concat(split(test, left, right || new ApolloLink(passthrough)));
};

@@ -226,3 +183,3 @@ ApolloLink.prototype.concat = function (next) {

ApolloLink.prototype.request = function (operation, forward) {
throw new Error('request is not implemented');
throw process.env.NODE_ENV === "production" ? new InvariantError(1) : new InvariantError('request is not implemented');
};

@@ -239,3 +196,3 @@ ApolloLink.empty = empty;

export { createOperation, makePromise, toPromise, fromPromise, fromError, getOperationName, empty, from, split, concat, ApolloLink, execute };
export { createOperation, makePromise, toPromise, fromPromise, fromError, empty, from, split, concat, ApolloLink, execute };
//# sourceMappingURL=bundle.esm.js.map
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('zen-observable-ts'), require('graphql/language/printer')) :
typeof define === 'function' && define.amd ? define(['exports', 'zen-observable-ts', 'graphql/language/printer'], factory) :
(global = global || self, factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.core = {}), global.apolloLink.zenObservable, global.printer));
}(this, function (exports, Observable, printer) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('zen-observable-ts'), require('ts-invariant'), require('tslib'), require('graphql/language/printer'), require('apollo-utilities')) :
typeof define === 'function' && define.amd ? define(['exports', 'zen-observable-ts', 'ts-invariant', 'tslib', 'graphql/language/printer', 'apollo-utilities'], factory) :
(global = global || self, factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.core = {}), global.apolloLink.zenObservable, global.invariant, global.tslib, global.graphql.printer, global.apolloUtilities));
}(this, function (exports, Observable, tsInvariant, tslib_1, printer, apolloUtilities) { 'use strict';
Observable = Observable && Observable.hasOwnProperty('default') ? Observable['default'] : Observable;
Observable = Observable && Observable.hasOwnProperty('default') ? Observable['default'] : Observable;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
function validateOperation(operation) {
var OPERATION_FIELDS = [
'query',
'operationName',
'variables',
'extensions',
'context',
];
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
var key = _a[_i];
if (OPERATION_FIELDS.indexOf(key) < 0) {
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(2) : new tsInvariant.InvariantError("illegal argument: " + key);
}
}
return operation;
}
var LinkError = (function (_super) {
tslib_1.__extends(LinkError, _super);
function LinkError(message, link) {
var _this = _super.call(this, message) || this;
_this.link = link;
return _this;
}
return LinkError;
}(Error));
function isTerminating(link) {
return link.request.length <= 1;
}
function toPromise(observable) {
var completed = false;
return new Promise(function (resolve, reject) {
observable.subscribe({
next: function (data) {
if (completed) {
process.env.NODE_ENV === "production" || tsInvariant.invariant.warn("Promise Wrapper does not support multiple results from Observable");
}
else {
completed = true;
resolve(data);
}
},
error: reject,
});
});
}
var makePromise = toPromise;
function fromPromise(promise) {
return new Observable(function (observer) {
promise
.then(function (value) {
observer.next(value);
observer.complete();
})
.catch(observer.error.bind(observer));
});
}
function fromError(errorValue) {
return new Observable(function (observer) {
observer.error(errorValue);
});
}
function transformOperation(operation) {
var transformedOperation = {
variables: operation.variables || {},
extensions: operation.extensions || {},
operationName: operation.operationName,
query: operation.query,
};
if (!transformedOperation.operationName) {
transformedOperation.operationName =
typeof transformedOperation.query !== 'string'
? apolloUtilities.getOperationName(transformedOperation.query)
: '';
}
return transformedOperation;
}
function createOperation(starting, operation) {
var context = tslib_1.__assign({}, starting);
var setContext = function (next) {
if (typeof next === 'function') {
context = tslib_1.__assign({}, context, next(context));
}
else {
context = tslib_1.__assign({}, context, next);
}
};
var getContext = function () { return (tslib_1.__assign({}, context)); };
Object.defineProperty(operation, 'setContext', {
enumerable: false,
value: setContext,
});
Object.defineProperty(operation, 'getContext', {
enumerable: false,
value: getContext,
});
Object.defineProperty(operation, 'toKey', {
enumerable: false,
value: function () { return getKey(operation); },
});
return operation;
}
function getKey(operation) {
return printer.print(operation.query) + "|" + JSON.stringify(operation.variables) + "|" + operation.operationName;
}
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
function passthrough(op, forward) {
return forward ? forward(op) : Observable.of();
}
function toLink(handler) {
return typeof handler === 'function' ? new ApolloLink(handler) : handler;
}
function empty() {
return new ApolloLink(function () { return Observable.of(); });
}
function from(links) {
if (links.length === 0)
return empty();
return links.map(toLink).reduce(function (x, y) { return x.concat(y); });
}
function split(test, left, right) {
var leftLink = toLink(left);
var rightLink = toLink(right || new ApolloLink(passthrough));
if (isTerminating(leftLink) && isTerminating(rightLink)) {
return new ApolloLink(function (operation) {
return test(operation)
? leftLink.request(operation) || Observable.of()
: rightLink.request(operation) || Observable.of();
});
}
else {
return new ApolloLink(function (operation, forward) {
return test(operation)
? leftLink.request(operation, forward) || Observable.of()
: rightLink.request(operation, forward) || Observable.of();
});
}
}
var concat = function (first, second) {
var firstLink = toLink(first);
if (isTerminating(firstLink)) {
process.env.NODE_ENV === "production" || tsInvariant.invariant.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink));
return firstLink;
}
var nextLink = toLink(second);
if (isTerminating(nextLink)) {
return new ApolloLink(function (operation) {
return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();
});
}
else {
return new ApolloLink(function (operation, forward) {
return (firstLink.request(operation, function (op) {
return nextLink.request(op, forward) || Observable.of();
}) || Observable.of());
});
}
};
var ApolloLink = (function () {
function ApolloLink(request) {
if (request)
this.request = request;
}
ApolloLink.prototype.split = function (test, left, right) {
return this.concat(split(test, left, right || new ApolloLink(passthrough)));
};
ApolloLink.prototype.concat = function (next) {
return concat(this, next);
};
ApolloLink.prototype.request = function (operation, forward) {
throw process.env.NODE_ENV === "production" ? new tsInvariant.InvariantError(1) : new tsInvariant.InvariantError('request is not implemented');
};
ApolloLink.empty = empty;
ApolloLink.from = from;
ApolloLink.split = split;
ApolloLink.execute = execute;
return ApolloLink;
}());
function execute(link, operation) {
return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());
}
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
exports.Observable = Observable;
exports.getOperationName = apolloUtilities.getOperationName;
exports.createOperation = createOperation;
exports.makePromise = makePromise;
exports.toPromise = toPromise;
exports.fromPromise = fromPromise;
exports.fromError = fromError;
exports.empty = empty;
exports.from = from;
exports.split = split;
exports.concat = concat;
exports.ApolloLink = ApolloLink;
exports.execute = execute;
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
Object.defineProperty(exports, '__esModule', { value: true });
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function getOperationName(doc) {
return (doc.definitions
.filter(function (definition) {
return definition.kind === 'OperationDefinition' && definition.name;
})
.map(function (x) { return x.name.value; })[0] || null);
}
function validateOperation(operation) {
var OPERATION_FIELDS = [
'query',
'operationName',
'variables',
'extensions',
'context',
];
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
var key = _a[_i];
if (OPERATION_FIELDS.indexOf(key) < 0) {
throw new Error("illegal argument: " + key);
}
}
return operation;
}
var LinkError = (function (_super) {
__extends(LinkError, _super);
function LinkError(message, link) {
var _this = _super.call(this, message) || this;
_this.link = link;
return _this;
}
return LinkError;
}(Error));
function isTerminating(link) {
return link.request.length <= 1;
}
function toPromise(observable) {
var completed = false;
return new Promise(function (resolve, reject) {
observable.subscribe({
next: function (data) {
if (completed) {
console.warn("Promise Wrapper does not support multiple results from Observable");
}
else {
completed = true;
resolve(data);
}
},
error: reject,
});
});
}
var makePromise = toPromise;
function fromPromise(promise) {
return new Observable(function (observer) {
promise
.then(function (value) {
observer.next(value);
observer.complete();
})
.catch(observer.error.bind(observer));
});
}
function fromError(errorValue) {
return new Observable(function (observer) {
observer.error(errorValue);
});
}
function transformOperation(operation) {
var transformedOperation = {
variables: operation.variables || {},
extensions: operation.extensions || {},
operationName: operation.operationName,
query: operation.query,
};
if (!transformedOperation.operationName) {
transformedOperation.operationName =
typeof transformedOperation.query !== 'string'
? getOperationName(transformedOperation.query)
: '';
}
return transformedOperation;
}
function createOperation(starting, operation) {
var context = __assign({}, starting);
var setContext = function (next) {
if (typeof next === 'function') {
context = __assign({}, context, next(context));
}
else {
context = __assign({}, context, next);
}
};
var getContext = function () { return (__assign({}, context)); };
Object.defineProperty(operation, 'setContext', {
enumerable: false,
value: setContext,
});
Object.defineProperty(operation, 'getContext', {
enumerable: false,
value: getContext,
});
Object.defineProperty(operation, 'toKey', {
enumerable: false,
value: function () { return getKey(operation); },
});
return operation;
}
function getKey(operation) {
return printer.print(operation.query) + "|" + JSON.stringify(operation.variables) + "|" + operation.operationName;
}
var passthrough = function (op, forward) { return (forward ? forward(op) : Observable.of()); };
var toLink = function (handler) {
return typeof handler === 'function' ? new ApolloLink(handler) : handler;
};
var empty = function () {
return new ApolloLink(function (op, forward) { return Observable.of(); });
};
var from = function (links) {
if (links.length === 0)
return empty();
return links.map(toLink).reduce(function (x, y) { return x.concat(y); });
};
var split = function (test, left, right) {
if (right === void 0) { right = new ApolloLink(passthrough); }
var leftLink = toLink(left);
var rightLink = toLink(right);
if (isTerminating(leftLink) && isTerminating(rightLink)) {
return new ApolloLink(function (operation) {
return test(operation)
? leftLink.request(operation) || Observable.of()
: rightLink.request(operation) || Observable.of();
});
}
else {
return new ApolloLink(function (operation, forward) {
return test(operation)
? leftLink.request(operation, forward) || Observable.of()
: rightLink.request(operation, forward) || Observable.of();
});
}
};
var concat = function (first, second) {
var firstLink = toLink(first);
if (isTerminating(firstLink)) {
console.warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink));
return firstLink;
}
var nextLink = toLink(second);
if (isTerminating(nextLink)) {
return new ApolloLink(function (operation) {
return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();
});
}
else {
return new ApolloLink(function (operation, forward) {
return (firstLink.request(operation, function (op) {
return nextLink.request(op, forward) || Observable.of();
}) || Observable.of());
});
}
};
var ApolloLink = (function () {
function ApolloLink(request) {
if (request)
this.request = request;
}
ApolloLink.prototype.split = function (test, left, right) {
if (right === void 0) { right = new ApolloLink(passthrough); }
return this.concat(split(test, left, right));
};
ApolloLink.prototype.concat = function (next) {
return concat(this, next);
};
ApolloLink.prototype.request = function (operation, forward) {
throw new Error('request is not implemented');
};
ApolloLink.empty = empty;
ApolloLink.from = from;
ApolloLink.split = split;
ApolloLink.execute = execute;
return ApolloLink;
}());
function execute(link, operation) {
return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());
}
exports.Observable = Observable;
exports.createOperation = createOperation;
exports.makePromise = makePromise;
exports.toPromise = toPromise;
exports.fromPromise = fromPromise;
exports.fromError = fromError;
exports.getOperationName = getOperationName;
exports.empty = empty;
exports.from = from;
exports.split = split;
exports.concat = concat;
exports.ApolloLink = ApolloLink;
exports.execute = execute;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=bundle.umd.js.map
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./link"));
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./link"), exports);
var linkUtils_1 = require("./linkUtils");

@@ -17,4 +12,4 @@ exports.createOperation = linkUtils_1.createOperation;

exports.getOperationName = linkUtils_1.getOperationName;
var zen_observable_ts_1 = __importDefault(require("zen-observable-ts"));
var zen_observable_ts_1 = tslib_1.__importDefault(require("zen-observable-ts"));
exports.Observable = zen_observable_ts_1.default;
//# sourceMappingURL=index.js.map
import Observable from 'zen-observable-ts';
import { GraphQLRequest, NextLink, Operation, RequestHandler, FetchResult } from './types';
export declare const empty: () => ApolloLink;
export declare const from: (links: ApolloLink[]) => ApolloLink;
export declare const split: (test: (op: Operation) => boolean, left: RequestHandler | ApolloLink, right?: RequestHandler | ApolloLink) => ApolloLink;
export declare function empty(): ApolloLink;
export declare function from(links: ApolloLink[]): ApolloLink;
export declare function split(test: (op: Operation) => boolean, left: ApolloLink | RequestHandler, right?: ApolloLink | RequestHandler): ApolloLink;
export declare const concat: (first: RequestHandler | ApolloLink, second: RequestHandler | ApolloLink) => ApolloLink;
export declare class ApolloLink {
static empty: () => ApolloLink;
static from: (links: ApolloLink[]) => ApolloLink;
static split: (test: (op: Operation) => boolean, left: RequestHandler | ApolloLink, right?: RequestHandler | ApolloLink) => ApolloLink;
static empty: typeof empty;
static from: typeof from;
static split: typeof split;
static execute: typeof execute;

@@ -12,0 +12,0 @@ constructor(request?: RequestHandler);

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var zen_observable_ts_1 = __importDefault(require("zen-observable-ts"));
var tslib_1 = require("tslib");
var zen_observable_ts_1 = tslib_1.__importDefault(require("zen-observable-ts"));
var ts_invariant_1 = require("ts-invariant");
var linkUtils_1 = require("./linkUtils");
var passthrough = function (op, forward) { return (forward ? forward(op) : zen_observable_ts_1.default.of()); };
var toLink = function (handler) {
function passthrough(op, forward) {
return forward ? forward(op) : zen_observable_ts_1.default.of();
}
function toLink(handler) {
return typeof handler === 'function' ? new ApolloLink(handler) : handler;
};
exports.empty = function () {
return new ApolloLink(function (op, forward) { return zen_observable_ts_1.default.of(); });
};
exports.from = function (links) {
}
function empty() {
return new ApolloLink(function () { return zen_observable_ts_1.default.of(); });
}
exports.empty = empty;
function from(links) {
if (links.length === 0)
return exports.empty();
return empty();
return links.map(toLink).reduce(function (x, y) { return x.concat(y); });
};
exports.split = function (test, left, right) {
if (right === void 0) { right = new ApolloLink(passthrough); }
}
exports.from = from;
function split(test, left, right) {
var leftLink = toLink(left);
var rightLink = toLink(right);
var rightLink = toLink(right || new ApolloLink(passthrough));
if (linkUtils_1.isTerminating(leftLink) && linkUtils_1.isTerminating(rightLink)) {

@@ -38,7 +40,8 @@ return new ApolloLink(function (operation) {

}
};
}
exports.split = split;
exports.concat = function (first, second) {
var firstLink = toLink(first);
if (linkUtils_1.isTerminating(firstLink)) {
console.warn(new linkUtils_1.LinkError("You are calling concat on a terminating link, which will have no effect", firstLink));
ts_invariant_1.invariant.warn(new linkUtils_1.LinkError("You are calling concat on a terminating link, which will have no effect", firstLink));
return firstLink;

@@ -66,4 +69,3 @@ }

ApolloLink.prototype.split = function (test, left, right) {
if (right === void 0) { right = new ApolloLink(passthrough); }
return this.concat(exports.split(test, left, right));
return this.concat(split(test, left, right || new ApolloLink(passthrough)));
};

@@ -74,7 +76,7 @@ ApolloLink.prototype.concat = function (next) {

ApolloLink.prototype.request = function (operation, forward) {
throw new Error('request is not implemented');
throw new ts_invariant_1.InvariantError('request is not implemented');
};
ApolloLink.empty = exports.empty;
ApolloLink.from = exports.from;
ApolloLink.split = exports.split;
ApolloLink.empty = empty;
ApolloLink.from = from;
ApolloLink.split = split;
ApolloLink.execute = execute;

@@ -81,0 +83,0 @@ return ApolloLink;

import Observable from 'zen-observable-ts';
import { DocumentNode } from 'graphql';
import { GraphQLRequest, Operation } from './types';
import { ApolloLink } from './link';
export declare function getOperationName(doc: DocumentNode): string | null;
import { getOperationName } from 'apollo-utilities';
export { getOperationName };
export declare function validateOperation(operation: GraphQLRequest): GraphQLRequest;

@@ -7,0 +7,0 @@ export declare class LinkError extends Error {

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var zen_observable_ts_1 = __importDefault(require("zen-observable-ts"));
var tslib_1 = require("tslib");
var zen_observable_ts_1 = tslib_1.__importDefault(require("zen-observable-ts"));
var printer_1 = require("graphql/language/printer");
function getOperationName(doc) {
return (doc.definitions
.filter(function (definition) {
return definition.kind === 'OperationDefinition' && definition.name;
})
.map(function (x) { return x.name.value; })[0] || null);
}
exports.getOperationName = getOperationName;
var apollo_utilities_1 = require("apollo-utilities");
exports.getOperationName = apollo_utilities_1.getOperationName;
var ts_invariant_1 = require("ts-invariant");
function validateOperation(operation) {

@@ -51,3 +20,3 @@ var OPERATION_FIELDS = [

if (OPERATION_FIELDS.indexOf(key) < 0) {
throw new Error("illegal argument: " + key);
throw new ts_invariant_1.InvariantError("illegal argument: " + key);
}

@@ -59,3 +28,3 @@ }

var LinkError = (function (_super) {
__extends(LinkError, _super);
tslib_1.__extends(LinkError, _super);
function LinkError(message, link) {

@@ -79,3 +48,3 @@ var _this = _super.call(this, message) || this;

if (completed) {
console.warn("Promise Wrapper does not support multiple results from Observable");
ts_invariant_1.invariant.warn("Promise Wrapper does not support multiple results from Observable");
}

@@ -120,3 +89,3 @@ else {

typeof transformedOperation.query !== 'string'
? getOperationName(transformedOperation.query)
? apollo_utilities_1.getOperationName(transformedOperation.query)
: '';

@@ -128,12 +97,12 @@ }

function createOperation(starting, operation) {
var context = __assign({}, starting);
var context = tslib_1.__assign({}, starting);
var setContext = function (next) {
if (typeof next === 'function') {
context = __assign({}, context, next(context));
context = tslib_1.__assign({}, context, next(context));
}
else {
context = __assign({}, context, next);
context = tslib_1.__assign({}, context, next);
}
};
var getContext = function () { return (__assign({}, context)); };
var getContext = function () { return (tslib_1.__assign({}, context)); };
Object.defineProperty(operation, 'setContext', {

@@ -140,0 +109,0 @@ enumerable: false,

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var mockLink_1 = __importDefault(require("./test-utils/mockLink"));
var tslib_1 = require("tslib");
var mockLink_1 = tslib_1.__importDefault(require("./test-utils/mockLink"));
exports.MockLink = mockLink_1.default;
var setContext_1 = __importDefault(require("./test-utils/setContext"));
var setContext_1 = tslib_1.__importDefault(require("./test-utils/setContext"));
exports.SetContextLink = setContext_1.default;
__export(require("./test-utils/testingUtils"));
tslib_1.__exportStar(require("./test-utils/testingUtils"), exports);
//# sourceMappingURL=test-utils.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var link_1 = require("../link");
var MockLink = (function (_super) {
__extends(MockLink, _super);
tslib_1.__extends(MockLink, _super);
function MockLink(handleRequest) {

@@ -20,0 +8,0 @@ if (handleRequest === void 0) { handleRequest = function () { return null; }; }

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var link_1 = require("../link");
var SetContextLink = (function (_super) {
__extends(SetContextLink, _super);
tslib_1.__extends(SetContextLink, _super);
function SetContextLink(setContext) {

@@ -20,0 +8,0 @@ if (setContext === void 0) { setContext = function (c) { return c; }; }

"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var graphql_tag_1 = __importDefault(require("graphql-tag"));
var tslib_1 = require("tslib");
var graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
var link_1 = require("../link");
var sampleQuery = graphql_tag_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query SampleQuery {\n stub {\n id\n }\n }\n"], ["\n query SampleQuery {\n stub {\n id\n }\n }\n"])));
var sampleQuery = graphql_tag_1.default(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n query SampleQuery {\n stub {\n id\n }\n }\n"], ["\n query SampleQuery {\n stub {\n id\n }\n }\n"])));
function checkCalls(calls, results) {

@@ -14,0 +8,0 @@ if (calls === void 0) { calls = []; }

import Observable from 'zen-observable-ts';
import { ExecutionResult, DocumentNode } from 'graphql';
import { DocumentNode } from 'graphql/language/ast';
import { ExecutionResult } from 'graphql/execution/execute';
export { ExecutionResult, DocumentNode };

@@ -4,0 +5,0 @@ export interface GraphQLRequest {

{
"name": "apollo-link",
"version": "1.2.9-alpha.1",
"version": "1.2.9",
"description": "Flexible, lightweight transport layer for GraphQL",

@@ -16,2 +16,3 @@ "author": "Evans Hauser <evanshauser@gmail.com>",

"typings": "./lib/index.d.ts",
"sideEffects": false,
"repository": {

@@ -26,19 +27,17 @@ "type": "git",

"scripts": {
"build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i graphql --i zen-observable-ts && npm run minify:browser",
"build": "tsc -p ./tsconfig.cjs.json",
"bundle": "rollup -c",
"build": "tsc && rollup -c",
"clean": "rimraf lib/* && rimraf coverage/*",
"coverage": "jest --coverage",
"filesize": "npm run build && npm run build:browser",
"filesize": "../../scripts/minify",
"lint": "tslint -c \"../../tslint.json\" -p tsconfig.json -c ../../tslint.json src/*.ts",
"minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js",
"postbuild": "npm run bundle",
"prebuild": "npm run clean",
"prepare": "npm run lint && npm run build",
"prepublishOnly": "npm run clean && npm run build",
"test": "jest",
"prepare": "npm run build",
"test": "npm run lint && jest",
"watch": "tsc -w -p . & rollup -c -w"
},
"dependencies": {
"zen-observable-ts": "^0.8.15"
"apollo-utilities": "^1.2.1",
"ts-invariant": "^0.3.2",
"tslib": "^1.9.3",
"zen-observable-ts": "^0.8.16"
},

@@ -49,6 +48,5 @@ "peerDependencies": {

"devDependencies": {
"@types/graphql": "14.0.5",
"@types/graphql": "14.0.7",
"@types/jest": "22.2.3",
"@types/node": "9.6.41",
"browserify": "16.2.3",
"@types/node": "9.6.42",
"graphql": "14.1.1",

@@ -58,7 +56,6 @@ "graphql-tag": "2.10.1",

"rimraf": "2.6.3",
"rollup": "0.68.2",
"rollup": "1.4.1",
"ts-jest": "22.4.6",
"tslint": "5.12.1",
"typescript": "3.0.3",
"uglify-js": "3.4.9"
"tslint": "5.13.1",
"typescript": "3.0.3"
},

@@ -77,3 +74,4 @@ "jest": {

"testURL": "http://localhost"
}
},
"gitHead": "2c960e057de9d664855bb18df4a4bd25c88bb6ef"
}

@@ -37,3 +37,3 @@ # apollo-link

```js
class import { ApolloLink, Observable } from 'apollo-link';
import { ApolloLink, Observable } from 'apollo-link';

@@ -40,0 +40,0 @@ export class CustomApolloLink extends ApolloLink {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc