Huge News!Announcing our $40M Series B led by Abstract Ventures.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 2.1.2 to 3.0.0

46

lib/reactiveSchemaLink.js

@@ -17,23 +17,3 @@ "use strict";

var apollo_link_1 = require("apollo-link");
var graphql_1 = require("graphql");
var reactive_graphql_1 = require("reactive-graphql");
var rxjs_1 = require("rxjs");
var operators_1 = require("rxjs/operators");
// will transform the errors of the execution results provided by
// reactive-graphql in proper GraphQLErrors
function normalizeErrorsField(results) {
var _results = {};
_results.data = results.data;
if (results.errors) {
_results.errors = results.errors.map(function (message) {
// @ts-ignore just to be sure, message could be an instance of error
if (typeof message.message === 'string') {
// @ts-ignore
return new graphql_1.GraphQLError(message.message);
}
return new graphql_1.GraphQLError(message);
});
}
return _results;
}
var ReactiveSchemaLink = /** @class */ (function (_super) {

@@ -51,18 +31,12 @@ __extends(ReactiveSchemaLink, _super);

return new apollo_link_1.Observable(function (observer) {
try {
var context = typeof _this.context === 'function' ? _this.context(operation) : _this.context || {};
return reactive_graphql_1.graphql(_this.schema, operation.query, null, context, operation.variables)
// reactive-graphql does not necessarely leverage the errors key (https://github.com/mesosphere/reactive-graphql/issues/13)
// so we do it ourself
.pipe(operators_1.catchError(function (error) { return rxjs_1.of({ errors: [new graphql_1.GraphQLError(error.message)] }); }))
.pipe(operators_1.map(normalizeErrorsField))
.subscribe(observer);
}
catch (e) {
if (e instanceof Error) {
observer.next({ errors: [new graphql_1.GraphQLError(e.message)] });
}
else
throw e;
}
var context = typeof _this.context === 'function' ? _this.context(operation) : _this.context || {};
var schema = _this.schema;
var query = operation.query, variables = operation.variables;
return reactive_graphql_1.execute({
schema: schema,
document: query,
contextValue: context,
variableValues: variables,
})
.subscribe(observer);
});

@@ -69,0 +43,0 @@ };

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

@@ -29,5 +29,3 @@ "license": "MIT",

"peerDependencies": {
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0",
"reactive-graphql": "^3.0.0",
"rxjs": "^6.0.0"
"reactive-graphql": "^4.0.1"
},

@@ -38,3 +36,2 @@ "devDependencies": {

"browserify": "16.2.3",
"graphql": "14.0.2",
"graphql-tag": "2.10.0",

@@ -48,3 +45,3 @@ "graphql-tools": "2.24.0",

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

@@ -51,0 +48,0 @@ },

@@ -22,5 +22,2 @@ # apollo-link-reactive-schema

link: new ReactiveSchemaLink({ schema }),
// without this option watchQuery won't be streaming
// see https://github.com/apollographql/apollo-client/issues/4322
queryDeduplication: false
});

@@ -27,0 +24,0 @@

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