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

augment-gql-operations

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

augment-gql-operations - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

19

index.js

@@ -20,5 +20,2 @@ "use strict";

plugin: function (schema, documents, config) {
if (!(config === null || config === void 0 ? void 0 : config.content)) {
return;
}
try {

@@ -33,10 +30,10 @@ var ContentDocument = graphql_tag_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query {\n ", "\n }\n "], ["\n query {\n ", "\n }\n "])), config.content);

if ('operation' in definition) {
var existingSelectionsMap_1 = definition.selectionSet.selections.reduce(function (agg, selection) {
var existingSelections_1 = definition.selectionSet.selections.reduce(function (agg, selection) {
if ('name' in selection) {
agg.set(selection.name.value, selection);
agg.add(selection.name.value);
}
return agg;
}, new Map());
}, new Set());
var newSelections = selectionSet_1.selections.reduce(function (agg, selection) {
if ('name' in selection && !existingSelectionsMap_1.has(selection.name.value)) {
if ('name' in selection && !existingSelections_1.has(selection.name.value)) {
agg.push(selection);

@@ -56,7 +53,13 @@ }

/* eslint-disable-next-line no-console */
console.warn("Failed to parse content for augment-gql-operations: " + err.message);
console.warn("\"augment-gql-operations\" failed: " + err.message);
throw err;
}
},
validate: function (schema, documents, config) {
if (!(config === null || config === void 0 ? void 0 : config.content)) {
throw new Error("You must specify \"content\" in the configuration for \"augment-gql-operations\".");
}
},
};
module.exports = codegen;
var templateObject_1;

@@ -11,7 +11,3 @@ import { DocumentNode, GraphQLSchema, SelectionNode } from 'graphql';

const codegen = {
plugin: (schema: GraphQLSchema, documents: CodegenDocuments[], config?: { content?: string }) => {
if (!config?.content) {
return;
}
plugin: (schema: GraphQLSchema, documents: CodegenDocuments[], config: { content: string }) => {
try {

@@ -32,14 +28,11 @@ const ContentDocument = gql`

if ('operation' in definition) {
const existingSelectionsMap = definition.selectionSet.selections.reduce<Map<string, SelectionNode>>(
(agg, selection) => {
if ('name' in selection) {
agg.set(selection.name.value, selection);
}
return agg;
},
new Map(),
);
const existingSelections = definition.selectionSet.selections.reduce<Set<string>>((agg, selection) => {
if ('name' in selection) {
agg.add(selection.name.value);
}
return agg;
}, new Set());
const newSelections = selectionSet.selections.reduce<SelectionNode[]>(
(agg, selection) => {
if ('name' in selection && !existingSelectionsMap.has(selection.name.value)) {
if ('name' in selection && !existingSelections.has(selection.name.value)) {
agg.push(selection);

@@ -60,7 +53,14 @@ }

/* eslint-disable-next-line no-console */
console.warn(`Failed to parse content for augment-gql-operations: ${err.message}`);
console.warn(`"augment-gql-operations" failed: ${err.message}`);
throw err;
}
},
validate: (schema: GraphQLSchema, documents: CodegenDocuments[], config?: { content?: string }) => {
if (!config?.content) {
throw new Error(`You must specify "content" in the configuration for "augment-gql-operations".`);
}
},
};
module.exports = codegen;

@@ -5,3 +5,3 @@ {

"main": "index.js",
"version": "0.0.3",
"version": "0.0.4",
"author": "dannycochran",

@@ -8,0 +8,0 @@ "license": "MIT",

@@ -22,9 +22,8 @@ ### augment-gql-operation

plugins:
- 'augment-gql-operations':
content: 'requestDetails { debugLink }'
- 'typescript'
- 'typescript-operations'
- 'named-operations-object'
- 'typescript-react-apollo'
- 'fragment-matcher'
- 'augment-gql-operations':
content: 'requestDetails { debugLink }'
```

@@ -31,0 +30,0 @@

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