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

@croquiscom/crary-graphql

Package Overview
Dependencies
Maintainers
5
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@croquiscom/crary-graphql - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

2

lib/index.js

@@ -10,3 +10,3 @@ "use strict";

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};

@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

import { GraphQLResolveInfo, GraphQLSchema } from 'graphql';
import { MergeInfo } from 'graphql-tools';
export declare function conformInfoToSchema<T extends GraphQLResolveInfo & {
mergeInfo?: MergeInfo;
} = GraphQLResolveInfo>(info: T, schema: GraphQLSchema, fragments?: {
field: string;
fragment: string;
}[]): T;
export declare function conformInfoToSchema<T extends GraphQLResolveInfo = GraphQLResolveInfo>(info: T, schema: GraphQLSchema, field_name?: string): T;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.conformInfoToSchema = void 0;
const delegate_1 = require("@graphql-tools/delegate");
const graphql_1 = require("graphql");
const graphql_tools_1 = require("graphql-tools");
function conformInfoToSchema(info, schema, fragments) {
function conformInfoToSchema(info, schema, field_name) {
var _a;
let rootSelectionSet;
if (field_name) {
let selections = [];
let args = [];
info.fieldNodes.forEach((field) => {
const fieldSelections = field.selectionSet
? field.selectionSet.selections
: [];
selections = selections.concat(fieldSelections);
args = args.concat(field.arguments || []);
});
let selectionSet;
if (selections.length > 0) {
selectionSet = {
kind: graphql_1.Kind.SELECTION_SET,
selections,
};
}
const rootField = {
kind: graphql_1.Kind.FIELD,
arguments: args,
selectionSet,
name: {
kind: graphql_1.Kind.NAME,
value: field_name,
},
};
rootSelectionSet = {
kind: graphql_1.Kind.SELECTION_SET,
selections: [rootField],
};
}
else {
rootSelectionSet = {
kind: graphql_1.Kind.SELECTION_SET,
selections: info.fieldNodes,
};
}
const document = {
kind: graphql_1.Kind.DOCUMENT,
definitions: [

@@ -12,21 +52,10 @@ {

operation: 'query',
selectionSet: {
kind: graphql_1.Kind.SELECTION_SET,
selections: info.fieldNodes,
},
selectionSet: rootSelectionSet,
variableDefinitions: [],
},
...Object.keys(info.fragments).map((fragmentName) => info.fragments[fragmentName]),
],
kind: graphql_1.Kind.DOCUMENT,
};
if (!fragments) {
if (info.mergeInfo) {
fragments = info.mergeInfo.fragments;
}
else {
fragments = [];
}
}
const request = { document, variables: {} };
const transformed = new graphql_tools_1.FilterToSchema(schema).transformRequest(new graphql_tools_1.ReplaceFieldWithFragment(schema, fragments).transformRequest(request));
const transformed = new delegate_1.FilterToSchema(schema).transformRequest(new delegate_1.AddFragmentsByField(schema, (_a = info === null || info === void 0 ? void 0 : info.schema.extensions) === null || _a === void 0 ? void 0 : _a.stitchingInfo.fragmentsByField).transformRequest(request));
const definition = transformed.document.definitions[0];

@@ -33,0 +62,0 @@ return Object.assign(Object.assign({}, info), { fieldNodes: definition.selectionSet.selections });

@@ -19,7 +19,4 @@ import { GraphQLInputType, GraphQLResolveInfo, GraphQLSchema } from 'graphql';

removeArgument(name: string): this;
conformToSchema(schema: GraphQLSchema, fragments?: {
field: string;
fragment: string;
}[]): this;
conformToSchema(schema: GraphQLSchema): this;
}
export declare function wrapInfo<T extends GraphQLResolveInfo = GraphQLResolveInfo>(info: T): T & IGraphQLResolveInfoMethods;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapInfo = exports.removeFieldFromInfo = exports.removeArgumentFromInfo = exports.conformInfoToSchema = exports.addFieldToInfo = exports.addArgumentToInfo = void 0;
exports.wrapInfo = exports.removeFieldFromInfo = exports.removeArgumentFromInfo = exports.getFieldString = exports.getFieldList1st = exports.getFieldList = exports.conformInfoToSchema = exports.addFieldToInfo = exports.addArgumentToInfo = void 0;
const addArgumentToInfo_1 = require("./addArgumentToInfo");

@@ -24,4 +24,4 @@ Object.defineProperty(exports, "addArgumentToInfo", { enumerable: true, get: function () { return addArgumentToInfo_1.addArgumentToInfo; } });

removeArgument(name) { return removeArgumentFromInfo_1.removeArgumentFromInfo(this, name); },
conformToSchema(schema, fragments) { return conformInfoToSchema_1.conformInfoToSchema(this, schema, fragments); } });
conformToSchema(schema) { return conformInfoToSchema_1.conformInfoToSchema(this, schema); } });
}
exports.wrapInfo = wrapInfo;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hookResolverAddArgument = exports.hookResolver = void 0;
var hookResolver_1 = require("./hookResolver");

@@ -4,0 +5,0 @@ Object.defineProperty(exports, "hookResolver", { enumerable: true, get: function () { return hookResolver_1.hookResolver; } });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CrTimestamp = exports.CrJson = void 0;
var json_1 = require("./json");

@@ -4,0 +5,0 @@ Object.defineProperty(exports, "CrJson", { enumerable: true, get: function () { return json_1.CrJson; } });

{
"name": "@croquiscom/crary-graphql",
"version": "0.7.0",
"version": "0.8.0",
"description": "Croquis's library - graphql extension",

@@ -26,7 +26,9 @@ "main": "./lib",

"dependencies": {
"graphql": "^15.3.0",
"graphql-tools": "^5.0.0"
"@graphql-tools/delegate": "^6.2.4",
"@graphql-tools/utils": "^6.2.4",
"graphql": "^15.3.0"
},
"devDependencies": {
"@types/chai": "^4.2.12",
"@graphql-tools/stitch": "^6.2.4",
"@types/chai": "^4.2.13",
"@types/graphql": "^14.5.0",

@@ -39,5 +41,4 @@ "@types/mocha": "^8.0.3",

"tslint": "^6.1.3",
"typescript": "^3.9.7"
},
"gitHead": "9a4ac1c5e2f8defb9b09b15fdafbbdfa45f3d1c2"
"typescript": "^4.0.3"
}
}
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