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.26 to 0.1.0-alpha.27

23

node7minus/index.js

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

});
exports.PgMutationPayloadEdgePlugin = exports.PgMutationProceduresPlugin = exports.PgMutationUpdateDeletePlugin = exports.PgMutationCreatePlugin = exports.PgConnectionTotalCount = exports.PageInfoStartEndCursor = exports.PgScalarFunctionConnectionPlugin = exports.PgNodeAliasPostGraphQL = exports.PgRowNode = exports.PgOrderByPrimaryKeyPlugin = exports.PgOrderAllColumnsPlugin = exports.PgQueryProceduresPlugin = exports.PgComputedColumnsPlugin = exports.PgRowByUniqueConstraint = exports.PgBackwardRelationPlugin = exports.PgForwardRelationPlugin = exports.PgColumnsPlugin = exports.PgAllRows = exports.PgConnectionArgCondition = exports.PgConnectionArgOrderBy = exports.PgConnectionArgFirstLastBeforeAfter = exports.PgTablesPlugin = exports.PgJWTPlugin = exports.PgTypesPlugin = exports.PgIntrospectionPlugin = exports.PgBasicsPlugin = exports.inflections = exports.defaultPlugins = undefined;
exports.constantCase = exports.camelCase = exports.upperFirst = exports.PgMutationPayloadEdgePlugin = exports.PgMutationProceduresPlugin = exports.PgMutationUpdateDeletePlugin = exports.PgMutationCreatePlugin = exports.PgConnectionTotalCount = exports.PageInfoStartEndCursor = exports.PgScalarFunctionConnectionPlugin = exports.PgNodeAliasPostGraphQL = exports.PgRowNode = exports.PgOrderByPrimaryKeyPlugin = exports.PgOrderAllColumnsPlugin = exports.PgQueryProceduresPlugin = exports.PgComputedColumnsPlugin = exports.PgRowByUniqueConstraint = exports.PgBackwardRelationPlugin = exports.PgForwardRelationPlugin = exports.PgColumnsPlugin = exports.PgAllRows = exports.PgConnectionArgCondition = exports.PgConnectionArgOrderBy = exports.PgConnectionArgFirstLastBeforeAfter = exports.PgTablesPlugin = exports.PgJWTPlugin = exports.PgTypesPlugin = exports.PgIntrospectionPlugin = exports.PgBasicsPlugin = exports.inflections = exports.defaultPlugins = undefined;
var _utils = require("./utils");
Object.defineProperty(exports, "upperFirst", {
enumerable: true,
get: function get() {
return _utils.upperFirst;
}
});
Object.defineProperty(exports, "camelCase", {
enumerable: true,
get: function get() {
return _utils.camelCase;
}
});
Object.defineProperty(exports, "constantCase", {
enumerable: true,
get: function get() {
return _utils.constantCase;
}
});
var _PgBasicsPlugin = require("./plugins/PgBasicsPlugin");

@@ -10,0 +31,0 @@

120

node7minus/inflections.js

@@ -12,6 +12,2 @@ "use strict";

var _slicedToArray2 = require("babel-runtime/helpers/slicedToArray");
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _pluralize = require("pluralize");

@@ -21,51 +17,19 @@

