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

netlify-onegraph-internal

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

netlify-onegraph-internal - npm Package Compare versions

Comparing version 0.0.34 to 0.0.35

dist/graphql.test.d.ts

1

dist/graphqlHelpers.d.ts

@@ -71,2 +71,3 @@ import { GraphQLSchema, FragmentDefinitionNode, OperationDefinitionNode, GraphQLType } from "graphql";

};
export declare const normalizeOperationsDoc: (operationsDoc: string) => string;
export {};

242

dist/graphqlHelpers.js

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.formElComponent = exports.remixFormInput = exports.formInput = exports.patchSubscriptionWebhookSecretField = exports.patchSubscriptionWebhookField = exports.typeScriptTypeNameForOperation = exports.typeScriptSignatureForFragment = exports.typeScriptDefinitionObjectForFragment = exports.typeScriptSignatureForOperation = exports.typeScriptDefinitionObjectForOperation = exports.listCount = exports.typeScriptSignatureForOperationVariables = exports.typeScriptForGraphQLType = exports.gatherVariableDefinitions = exports.gatherAllReferencedTypes = void 0;
exports.normalizeOperationsDoc = exports.formElComponent = exports.remixFormInput = exports.formInput = exports.patchSubscriptionWebhookSecretField = exports.patchSubscriptionWebhookField = exports.typeScriptTypeNameForOperation = exports.typeScriptSignatureForFragment = exports.typeScriptDefinitionObjectForFragment = exports.typeScriptSignatureForOperation = exports.typeScriptDefinitionObjectForOperation = exports.listCount = exports.typeScriptSignatureForOperationVariables = exports.typeScriptForGraphQLType = exports.gatherVariableDefinitions = exports.gatherAllReferencedTypes = void 0;
var graphql_1 = require("graphql");

@@ -137,12 +137,15 @@ function capitalizeFirstLetter(string) {

});
var typesObject = variables.map(function (_a) {
var typesObject = variables
.map(function (_a) {
var varName = _a[0], varDef = _a[1];
var printedType = (0, graphql_1.print)(varDef.type);
var parsedType = (0, graphql_1.parseType)(printedType);
//@ts-ignore
var gqlType = (0, graphql_1.typeFromAST)(schema, parsedType);
//@ts-ignore
if (!gqlType) {
return;
}
var tsType = typeScriptForGraphQLType(schema, gqlType);
return [varName, tsType];
});
})
.filter(Boolean);
var typeFields = typesObject

