New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

apollo-link

Package Overview
Dependencies
Maintainers
4
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

6

CHANGELOG.md

@@ -5,2 +5,8 @@ # Change log

# 1.0.5
- fix bug where context wasn't merged when setting it
# 1.0.4
- export link util helpers
# 1.0.3

@@ -7,0 +13,0 @@ - removed requiring query on initial execution check

4

lib/bundle.umd.js

@@ -100,6 +100,6 @@ (function (global, factory) {

if (typeof next === 'function') {
context = next(context);
context = __assign({}, context, next(context));
}
else {
context = __assign({}, next);
context = __assign({}, context, next);
}

@@ -106,0 +106,0 @@ };

@@ -98,6 +98,6 @@ var __extends = (this && this.__extends) || (function () {

if (typeof next === 'function') {
context = next(context);
context = __assign({}, context, next(context));
}
else {
context = __assign({}, next);
context = __assign({}, context, next);
}

@@ -104,0 +104,0 @@ };

{
"name": "apollo-link",
"version": "1.0.4",
"version": "1.0.5",
"description": "Flexible, lightweight transport layer for GraphQL",

@@ -5,0 +5,0 @@ "author": "Evans Hauser <evanshauser@gmail.com>",

@@ -17,5 +17,4 @@ import * as Observable from 'zen-observable';

const setContext = () => ({ add: 1 });
describe('ApolloLink(abstract class)', () => {
const setContext = () => ({ add: 1 });
describe('concat', () => {

@@ -349,3 +348,49 @@ it('should concat a function', done => {

});
describe('context', () => {
it('should merge context when using a function', done => {
const returnOne = new SetContextLink(setContext);
const mock = new MockLink((op, forward) => {
op.setContext(({ add }) => ({ add: add + 2 }));
op.setContext(() => ({ substract: 1 }));
return forward(op);
});
const link = returnOne.concat(mock).concat(op => {
expect(op.getContext()).toEqual({
add: 3,
substract: 1,
});
return Observable.of({ data: op.getContext().add });
});
testLinkResults({
link,
results: [3],
done,
});
});
it('should merge context when not using a function', done => {
const returnOne = new SetContextLink(setContext);
const mock = new MockLink((op, forward) => {
op.setContext({ add: 3 });
op.setContext({ substract: 1 });
return forward(op);
});
const link = returnOne.concat(mock).concat(op => {
expect(op.getContext()).toEqual({
add: 3,
substract: 1,
});
return Observable.of({ data: op.getContext().add });
});
testLinkResults({
link,
results: [3],
done,
});
});
});
describe('Link static library', () => {

@@ -352,0 +397,0 @@ describe('from', () => {

@@ -96,5 +96,5 @@ import { getOperationName } from 'apollo-utilities';

if (typeof next === 'function') {
context = next(context);
context = { ...context, ...next(context) };
} else {
context = { ...next };
context = { ...context, ...next };
}

@@ -101,0 +101,0 @@ };

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