@graphile-contrib/pg-many-to-many
Advanced tools
Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const grafast_1 = require("grafast"); | ||
function createManyToManyConnectionType(relationship, build, leftTable) { | ||
@@ -12,3 +11,3 @@ const { | ||
} = relationship; | ||
const { inflection, graphql: { GraphQLNonNull, GraphQLList }, getTypeByName, options: { pgForbidSetofFunctionsToReturnNull = false }, nullableIf, } = build; | ||
const { inflection, graphql: { GraphQLNonNull, GraphQLList }, grafast: { ConnectionStep, EdgeStep }, getTypeByName, options: { pgForbidSetofFunctionsToReturnNull = false }, nullableIf, } = build; | ||
const leftTableTypeName = inflection.tableType(leftTable.codec); | ||
@@ -29,3 +28,8 @@ const junctionTypeName = inflection.tableType(junctionTable.codec); | ||
pgManyToManyRelationship: relationship, | ||
}, grafast_1.ExecutableStep, () => ({ | ||
}, () => ({ | ||
assertStep($step) { | ||
if (!($step instanceof EdgeStep)) { | ||
throw new Error(`Expected ${$step} to be an EdgeStep`); | ||
} | ||
}, | ||
description: `A \`${rightTableTypeName}\` edge in the connection, with data from \`${junctionTypeName}\`.`, | ||
@@ -66,3 +70,8 @@ fields: ({ fieldWithHooks }) => { | ||
// pgIntrospection: rightTable, | ||
}, grafast_1.ExecutableStep, () => ({ | ||
}, () => ({ | ||
assertStep($step) { | ||
if (!($step instanceof ConnectionStep)) { | ||
throw new Error(`Expected ${$step} to be a ConnectionStep`); | ||
} | ||
}, | ||
description: `A connection to a list of \`${rightTableTypeName}\` values, with data from \`${junctionTypeName}\`.`, | ||
@@ -69,0 +78,0 @@ fields: ({ fieldWithHooks }) => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PgManyToManyRelationEdgeAttributesPlugin = void 0; | ||
const graphql_1 = require("graphql"); | ||
const PgManyToManyRelationPlugin_1 = require("./PgManyToManyRelationPlugin"); | ||
@@ -18,3 +17,3 @@ const version = require("../package.json").version; | ||
GraphQLObjectType_fields(fields, build, context) { | ||
const { extend, sql, inflection, nullableIf } = build; | ||
const { extend, sql, inflection, nullableIf, graphql: { isOutputType }, } = build; | ||
const { scope: { isPgManyToManyEdgeType, pgManyToManyRelationship }, fieldWithHooks, Self, } = context; | ||
@@ -47,3 +46,3 @@ if (!isPgManyToManyEdgeType || !pgManyToManyRelationship) { | ||
const ReturnType = build.getGraphQLTypeByPgCodec(attribute.codec, "output"); | ||
if (!ReturnType || !(0, graphql_1.isOutputType)(ReturnType)) { | ||
if (!ReturnType || !isOutputType(ReturnType)) { | ||
return memo; | ||
@@ -50,0 +49,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PgManyToManyRelationEdgeTablePlugin = void 0; | ||
const grafast_1 = require("grafast"); | ||
const PgManyToManyRelationPlugin_1 = require("./PgManyToManyRelationPlugin"); | ||
@@ -55,3 +54,3 @@ const version = require("../package.json").version; | ||
GraphQLObjectType_fields(fields, build, context) { | ||
const { extend, getTypeByName, graphql: { GraphQLNonNull, GraphQLList }, inflection, sql, } = build; | ||
const { extend, getTypeByName, graphql: { GraphQLNonNull, GraphQLList }, grafast: { connection }, inflection, sql, } = build; | ||
const { scope: { isPgManyToManyEdgeType, pgManyToManyRelationship }, fieldWithHooks, Self, } = context; | ||
@@ -121,3 +120,3 @@ if (!isPgManyToManyEdgeType || !pgManyToManyRelationship) { | ||
return isConnection | ||
? (0, grafast_1.connection)($junctions) | ||
? connection($junctions) | ||
: $junctions; | ||
@@ -124,0 +123,0 @@ }, |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.PgManyToManyRelationPlugin = exports.junctionSymbol = void 0; | ||
const grafast_1 = require("grafast"); | ||
const createManyToManyConnectionType_1 = __importDefault(require("./createManyToManyConnectionType")); | ||
@@ -56,3 +55,3 @@ const manyToManyRelationships_1 = __importDefault(require("./manyToManyRelationships")); | ||
GraphQLObjectType_fields(fields, build, context) { | ||
const { extend, sql, graphql: { GraphQLNonNull, GraphQLList }, inflection, } = build; | ||
const { extend, sql, graphql: { GraphQLNonNull, GraphQLList }, grafast: { connection }, inflection, } = build; | ||
const { scope: { isPgClassType, pgCodec: leftTableCodec }, fieldWithHooks, Self, } = context; | ||
@@ -146,3 +145,3 @@ if (!isPgClassType || !leftTableCodec || !leftTableCodec.attributes) { | ||
}); | ||
return (0, grafast_1.connection)($rights); | ||
return connection($rights); | ||
} | ||
@@ -172,3 +171,3 @@ : isConnection | ||
} | ||
return (0, grafast_1.connection)($rights); | ||
return connection($rights); | ||
} | ||
@@ -175,0 +174,0 @@ : // Subquery strategy - most efficient, but we cannot query attributes from the junction table |
{ | ||
"name": "@graphile-contrib/pg-many-to-many", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0-alpha.1", | ||
"description": "Add connection fields for many-to-many relations", | ||
@@ -23,3 +23,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@dataplan/pg": "^0.0.1-alpha.10", | ||
"@dataplan/pg": "^0.0.1-alpha.11", | ||
"@tsconfig/node16": "^1.0.3", | ||
@@ -31,4 +31,4 @@ "eslint": "^8.28.0", | ||
"eslint_d": "^12.2.1", | ||
"grafast": "^0.0.1-alpha.9", | ||
"graphile-build-pg": "^5.0.0-alpha.11", | ||
"grafast": "^0.0.1-alpha.10", | ||
"graphile-build-pg": "^5.0.0-alpha.12", | ||
"graphql": "16.1.0-experimental-stream-defer.6", | ||
@@ -38,3 +38,3 @@ "jest": "^29.3.1", | ||
"pg": ">=6.1.0 <9", | ||
"postgraphile": "^5.0.0-alpha.11", | ||
"postgraphile": "^5.0.0-alpha.12", | ||
"prettier": "2.8.0", | ||
@@ -41,0 +41,0 @@ "typescript": "^5.0.0" |
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
81568
741