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 5.0.0-beta.20 to 5.0.0-beta.21

15

dist/plugins/PgCodecsPlugin.js

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

classTagsAndDescription.description;
// Do NOT mark `extensions` as `EXPORTABLE` otherwise changes
// implemented through hooks will not be represented in the export.
const extensions = {

@@ -223,3 +225,5 @@ oid: pgClass.reltype,

(0, utils_js_1.exportNameHint)(attributes, `${codecName}Attributes`);
const spec = (0, graphile_build_1.EXPORTABLE)((attributes, codecName, description, executor, extensions, sqlIdent) => ({
// Do NOT mark `spec` as `EXPORTABLE` otherwise the changes from
// `pgCodecs_recordType_spec` won't be represented in the export.
const spec = {
name: codecName,

@@ -231,10 +235,3 @@ identifier: sqlIdent,

executor,
}), [
attributes,
codecName,
description,
executor,
extensions,
sqlIdent,
], `${codecName}CodecSpec`);
};
await info.process("pgCodecs_recordType_spec", {

@@ -241,0 +238,0 @@ serviceName,

9

dist/plugins/PgCustomTypeFieldPlugin.js

@@ -695,5 +695,8 @@ "use strict";

const $select = getSelectPlanFromParentAndArgs($parent, args, info);
return connection($select, ($item) => $item, ($item) => $item.getParentStep
? $item.getParentStep().cursor()
: $item.cursor());
return connection($select, {
// nodePlan: ($item) => $item,
cursorPlan: ($item) => $item.getParentStep
? $item.getParentStep().cursor()
: $item.cursor(),
});
}, [grafast_1.connection, getSelectPlanFromParentAndArgs]),

@@ -700,0 +703,0 @@ }),

@@ -69,2 +69,10 @@ "use strict";

