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

apollo-link-reactive-schema

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-reactive-schema - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

7

package.json
{
"name": "apollo-link-reactive-schema",
"version": "1.0.0",
"version": "2.0.0",
"description": "Apollo Link that provides a reactive-graphql execution environment to perform operations on a provided reactive schema.",

@@ -22,3 +22,2 @@ "license": "MIT",

"filesize": "npm run build && npm run build:browser",
"lint": "tslint --type-check -p tsconfig.json -c ../../tslint.json src/*.ts",
"prebuild": "npm run clean",

@@ -34,3 +33,3 @@ "prepublishOnly": "npm run clean && npm run build",

"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0",
"reactive-graphql": "^2.0.0",
"reactive-graphql": "^3.0.0",
"rxjs": "^6.0.0"

@@ -51,3 +50,3 @@ },

"uglify-js": "3.4.9",
"reactive-graphql": "^2.0.0",
"reactive-graphql": "^3.0.0",
"rxjs": "^6.0.0"

@@ -54,0 +53,0 @@ },

import { ApolloLink, Operation, FetchResult, Observable } from 'apollo-link';
import { GraphQLSchema } from 'graphql';
import graphql from 'reactive-graphql';
import { graphql } from 'reactive-graphql';

@@ -23,5 +23,2 @@ export namespace ReactiveSchemaLink {

// util
const intersect = (array1: any[], array2: any[]) => array1.filter(value => -1 !== array2.indexOf(value));
export class ReactiveSchemaLink<ContextType> extends ApolloLink {

@@ -43,20 +40,10 @@ public schema: GraphQLSchema;

// reactive-graphql mixes variables and context
// see https://github.com/mesosphere/reactive-graphql/issues/6
// we we need to merge the vaiables in the context
// though let's throw an error if we end-up overiding a key
// already present on context
const { variables } = operation;
if (variables) {
const overridenKeys = intersect(Object.keys(variables), Object.keys(context));
if(overridenKeys.length > 0) {
throw new Error(`Variables overrides keys ${overridenKeys.map(k => `'${k}'`).join(',')} of context`);
}
}
const contextAndAriables = { ...context, ...variables };
return graphql(
this.schema,
operation.query,
this.schema,
contextAndAriables,
null,
context,
operation.variables,
// @ts-ignore issue with the typage of the `errors` key in reactive-graphql
// https://github.com/mesosphere/reactive-graphql/pull/11/files#r249788225
).subscribe(observer);

@@ -63,0 +50,0 @@ } catch(e) {

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