apollo-link
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -5,30 +5,33 @@ # Change log | ||
# 1.1.0 | ||
### 1.2.0 | ||
- Add `fromError` Observable helper | ||
- change import method of zen-observable for rollup compat | ||
### 1.1.0 | ||
- Expose `#execute` on ApolloLink as static | ||
# 1.0.7 | ||
### 1.0.7 | ||
- Update to graphql@0.12 | ||
# 1.0.6 | ||
### 1.0.6 | ||
- update rollup | ||
# 1.0.5 | ||
### 1.0.5 | ||
- fix bug where context wasn't merged when setting it | ||
# 1.0.4 | ||
### 1.0.4 | ||
- export link util helpers | ||
# 1.0.3 | ||
### 1.0.3 | ||
- removed requiring query on initial execution check | ||
- moved to move efficent rollup build | ||
# 1.0.1, 1.0.2 | ||
### 1.0.1, 1.0.2 | ||
<!-- never published as latest --> | ||
- preleases for dev tool integation | ||
# 0.8.0 | ||
### 0.8.0 | ||
- added support for `extensions` on an operation | ||
# 0.7.0 | ||
### 0.7.0 | ||
- new operation API and start of changelog |
@@ -7,2 +7,4 @@ (function (global, factory) { | ||
Observable = Observable && Observable.hasOwnProperty('default') ? Observable['default'] : Observable; | ||
var __extends = (undefined && undefined.__extends) || (function () { | ||
@@ -82,2 +84,7 @@ var extendStatics = Object.setPrototypeOf || | ||
} | ||
function fromError(errorValue) { | ||
return new Observable(function (observer) { | ||
observer.error(errorValue); | ||
}); | ||
} | ||
function transformOperation(operation) { | ||
@@ -208,2 +215,3 @@ var transformedOperation = { | ||
exports.fromPromise = fromPromise; | ||
exports.fromError = fromError; | ||
exports.empty = empty; | ||
@@ -210,0 +218,0 @@ exports.from = from; |
export * from './link'; | ||
export { createOperation, makePromise, toPromise, fromPromise } from './linkUtils'; | ||
export { createOperation, makePromise, toPromise, fromPromise, fromError } from './linkUtils'; | ||
export * from './types'; | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
export { Observable }; |
export * from './link'; | ||
export { createOperation, makePromise, toPromise, fromPromise } from './linkUtils'; | ||
import * as Observable from 'zen-observable'; | ||
export { createOperation, makePromise, toPromise, fromPromise, fromError, } from './linkUtils'; | ||
import Observable from 'zen-observable'; | ||
export { Observable }; | ||
//# sourceMappingURL=index.js.map |
/// <reference types="zen-observable" /> | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { GraphQLRequest, NextLink, Operation, RequestHandler, FetchResult } from './types'; | ||
@@ -4,0 +4,0 @@ export declare const empty: () => ApolloLink; |
@@ -1,2 +0,2 @@ | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { validateOperation, isTerminating, LinkError, transformOperation, createOperation, } from './linkUtils'; | ||
@@ -3,0 +3,0 @@ var passthrough = function (op, forward) { return (forward ? forward(op) : Observable.of()); }; |
/// <reference types="zen-observable" /> | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { GraphQLRequest, Operation } from './types'; | ||
@@ -14,4 +14,5 @@ import { ApolloLink } from './link'; | ||
export declare function fromPromise<T>(promise: Promise<T>): Observable<T>; | ||
export declare function fromError<T>(errorValue: any): Observable<T>; | ||
export declare function transformOperation(operation: GraphQLRequest): GraphQLRequest; | ||
export declare function createOperation(starting: any, operation: GraphQLRequest): Operation; | ||
export declare function getKey(operation: GraphQLRequest): string; |
@@ -20,3 +20,3 @@ var __extends = (this && this.__extends) || (function () { | ||
import { getOperationName } from 'apollo-utilities'; | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { print } from 'graphql/language/printer'; | ||
@@ -80,2 +80,7 @@ export function validateOperation(operation) { | ||
} | ||
export function fromError(errorValue) { | ||
return new Observable(function (observer) { | ||
observer.error(errorValue); | ||
}); | ||
} | ||
export function transformOperation(operation) { | ||
@@ -82,0 +87,0 @@ var transformedOperation = { |
/// <reference types="zen-observable" /> | ||
import { Operation, RequestHandler, NextLink, FetchResult } from '../types'; | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { ApolloLink } from '../link'; | ||
@@ -5,0 +5,0 @@ export default class MockLink extends ApolloLink { |
/// <reference types="zen-observable" /> | ||
import { Operation, NextLink, FetchResult } from '../types'; | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { ApolloLink } from '../link'; | ||
@@ -5,0 +5,0 @@ export default class SetContextLink extends ApolloLink { |
/// <reference types="zen-observable" /> | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { ExecutionResult, DocumentNode } from 'graphql'; | ||
@@ -4,0 +4,0 @@ export interface GraphQLRequest { |
{ | ||
"name": "apollo-link", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Flexible, lightweight transport layer for GraphQL", | ||
@@ -26,4 +26,3 @@ "author": "Evans Hauser <evanshauser@gmail.com>", | ||
"scripts": { | ||
"build:browser": | ||
"browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities --i graphql --i zen-observable && npm run minify:browser", | ||
"build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities --i graphql --i zen-observable && npm run minify:browser", | ||
"build": "tsc -p .", | ||
@@ -34,6 +33,4 @@ "bundle": "rollup -c", | ||
"filesize": "npm run build && npm run build:browser", | ||
"lint": | ||
"tslint --type-check -p tsconfig.json -c ../../tslint.json src/*.ts", | ||
"minify:browser": | ||
"uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", | ||
"lint": "tslint --type-check -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", | ||
@@ -46,5 +43,6 @@ "prebuild": "npm run clean", | ||
"dependencies": { | ||
"@types/node": "^9.4.6", | ||
"@types/zen-observable": "0.5.3", | ||
"apollo-utilities": "^1.0.0", | ||
"zen-observable": "^0.7.0" | ||
"zen-observable": "^0.8.0" | ||
}, | ||
@@ -55,14 +53,14 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@types/graphql": "0.12.3", | ||
"@types/graphql": "0.12.4", | ||
"@types/jest": "21.1.10", | ||
"browserify": "14.5.0", | ||
"graphql": "0.13.0", | ||
"browserify": "16.1.0", | ||
"graphql": "0.13.1", | ||
"graphql-tag": "2.7.3", | ||
"jest": "21.2.1", | ||
"rimraf": "2.6.1", | ||
"rollup": "0.55.3", | ||
"rollup": "0.56.2", | ||
"ts-jest": "21.2.4", | ||
"tslint": "5.9.1", | ||
"typescript": "2.7.1", | ||
"uglify-js": "3.3.9" | ||
"typescript": "2.7.2", | ||
"uglify-js": "3.3.11" | ||
}, | ||
@@ -74,4 +72,10 @@ "jest": { | ||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", | ||
"moduleFileExtensions": ["ts", "tsx", "js", "json"] | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"json" | ||
], | ||
"mapCoverage": true | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import gql from 'graphql-tag'; | ||
@@ -3,0 +3,0 @@ import { print } from 'graphql/language/printer'; |
@@ -1,3 +0,8 @@ | ||
import { validateOperation, fromPromise, makePromise } from '../linkUtils'; | ||
import * as Observable from 'zen-observable'; | ||
import { | ||
validateOperation, | ||
fromPromise, | ||
makePromise, | ||
fromError, | ||
} from '../linkUtils'; | ||
import Observable from 'zen-observable'; | ||
@@ -36,3 +41,3 @@ describe('Link utilities:', () => { | ||
it('return error call as Promise rejection', () => { | ||
return makePromise(new Observable(observer => observer.error(error))) | ||
return makePromise(fromError(error)) | ||
.then(expect.fail) | ||
@@ -86,2 +91,11 @@ .catch(actualError => expect(error).toEqual(actualError)); | ||
}); | ||
describe('fromError', () => { | ||
it('acts as error call', () => { | ||
const error = new Error('I always error'); | ||
const observable = fromError(error); | ||
return makePromise(observable) | ||
.then(expect.fail) | ||
.catch(actualError => expect(error).toEqual(actualError)); | ||
}); | ||
}); | ||
}); |
export * from './link'; | ||
export { createOperation, makePromise, toPromise, fromPromise } from './linkUtils'; | ||
export { | ||
createOperation, | ||
makePromise, | ||
toPromise, | ||
fromPromise, | ||
fromError, | ||
} from './linkUtils'; | ||
export * from './types'; | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
export { Observable }; |
@@ -1,2 +0,2 @@ | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
@@ -3,0 +3,0 @@ import { |
import { getOperationName } from 'apollo-utilities'; | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { print } from 'graphql/language/printer'; | ||
@@ -70,2 +70,8 @@ | ||
export function fromError<T>(errorValue: any): Observable<T> { | ||
return new Observable<T>(observer => { | ||
observer.error(errorValue); | ||
}); | ||
} | ||
export function transformOperation(operation: GraphQLRequest): GraphQLRequest { | ||
@@ -72,0 +78,0 @@ const transformedOperation: GraphQLRequest = { |
import { Operation, RequestHandler, NextLink, FetchResult } from '../types'; | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
@@ -5,0 +5,0 @@ import { ApolloLink } from '../link'; |
import { Operation, NextLink, FetchResult } from '../types'; | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
@@ -5,0 +5,0 @@ import { ApolloLink } from '../link'; |
@@ -1,2 +0,2 @@ | ||
import * as Observable from 'zen-observable'; | ||
import Observable from 'zen-observable'; | ||
import { ExecutionResult, DocumentNode } from 'graphql'; | ||
@@ -3,0 +3,0 @@ |
@@ -5,3 +5,4 @@ { | ||
"rootDir": "./src", | ||
"outDir": "lib" | ||
"outDir": "lib", | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
@@ -8,0 +9,0 @@ "include": ["src/**/*.ts"], |
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
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
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
103415
50
2135
5
+ Added@types/node@^9.4.6
+ Added@types/node@9.6.61(transitive)
+ Addedzen-observable@0.8.15(transitive)
- Removedzen-observable@0.7.1(transitive)
Updatedzen-observable@^0.8.0