graphile-build-pg
Advanced tools
Comparing version 5.0.0-beta.27 to 5.0.0-beta.28
import "./PgTablesPlugin.js"; | ||
import "graphile-config"; | ||
import type { PgCodec, PgCodecRef, PgCodecRelation, PgCodecWithAttributes, PgRefDefinition, PgResource, PgResourceUnique } from "@dataplan/pg"; | ||
import type { PgCodec, PgCodecRelation, PgCodecWithAttributes, PgRefDefinition, PgResource, PgResourceUnique } from "@dataplan/pg"; | ||
import type { GraphQLType } from "grafast/graphql"; | ||
@@ -62,3 +62,3 @@ import type { SQL } from "pg-sql2"; | ||
pgCodecRelation: PgCodecRelation; | ||
pgCodecRef: PgCodecRef; | ||
pgCodecRef: [codec: PgCodec, refName: string]; | ||
pgRefDefinition: PgRefDefinition; | ||
@@ -65,0 +65,0 @@ } |
@@ -105,3 +105,7 @@ "use strict"; | ||
provides: ["override"], | ||
callback(behavior, ref) { | ||
callback(behavior, [codec, refName]) { | ||
const ref = codec.refs?.[refName]; | ||
if (!ref) { | ||
throw new Error(`Codec ${codec.name} has no ref '${refName}'`); | ||
} | ||
return [ | ||
@@ -108,0 +112,0 @@ behavior, |
@@ -281,2 +281,3 @@ "use strict"; | ||
if (poly?.mode === "relational") { | ||
const polyRelationNames = Object.values(poly.types).map((t) => t.relationName); | ||
// Copy common attributes to implementations | ||
@@ -326,2 +327,5 @@ for (const spec of Object.values(poly.types)) { | ||
for (const [relationName, relationSpec] of Object.entries(relations)) { | ||
// Skip over the polymorphic relations | ||
if (polyRelationNames.includes(relationName)) | ||
continue; | ||
// TODO: normally we wouldn't call `getBehavior` anywhere | ||
@@ -328,0 +332,0 @@ // except in an entityBehavior definition... Should this be |
@@ -287,4 +287,5 @@ "use strict"; | ||
after: ["default"], | ||
callback(behavior, entity) { | ||
if (entity.definition.singular) { | ||
callback(behavior, [codec, refName]) { | ||
const ref = codec.refs?.[refName]; | ||
if (ref?.definition.singular) { | ||
return [ | ||
@@ -424,2 +425,3 @@ behavior, | ||
.map(([refName, spec]) => ({ | ||
codec, | ||
refName, | ||
@@ -434,5 +436,5 @@ refDefinition: spec.definition, | ||
.map(([refName, refDefinition]) => ({ | ||
codec, | ||
refName, | ||
refDefinition, | ||
codec, | ||
})); | ||
@@ -513,3 +515,3 @@ const digests = []; | ||
// Digest refs | ||
for (const { refName: identifier, refDefinition: refSpec, ref, } of refDefinitionList) { | ||
for (const { codec, refName: identifier, refDefinition: refSpec, ref, } of refDefinitionList) { | ||
const isUnique = !!refSpec.singular; | ||
@@ -570,6 +572,6 @@ let hasReferencee; | ||
behavior = hasExactlyOneSource | ||
? `${build.behavior.pgResourceBehavior(firstSource)} ${build.behavior.pgCodecRefBehavior(ref, false)}` | ||
? `${build.behavior.pgResourceBehavior(firstSource)} ${build.behavior.pgCodecRefBehavior([codec, identifier], false)}` | ||
: sharedCodec | ||
? `${build.behavior.pgCodecBehavior(sharedCodec)} ${build.behavior.pgCodecRefBehavior(ref, false)}` | ||
: build.behavior.pgCodecRefBehavior(ref); | ||
? `${build.behavior.pgCodecBehavior(sharedCodec)} ${build.behavior.pgCodecRefBehavior([codec, identifier], false)}` | ||
: build.behavior.pgCodecRefBehavior([codec, identifier]); | ||
// Shortcut simple relation alias | ||
@@ -576,0 +578,0 @@ ({ singleRecordPlan, listPlan, connectionPlan } = (() => { |
@@ -1,2 +0,2 @@ | ||
export declare const version = "5.0.0-beta.27"; | ||
export declare const version = "5.0.0-beta.28"; | ||
//# 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.27"; | ||
exports.version = "5.0.0-beta.28"; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "graphile-build-pg", | ||
"version": "5.0.0-beta.27", | ||
"version": "5.0.0-beta.28", | ||
"description": "PostgreSQL plugins for Graphile Build - build a supercharged GraphQL schema by reflection over a PostgreSQL database and executed by Grafast.", | ||
@@ -56,5 +56,5 @@ "type": "commonjs", | ||
"peerDependencies": { | ||
"@dataplan/pg": "^0.0.1-beta.24", | ||
"grafast": "^0.1.1-beta.13", | ||
"graphile-build": "5.0.0-beta.23", | ||
"@dataplan/pg": "^0.0.1-beta.25", | ||
"grafast": "^0.1.1-beta.14", | ||
"graphile-build": "5.0.0-beta.24", | ||
"graphile-config": "^0.0.1-beta.9", | ||
@@ -92,3 +92,3 @@ "graphql": "^16.1.0-experimental-stream-defer.6", | ||
"fastify-static": "^4.7.0", | ||
"graphile-export": "^0.0.2-beta.18", | ||
"graphile-export": "^0.0.2-beta.19", | ||
"graphql": "16.1.0-experimental-stream-defer.6", | ||
@@ -95,0 +95,0 @@ "graphql-helix": "^1.13.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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1141062
11862