@@ -158,3 +161,2 @@ .map(function (_a) {

exports.typeScriptSignatureForOperationVariables = typeScriptSignatureForOperationVariables;
//@ts-ignore
function listCount(gqlType) {

@@ -744,11 +746,11 @@ var inspectedType = gqlType;

{
kind: "Argument",
kind: graphql_1.Kind.ARGUMENT,
name: {
kind: "Name",
kind: graphql_1.Kind.NAME,
value: "webhookUrl",
},
value: {
kind: "Variable",
kind: graphql_1.Kind.VARIABLE,
name: {
kind: "Name",
kind: graphql_1.Kind.NAME,
value: "netlifyGraphWebhookUrl",

@@ -763,31 +765,28 @@ },

var hasWebhookVariableDefinition = (_b = definition.variableDefinitions) === null || _b === void 0 ? void 0 : _b.find(function (varDef) { return varDef.variable.name.value === "netlifyGraphWebhookUrl"; });
var netlifyGraphWebhookUrlVariable = {
kind: graphql_1.Kind.VARIABLE_DEFINITION,
type: {
kind: graphql_1.Kind.NON_NULL_TYPE,
type: {
kind: graphql_1.Kind.NAMED_TYPE,
name: {
kind: graphql_1.Kind.NAME,
value: "String",
},
},
},
variable: {
kind: graphql_1.Kind.VARIABLE,
name: {
kind: graphql_1.Kind.NAME,
value: "netlifyGraphWebhookUrl",
},
},
};
var variableDefinitions = !!hasWebhookVariableDefinition
? definition.variableDefinitions
: __spreadArray(__spreadArray([], (definition.variableDefinitions || []), true), [
{
kind: "VariableDefinition",
type: {
kind: "NonNullType",
type: {
kind: "NamedType",
name: {
kind: "Name",
value: "String",
},
},
},
variable: {
kind: "Variable",
name: {
kind: "Name",
value: "netlifyGraphWebhookUrl",
},
},
},
netlifyGraphWebhookUrlVariable,
], false);
return __assign(__assign({}, definition), {
//@ts-ignore: Handle edge cases later
variableDefinitions: variableDefinitions,
//@ts-ignore: Handle edge cases later
selectionSet: __assign(__assign({}, definition.selectionSet), { selections: newSelections }) });
return __assign(__assign({}, definition), { variableDefinitions: variableDefinitions, selectionSet: __assign(__assign({}, definition.selectionSet), { selections: newSelections }) });
}

@@ -818,11 +817,11 @@ exports.patchSubscriptionWebhookField = patchSubscriptionWebhookField;

{
kind: "Argument",
kind: graphql_1.Kind.ARGUMENT,
name: {
kind: "Name",
kind: graphql_1.Kind.NAME,
value: "secret",
},
value: {
kind: "Variable",
kind: graphql_1.Kind.VARIABLE,
name: {
kind: "Name",
kind: graphql_1.Kind.NAME,
value: "netlifyGraphWebhookSecret",

@@ -837,31 +836,28 @@ },

var hasWebhookVariableDefinition = (_b = definition.variableDefinitions) === null || _b === void 0 ? void 0 : _b.find(function (varDef) { return varDef.variable.name.value === "netlifyGraphWebhookSecret"; });
var netlifyGraphWebhookUrlVariable = {
kind: graphql_1.Kind.VARIABLE_DEFINITION,
type: {
kind: graphql_1.Kind.NON_NULL_TYPE,
type: {
kind: graphql_1.Kind.NAMED_TYPE,
name: {
kind: graphql_1.Kind.NAME,
value: "OneGraphSubscriptionSecretInput",
},
},
},
variable: {
kind: graphql_1.Kind.VARIABLE,
name: {
kind: graphql_1.Kind.NAME,
value: "netlifyGraphWebhookSecret",
},
},
};
var variableDefinitions = !!hasWebhookVariableDefinition
? definition.variableDefinitions
: __spreadArray(__spreadArray([], (definition.variableDefinitions || []), true), [
{
kind: "VariableDefinition",
type: {
kind: "NonNullType",
type: {
kind: "NamedType",
name: {
kind: "Name",
value: "OneGraphSubscriptionSecretInput",
},
},
},
variable: {
kind: "Variable",
name: {
kind: "Name",
value: "netlifyGraphWebhookSecret",
},
},
},
netlifyGraphWebhookUrlVariable,
], false);
return __assign(__assign({}, definition), {
//@ts-ignore: Handle edge cases later
variableDefinitions: variableDefinitions,
//@ts-ignore: Handle edge cases later
selectionSet: __assign(__assign({}, definition.selectionSet), { selections: newSelections }) });
return __assign(__assign({}, definition), { variableDefinitions: variableDefinitions, selectionSet: __assign(__assign({}, definition.selectionSet), { selections: newSelections }) });
}

@@ -1089,2 +1085,120 @@ exports.patchSubscriptionWebhookSecretField = patchSubscriptionWebhookSecretField;

exports.formElComponent = formElComponent;
var makeInputValueDefinitionNode = function (_a) {
var name = _a.name, baseKind = _a.baseKind, optional = _a.optional, description = _a.description;
var baseType = {
kind: graphql_1.Kind.NAMED_TYPE,
name: {
kind: graphql_1.Kind.NAME,
value: baseKind,
},
};
var type = optional
? baseType
: { kind: graphql_1.Kind.NON_NULL_TYPE, type: baseType };
return {
kind: graphql_1.Kind.INPUT_VALUE_DEFINITION,
name: {
kind: graphql_1.Kind.NAME,
value: name,
},
type: type,
directives: [],
description: {
kind: graphql_1.Kind.STRING,
block: true,
value: description,
},
};
};
var netlifyDirective = {
kind: graphql_1.Kind.DIRECTIVE_DEFINITION,
description: {
kind: graphql_1.Kind.STRING,
value: "An internal directive used by Netlify Graph",
block: true,
},
name: {
kind: graphql_1.Kind.NAME,
value: "netlify",
},
arguments: [
makeInputValueDefinitionNode({
name: "id",
baseKind: "String",
optional: false,
description: "The uuid of the operation (normally auto-generated)",
}),
makeInputValueDefinitionNode({
name: "doc",
baseKind: "String",
optional: true,
description: "The docstring for this operation",
}),
],
repeatable: false,
locations: [
{
kind: graphql_1.Kind.NAME,
value: "QUERY",
},
{
kind: graphql_1.Kind.NAME,
value: "MUTATION",
},
{
kind: graphql_1.Kind.NAME,
value: "SUBSCRIPTION",
},
{
kind: graphql_1.Kind.NAME,
value: "FRAGMENT_DEFINITION",
},
],
};
var normalizeOperationsDoc = function (operationsDoc) {
var parsedOperations = (0, graphql_1.parse)(operationsDoc);
var fragments = [];
var operations = [];
var sortedDefinitions = __spreadArray([], parsedOperations.definitions, true).sort(function (a, b) {
var _a, _b;
var aName = (a.kind === graphql_1.Kind.OPERATION_DEFINITION
? (_a = a.name) === null || _a === void 0 ? void 0 : _a.value
: a.kind === graphql_1.Kind.FRAGMENT_DEFINITION
? a.name.value
: null) || "__unknownDefinition";
var bName = (b.kind === graphql_1.Kind.OPERATION_DEFINITION
? (_b = b.name) === null || _b === void 0 ? void 0 : _b.value
: b.kind === graphql_1.Kind.FRAGMENT_DEFINITION
? b.name.value
: null) || "__unknownDefinition";
return aName.localeCompare(bName);
});
for (var _i = 0, sortedDefinitions_1 = sortedDefinitions; _i < sortedDefinitions_1.length; _i++) {
var definition = sortedDefinitions_1[_i];
var definitionWithNormalizedStrings = (0, graphql_1.visit)(definition, {
StringValue: {
enter: function (node) {
var hasNewlines = node.value.match(/\n/);
return __assign(__assign({}, node), { block: hasNewlines ? true : node.block });
},
},
});
if (definitionWithNormalizedStrings.kind === graphql_1.Kind.OPERATION_DEFINITION) {
operations.push(definitionWithNormalizedStrings);
}
else if (definitionWithNormalizedStrings.kind === graphql_1.Kind.FRAGMENT_DEFINITION) {
fragments.push(definitionWithNormalizedStrings);
}
}
var netlifyDirectiveString = (0, graphql_1.print)(netlifyDirective);
var fragmentStrings = fragments.map(function (fragment) {
return (0, graphql_1.print)(fragment);
});
var operationStrings = operations.map(function (operation) {
return (0, graphql_1.print)(operation);
});
var fullDoc = __spreadArray(__spreadArray([netlifyDirectiveString], fragmentStrings, true), operationStrings, true).join("\n\n") + "\n";
return fullDoc;
};
exports.normalizeOperationsDoc = normalizeOperationsDoc;
//# sourceMappingURL=graphqlHelpers.js.map
{
"name": "netlify-onegraph-internal",
"version": "0.0.34",
"version": "0.0.35",
"description": "Internal tools for use by Netlify",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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