const { pgSettingsKey, withPgClientKey } = pgService;
/* TODO: consider replacing the `withPgClient` with:
```
withPgClient: assertNotNull(
ctx.get(withPgClientKey),
`Server is misconfigured; unable to find '${withPgClientKey}' in context.`,
),
```
*/
const executor = (0, graphile_build_1.EXPORTABLE)((PgExecutor, constant, context, object, pgSettingsKey, serviceName, withPgClientKey) => new PgExecutor({

@@ -71,0 +79,0 @@ name: serviceName,

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

require("graphile-config");
const grafast_1 = require("grafast");
const graphile_build_1 = require("graphile-build");

@@ -84,28 +85,27 @@ const version_js_1 = require("../version.js");

// (unless we want to check it exists).
// ENHANCE: we know nodeId will always be unary, so we
// could optimize this SQL at execution time when we know
// if it is null or not.
applyPlan: isPgCondition
? (0, graphile_build_1.EXPORTABLE)((getSpec, localAttributeCodecs, localAttributes, remoteAttributes, sql) => function plan($condition, val) {
if (val.getRaw().evalIs(null)) {
for (let i = 0, l = localAttributes.length; i < l; i++) {
const localName = localAttributes[i];
$condition.where({
type: "attribute",
attribute: localName,
callback: (expression) => sql `${expression} is null`,
});
}
? (0, graphile_build_1.EXPORTABLE)((TRAP_INHIBITED, assertNotNull, condition, getSpec, localAttributeCodecs, localAttributes, remoteAttributes, sql, trap, typeName) => function plan($condition, val) {
const $nodeId = val.get();
const spec = getSpec($nodeId);
for (let i = 0, l = localAttributes.length; i < l; i++) {
const localName = localAttributes[i];
const codec = localAttributeCodecs[i];
const remoteName = remoteAttributes[i];
const $rawCol = spec[remoteName];
// const $col = nodeIdentifierColumnOrNull($nodeId, spec, 'id')
const $col = assertNotNull(trap($rawCol, TRAP_INHIBITED), `Invalid node identifier for '${typeName}'`, { if: condition("exists", $nodeId) });
const sqlRemoteValue = $condition.placeholder($col, codec);
$condition.where({
type: "attribute",
attribute: localName,
callback: (expression) => sql `((${sqlRemoteValue} is null and ${expression} is null) or (${sqlRemoteValue} is not null and ${expression} = ${sqlRemoteValue}))`,
});
}
else {
const spec = getSpec(val.get());
for (let i = 0, l = localAttributes.length; i < l; i++) {
const localName = localAttributes[i];
const codec = localAttributeCodecs[i];
const remoteName = remoteAttributes[i];
$condition.where({
type: "attribute",
attribute: localName,
callback: (expression) => sql `${expression} = ${$condition.placeholder(spec[remoteName], codec)}`,
});
}
}
}, [
grafast_1.TRAP_INHIBITED,
grafast_1.assertNotNull,
grafast_1.condition,
getSpec,

@@ -116,2 +116,4 @@ localAttributeCodecs,

sql,
grafast_1.trap,
typeName,
])

@@ -118,0 +120,0 @@ : (0, graphile_build_1.EXPORTABLE)((getSpec, localAttributes, remoteAttributes) => function plan($insert, val) {

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

codec: attribute.codec,
fragment: sql `${step.alias}.${sql.identifier(attributeName)}`,
fragment: sql `${step}.${sql.identifier(attributeName)}`,
direction: "ASC",

@@ -66,3 +66,3 @@ ...(pgOrderByNullsLast != null

codec: attribute.codec,
fragment: sql `${step.alias}.${sql.identifier(attributeName)}`,
fragment: sql `${step}.${sql.identifier(attributeName)}`,
direction: "DESC",

@@ -69,0 +69,0 @@ ...(pgOrderByNullsLast != null

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

const $pkValues = lambda($handlerMatches, (handlerMatches) => {
// Explicit typing because TypeScript has lost the
// plot.
const match = handlerMatches.find((pk) => pk.match);

@@ -690,3 +692,3 @@ return match?.pks;

init(_, build, _context) {
const { inflection, options: { pgForbidSetofFunctionsToReturnNull }, setGraphQLTypeForPgCodec, grafast: { list, constant, access }, } = build;
const { inflection, options: { pgForbidSetofFunctionsToReturnNull }, setGraphQLTypeForPgCodec, grafast: { list, constant, access, inhibitOnNull }, } = build;
const unionsToRegister = new Map();

@@ -796,14 +798,12 @@ for (const codec of build.pgCodecMetaLookup.keys()) {

(0, graphile_build_1.EXPORTABLE)(tamedevil_1.default.run `\
return function (access) {
return $list => ({ ${tamedevil_1.default.join(pk.map((attributeName, index) => (0, tamedevil_1.default) `${tamedevil_1.default.safeKeyOrThrow(attributeName)}: access($list, [${tamedevil_1.default.lit(index + 1)}])`), ", ")} });
}`, [access])
: (0, graphile_build_1.EXPORTABLE)((access, pk) => ($list) => {
return function (access, inhibitOnNull) {
return $list => ({ ${tamedevil_1.default.join(pk.map((attributeName, index) => (0, tamedevil_1.default) `${tamedevil_1.default.safeKeyOrThrow(attributeName)}: inhibitOnNull(access($list, [${tamedevil_1.default.lit(index + 1)}]))`), ", ")} });
}`, [access, inhibitOnNull])
: (0, graphile_build_1.EXPORTABLE)((access, inhibitOnNull, pk) => ($list) => {
const spec = pk.reduce((memo, attribute, index) => {
memo[attribute] = access($list, [
index + 1,
]);
memo[attribute] = inhibitOnNull(access($list, [index + 1]));
return memo;
}, Object.create(null));
return spec;
}, [access, pk]),
}, [access, inhibitOnNull, pk]),
get: (0, graphile_build_1.EXPORTABLE)((resource) => (spec) => resource.get(spec), [resource]),

@@ -810,0 +810,0 @@ match: (0, graphile_build_1.EXPORTABLE)((tableTypeName) => (obj) => {

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

require("graphile-config");
const grafast_1 = require("grafast");
const graphile_build_1 = require("graphile-build");

@@ -51,2 +50,3 @@ const tamedevil_1 = tslib_1.__importStar(require("tamedevil"));

}
const { grafast: { access, constant, inhibitOnNull, list }, } = build;
const tableResources = Object.values(build.input.pgRegistry.pgResources).filter((resource) => {

@@ -63,8 +63,8 @@ // TODO: if (!resourceCanSupportNode(resource)) return false;

for (const resource of tableResources) {
let list = resourcesByCodec.get(resource.codec);
if (!list) {
list = [];
resourcesByCodec.set(resource.codec, list);
let resourcesList = resourcesByCodec.get(resource.codec);
if (!resourcesList) {
resourcesList = [];
resourcesByCodec.set(resource.codec, resourcesList);
}
list.push(resource);
resourcesList.push(resource);
}

@@ -111,3 +111,3 @@ for (const [codec, resources] of resourcesByCodec.entries()) {

return $record => list([constant(${tamedevil_1.default.lit(identifier)}, false), ${tamedevil_1.default.join(pk.map((attributeName) => (0, tamedevil_1.default) `$record.get(${tamedevil_1.default.lit(attributeName)})`), ", ")}]);
}`, [grafast_1.list, grafast_1.constant])
}`, [list, constant])
: (0, graphile_build_1.EXPORTABLE)((constant, identifier, list, pk) => ($record) => {

@@ -118,16 +118,16 @@ return list([

]);
}, [grafast_1.constant, identifier, grafast_1.list, pk]),
}, [constant, identifier, list, pk]),
getSpec: clean
? // eslint-disable-next-line graphile-export/exhaustive-deps
(0, graphile_build_1.EXPORTABLE)(tamedevil_1.default.run `\
return function (access) {
return $list => ({ ${tamedevil_1.default.join(pk.map((attributeName, index) => (0, tamedevil_1.default) `${tamedevil_1.default.safeKeyOrThrow(attributeName)}: access($list, [${tamedevil_1.default.lit(index + 1)}])`), ", ")} });
}`, [grafast_1.access])
: (0, graphile_build_1.EXPORTABLE)((access, pk) => ($list) => {
return function (access, inhibitOnNull) {
return $list => ({ ${tamedevil_1.default.join(pk.map((attributeName, index) => (0, tamedevil_1.default) `${tamedevil_1.default.safeKeyOrThrow(attributeName)}: inhibitOnNull(access($list, [${tamedevil_1.default.lit(index + 1)}]))`), ", ")} });
}`, [access, inhibitOnNull])
: (0, graphile_build_1.EXPORTABLE)((access, inhibitOnNull, pk) => ($list) => {
const spec = pk.reduce((memo, attribute, index) => {
memo[attribute] = access($list, [index + 1]);
memo[attribute] = inhibitOnNull(access($list, [index + 1]));
return memo;
}, Object.create(null));
return spec;
}, [grafast_1.access, pk]),
}, [access, inhibitOnNull, pk]),
get: (0, graphile_build_1.EXPORTABLE)((pgResource) => (spec) => pgResource.get(spec), [pgResource]),

@@ -134,0 +134,0 @@ match: (0, graphile_build_1.EXPORTABLE)((identifier) => (obj) => {

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

};
const options = (0, graphile_build_1.EXPORTABLE)((codec, description, executor, extensions, identifier, isVirtual, name, uniques) => ({
const options = {
executor,

@@ -188,12 +188,3 @@ name,

extensions,
}), [
codec,
description,
executor,
extensions,
identifier,
isVirtual,
name,
uniques,
]);
};
await info.process("pgTables_PgResourceOptions", {

@@ -204,3 +195,7 @@ serviceName,

});
const resourceOptions = (0, graphile_build_1.EXPORTABLE)((makePgResourceOptions, options) => makePgResourceOptions(options), [pg_1.makePgResourceOptions, options]);
// Need to mark this exportable to avoid out-of-order access to
// variables in the export
const entries = Object.entries(options);
const finalOptions = (0, graphile_build_1.EXPORTABLE)((entries) => Object.fromEntries(entries), [entries]);
const resourceOptions = (0, graphile_build_1.EXPORTABLE)((finalOptions, makePgResourceOptions) => makePgResourceOptions(finalOptions), [finalOptions, pg_1.makePgResourceOptions]);
const registryBuilder = await info.helpers.pgRegistry.getRegistryBuilder();

@@ -207,0 +202,0 @@ if (!resourceOptions.isVirtual) {

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

};
const parseValueLiteral = (ast, variables) => {
const parseValueLiteral = (0, graphile_build_1.EXPORTABLE)((Kind) => (ast, variables) => {
switch (ast.kind) {

@@ -317,3 +317,3 @@ case Kind.INT:

}
};
}, [Kind]);
build.registerScalarType(hstoreTypeName, {}, () => ({

@@ -320,0 +320,0 @@ description: build.wrapDescription("A set of key/value pairs, keys are strings, values may be a string or null. Exposed as a JSON object.", "type"),

@@ -1,2 +0,2 @@

export declare const version = "5.0.0-beta.20";
export declare const version = "5.0.0-beta.21";
//# sourceMappingURL=version.d.ts.map

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

// This file is autogenerated by /scripts/postversion.mjs
exports.version = "5.0.0-beta.20";
exports.version = "5.0.0-beta.21";
//# sourceMappingURL=version.js.map
{
"name": "graphile-build-pg",
"version": "5.0.0-beta.20",
"version": "5.0.0-beta.21",
"description": "PostgreSQL plugins for Graphile Build - build a supercharged GraphQL schema by reflection over a PostgreSQL database and executed by Grafast.",

@@ -50,16 +50,16 @@ "type": "commonjs",

"debug": "^4.3.4",
"graphile-config": "^0.0.1-beta.7",
"graphile-config": "^0.0.1-beta.8",
"jsonwebtoken": "^9.0.2",
"pg-introspection": "^0.0.1-beta.7",
"pg-introspection": "^0.0.1-beta.8",
"tslib": "^2.6.2"
},
"peerDependencies": {
"@dataplan/pg": "^0.0.1-beta.17",
"grafast": "^0.1.1-beta.6",
"graphile-build": "5.0.0-beta.16",
"graphile-config": "^0.0.1-beta.7",
"@dataplan/pg": "^0.0.1-beta.18",
"grafast": "^0.1.1-beta.7",
"graphile-build": "5.0.0-beta.17",
"graphile-config": "^0.0.1-beta.8",
"graphql": "^16.1.0-experimental-stream-defer.6",
"pg": "^8.7.1",
"pg-sql2": "^5.0.0-beta.5",
"tamedevil": "^0.0.0-beta.6"
"pg-sql2": "^5.0.0-beta.6",
"tamedevil": "^0.0.0-beta.7"
},

@@ -80,5 +80,5 @@ "peerDependenciesMeta": {

"devDependencies": {
"@envelop/core": "^4.0.1",
"@envelop/parser-cache": "^6.0.2",
"@envelop/validation-cache": "^6.0.2",
"@envelop/core": "^5.0.0",
"@envelop/parser-cache": "^7.0.0",
"@envelop/validation-cache": "^7.0.0",
"@types/debug": "^4.1.8",

@@ -89,7 +89,7 @@ "@types/express": "^4.17.17",

"chalk": "^4.1.2",
"express": "^4.18.2",
"express": "^4.19.2",
"express-graphql": "^0.12.0",
"fastify": "^4.22.1",
"fastify-static": "^4.7.0",
"graphile-export": "^0.0.2-beta.11",
"graphile-export": "^0.0.2-beta.12",
"graphql": "16.1.0-experimental-stream-defer.6",

@@ -100,3 +100,3 @@ "graphql-helix": "^1.13.0",

"pg": "^8.11.3",
"ruru": "^2.0.0-beta.11",
"ruru": "^2.0.0-beta.12",
"ts-node": "^10.9.1",

@@ -103,0 +103,0 @@ "typescript": "^5.2.2",

@@ -47,2 +47,3 @@ # graphile-build-pg

<td align="center"><a href="https://gosteelhead.com/"><img src="https://graphile.org/images/sponsors/steelhead.svg" width="90" height="90" alt="Steelhead" /><br />Steelhead</a> *</td>
<td align="center"><a href="https://www.sylvera.com/"><img src="https://graphile.org/images/sponsors/sylvera.svg" width="90" height="90" alt="Sylvera" /><br />Sylvera</a> *</td>
</tr></table>

@@ -49,0 +50,0 @@

Sorry, the diff of this file is too big to display

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