apollo-link-dedup
Advanced tools
Comparing version 1.0.13 to 1.0.14
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('apollo-link')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'apollo-link'], factory) : | ||
(factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.dedup = {}),global.apolloLink.core)); | ||
}(this, (function (exports,apolloLink) { 'use strict'; | ||
(global = global || self, factory((global.apolloLink = global.apolloLink || {}, global.apolloLink.dedup = {}), global.apolloLink.core)); | ||
}(this, function (exports, apolloLink) { 'use strict'; | ||
var __extends = (undefined && undefined.__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 __()); | ||
}; | ||
})(); | ||
/* | ||
* Expects context to contain the forceFetch field if no dedup | ||
*/ | ||
var DedupLink = /** @class */ (function (_super) { | ||
/*! ***************************************************************************** | ||
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 DedupLink = (function (_super) { | ||
__extends(DedupLink, _super); | ||
@@ -33,3 +46,2 @@ function DedupLink() { | ||
var _this = this; | ||
// sometimes we might not want to deduplicate a request, for example when we want to force fetch it. | ||
if (operation.getContext().forceFetch) { | ||
@@ -45,9 +57,5 @@ return forward(operation); | ||
if (!this.inFlightRequestObservables.get(key)) { | ||
// this is a new request, i.e. we haven't deduplicated it yet | ||
// call the next link | ||
var singleObserver_1 = forward(operation); | ||
var subscription_1; | ||
var sharedObserver = new apolloLink.Observable(function (observer) { | ||
// this will still be called by each subscriber regardless of | ||
// deduplication status | ||
var prev = _this.subscribers.get(key); | ||
@@ -87,3 +95,2 @@ if (!prev) | ||
} | ||
// return shared Observable | ||
return this.inFlightRequestObservables.get(key); | ||
@@ -98,3 +105,3 @@ }; | ||
}))); | ||
})); | ||
//# sourceMappingURL=bundle.umd.js.map |
@@ -7,1 +7,2 @@ import { ApolloLink, Operation, NextLink, FetchResult, Observable } from 'apollo-link'; | ||
} | ||
//# sourceMappingURL=dedupLink.d.ts.map |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -14,7 +15,5 @@ var extendStatics = function (d, b) { | ||
})(); | ||
import { ApolloLink, Observable, } from 'apollo-link'; | ||
/* | ||
* Expects context to contain the forceFetch field if no dedup | ||
*/ | ||
var DedupLink = /** @class */ (function (_super) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var apollo_link_1 = require("apollo-link"); | ||
var DedupLink = (function (_super) { | ||
__extends(DedupLink, _super); | ||
@@ -29,3 +28,2 @@ function DedupLink() { | ||
var _this = this; | ||
// sometimes we might not want to deduplicate a request, for example when we want to force fetch it. | ||
if (operation.getContext().forceFetch) { | ||
@@ -41,9 +39,5 @@ return forward(operation); | ||
if (!this.inFlightRequestObservables.get(key)) { | ||
// this is a new request, i.e. we haven't deduplicated it yet | ||
// call the next link | ||
var singleObserver_1 = forward(operation); | ||
var subscription_1; | ||
var sharedObserver = new Observable(function (observer) { | ||
// this will still be called by each subscriber regardless of | ||
// deduplication status | ||
var sharedObserver = new apollo_link_1.Observable(function (observer) { | ||
var prev = _this.subscribers.get(key); | ||
@@ -83,8 +77,7 @@ if (!prev) | ||
} | ||
// return shared Observable | ||
return this.inFlightRequestObservables.get(key); | ||
}; | ||
return DedupLink; | ||
}(ApolloLink)); | ||
export { DedupLink }; | ||
}(apollo_link_1.ApolloLink)); | ||
exports.DedupLink = DedupLink; | ||
//# sourceMappingURL=dedupLink.js.map |
export * from './dedupLink'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,7 @@ | ||
export * from './dedupLink'; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./dedupLink")); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "apollo-link-dedup", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Deduplicates queries that are currently on the wire", | ||
@@ -13,5 +13,4 @@ "author": "Evans Hauser <evanshauser@gmail.com>", | ||
"license": "MIT", | ||
"main": "./lib/bundle.umd.js", | ||
"module": "./lib/index.js", | ||
"jsnext:main": "./lib/index.js", | ||
"main": "./lib/index.js", | ||
"module": "./lib/bundle.esm.js", | ||
"typings": "./lib/index.d.ts", | ||
@@ -28,3 +27,3 @@ "repository": { | ||
"build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-link && npm run minify:browser", | ||
"build": "tsc -p .", | ||
"build": "tsc -p ./tsconfig.cjs.json", | ||
"bundle": "rollup -c", | ||
@@ -34,6 +33,7 @@ "clean": "rimraf lib/* && rimraf coverage/*", | ||
"filesize": "npm run build && npm run build:browser", | ||
"lint": "tslint --type-check -p tsconfig.json -c ../../tslint.json src/*.ts", | ||
"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", | ||
@@ -44,15 +44,15 @@ "test": "jest", | ||
"dependencies": { | ||
"apollo-link": "^1.2.6" | ||
"apollo-link": "^1.2.7" | ||
}, | ||
"devDependencies": { | ||
"@types/graphql": "14.0.3", | ||
"@types/graphql": "14.0.5", | ||
"@types/jest": "22.2.3", | ||
"browserify": "16.2.3", | ||
"graphql": "14.0.2", | ||
"graphql-tag": "2.10.0", | ||
"graphql": "14.1.1", | ||
"graphql-tag": "2.10.1", | ||
"jest": "22.4.4", | ||
"rimraf": "2.6.1", | ||
"rollup": "0.67.4", | ||
"rimraf": "2.6.3", | ||
"rollup": "0.68.2", | ||
"ts-jest": "22.4.6", | ||
"tslint": "5.11.0", | ||
"tslint": "5.12.1", | ||
"typescript": "3.0.3", | ||
@@ -72,5 +72,4 @@ "uglify-js": "3.4.9" | ||
], | ||
"mapCoverage": true, | ||
"testURL": "http://localhost" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58943
27
279
1
Updatedapollo-link@^1.2.7