Socket
Socket
Sign inDemoInstall

graphile-build-pg

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphile-build-pg - npm Package Compare versions

Comparing version 0.1.0-alpha.30 to 0.1.0-alpha.31

2

node7minus/plugins/makeProcField.js

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

var returnFirstValueAsValue = false;
var TableType = returnTypeTable && getTypeByName(inflection.tableType(returnTypeTable.name, returnTypeTable.namespace && returnTypeTable.namespace.name));
var TableType = returnTypeTable && getTypeByName(inflection.tableType(returnTypeTable.name, returnTypeTable.namespaceName));

@@ -151,0 +151,0 @@ var isTableLike = TableType && isCompositeType(TableType) || false;

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

*/
var fieldName = inflection.column(attr.name, table.name, table.namespace && table.namespace.name);
var fieldName = inflection.column(attr.name, table.name, table.namespaceName);
memo[fieldName] = fieldWithHooks(fieldName, function (_ref4) {

@@ -121,3 +121,3 @@ var getDataFromParsedResolveInfoFragment = _ref4.getDataFromParsedResolveInfoFragment,

}).reduce(function (memo, attr) {
var fieldName = inflection.column(attr.name, table.name, table.namespace && table.namespace.name);
var fieldName = inflection.column(attr.name, table.name, table.namespaceName);
memo[fieldName] = pgAddSubfield(fieldName, attr.name, attr.type, {

@@ -124,0 +124,0 @@ description: attr.description,

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

if (isInputType || !(isPgRowType || isPgCompoundType) || !table || table.kind !== "class") {
if (isInputType || !(isPgRowType || isPgCompoundType) || !table || table.kind !== "class" || !table.namespace) {
return fields;

@@ -25,0 +25,0 @@ }

@@ -18,8 +18,12 @@ "use strict";

introspectionResultsByKind.class.map(function (table) {
var tableTypeName = inflection.tableType(table.name, table.namespace && table.namespace.name);
introspectionResultsByKind.class.filter(function (table) {
return table.isSelectable;
}).filter(function (table) {
return !!table.namespace;
}).forEach(function (table) {
var tableTypeName = inflection.tableType(table.name, table.namespace.name);
/* const TableConditionType = */
newWithHooks(GraphQLInputObjectType, {
description: `A condition to be used against \`${tableTypeName}\` object types. All fields are tested for equality and combined with a logical ‘and.’`,
name: inflection.conditionType(inflection.tableType(table.name, table.namespace && table.namespace.name)),
name: inflection.conditionType(inflection.tableType(table.name, table.namespace.name)),
fields: function fields(_ref3) {

@@ -30,3 +34,3 @@ var fieldWithHooks = _ref3.fieldWithHooks;

}).reduce(function (memo, attr) {
var fieldName = inflection.column(attr.name, table.name, table.namespace && table.namespace.name);
var fieldName = inflection.column(attr.name, table.name, table.namespace.name);
memo[fieldName] = fieldWithHooks(fieldName, {

@@ -59,6 +63,6 @@ description: `Checks for equality with the object’s \`${fieldName}\` field.`,

if (!isPgConnectionField || !table || table.kind !== "class") {
if (!isPgConnectionField || !table || table.kind !== "class" || !table.namespace) {
return args;
}
var TableConditionType = getTypeByName(inflection.conditionType(inflection.tableType(table.name, table.namespace && table.namespace.name)));
var TableConditionType = getTypeByName(inflection.conditionType(inflection.tableType(table.name, table.namespace.name)));

@@ -65,0 +69,0 @@ addArgDataGenerator(function connectionCondition(_ref6) {

@@ -25,4 +25,8 @@ "use strict";

introspectionResultsByKind.class.map(function (table) {
var tableTypeName = inflection.tableType(table.name, table.namespace && table.namespace.name);
introspectionResultsByKind.class.filter(function (table) {
return table.isSelectable;
}).filter(function (table) {
return !!table.namespace;
}).forEach(function (table) {
var tableTypeName = inflection.tableType(table.name, table.namespace.name);
/* const TableOrderByType = */

@@ -56,6 +60,6 @@ newWithHooks(GraphQLEnumType, {

if (!isPgConnectionField || !table || table.kind !== "class") {
if (!isPgConnectionField || !table || table.kind !== "class" || !table.namespace || !table.isSelectable) {
return args;
}
var tableTypeName = inflection.tableType(table.name, table.namespace && table.namespace.name);
var tableTypeName = inflection.tableType(table.name, table.namespace.name);
var TableOrderByType = getTypeByName(inflection.orderByType(tableTypeName));

@@ -62,0 +66,0 @@

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

var table = pgIntrospectionTable || pgIntrospection;
if (!(isPgRowType || isMutationPayload) || !table || table.kind !== "class") {
if (!(isPgRowType || isMutationPayload) || !table || table.kind !== "class" || !table.namespace) {
return fields;

@@ -43,0 +43,0 @@ }

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

var compositeClass = introspectionResultsByKind.class.find(function (table) {
return !table.isSelectable && !table.isInsertable && !table.isUpdatable && !table.isDeletable && table.name === typeName && table.namespace && table.namespace.name === namespaceName;
return !table.isSelectable && !table.isInsertable && !table.isUpdatable && !table.isDeletable && table.name === typeName && table.namespaceName === namespaceName;
});

@@ -63,3 +63,3 @@ if (!compositeClass) {

var compositeTypeName = inflection.tableType(compositeClass.name, compositeClass.namespace.name);
var compositeTypeName = inflection.tableType(compositeClass.name, compositeClass.namespaceName);

@@ -66,0 +66,0 @@ var JWTType = newWithHooks(GraphQLScalarType, {

@@ -27,2 +27,4 @@ "use strict";

return !proc.isStable;
}).filter(function (proc) {
return !!proc.namespace;
}).reduce(function (memo, proc) {

@@ -29,0 +31,0 @@ /*

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

}).reduce(function (memo, attr) {
var ascFieldName = inflection.orderByEnum(attr.name, true, table.name, table.namespace && table.namespace.name);
var descFieldName = inflection.orderByEnum(attr.name, false, table.name, table.namespace && table.namespace.name);
var ascFieldName = inflection.orderByEnum(attr.name, true, table.name, table.namespaceName);
var descFieldName = inflection.orderByEnum(attr.name, false, table.name, table.namespaceName);
memo[ascFieldName] = {

@@ -27,0 +27,0 @@ value: {

@@ -37,2 +37,4 @@ "use strict";

return proc.isStable;
}).filter(function (proc) {
return !!proc.namespace;
}).reduce(function (memo, proc) {

@@ -39,0 +41,0 @@ /*

@@ -34,2 +34,4 @@ "use strict";

return proc.returnsSet;
}).filter(function (proc) {
return !!proc.namespace;
}).forEach(function (proc) {

@@ -36,0 +38,0 @@ var returnType = introspectionResultsByKind.typeById[proc.returnTypeId];

@@ -67,3 +67,2 @@ "use strict";

*/
var schema = table.namespace;
var primaryKeyConstraint = introspectionResultsByKind.constraint.filter(function (con) {

@@ -82,4 +81,4 @@ return con.classId === table.id;

});
var tableTypeName = inflection.tableType(table.name, schema && schema.name);
var shouldHaveNodeId = nodeIdFieldName && table.isSelectable && primaryKeys && primaryKeys.length ? true : false;
var tableTypeName = inflection.tableType(table.name, table.namespaceName);
var shouldHaveNodeId = nodeIdFieldName && table.isSelectable && table.namespace && primaryKeys && primaryKeys.length ? true : false;
var TableType = newWithHooks(GraphQLObjectType, {

@@ -150,3 +149,3 @@ description: table.description || tablePgType.description,

return sql.fragment`row(${sql.join(attributes.map(function (attr) {
var fieldName = inflection.column(attr.name, table.name, table.namespace.name);
var fieldName = inflection.column(attr.name, table.name, table.namespaceName);
var pgInputField = pgInputFields[fieldName];

@@ -153,0 +152,0 @@ var v = obj[fieldName];

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

let returnFirstValueAsValue = false;
const TableType = returnTypeTable && getTypeByName(inflection.tableType(returnTypeTable.name, returnTypeTable.namespace && returnTypeTable.namespace.name));
const TableType = returnTypeTable && getTypeByName(inflection.tableType(returnTypeTable.name, returnTypeTable.namespaceName));

@@ -129,0 +129,0 @@ const isTableLike = TableType && isCompositeType(TableType) || false;

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

*/
const fieldName = inflection.column(attr.name, table.name, table.namespace && table.namespace.name);
const fieldName = inflection.column(attr.name, table.name, table.namespaceName);
memo[fieldName] = fieldWithHooks(fieldName, ({ getDataFromParsedResolveInfoFragment, addDataGenerator }) => {

@@ -109,3 +109,3 @@ const ReturnType = gqlTypeByTypeId[attr.typeId] || _graphql.GraphQLString;

return extend(fields, introspectionResultsByKind.attribute.filter(attr => attr.classId === table.id).reduce((memo, attr) => {
const fieldName = inflection.column(attr.name, table.name, table.namespace && table.namespace.name);
const fieldName = inflection.column(attr.name, table.name, table.namespaceName);
memo[fieldName] = pgAddSubfield(fieldName, attr.name, attr.type, {

@@ -112,0 +112,0 @@ description: attr.description,

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

}) => {
if (isInputType || !(isPgRowType || isPgCompoundType) || !table || table.kind !== "class") {
if (isInputType || !(isPgRowType || isPgCompoundType) || !table || table.kind !== "class" || !table.namespace) {
return fields;

@@ -26,0 +26,0 @@ }

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

}) => {
introspectionResultsByKind.class.map(table => {
const tableTypeName = inflection.tableType(table.name, table.namespace && table.namespace.name);
introspectionResultsByKind.class.filter(table => table.isSelectable).filter(table => !!table.namespace).forEach(table => {
const tableTypeName = inflection.tableType(table.name, table.namespace.name);
/* const TableConditionType = */
newWithHooks(GraphQLInputObjectType, {
description: `A condition to be used against \`${tableTypeName}\` object types. All fields are tested for equality and combined with a logical ‘and.’`,
name: inflection.conditionType(inflection.tableType(table.name, table.namespace && table.namespace.name)),
name: inflection.conditionType(inflection.tableType(table.name, table.namespace.name)),
fields: ({ fieldWithHooks }) => introspectionResultsByKind.attribute.filter(attr => attr.classId === table.id).reduce((memo, attr) => {
const fieldName = inflection.column(attr.name, table.name, table.namespace && table.namespace.name);
const fieldName = inflection.column(attr.name, table.name, table.namespace.name);
memo[fieldName] = fieldWithHooks(fieldName, {

@@ -48,6 +48,6 @@ description: `Checks for equality with the object’s \`${fieldName}\` field.`,

}) => {
if (!isPgConnectionField || !table || table.kind !== "class") {
if (!isPgConnectionField || !table || table.kind !== "class" || !table.namespace) {
return args;
}
const TableConditionType = getTypeByName(inflection.conditionType(inflection.tableType(table.name, table.namespace && table.namespace.name)));
const TableConditionType = getTypeByName(inflection.conditionType(inflection.tableType(table.name, table.namespace.name)));

@@ -54,0 +54,0 @@ addArgDataGenerator(function connectionCondition({ condition }) {

@@ -19,4 +19,4 @@ "use strict";

}) => {
introspectionResultsByKind.class.map(table => {
const tableTypeName = inflection.tableType(table.name, table.namespace && table.namespace.name);
introspectionResultsByKind.class.filter(table => table.isSelectable).filter(table => !!table.namespace).forEach(table => {
const tableTypeName = inflection.tableType(table.name, table.namespace.name);
/* const TableOrderByType = */

@@ -45,6 +45,6 @@ newWithHooks(GraphQLEnumType, {

}) => {
if (!isPgConnectionField || !table || table.kind !== "class") {
if (!isPgConnectionField || !table || table.kind !== "class" || !table.namespace || !table.isSelectable) {
return args;
}
const tableTypeName = inflection.tableType(table.name, table.namespace && table.namespace.name);
const tableTypeName = inflection.tableType(table.name, table.namespace.name);
const TableOrderByType = getTypeByName(inflection.orderByType(tableTypeName));

@@ -51,0 +51,0 @@

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

const table = pgIntrospectionTable || pgIntrospection;
if (!(isPgRowType || isMutationPayload) || !table || table.kind !== "class") {
if (!(isPgRowType || isMutationPayload) || !table || table.kind !== "class" || !table.namespace) {
return fields;

@@ -43,0 +43,0 @@ }

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

const compositeClass = introspectionResultsByKind.class.find(table => !table.isSelectable && !table.isInsertable && !table.isUpdatable && !table.isDeletable && table.name === typeName && table.namespace && table.namespace.name === namespaceName);
const compositeClass = introspectionResultsByKind.class.find(table => !table.isSelectable && !table.isInsertable && !table.isUpdatable && !table.isDeletable && table.name === typeName && table.namespaceName === namespaceName);
if (!compositeClass) {

@@ -48,3 +48,3 @@ throw new Error(`Could not find JWT type '"${namespaceName}"."${typeName}"'`);

const compositeTypeName = inflection.tableType(compositeClass.name, compositeClass.namespace.name);
const compositeTypeName = inflection.tableType(compositeClass.name, compositeClass.namespaceName);

@@ -51,0 +51,0 @@ const JWTType = newWithHooks(GraphQLScalarType, {

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

} = build;
return extend(fields, introspectionResultsByKind.procedure.filter(proc => !proc.isStable).reduce((memo, proc) => {
return extend(fields, introspectionResultsByKind.procedure.filter(proc => !proc.isStable).filter(proc => !!proc.namespace).reduce((memo, proc) => {
/*

@@ -26,0 +26,0 @@ proc =

@@ -13,4 +13,4 @@ "use strict";

return extend(values, introspectionResultsByKind.attribute.filter(attr => attr.classId === table.id).reduce((memo, attr) => {
const ascFieldName = inflection.orderByEnum(attr.name, true, table.name, table.namespace && table.namespace.name);
const descFieldName = inflection.orderByEnum(attr.name, false, table.name, table.namespace && table.namespace.name);
const ascFieldName = inflection.orderByEnum(attr.name, true, table.name, table.namespaceName);
const descFieldName = inflection.orderByEnum(attr.name, false, table.name, table.namespaceName);
memo[ascFieldName] = {

@@ -17,0 +17,0 @@ value: {

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

} = build;
return extend(fields, introspectionResultsByKind.procedure.filter(proc => proc.isStable).reduce((memo, proc) => {
return extend(fields, introspectionResultsByKind.procedure.filter(proc => proc.isStable).filter(proc => !!proc.namespace).reduce((memo, proc) => {
/*

@@ -36,0 +36,0 @@ proc =

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

const Cursor = getTypeByName("Cursor");
introspectionResultsByKind.procedure.filter(proc => proc.returnsSet).forEach(proc => {
introspectionResultsByKind.procedure.filter(proc => proc.returnsSet).filter(proc => !!proc.namespace).forEach(proc => {
const returnType = introspectionResultsByKind.typeById[proc.returnTypeId];

@@ -32,0 +32,0 @@ const returnTypeTable = introspectionResultsByKind.classById[returnType.classId];

@@ -58,8 +58,7 @@ "use strict";

*/
const schema = table.namespace;
const primaryKeyConstraint = introspectionResultsByKind.constraint.filter(con => con.classId === table.id).filter(con => con.type === "p")[0];
const primaryKeys = primaryKeyConstraint && primaryKeyConstraint.keyAttributeNums.map(num => introspectionResultsByKind.attributeByClassIdAndNum[table.id][num]);
const attributes = introspectionResultsByKind.attribute.filter(attr => attr.classId === table.id).sort((a1, a2) => a1.num - a2.num);
const tableTypeName = inflection.tableType(table.name, schema && schema.name);
const shouldHaveNodeId = nodeIdFieldName && table.isSelectable && primaryKeys && primaryKeys.length ? true : false;
const tableTypeName = inflection.tableType(table.name, table.namespaceName);
const shouldHaveNodeId = nodeIdFieldName && table.isSelectable && table.namespace && primaryKeys && primaryKeys.length ? true : false;
const TableType = newWithHooks(GraphQLObjectType, {

@@ -123,3 +122,3 @@ description: table.description || tablePgType.description,

return sql.fragment`row(${sql.join(attributes.map(attr => {
const fieldName = inflection.column(attr.name, table.name, table.namespace.name);
const fieldName = inflection.column(attr.name, table.name, table.namespaceName);
const pgInputField = pgInputFields[fieldName];

@@ -126,0 +125,0 @@ const v = obj[fieldName];

{
"name": "graphile-build-pg",
"version": "0.1.0-alpha.30",
"version": "0.1.0-alpha.31",
"description": "Build a GraphQL schema by reflection over a PostgreSQL schema. Easy to customize since it's built with plugins on graphile-build",

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

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

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

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

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

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

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

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

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

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

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

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

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

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