var _upperFirst = require("lodash/upperFirst");
var _utils = require("./utils");
var _upperFirst2 = _interopRequireDefault(_upperFirst);
var _camelCase = require("lodash/camelCase");
var _camelCase2 = _interopRequireDefault(_camelCase);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var constantCaseAll = function constantCaseAll(str) {
return str.replace(/[^a-zA-Z0-9_]+/g, "_").replace(/[A-Z]+/g, "_$&").replace(/__+/g, "_").replace(/^[^a-zA-Z0-9]+/, "").replace(/^[0-9]/, "_$&") // GraphQL enums must not start with a number
.toUpperCase();
};
var formatInsideUnderscores = function formatInsideUnderscores(fn) {
return function (str) {
var matches = str.match(/^(_*)([\s\S]*?)(_*)$/);
if (!matches) {
throw new Error("Impossible?"); // Satiate Flow
}
var _matches = (0, _slicedToArray3.default)(matches, 4),
start = _matches[1],
middle = _matches[2],
end = _matches[3];
return `${start}${fn(middle)}${end}`;
};
};
var upperFirst = formatInsideUnderscores(_upperFirst2.default);
var camelCase = formatInsideUnderscores(_camelCase2.default);
var constantCase = formatInsideUnderscores(constantCaseAll);
var defaultInflection = exports.defaultInflection = {
pluralize: _pluralize2.default,
argument(name, index) {
return camelCase(name || `arg${index}`);
return (0, _utils.camelCase)(name || `arg${index}`);
},
orderByType(typeName) {
return upperFirst(camelCase(`${(0, _pluralize2.default)(typeName)}-order-by`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${(0, _pluralize2.default)(typeName)}-order-by`));
},
orderByEnum(name, ascending, _table, _schema) {
return constantCase(`${name}_${ascending ? "asc" : "desc"}`);
return (0, _utils.constantCase)(`${name}_${ascending ? "asc" : "desc"}`);
},
domainType(name) {
return upperFirst(camelCase(name));
return (0, _utils.upperFirst)((0, _utils.camelCase)(name));
},

@@ -76,45 +40,45 @@ enumName(value) {

enumType(name) {
return upperFirst(camelCase(name));
return (0, _utils.upperFirst)((0, _utils.camelCase)(name));
},
conditionType(typeName) {
return upperFirst(camelCase(`${typeName}-condition`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-condition`));
},
inputType(typeName) {
return upperFirst(camelCase(`${typeName}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-input`));
},
rangeBoundType(typeName) {
return upperFirst(camelCase(`${typeName}-range-bound`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-range-bound`));
},
rangeType(typeName) {
return upperFirst(camelCase(`${typeName}-range`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-range`));
},
patchType(typeName) {
return upperFirst(camelCase(`${typeName}-patch`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-patch`));
},
patchField(itemName) {
return camelCase(`${itemName}-patch`);
return (0, _utils.camelCase)(`${itemName}-patch`);
},
tableName(name, _schema) {
return camelCase(_pluralize2.default.singular(name));
return (0, _utils.camelCase)(_pluralize2.default.singular(name));
},
tableNode(name, _schema) {
return camelCase(_pluralize2.default.singular(name));
return (0, _utils.camelCase)(_pluralize2.default.singular(name));
},
allRows(name, schema) {
return camelCase(`all-${this.pluralize(this.tableName(name, schema))}`);
return (0, _utils.camelCase)(`all-${this.pluralize(this.tableName(name, schema))}`);
},
functionName(name, _schema) {
return camelCase(name);
return (0, _utils.camelCase)(name);
},
functionPayloadType(name, _schema) {
return upperFirst(camelCase(`${name}-payload`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${name}-payload`));
},
functionInputType(name, _schema) {
return upperFirst(camelCase(`${name}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${name}-input`));
},
tableType(name, schema) {
return upperFirst(this.tableName(name, schema));
return (0, _utils.upperFirst)(this.tableName(name, schema));
},
column(name, _table, _schema) {
return camelCase(name);
return (0, _utils.camelCase)(name);
},

@@ -124,3 +88,3 @@ singleRelationByKeys(detailedKeys, table, schema) {

return camelCase(`${this.tableName(table, schema)}-by-${detailedKeys.map(function (key) {
return (0, _utils.camelCase)(`${this.tableName(table, schema)}-by-${detailedKeys.map(function (key) {
return _this.column(key.column, key.table, key.schema);

@@ -132,3 +96,3 @@ }).join("-and-")}`);

return camelCase(`update-${this.tableName(table, schema)}-by-${detailedKeys.map(function (key) {
return (0, _utils.camelCase)(`update-${this.tableName(table, schema)}-by-${detailedKeys.map(function (key) {
return _this2.column(key.column, key.table, key.schema);

@@ -140,3 +104,3 @@ }).join("-and-")}`);

return camelCase(`delete-${this.tableName(table, schema)}-by-${detailedKeys.map(function (key) {
return (0, _utils.camelCase)(`delete-${this.tableName(table, schema)}-by-${detailedKeys.map(function (key) {
return _this3.column(key.column, key.table, key.schema);

@@ -146,6 +110,6 @@ }).join("-and-")}`);

updateNode(name, _schema) {
return camelCase(`update-${_pluralize2.default.singular(name)}`);
return (0, _utils.camelCase)(`update-${_pluralize2.default.singular(name)}`);
},
deleteNode(name, _schema) {
return camelCase(`delete-${_pluralize2.default.singular(name)}`);
return (0, _utils.camelCase)(`delete-${_pluralize2.default.singular(name)}`);
},

@@ -155,3 +119,3 @@ updateByKeysInputType(detailedKeys, name, _schema) {

return upperFirst(camelCase(`update-${_pluralize2.default.singular(name)}-by-${detailedKeys.map(function (key) {
return (0, _utils.upperFirst)((0, _utils.camelCase)(`update-${_pluralize2.default.singular(name)}-by-${detailedKeys.map(function (key) {
return _this4.column(key.column, key.table, key.schema);

@@ -163,3 +127,3 @@ }).join("-and-")}-input`));

return upperFirst(camelCase(`delete-${_pluralize2.default.singular(name)}-by-${detailedKeys.map(function (key) {
return (0, _utils.upperFirst)((0, _utils.camelCase)(`delete-${_pluralize2.default.singular(name)}-by-${detailedKeys.map(function (key) {
return _this5.column(key.column, key.table, key.schema);

@@ -169,6 +133,6 @@ }).join("-and-")}-input`));

updateNodeInputType(name, _schema) {
return upperFirst(camelCase(`update-${_pluralize2.default.singular(name)}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`update-${_pluralize2.default.singular(name)}-input`));
},
deleteNodeInputType(name, _schema) {
return upperFirst(camelCase(`delete-${_pluralize2.default.singular(name)}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`delete-${_pluralize2.default.singular(name)}-input`));
},

@@ -178,3 +142,3 @@ manyRelationByKeys(detailedKeys, table, schema) {

return camelCase(`${this.pluralize(this.tableName(table, schema))}-by-${detailedKeys.map(function (key) {
return (0, _utils.camelCase)(`${this.pluralize(this.tableName(table, schema))}-by-${detailedKeys.map(function (key) {
return _this6.column(key.column, key.table, key.schema);

@@ -184,30 +148,30 @@ }).join("-and-")}`);

edge(typeName) {
return upperFirst(camelCase(`${(0, _pluralize2.default)(typeName)}-edge`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${(0, _pluralize2.default)(typeName)}-edge`));
},
edgeField(name, _schema) {
return camelCase(`${_pluralize2.default.singular(name)}-edge`);
return (0, _utils.camelCase)(`${_pluralize2.default.singular(name)}-edge`);
},
connection(typeName) {
return upperFirst(camelCase(`${this.pluralize(typeName)}-connection`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${this.pluralize(typeName)}-connection`));
},
scalarFunctionConnection(procName, _procSchema) {
return upperFirst(camelCase(`${procName}-connection`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${procName}-connection`));
},
scalarFunctionEdge(procName, _procSchema) {
return upperFirst(camelCase(`${procName}-edge`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${procName}-edge`));
},
createField(name, _schema) {
return camelCase(`create-${_pluralize2.default.singular(name)}`);
return (0, _utils.camelCase)(`create-${_pluralize2.default.singular(name)}`);
},
createInputType(name, _schema) {
return upperFirst(camelCase(`create-${_pluralize2.default.singular(name)}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`create-${_pluralize2.default.singular(name)}-input`));
},
createPayloadType(name, _schema) {
return upperFirst(camelCase(`create-${_pluralize2.default.singular(name)}-payload`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`create-${_pluralize2.default.singular(name)}-payload`));
},
updatePayloadType(name, _schema) {
return upperFirst(camelCase(`update-${_pluralize2.default.singular(name)}-payload`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`update-${_pluralize2.default.singular(name)}-payload`));
},
deletePayloadType(name, _schema) {
return upperFirst(camelCase(`delete-${_pluralize2.default.singular(name)}-payload`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`delete-${_pluralize2.default.singular(name)}-payload`));
}

@@ -218,3 +182,3 @@ };

enumName(value) {
return constantCase(value);
return (0, _utils.constantCase)(value);
}

@@ -225,5 +189,5 @@ });

column(name, _table, _schema) {
return name === "id" ? "rowId" : camelCase(name);
return name === "id" ? "rowId" : (0, _utils.camelCase)(name);
}
});
//# sourceMappingURL=inflections.js.map

@@ -37,6 +37,9 @@ "use strict";

var _chalk = require("chalk");
var _chalk2 = _interopRequireDefault(_chalk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _debug2.default)("graphile-build-pg");
var INTROSPECTION_PATH = `${__dirname}/../../res/introspection-query.sql`;

@@ -294,3 +297,3 @@ var WATCH_FIXTURES_PATH = `${__dirname}/../../res/watch-fixtures.sql`;

case 25:
_context5.next = 34;
_context5.next = 36;
break;

@@ -303,14 +306,16 @@

/* eslint-disable no-console */
console.warn("Failed to setup watch fixtures in Postgres database");
console.warn("This is likely because your Postgres user is not a superuser. If the fixtures already exist, the watch functionality may still work.");
console.warn(_context5.t0);
console.warn(`${_chalk2.default.bold.yellow("Failed to setup watch fixtures in Postgres database")} ️️⚠️`);
console.warn(_chalk2.default.yellow("This is likely because your Postgres user is not a superuser. If the"));
console.warn(_chalk2.default.yellow("fixtures already exist, the watch functionality may still work."));
console.warn(_chalk2.default.yellow("Enable DEBUG='graphile-build-pg' to see the error"));
debug(_context5.t0);
/* eslint-enable no-console */
_context5.next = 34;
_context5.next = 36;
return pgClient.query("rollback");
case 34:
_context5.next = 36;
case 36:
_context5.next = 38;
return pgClient.query("listen postgraphql_watch");
case 36:
case 38:
handleChange = function () {

@@ -426,9 +431,9 @@ var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3() {

pgClient.on("notification", listener);
_context5.next = 41;
_context5.next = 43;
return introspect();
case 41:
case 43:
introspectionResultsByKind = _context5.sent;
case 42:
case 44:
case "end":

@@ -435,0 +440,0 @@ return _context5.stop();

@@ -15,2 +15,6 @@ "use strict";

var _chalk = require("chalk");
var _chalk2 = _interopRequireDefault(_chalk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -71,3 +75,3 @@

// eslint-disable-next-line no-console
console.warn(`Failed to add function '${proc.namespace.name}.${proc.name}'; run with 'DEBUG="graphile-build-pg:warn"' to view the error`);
console.warn(_chalk2.default.bold.yellow(`Failed to add function '${proc.namespace.name}.${proc.name}'; run with 'DEBUG="graphile-build-pg:warn"' to view the error`));
debugWarn(e);

@@ -74,0 +78,0 @@ }

@@ -33,2 +33,6 @@ "use strict";

var _graphqlTypeJson = require("graphql-type-json");
var _graphqlTypeJson2 = _interopRequireDefault(_graphqlTypeJson);
var _postgresInterval = require("postgres-interval");

@@ -127,3 +131,2 @@

var GraphQLJSON = getTypeByName("JSON");
var GraphQLUUID = getTypeByName("UUID");

@@ -293,4 +296,4 @@ var gqlTypeByTypeId = (0, _assign2.default)({}, build.pgGqlTypeByTypeId);

}, pgExtendedTypes && {
"114": GraphQLJSON,
"3802": GraphQLJSON,
"114": _graphqlTypeJson2.default,
"3802": _graphqlTypeJson2.default,
"2950": GraphQLUUID

@@ -559,2 +562,3 @@ /*

}
addType((0, _graphql.getNamedType)(gqlTypeByTypeId[type.id]));
return gqlTypeByTypeId[type.id];

@@ -561,0 +565,0 @@ };

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

} else if (offset > 0) {
// eslint-disable-next-line
debugger;
throw new Error("Cannot combine 'last' and 'offset'");

@@ -365,0 +363,0 @@ } else {

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

});
exports.sqlJsonBuildObjectFromFragments = undefined;
exports.constantCase = exports.camelCase = exports.upperFirst = exports.formatInsideUnderscores = exports.constantCaseAll = exports.sqlJsonBuildObjectFromFragments = undefined;
var _slicedToArray2 = require("babel-runtime/helpers/slicedToArray");
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _pgSql = require("pg-sql2");

@@ -13,2 +17,10 @@

var _upperFirst = require("lodash/upperFirst");
var _upperFirst2 = _interopRequireDefault(_upperFirst);
var _camelCase = require("lodash/camelCase");
var _camelCase2 = _interopRequireDefault(_camelCase);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -26,2 +38,26 @@

};
var constantCaseAll = exports.constantCaseAll = function constantCaseAll(str) {
return str.replace(/[^a-zA-Z0-9_]+/g, "_").replace(/[A-Z]+/g, "_$&").replace(/__+/g, "_").replace(/^[^a-zA-Z0-9]+/, "").replace(/^[0-9]/, "_$&") // GraphQL enums must not start with a number
.toUpperCase();
};
var formatInsideUnderscores = exports.formatInsideUnderscores = function formatInsideUnderscores(fn) {
return function (str) {
var matches = str.match(/^(_*)([\s\S]*?)(_*)$/);
if (!matches) {
throw new Error("Impossible?"); // Satiate Flow
}
var _matches = (0, _slicedToArray3.default)(matches, 4),
start = _matches[1],
middle = _matches[2],
end = _matches[3];
return `${start}${fn(middle)}${end}`;
};
};
var upperFirst = exports.upperFirst = formatInsideUnderscores(_upperFirst2.default);
var camelCase = exports.camelCase = formatInsideUnderscores(_camelCase2.default);
var constantCase = exports.constantCase = formatInsideUnderscores(constantCaseAll);
//# sourceMappingURL=utils.js.map

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

});
exports.PgMutationPayloadEdgePlugin = exports.PgMutationProceduresPlugin = exports.PgMutationUpdateDeletePlugin = exports.PgMutationCreatePlugin = exports.PgConnectionTotalCount = exports.PageInfoStartEndCursor = exports.PgScalarFunctionConnectionPlugin = exports.PgNodeAliasPostGraphQL = exports.PgRowNode = exports.PgOrderByPrimaryKeyPlugin = exports.PgOrderAllColumnsPlugin = exports.PgQueryProceduresPlugin = exports.PgComputedColumnsPlugin = exports.PgRowByUniqueConstraint = exports.PgBackwardRelationPlugin = exports.PgForwardRelationPlugin = exports.PgColumnsPlugin = exports.PgAllRows = exports.PgConnectionArgCondition = exports.PgConnectionArgOrderBy = exports.PgConnectionArgFirstLastBeforeAfter = exports.PgTablesPlugin = exports.PgJWTPlugin = exports.PgTypesPlugin = exports.PgIntrospectionPlugin = exports.PgBasicsPlugin = exports.inflections = exports.defaultPlugins = undefined;
exports.constantCase = exports.camelCase = exports.upperFirst = exports.PgMutationPayloadEdgePlugin = exports.PgMutationProceduresPlugin = exports.PgMutationUpdateDeletePlugin = exports.PgMutationCreatePlugin = exports.PgConnectionTotalCount = exports.PageInfoStartEndCursor = exports.PgScalarFunctionConnectionPlugin = exports.PgNodeAliasPostGraphQL = exports.PgRowNode = exports.PgOrderByPrimaryKeyPlugin = exports.PgOrderAllColumnsPlugin = exports.PgQueryProceduresPlugin = exports.PgComputedColumnsPlugin = exports.PgRowByUniqueConstraint = exports.PgBackwardRelationPlugin = exports.PgForwardRelationPlugin = exports.PgColumnsPlugin = exports.PgAllRows = exports.PgConnectionArgCondition = exports.PgConnectionArgOrderBy = exports.PgConnectionArgFirstLastBeforeAfter = exports.PgTablesPlugin = exports.PgJWTPlugin = exports.PgTypesPlugin = exports.PgIntrospectionPlugin = exports.PgBasicsPlugin = exports.inflections = exports.defaultPlugins = undefined;
var _utils = require("./utils");
Object.defineProperty(exports, "upperFirst", {
enumerable: true,
get: function () {
return _utils.upperFirst;
}
});
Object.defineProperty(exports, "camelCase", {
enumerable: true,
get: function () {
return _utils.camelCase;
}
});
Object.defineProperty(exports, "constantCase", {
enumerable: true,
get: function () {
return _utils.constantCase;
}
});
var _PgBasicsPlugin = require("./plugins/PgBasicsPlugin");

@@ -10,0 +31,0 @@

@@ -16,42 +16,19 @@ "use strict";

var _upperFirst = require("lodash/upperFirst");
var _utils = require("./utils");
var _upperFirst2 = _interopRequireDefault(_upperFirst);
var _camelCase = require("lodash/camelCase");
var _camelCase2 = _interopRequireDefault(_camelCase);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const constantCaseAll = str => str.replace(/[^a-zA-Z0-9_]+/g, "_").replace(/[A-Z]+/g, "_$&").replace(/__+/g, "_").replace(/^[^a-zA-Z0-9]+/, "").replace(/^[0-9]/, "_$&") // GraphQL enums must not start with a number
.toUpperCase();
const formatInsideUnderscores = fn => str => {
const matches = str.match(/^(_*)([\s\S]*?)(_*)$/);
if (!matches) {
throw new Error("Impossible?"); // Satiate Flow
}
const [, start, middle, end] = matches;
return `${start}${fn(middle)}${end}`;
};
const upperFirst = formatInsideUnderscores(_upperFirst2.default);
const camelCase = formatInsideUnderscores(_camelCase2.default);
const constantCase = formatInsideUnderscores(constantCaseAll);
const defaultInflection = exports.defaultInflection = {
pluralize: _pluralize2.default,
argument(name, index) {
return camelCase(name || `arg${index}`);
return (0, _utils.camelCase)(name || `arg${index}`);
},
orderByType(typeName) {
return upperFirst(camelCase(`${(0, _pluralize2.default)(typeName)}-order-by`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${(0, _pluralize2.default)(typeName)}-order-by`));
},
orderByEnum(name, ascending, _table, _schema) {
return constantCase(`${name}_${ascending ? "asc" : "desc"}`);
return (0, _utils.constantCase)(`${name}_${ascending ? "asc" : "desc"}`);
},
domainType(name) {
return upperFirst(camelCase(name));
return (0, _utils.upperFirst)((0, _utils.camelCase)(name));
},

@@ -62,105 +39,105 @@ enumName(value) {

enumType(name) {
return upperFirst(camelCase(name));
return (0, _utils.upperFirst)((0, _utils.camelCase)(name));
},
conditionType(typeName) {
return upperFirst(camelCase(`${typeName}-condition`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-condition`));
},
inputType(typeName) {
return upperFirst(camelCase(`${typeName}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-input`));
},
rangeBoundType(typeName) {
return upperFirst(camelCase(`${typeName}-range-bound`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-range-bound`));
},
rangeType(typeName) {
return upperFirst(camelCase(`${typeName}-range`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-range`));
},
patchType(typeName) {
return upperFirst(camelCase(`${typeName}-patch`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${typeName}-patch`));
},
patchField(itemName) {
return camelCase(`${itemName}-patch`);
return (0, _utils.camelCase)(`${itemName}-patch`);
},
tableName(name, _schema) {
return camelCase(_pluralize2.default.singular(name));
return (0, _utils.camelCase)(_pluralize2.default.singular(name));
},
tableNode(name, _schema) {
return camelCase(_pluralize2.default.singular(name));
return (0, _utils.camelCase)(_pluralize2.default.singular(name));
},
allRows(name, schema) {
return camelCase(`all-${this.pluralize(this.tableName(name, schema))}`);
return (0, _utils.camelCase)(`all-${this.pluralize(this.tableName(name, schema))}`);
},
functionName(name, _schema) {
return camelCase(name);
return (0, _utils.camelCase)(name);
},
functionPayloadType(name, _schema) {
return upperFirst(camelCase(`${name}-payload`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${name}-payload`));
},
functionInputType(name, _schema) {
return upperFirst(camelCase(`${name}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${name}-input`));
},
tableType(name, schema) {
return upperFirst(this.tableName(name, schema));
return (0, _utils.upperFirst)(this.tableName(name, schema));
},
column(name, _table, _schema) {
return camelCase(name);
return (0, _utils.camelCase)(name);
},
singleRelationByKeys(detailedKeys, table, schema) {
return camelCase(`${this.tableName(table, schema)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}`);
return (0, _utils.camelCase)(`${this.tableName(table, schema)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}`);
},
updateByKeys(detailedKeys, table, schema) {
return camelCase(`update-${this.tableName(table, schema)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}`);
return (0, _utils.camelCase)(`update-${this.tableName(table, schema)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}`);
},
deleteByKeys(detailedKeys, table, schema) {
return camelCase(`delete-${this.tableName(table, schema)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}`);
return (0, _utils.camelCase)(`delete-${this.tableName(table, schema)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}`);
},
updateNode(name, _schema) {
return camelCase(`update-${_pluralize2.default.singular(name)}`);
return (0, _utils.camelCase)(`update-${_pluralize2.default.singular(name)}`);
},
deleteNode(name, _schema) {
return camelCase(`delete-${_pluralize2.default.singular(name)}`);
return (0, _utils.camelCase)(`delete-${_pluralize2.default.singular(name)}`);
},
updateByKeysInputType(detailedKeys, name, _schema) {
return upperFirst(camelCase(`update-${_pluralize2.default.singular(name)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`update-${_pluralize2.default.singular(name)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}-input`));
},
deleteByKeysInputType(detailedKeys, name, _schema) {
return upperFirst(camelCase(`delete-${_pluralize2.default.singular(name)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`delete-${_pluralize2.default.singular(name)}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}-input`));
},
updateNodeInputType(name, _schema) {
return upperFirst(camelCase(`update-${_pluralize2.default.singular(name)}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`update-${_pluralize2.default.singular(name)}-input`));
},
deleteNodeInputType(name, _schema) {
return upperFirst(camelCase(`delete-${_pluralize2.default.singular(name)}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`delete-${_pluralize2.default.singular(name)}-input`));
},
manyRelationByKeys(detailedKeys, table, schema) {
return camelCase(`${this.pluralize(this.tableName(table, schema))}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}`);
return (0, _utils.camelCase)(`${this.pluralize(this.tableName(table, schema))}-by-${detailedKeys.map(key => this.column(key.column, key.table, key.schema)).join("-and-")}`);
},
edge(typeName) {
return upperFirst(camelCase(`${(0, _pluralize2.default)(typeName)}-edge`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${(0, _pluralize2.default)(typeName)}-edge`));
},
edgeField(name, _schema) {
return camelCase(`${_pluralize2.default.singular(name)}-edge`);
return (0, _utils.camelCase)(`${_pluralize2.default.singular(name)}-edge`);
},
connection(typeName) {
return upperFirst(camelCase(`${this.pluralize(typeName)}-connection`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${this.pluralize(typeName)}-connection`));
},
scalarFunctionConnection(procName, _procSchema) {
return upperFirst(camelCase(`${procName}-connection`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${procName}-connection`));
},
scalarFunctionEdge(procName, _procSchema) {
return upperFirst(camelCase(`${procName}-edge`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`${procName}-edge`));
},
createField(name, _schema) {
return camelCase(`create-${_pluralize2.default.singular(name)}`);
return (0, _utils.camelCase)(`create-${_pluralize2.default.singular(name)}`);
},
createInputType(name, _schema) {
return upperFirst(camelCase(`create-${_pluralize2.default.singular(name)}-input`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`create-${_pluralize2.default.singular(name)}-input`));
},
createPayloadType(name, _schema) {
return upperFirst(camelCase(`create-${_pluralize2.default.singular(name)}-payload`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`create-${_pluralize2.default.singular(name)}-payload`));
},
updatePayloadType(name, _schema) {
return upperFirst(camelCase(`update-${_pluralize2.default.singular(name)}-payload`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`update-${_pluralize2.default.singular(name)}-payload`));
},
deletePayloadType(name, _schema) {
return upperFirst(camelCase(`delete-${_pluralize2.default.singular(name)}-payload`));
return (0, _utils.upperFirst)((0, _utils.camelCase)(`delete-${_pluralize2.default.singular(name)}-payload`));
}

@@ -171,3 +148,3 @@ };

enumName(value) {
return constantCase(value);
return (0, _utils.constantCase)(value);
}

@@ -178,5 +155,5 @@ });

column(name, _table, _schema) {
return name === "id" ? "rowId" : camelCase(name);
return name === "id" ? "rowId" : (0, _utils.camelCase)(name);
}
});
//# sourceMappingURL=inflections.js.map

@@ -29,6 +29,9 @@ "use strict";

var _chalk = require("chalk");
var _chalk2 = _interopRequireDefault(_chalk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _debug2.default)("graphile-build-pg");
const INTROSPECTION_PATH = `${__dirname}/../../res/introspection-query.sql`;

@@ -169,5 +172,7 @@ const WATCH_FIXTURES_PATH = `${__dirname}/../../res/watch-fixtures.sql`;

/* eslint-disable no-console */
console.warn("Failed to setup watch fixtures in Postgres database");
console.warn("This is likely because your Postgres user is not a superuser. If the fixtures already exist, the watch functionality may still work.");
console.warn(error);
console.warn(`${_chalk2.default.bold.yellow("Failed to setup watch fixtures in Postgres database")} ️️⚠️`);
console.warn(_chalk2.default.yellow("This is likely because your Postgres user is not a superuser. If the"));
console.warn(_chalk2.default.yellow("fixtures already exist, the watch functionality may still work."));
console.warn(_chalk2.default.yellow("Enable DEBUG='graphile-build-pg' to see the error"));
debug(error);
/* eslint-enable no-console */

@@ -174,0 +179,0 @@ await pgClient.query("rollback");

@@ -15,2 +15,6 @@ "use strict";

var _chalk = require("chalk");
var _chalk2 = _interopRequireDefault(_chalk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -63,3 +67,3 @@

// eslint-disable-next-line no-console
console.warn(`Failed to add function '${proc.namespace.name}.${proc.name}'; run with 'DEBUG="graphile-build-pg:warn"' to view the error`);
console.warn(_chalk2.default.bold.yellow(`Failed to add function '${proc.namespace.name}.${proc.name}'; run with 'DEBUG="graphile-build-pg:warn"' to view the error`));
debugWarn(e);

@@ -66,0 +70,0 @@ }

@@ -29,2 +29,6 @@ "use strict";

var _graphqlTypeJson = require("graphql-type-json");
var _graphqlTypeJson2 = _interopRequireDefault(_graphqlTypeJson);
var _postgresInterval = require("postgres-interval");

@@ -111,3 +115,2 @@

const GraphQLJSON = getTypeByName("JSON");
const GraphQLUUID = getTypeByName("UUID");

@@ -267,4 +270,4 @@ const gqlTypeByTypeId = (0, _assign2.default)({}, build.pgGqlTypeByTypeId);

}, pgExtendedTypes && {
"114": GraphQLJSON,
"3802": GraphQLJSON,
"114": _graphqlTypeJson2.default,
"3802": _graphqlTypeJson2.default,
"2950": GraphQLUUID

@@ -494,2 +497,3 @@ /*

}
addType((0, _graphql.getNamedType)(gqlTypeByTypeId[type.id]));
return gqlTypeByTypeId[type.id];

@@ -496,0 +500,0 @@ };

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

} else if (offset > 0) {
// eslint-disable-next-line
debugger;
throw new Error("Cannot combine 'last' and 'offset'");

@@ -275,0 +273,0 @@ } else {

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

});
exports.sqlJsonBuildObjectFromFragments = undefined;
exports.constantCase = exports.camelCase = exports.upperFirst = exports.formatInsideUnderscores = exports.constantCaseAll = exports.sqlJsonBuildObjectFromFragments = undefined;

@@ -13,2 +13,10 @@ var _pgSql = require("pg-sql2");

var _upperFirst = require("lodash/upperFirst");
var _upperFirst2 = _interopRequireDefault(_upperFirst);
var _camelCase = require("lodash/camelCase");
var _camelCase2 = _interopRequireDefault(_camelCase);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -22,2 +30,17 @@

};
const constantCaseAll = exports.constantCaseAll = str => str.replace(/[^a-zA-Z0-9_]+/g, "_").replace(/[A-Z]+/g, "_$&").replace(/__+/g, "_").replace(/^[^a-zA-Z0-9]+/, "").replace(/^[0-9]/, "_$&") // GraphQL enums must not start with a number
.toUpperCase();
const formatInsideUnderscores = exports.formatInsideUnderscores = fn => str => {
const matches = str.match(/^(_*)([\s\S]*?)(_*)$/);
if (!matches) {
throw new Error("Impossible?"); // Satiate Flow
}
const [, start, middle, end] = matches;
return `${start}${fn(middle)}${end}`;
};
const upperFirst = exports.upperFirst = formatInsideUnderscores(_upperFirst2.default);
const camelCase = exports.camelCase = formatInsideUnderscores(_camelCase2.default);
const constantCase = exports.constantCase = formatInsideUnderscores(constantCaseAll);
//# sourceMappingURL=utils.js.map
{
"name": "graphile-build-pg",
"version": "0.1.0-alpha.26",
"version": "0.1.0-alpha.27",
"description": "Build a GraphQL schema by reflection over a PostgreSQL schema. Easy to customize since it's built with plugins on graphile-build",

@@ -38,4 +38,5 @@ "main": "index.js",

"babel-runtime": ">=6 <7",
"chalk": "^2.1.0",
"debug": ">=2 <3",
"graphile-build": "^0.1.0-alpha.18",
"graphile-build": "^0.1.0-alpha.27",
"graphql-iso-date": "^3.2.0",

@@ -42,0 +43,0 @@ "graphql-type-json": "^0.1.4",

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