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

@grapes-agency/apollo-link-local-schema

Package Overview
Dependencies
Maintainers
6
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grapes-agency/apollo-link-local-schema - npm Package Compare versions

Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Changelog

## 1.0.0-alpha.2 (2020-10-05)
### Features
* allow discrimination directive to be configured ([eb9107b](https://github.com/grapes-agency/apollo-link-local-schema/commit/eb9107b4da2500b1872ecf2086e7a1922eac72b2))
### Bug Fixes
* always allow __typename selection ([9de9386](https://github.com/grapes-agency/apollo-link-local-schema/commit/9de9386864199592271a8dc9d22a025f95863258))
## 1.0.0-alpha.1 (2020-10-02)

9

index.cjs.js

@@ -71,3 +71,3 @@ 'use strict';

utilities.checkDocument(document);
const hasLocalDirective = (field) => { var _a; return Boolean((_a = field.directives) === null || _a === void 0 ? void 0 : _a.find(directive => directive.name.value === 'local')); };
const hasLocalDirective = (field) => { var _a; return Boolean((_a = field.directives) === null || _a === void 0 ? void 0 : _a.find(directive => directive.name.value === splitDirective)); };
const localParentFields = new Set();

@@ -359,3 +359,3 @@ const usedFragments = new Set();

}
if (selection.kind === 'Field') {
if (selection.kind === 'Field' && selection.name.value !== '__typename') {
const field = (_a = type.fields) === null || _a === void 0 ? void 0 : _a.find(f => f.name.value === selection.name.value);

@@ -383,3 +383,3 @@ if (!field) {

class LocalSchemaLink extends client.ApolloLink {
constructor({ typeDefs, resolvers, context, assumeLocal, validateQuery = true }) {
constructor({ typeDefs, resolvers, context, assumeLocal, validateQuery = true, discriminationDirective = 'local', }) {
super();

@@ -394,2 +394,3 @@ this.localState = null;

this.validateQuery = validateQuery;
this.discriminationDirective = discriminationDirective;
}

@@ -409,3 +410,3 @@ getLocalState(operation) {

}
const documentsPair = splitDocument(document, 'local');
const documentsPair = splitDocument(document, this.discriminationDirective);
this.processedDocuments.set(document, documentsPair);

@@ -412,0 +413,0 @@ return documentsPair;

@@ -7,2 +7,3 @@ /// <reference types="zen-observable" />

assumeLocal?: boolean;
discriminationDirective?: string;
typeDefs: DocumentNode | Array<DocumentNode>;

@@ -21,3 +22,4 @@ resolvers: Resolvers<Context>;

private validateQuery;
constructor({ typeDefs, resolvers, context, assumeLocal, validateQuery }: LocalSchemaLinkOptions<Context>);
private discriminationDirective;
constructor({ typeDefs, resolvers, context, assumeLocal, validateQuery, discriminationDirective, }: LocalSchemaLinkOptions<Context>);
private getLocalState;

@@ -24,0 +26,0 @@ private splitDocument;

@@ -11,3 +11,3 @@ import { ApolloLink, Observable } from '@apollo/client';

class LocalSchemaLink extends ApolloLink {
constructor({ typeDefs, resolvers, context, assumeLocal, validateQuery = true }) {
constructor({ typeDefs, resolvers, context, assumeLocal, validateQuery = true, discriminationDirective = 'local', }) {
super();

@@ -22,2 +22,3 @@ this.localState = null;

this.validateQuery = validateQuery;
this.discriminationDirective = discriminationDirective;
}

@@ -37,3 +38,3 @@ getLocalState(operation) {

}
const documentsPair = splitDocument(document, 'local');
const documentsPair = splitDocument(document, this.discriminationDirective);
this.processedDocuments.set(document, documentsPair);

@@ -40,0 +41,0 @@ return documentsPair;

{
"name": "@grapes-agency/apollo-link-local-schema",
"version": "1.0.0-alpha.1",
"version": "1.0.0-alpha.2",
"description": "Lightweight local schema resolver for @apollo/client",

@@ -20,4 +20,3 @@ "main": "index.cjs.js",

},
"private": false,
"module": "index.js"
}

@@ -6,3 +6,3 @@ import { visit } from 'graphql';

checkDocument(document);
const hasLocalDirective = (field) => { var _a; return Boolean((_a = field.directives) === null || _a === void 0 ? void 0 : _a.find(directive => directive.name.value === 'local')); };
const hasLocalDirective = (field) => { var _a; return Boolean((_a = field.directives) === null || _a === void 0 ? void 0 : _a.find(directive => directive.name.value === splitDirective)); };
const localParentFields = new Set();

@@ -9,0 +9,0 @@ const usedFragments = new Set();

@@ -32,3 +32,3 @@ import { isOperationDefinition, isFragmentDefinition, getTypeName } from './node.js';

}
if (selection.kind === 'Field') {
if (selection.kind === 'Field' && selection.name.value !== '__typename') {
const field = (_a = type.fields) === null || _a === void 0 ? void 0 : _a.find(f => f.name.value === selection.name.value);

@@ -35,0 +35,0 @@ if (!field) {

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