apollo-link-dedup
Advanced tools
Comparing version 0.3.4 to 0.4.1-beta.0
@@ -1,2 +0,2 @@ | ||
import { ApolloLink, Operation, NextLink, FetchResult, Observable } from 'apollo-link-core'; | ||
import { ApolloLink, Operation, NextLink, FetchResult, Observable } from 'apollo-link'; | ||
export default class DedupLink extends ApolloLink { | ||
@@ -3,0 +3,0 @@ private inFlightRequestObservables; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -12,5 +11,4 @@ var extendStatics = Object.setPrototypeOf || | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var apollo_link_core_1 = require("apollo-link-core"); | ||
var printer_1 = require("graphql/language/printer"); | ||
import { ApolloLink, Observable, } from 'apollo-link'; | ||
import { print } from 'graphql/language/printer'; | ||
var DedupLink = (function (_super) { | ||
@@ -32,4 +30,4 @@ __extends(DedupLink, _super); | ||
} | ||
return new apollo_link_core_1.Observable(function (observer) { | ||
return _this.inFlightRequestObservables[key].subscribe({ | ||
return new Observable(function (observer) { | ||
var subscription = _this.inFlightRequestObservables[key].subscribe({ | ||
next: observer.next.bind(observer), | ||
@@ -45,10 +43,16 @@ error: function (error) { | ||
}); | ||
return function () { | ||
if (subscription) { | ||
subscription.unsubscribe(); | ||
} | ||
delete _this.inFlightRequestObservables[key]; | ||
}; | ||
}); | ||
}; | ||
DedupLink.prototype.getKey = function (operation) { | ||
return printer_1.print(operation.query) + "|" + JSON.stringify(operation.variables) + "|" + operation.operationName; | ||
return print(operation.query) + "|" + JSON.stringify(operation.variables) + "|" + operation.operationName; | ||
}; | ||
return DedupLink; | ||
}(apollo_link_core_1.ApolloLink)); | ||
exports.default = DedupLink; | ||
}(ApolloLink)); | ||
export default DedupLink; | ||
//# sourceMappingURL=dedupLink.js.map |
{ | ||
"name": "apollo-link-dedup", | ||
"version": "0.3.4", | ||
"version": "0.4.1-beta.0", | ||
"description": "Deduplicates queries that are currently on the wire", | ||
@@ -13,4 +13,6 @@ "author": "Evans Hauser <evanshauser@gmail.com>", | ||
"license": "MIT", | ||
"main": "./lib/dedupLink.js", | ||
"typings": "./lib/dedupLink.d.ts", | ||
"main": "./dist/src/bundle.umd.js", | ||
"module": "./dist/src/dedupLink.js", | ||
"jsnext:main": "./dist/src/dedupLink.js", | ||
"typings": "./dist/src/dedupLink.d.ts", | ||
"repository": { | ||
@@ -25,3 +27,3 @@ "type": "git", | ||
"scripts": { | ||
"pretest": "npm run build", | ||
"pretest": "npm run build-test", | ||
"test": "npm run test-only --", | ||
@@ -37,9 +39,12 @@ "posttest": "npm run lint", | ||
"lint": | ||
"tslint --type-check -p tsconfig.json src/*.ts && tslint --type-check -p tsconfig.json tests/*.ts", | ||
"tslint --type-check -p tsconfig.test.json src/*.ts && tslint --type-check -p tsconfig.test.json tests/*.ts", | ||
"prebuild": "npm run clean:dist", | ||
"build": "tsc -p .", | ||
"postbuild": "cp -R ./dist/src/. ./lib", | ||
"build-test": "tsc -p tsconfig.test.json", | ||
"postbuild": "npm run bundle", | ||
"postbuild-test": "npm run bundle", | ||
"bundle": "rollup -c", | ||
"watch": "tsc -w -p .", | ||
"clean": "npm run clean:dist && npm run clean:coverage", | ||
"clean:dist": "rimraf dist/* && rimraf lib/*", | ||
"clean:dist": "rimraf dist/*", | ||
"clean:coverage": "rimraf coverage/*", | ||
@@ -50,5 +55,7 @@ "prepublishOnly": "npm run clean && npm run build" | ||
"apollo-fetch": "^0.6.0", | ||
"apollo-link-core": "^0.5.4", | ||
"graphql": "^0.10.5" | ||
}, | ||
"peerDependencies": { | ||
"apollo-link": "^0.6.1-beta.0" | ||
}, | ||
"devDependencies": { | ||
@@ -60,2 +67,3 @@ "@types/chai": "4.0.4", | ||
"@types/sinon": "2.3.3", | ||
"apollo-link": "^0.6.1-beta.0", | ||
"chai": "4.1.1", | ||
@@ -70,2 +78,3 @@ "chai-as-promised": "7.1.1", | ||
"rimraf": "2.6.1", | ||
"rollup": "^0.45.2", | ||
"sinon": "3.2.0", | ||
@@ -72,0 +81,0 @@ "source-map-support": "0.4.16", |
@@ -7,3 +7,3 @@ import { | ||
Observable, | ||
} from 'apollo-link-core'; | ||
} from 'apollo-link'; | ||
@@ -38,4 +38,4 @@ import { print } from 'graphql/language/printer'; | ||
} | ||
return new Observable<FetchResult>(observer => | ||
this.inFlightRequestObservables[key].subscribe({ | ||
return new Observable<FetchResult>(observer => { | ||
const subscription = this.inFlightRequestObservables[key].subscribe({ | ||
next: observer.next.bind(observer), | ||
@@ -50,4 +50,11 @@ error: error => { | ||
}, | ||
}), | ||
); | ||
}); | ||
return () => { | ||
if (subscription) { | ||
subscription.unsubscribe(); | ||
} | ||
delete this.inFlightRequestObservables[key]; | ||
}; | ||
}); | ||
} | ||
@@ -54,0 +61,0 @@ |
{ | ||
"extends": "../../tsconfig", | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["es6", "dom"], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"removeComments": true, | ||
"sourceMap": true, | ||
"declaration": true, | ||
"rootDir": ".", | ||
"outDir": "dist", | ||
"noImplicitAny": false, | ||
"noUnusedParameters": false, | ||
"noUnusedLocals": true, | ||
"skipLibCheck": true | ||
"rootDir": "." | ||
}, | ||
"include": ["src/**/*.ts", "tests/**/*.ts"] | ||
"include": ["src/**/*.ts"] | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
19125
20
11
322
1
+ Addedapollo-link@0.6.1-beta.6(transitive)
+ Addedapollo-utilities@0.2.0-rc.3(transitive)
+ Addedgraphql@0.11.7(transitive)
+ Addediterall@1.1.3(transitive)
- Removedapollo-link-core@^0.5.4
- Removedapollo-link-core@0.5.4(transitive)
- Removedgraphql-tag@2.12.6(transitive)
- Removediterall@1.3.0(transitive)
- Removedtslib@2.8.1(transitive)