Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-link-retry

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-retry - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

dist/src/bundle.umd.js

4

CHANGELOG.md

@@ -0,4 +1,8 @@

# Change log
### vNext
### 2.0.2
- ApolloLink upgrade
### 2.0.1

@@ -5,0 +9,0 @@ - ApolloLink upgrade

1

lib/retryLink.d.ts

@@ -1,2 +0,1 @@

/// <reference types="zen-observable" />
import { ApolloLink, Observable, Operation, NextLink, FetchResult } from 'apollo-link';

@@ -3,0 +2,0 @@ import { DelayFunction, DelayFunctionOptions } from './delayFunction';

{
"name": "apollo-link-retry",
"version": "2.1.2",
"version": "2.1.3",
"description": "Retry Apollo Link for GraphQL Network Stack",

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

"scripts": {
"build:browser":
"browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-link && npm run minify:browser",
"build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-link && 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",

@@ -47,17 +44,17 @@ "prebuild": "npm run clean",

"@types/zen-observable": "0.5.3",
"apollo-link": "^1.1.0"
"apollo-link": "^1.2.0"
},
"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",
"wait-for-observables": "1.0.3"

@@ -70,4 +67,10 @@ },

"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": ["ts", "tsx", "js", "json"]
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json"
],
"mapCoverage": true
}
}
import gql from 'graphql-tag';
import { execute, ApolloLink, Observable, FetchResult } from 'apollo-link';
import {
execute,
ApolloLink,
Observable,
FetchResult,
fromError,
} from 'apollo-link';
import waitFor from 'wait-for-observables';

@@ -21,3 +27,3 @@

const retry = new RetryLink({ delay: { initial: 1 }, attempts: { max } });
const stub = jest.fn(() => new Observable(o => o.error(standardError)));
const stub = jest.fn(() => fromError(standardError));
const link = ApolloLink.from([retry, stub]);

@@ -48,3 +54,3 @@

const stub = jest.fn();
stub.mockReturnValueOnce(new Observable(o => o.error(standardError)));
stub.mockReturnValueOnce(fromError(standardError));
stub.mockReturnValueOnce(Observable.of(data));

@@ -66,3 +72,3 @@ const link = ApolloLink.from([retry, stub]);

const firstTry = new Observable(o => o.error(standardError));
const firstTry = fromError(standardError);
// Hold the test hostage until we're hit

@@ -102,4 +108,4 @@ let secondTry;

const stub = jest.fn();
stub.mockReturnValueOnce(new Observable(o => o.error(standardError)));
stub.mockReturnValueOnce(new Observable(o => o.error(standardError)));
stub.mockReturnValueOnce(fromError(standardError));
stub.mockReturnValueOnce(fromError(standardError));
stub.mockReturnValueOnce(Observable.of(data));

@@ -121,3 +127,3 @@ const link = ApolloLink.from([retry, stub]);

const data = { data: { hello: 'world' } };
const stub = jest.fn(() => new Observable(o => o.error(standardError)));
const stub = jest.fn(() => fromError(standardError));
const link = ApolloLink.from([retry, stub]);

@@ -137,3 +143,3 @@

const retry = new RetryLink({ delay: delayStub, attempts: { max: 3 } });
const linkStub = jest.fn(() => new Observable(o => o.error(standardError)));
const linkStub = jest.fn(() => fromError(standardError));
const link = ApolloLink.from([retry, linkStub]);

@@ -160,3 +166,3 @@ const [{ error }] = await waitFor(execute(link, { query }));

});
const linkStub = jest.fn(() => new Observable(o => o.error(standardError)));
const linkStub = jest.fn(() => fromError(standardError));
const link = ApolloLink.from([retry, linkStub]);

@@ -163,0 +169,0 @@ const [{ error }] = await waitFor(execute(link, { query }));

@@ -44,5 +44,7 @@ import { Operation } from 'apollo-link';

export function buildDelayFunction(
{ initial = 300, max = Infinity, jitter = true }: DelayFunctionOptions = {},
): DelayFunction {
export function buildDelayFunction({
initial = 300,
max = Infinity,
jitter = true,
}: DelayFunctionOptions = {}): DelayFunction {
let baseDelay;

@@ -49,0 +51,0 @@ if (jitter) {

@@ -33,5 +33,6 @@ import { Operation } from 'apollo-link';

export function buildRetryFunction(
{ max = 5, retryIf }: RetryFunctionOptions = {},
): RetryFunction {
export function buildRetryFunction({
max = 5,
retryIf,
}: RetryFunctionOptions = {}): RetryFunction {
return function retryFunction(count, operation, error) {

@@ -38,0 +39,0 @@ if (count >= max) return false;

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc