diff --git a/bun.lockb b/bun.lockb index 6d15d42..ed14116 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 9e77be3..2364498 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@graphile/simplify-inflection": "^8.0.0-beta.5", "dayjs": "^1.11.13", "drizzle-orm": "^0.38.2", - "drizzle-seed": "^0.2.1", + "drizzle-seed": "^0.3.0", "graphile-export": "^0.0.2-beta.24", "graphql": "^16.9.0", "graphql-yoga": "^5.8.0", diff --git a/src/generated/graphql/schema.executable.ts b/src/generated/graphql/schema.executable.ts index 49e4587..f9a3768 100644 --- a/src/generated/graphql/schema.executable.ts +++ b/src/generated/graphql/schema.executable.ts @@ -120,7 +120,7 @@ const spec_userOrganization = { }), description: undefined, extensions: { - oid: "77600", + oid: "77872", isTableLike: true, pg: { serviceName: "main", @@ -132,6 +132,86 @@ const spec_userOrganization = { executor: executor }; const userOrganizationCodec = recordCodec(spec_userOrganization); +const downvoteIdentifier = sql.identifier("public", "downvote"); +const spec_downvote = { + name: "downvote", + identifier: downvoteIdentifier, + attributes: Object.assign(Object.create(null), { + id: { + description: undefined, + codec: TYPES.uuid, + notNull: true, + hasDefault: true, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + post_id: { + description: undefined, + codec: TYPES.uuid, + notNull: true, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + user_id: { + description: undefined, + codec: TYPES.uuid, + notNull: true, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + created_at: { + description: undefined, + codec: TYPES.timestamptz, + notNull: false, + hasDefault: true, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + updated_at: { + description: undefined, + codec: TYPES.timestamptz, + notNull: false, + hasDefault: true, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + } + }), + description: undefined, + extensions: { + oid: "78725", + isTableLike: true, + pg: { + serviceName: "main", + schemaName: "public", + name: "downvote" + }, + tags: Object.create(null) + }, + executor: executor +}; +const downvoteCodec = recordCodec(spec_downvote); const upvoteIdentifier = sql.identifier("public", "upvote"); const spec_upvote = { name: "upvote", @@ -200,7 +280,7 @@ const spec_upvote = { }), description: undefined, extensions: { - oid: "77578", + oid: "77850", isTableLike: true, pg: { serviceName: "main", @@ -280,7 +360,7 @@ const spec_organization = { }), description: undefined, extensions: { - oid: "77540", + oid: "77812", isTableLike: true, pg: { serviceName: "main", @@ -292,6 +372,98 @@ const spec_organization = { executor: executor }; const organizationCodec = recordCodec(spec_organization); +const commentIdentifier = sql.identifier("public", "comment"); +const spec_comment = { + name: "comment", + identifier: commentIdentifier, + attributes: Object.assign(Object.create(null), { + id: { + description: undefined, + codec: TYPES.uuid, + notNull: true, + hasDefault: true, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + message: { + description: undefined, + codec: TYPES.text, + notNull: false, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + post_id: { + description: undefined, + codec: TYPES.uuid, + notNull: true, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + user_id: { + description: undefined, + codec: TYPES.uuid, + notNull: true, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + created_at: { + description: undefined, + codec: TYPES.timestamptz, + notNull: false, + hasDefault: true, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + updated_at: { + description: undefined, + codec: TYPES.timestamptz, + notNull: false, + hasDefault: true, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + } + }), + description: undefined, + extensions: { + oid: "78467", + isTableLike: true, + pg: { + serviceName: "main", + schemaName: "public", + name: "comment" + }, + tags: Object.create(null) + }, + executor: executor +}; +const commentCodec = recordCodec(spec_comment); const postIdentifier = sql.identifier("public", "post"); const spec_post = { name: "post", @@ -384,7 +556,7 @@ const spec_post = { }), description: undefined, extensions: { - oid: "77554", + oid: "77826", isTableLike: true, pg: { serviceName: "main", @@ -500,7 +672,7 @@ const spec_project = { }), description: undefined, extensions: { - oid: "77564", + oid: "77836", isTableLike: true, pg: { serviceName: "main", @@ -604,7 +776,7 @@ const spec_user = { }), description: undefined, extensions: { - oid: "77588", + oid: "77860", isTableLike: true, pg: { serviceName: "main", @@ -649,6 +821,47 @@ const registryConfig_pgResources_user_organization_user_organization = { canDelete: true } }; +const downvoteUniques = [{ + isPrimary: true, + attributes: ["id"], + description: undefined, + extensions: { + tags: Object.create(null) + } +}, { + isPrimary: false, + attributes: ["post_id", "user_id"], + description: undefined, + extensions: { + tags: Object.create(null) + } +}]; +const registryConfig_pgResources_downvote_downvote = { + executor: executor, + name: "downvote", + identifier: "main.public.downvote", + from: downvoteIdentifier, + codec: downvoteCodec, + uniques: downvoteUniques, + isVirtual: false, + description: undefined, + extensions: { + description: undefined, + pg: { + serviceName: "main", + schemaName: "public", + name: "downvote" + }, + isInsertable: true, + isUpdatable: true, + isDeletable: true, + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true, + canDelete: true + } +}; const upvoteUniques = [{ isPrimary: true, attributes: ["id"], @@ -738,6 +951,40 @@ const registryConfig_pgResources_organization_organization = { canDelete: true } }; +const commentUniques = [{ + isPrimary: true, + attributes: ["id"], + description: undefined, + extensions: { + tags: Object.create(null) + } +}]; +const registryConfig_pgResources_comment_comment = { + executor: executor, + name: "comment", + identifier: "main.public.comment", + from: commentIdentifier, + codec: commentCodec, + uniques: commentUniques, + isVirtual: false, + description: undefined, + extensions: { + description: undefined, + pg: { + serviceName: "main", + schemaName: "public", + name: "comment" + }, + isInsertable: true, + isUpdatable: true, + isDeletable: true, + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true, + canDelete: true + } +}; const postUniques = [{ isPrimary: true, attributes: ["id"], @@ -876,31 +1123,35 @@ const registryConfig = { userOrganization: userOrganizationCodec, uuid: TYPES.uuid, timestamptz: TYPES.timestamptz, + downvote: downvoteCodec, upvote: upvoteCodec, organization: organizationCodec, text: TYPES.text, + comment: commentCodec, post: postCodec, project: projectCodec, user: userCodec }), pgResources: Object.assign(Object.create(null), { user_organization: registryConfig_pgResources_user_organization_user_organization, + downvote: registryConfig_pgResources_downvote_downvote, upvote: registryConfig_pgResources_upvote_upvote, organization: registryConfig_pgResources_organization_organization, + comment: registryConfig_pgResources_comment_comment, post: registryConfig_pgResources_post_post, user: registryConfig_pgResources_user_user, project: registryConfig_pgResources_project_project }), pgRelations: Object.assign(Object.create(null), { - organization: Object.assign(Object.create(null), { - projectsByTheirOrganizationId: { - localCodec: organizationCodec, - remoteResourceOptions: registryConfig_pgResources_project_project, + comment: Object.assign(Object.create(null), { + postByMyPostId: { + localCodec: commentCodec, + remoteResourceOptions: registryConfig_pgResources_post_post, localCodecPolymorphicTypes: undefined, - localAttributes: ["id"], - remoteAttributes: ["organization_id"], - isUnique: false, - isReferencee: true, + localAttributes: ["post_id"], + remoteAttributes: ["id"], + isUnique: true, + isReferencee: false, description: undefined, extensions: { tags: { @@ -908,14 +1159,14 @@ const registryConfig = { } } }, - userOrganizationsByTheirOrganizationId: { - localCodec: organizationCodec, - remoteResourceOptions: registryConfig_pgResources_user_organization_user_organization, + userByMyUserId: { + localCodec: commentCodec, + remoteResourceOptions: registryConfig_pgResources_user_user, localCodecPolymorphicTypes: undefined, - localAttributes: ["id"], - remoteAttributes: ["organization_id"], - isUnique: false, - isReferencee: true, + localAttributes: ["user_id"], + remoteAttributes: ["id"], + isUnique: true, + isReferencee: false, description: undefined, extensions: { tags: { @@ -924,12 +1175,12 @@ const registryConfig = { } } }), - post: Object.assign(Object.create(null), { - projectByMyProjectId: { - localCodec: postCodec, - remoteResourceOptions: registryConfig_pgResources_project_project, + downvote: Object.assign(Object.create(null), { + postByMyPostId: { + localCodec: downvoteCodec, + remoteResourceOptions: registryConfig_pgResources_post_post, localCodecPolymorphicTypes: undefined, - localAttributes: ["project_id"], + localAttributes: ["post_id"], remoteAttributes: ["id"], isUnique: true, isReferencee: false, @@ -941,7 +1192,7 @@ const registryConfig = { } }, userByMyUserId: { - localCodec: postCodec, + localCodec: downvoteCodec, remoteResourceOptions: registryConfig_pgResources_user_user, localCodecPolymorphicTypes: undefined, localAttributes: ["user_id"], @@ -954,10 +1205,104 @@ const registryConfig = { behavior: [] } } - }, - upvotesByTheirPostId: { - localCodec: postCodec, - remoteResourceOptions: registryConfig_pgResources_upvote_upvote, + } + }), + organization: Object.assign(Object.create(null), { + projectsByTheirOrganizationId: { + localCodec: organizationCodec, + remoteResourceOptions: registryConfig_pgResources_project_project, + localCodecPolymorphicTypes: undefined, + localAttributes: ["id"], + remoteAttributes: ["organization_id"], + isUnique: false, + isReferencee: true, + description: undefined, + extensions: { + tags: { + behavior: [] + } + } + }, + userOrganizationsByTheirOrganizationId: { + localCodec: organizationCodec, + remoteResourceOptions: registryConfig_pgResources_user_organization_user_organization, + localCodecPolymorphicTypes: undefined, + localAttributes: ["id"], + remoteAttributes: ["organization_id"], + isUnique: false, + isReferencee: true, + description: undefined, + extensions: { + tags: { + behavior: [] + } + } + } + }), + post: Object.assign(Object.create(null), { + projectByMyProjectId: { + localCodec: postCodec, + remoteResourceOptions: registryConfig_pgResources_project_project, + localCodecPolymorphicTypes: undefined, + localAttributes: ["project_id"], + remoteAttributes: ["id"], + isUnique: true, + isReferencee: false, + description: undefined, + extensions: { + tags: { + behavior: [] + } + } + }, + userByMyUserId: { + localCodec: postCodec, + remoteResourceOptions: registryConfig_pgResources_user_user, + localCodecPolymorphicTypes: undefined, + localAttributes: ["user_id"], + remoteAttributes: ["id"], + isUnique: true, + isReferencee: false, + description: undefined, + extensions: { + tags: { + behavior: [] + } + } + }, + upvotesByTheirPostId: { + localCodec: postCodec, + remoteResourceOptions: registryConfig_pgResources_upvote_upvote, + localCodecPolymorphicTypes: undefined, + localAttributes: ["id"], + remoteAttributes: ["post_id"], + isUnique: false, + isReferencee: true, + description: undefined, + extensions: { + tags: { + behavior: [] + } + } + }, + commentsByTheirPostId: { + localCodec: postCodec, + remoteResourceOptions: registryConfig_pgResources_comment_comment, + localCodecPolymorphicTypes: undefined, + localAttributes: ["id"], + remoteAttributes: ["post_id"], + isUnique: false, + isReferencee: true, + description: undefined, + extensions: { + tags: { + behavior: [] + } + } + }, + downvotesByTheirPostId: { + localCodec: postCodec, + remoteResourceOptions: registryConfig_pgResources_downvote_downvote, localCodecPolymorphicTypes: undefined, localAttributes: ["id"], remoteAttributes: ["post_id"], @@ -1080,6 +1425,36 @@ const registryConfig = { behavior: [] } } + }, + commentsByTheirUserId: { + localCodec: userCodec, + remoteResourceOptions: registryConfig_pgResources_comment_comment, + localCodecPolymorphicTypes: undefined, + localAttributes: ["id"], + remoteAttributes: ["user_id"], + isUnique: false, + isReferencee: true, + description: undefined, + extensions: { + tags: { + behavior: [] + } + } + }, + downvotesByTheirUserId: { + localCodec: userCodec, + remoteResourceOptions: registryConfig_pgResources_downvote_downvote, + localCodecPolymorphicTypes: undefined, + localAttributes: ["id"], + remoteAttributes: ["user_id"], + isUnique: false, + isReferencee: true, + description: undefined, + extensions: { + tags: { + behavior: [] + } + } } }), userOrganization: Object.assign(Object.create(null), { @@ -1117,13 +1492,34 @@ const registryConfig = { }) }; const registry = makeRegistry(registryConfig); +const pgResource_downvotePgResource = registry.pgResources["downvote"]; const pgResource_upvotePgResource = registry.pgResources["upvote"]; const pgResource_organizationPgResource = registry.pgResources["organization"]; +const pgResource_commentPgResource = registry.pgResources["comment"]; const pgResource_postPgResource = registry.pgResources["post"]; const pgResource_userPgResource = registry.pgResources["user"]; const pgResource_projectPgResource = registry.pgResources["project"]; const nodeIdHandlerByTypeName = Object.assign(Object.create(null), { Query: handler, + Downvote: { + typeName: "Downvote", + codec: nodeIdCodecs_base64JSON_base64JSON, + deprecationReason: undefined, + plan($record) { + return list([constant("Downvote", false), $record.get("id")]); + }, + getSpec($list) { + return { + id: inhibitOnNull(access($list, [1])) + }; + }, + get(spec) { + return pgResource_downvotePgResource.get(spec); + }, + match(obj) { + return obj[0] === "Downvote"; + } + }, Upvote: { typeName: "Upvote", codec: nodeIdCodecs_base64JSON_base64JSON, @@ -1162,6 +1558,25 @@ const nodeIdHandlerByTypeName = Object.assign(Object.create(null), { return obj[0] === "Organization"; } }, + Comment: { + typeName: "Comment", + codec: nodeIdCodecs_base64JSON_base64JSON, + deprecationReason: undefined, + plan($record) { + return list([constant("Comment", false), $record.get("id")]); + }, + getSpec($list) { + return { + id: inhibitOnNull(access($list, [1])) + }; + }, + get(spec) { + return pgResource_commentPgResource.get(spec); + }, + match(obj) { + return obj[0] === "Comment"; + } + }, Post: { typeName: "Post", codec: nodeIdCodecs_base64JSON_base64JSON, @@ -1240,7 +1655,7 @@ const fetcher = (handler => { }; fn.deprecationReason = handler.deprecationReason; return fn; -})(nodeIdHandlerByTypeName.Upvote); +})(nodeIdHandlerByTypeName.Downvote); const fetcher2 = (handler => { const fn = $nodeId => { const $decoded = lambda($nodeId, specForHandler(handler)); @@ -1248,7 +1663,7 @@ const fetcher2 = (handler => { }; fn.deprecationReason = handler.deprecationReason; return fn; -})(nodeIdHandlerByTypeName.Organization); +})(nodeIdHandlerByTypeName.Upvote); const fetcher3 = (handler => { const fn = $nodeId => { const $decoded = lambda($nodeId, specForHandler(handler)); @@ -1256,7 +1671,7 @@ const fetcher3 = (handler => { }; fn.deprecationReason = handler.deprecationReason; return fn; -})(nodeIdHandlerByTypeName.Post); +})(nodeIdHandlerByTypeName.Organization); const fetcher4 = (handler => { const fn = $nodeId => { const $decoded = lambda($nodeId, specForHandler(handler)); @@ -1264,7 +1679,7 @@ const fetcher4 = (handler => { }; fn.deprecationReason = handler.deprecationReason; return fn; -})(nodeIdHandlerByTypeName.User); +})(nodeIdHandlerByTypeName.Comment); const fetcher5 = (handler => { const fn = $nodeId => { const $decoded = lambda($nodeId, specForHandler(handler)); @@ -1272,6 +1687,22 @@ const fetcher5 = (handler => { }; fn.deprecationReason = handler.deprecationReason; return fn; +})(nodeIdHandlerByTypeName.Post); +const fetcher6 = (handler => { + const fn = $nodeId => { + const $decoded = lambda($nodeId, specForHandler(handler)); + return handler.get(handler.getSpec($decoded)); + }; + fn.deprecationReason = handler.deprecationReason; + return fn; +})(nodeIdHandlerByTypeName.User); +const fetcher7 = (handler => { + const fn = $nodeId => { + const $decoded = lambda($nodeId, specForHandler(handler)); + return handler.get(handler.getSpec($decoded)); + }; + fn.deprecationReason = handler.deprecationReason; + return fn; })(nodeIdHandlerByTypeName.Project); const applyOrderToPlan = ($select, $value, TableOrderByType) => { if (!("evalLength" in $value)) return; @@ -1360,6 +1791,30 @@ function assertAllowed6(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } +function assertAllowed7(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed8(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} function UUIDSerialize(value) { return "" + value; } @@ -1367,7 +1822,7 @@ const coerce = string => { if (!/^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i.test(string)) throw new GraphQLError("Invalid UUID, expected 32 hexadecimal characters, optionally with hypens"); return string; }; -function assertAllowed7(fieldArgs, mode) { +function assertAllowed9(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1379,7 +1834,7 @@ function assertAllowed7(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed8(fieldArgs, mode) { +function assertAllowed10(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1545,7 +2000,7 @@ export const ProjectGroupBy = new GraphQLEnumType({ } }) }); -function assertAllowed9(fieldArgs, mode) { +function assertAllowed11(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1693,7 +2148,7 @@ export const PostGroupBy = new GraphQLEnumType({ } }) }); -function assertAllowed10(fieldArgs, mode) { +function assertAllowed12(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1705,7 +2160,7 @@ function assertAllowed10(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed11(fieldArgs, mode) { +function assertAllowed13(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1717,7 +2172,7 @@ function assertAllowed11(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed12(fieldArgs, mode) { +function assertAllowed14(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1729,7 +2184,55 @@ function assertAllowed12(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed13(fieldArgs, mode) { +function assertAllowed15(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed16(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed17(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed18(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed19(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1759,6 +2262,8 @@ const aggregateSpec = { return (_b = oid ? dataTypeToAggregateTypeMap[oid] : null) !== null && _b !== void 0 ? _b : TYPES.bigint; } }; +const relation2 = registry.pgRelations["post"]["commentsByTheirPostId"]; +const relation3 = registry.pgRelations["post"]["downvotesByTheirPostId"]; const colSpec = { fieldName: "rowId", attributeName: "id", @@ -1794,7 +2299,7 @@ const colSpec7 = { attributeName: "updated_at", attribute: spec_post.attributes.updated_at }; -function assertAllowed14(fieldArgs, mode) { +function assertAllowed20(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1806,7 +2311,7 @@ function assertAllowed14(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed15(fieldArgs, mode) { +function assertAllowed21(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -1818,7 +2323,7 @@ function assertAllowed15(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed16(fieldArgs, mode) { +function assertAllowed22(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2252,7 +2757,7 @@ const resolve46 = (i, v) => sql`${i} < ${v}`; const resolve47 = (i, v) => sql`${i} <= ${v}`; const resolve48 = (i, v) => sql`${i} > ${v}`; const resolve49 = (i, v) => sql`${i} >= ${v}`; -function assertAllowed17(fieldArgs, mode) { +function assertAllowed23(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2352,7 +2857,7 @@ const colSpec12 = { attributeName: "updated_at", attribute: spec_upvote.attributes.updated_at }; -function assertAllowed18(fieldArgs, mode) { +function assertAllowed24(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2364,7 +2869,7 @@ function assertAllowed18(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed19(fieldArgs, mode) { +function assertAllowed25(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2411,7 +2916,7 @@ const colSpec19 = { attributeName: "last_name", attribute: spec_user.attributes.last_name }; -function assertAllowed20(fieldArgs, mode) { +function assertAllowed26(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2423,7 +2928,7 @@ function assertAllowed20(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed21(fieldArgs, mode) { +function assertAllowed27(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2435,7 +2940,7 @@ function assertAllowed21(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed22(fieldArgs, mode) { +function assertAllowed28(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2497,7 +3002,7 @@ const resolve57 = (i, v) => sql`${i} < ${v}`; const resolve58 = (i, v) => sql`${i} <= ${v}`; const resolve59 = (i, v) => sql`${i} > ${v}`; const resolve60 = (i, v) => sql`${i} >= ${v}`; -function assertAllowed23(fieldArgs, mode) { +function assertAllowed29(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2509,7 +3014,7 @@ function assertAllowed23(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed24(fieldArgs, mode) { +function assertAllowed30(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2536,7 +3041,7 @@ const colSpec22 = { attributeName: "created_at", attribute: spec_userOrganization.attributes.created_at }; -function assertAllowed25(fieldArgs, mode) { +function assertAllowed31(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2548,7 +3053,7 @@ function assertAllowed25(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed26(fieldArgs, mode) { +function assertAllowed32(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2585,7 +3090,7 @@ const colSpec27 = { attributeName: "updated_at", attribute: spec_organization.attributes.updated_at }; -function assertAllowed27(fieldArgs, mode) { +function assertAllowed33(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2597,7 +3102,7 @@ function assertAllowed27(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed28(fieldArgs, mode) { +function assertAllowed34(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2609,7 +3114,7 @@ function assertAllowed28(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed29(fieldArgs, mode) { +function assertAllowed35(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2661,7 +3166,7 @@ const colSpec35 = { attributeName: "updated_at", attribute: spec_project.attributes.updated_at }; -function assertAllowed30(fieldArgs, mode) { +function assertAllowed36(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2673,7 +3178,7 @@ function assertAllowed30(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed31(fieldArgs, mode) { +function assertAllowed37(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2685,7 +3190,7 @@ function assertAllowed31(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed32(fieldArgs, mode) { +function assertAllowed38(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2697,7 +3202,7 @@ function assertAllowed32(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed33(fieldArgs, mode) { +function assertAllowed39(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -2709,7 +3214,158 @@ function assertAllowed33(fieldArgs, mode) { } if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed34(fieldArgs, mode) { +function assertAllowed40(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed41(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +const colSpec36 = { + fieldName: "rowId", + attributeName: "id", + attribute: spec_comment.attributes.id +}; +const colSpec37 = { + fieldName: "message", + attributeName: "message", + attribute: spec_comment.attributes.message +}; +const colSpec38 = { + fieldName: "postId", + attributeName: "post_id", + attribute: spec_comment.attributes.post_id +}; +const colSpec39 = { + fieldName: "userId", + attributeName: "user_id", + attribute: spec_comment.attributes.user_id +}; +const colSpec40 = { + fieldName: "createdAt", + attributeName: "created_at", + attribute: spec_comment.attributes.created_at +}; +const colSpec41 = { + fieldName: "updatedAt", + attributeName: "updated_at", + attribute: spec_comment.attributes.updated_at +}; +function assertAllowed42(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed43(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed44(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +const colSpec42 = { + fieldName: "rowId", + attributeName: "id", + attribute: spec_downvote.attributes.id +}; +const colSpec43 = { + fieldName: "postId", + attributeName: "post_id", + attribute: spec_downvote.attributes.post_id +}; +const colSpec44 = { + fieldName: "userId", + attributeName: "user_id", + attribute: spec_downvote.attributes.user_id +}; +const colSpec45 = { + fieldName: "createdAt", + attributeName: "created_at", + attribute: spec_downvote.attributes.created_at +}; +const colSpec46 = { + fieldName: "updatedAt", + attributeName: "updated_at", + attribute: spec_downvote.attributes.updated_at +}; +function assertAllowed45(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed46(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed47(fieldArgs, mode) { + const $raw = fieldArgs.getRaw(); + if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !false && "evalLength" in $raw) { + const l = $raw.evalLength(); + if (l != null) for (let i = 0; i < l; i++) { + const $entry = $raw.at(i); + if ("evalIsEmpty" in $entry && $entry.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +function assertAllowed48(fieldArgs, mode) { const $raw = fieldArgs.getRaw(); if (mode === "object" && !false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (mode === "list" && !false && "evalLength" in $raw) { @@ -3054,46 +3710,84 @@ export const UserOrganizationGroupBy = new GraphQLEnumType({ } }) }); -const relation2 = registry.pgRelations["project"]["postsByTheirProjectId"]; -function OrganizationGroupBy_extensions_grafast_applyPlan($pgSelect) { +function CommentGroupBy_extensions_grafast_applyPlan($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("message")}` + }); +} +function CommentGroupBy_extensions_grafast_applyPlan2($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("post_id")}` + }); +} +function CommentGroupBy_extensions_grafast_applyPlan3($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}` + }); +} +function CommentGroupBy_extensions_grafast_applyPlan4($pgSelect) { $pgSelect.groupBy({ fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` }); } -function OrganizationGroupBy_extensions_grafast_applyPlan2($pgSelect) { +function CommentGroupBy_extensions_grafast_applyPlan5($pgSelect) { $pgSelect.groupBy({ fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) }); } -function OrganizationGroupBy_extensions_grafast_applyPlan3($pgSelect) { +function CommentGroupBy_extensions_grafast_applyPlan6($pgSelect) { $pgSelect.groupBy({ fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) }); } -function OrganizationGroupBy_extensions_grafast_applyPlan4($pgSelect) { +function CommentGroupBy_extensions_grafast_applyPlan7($pgSelect) { $pgSelect.groupBy({ fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` }); } -function OrganizationGroupBy_extensions_grafast_applyPlan5($pgSelect) { +function CommentGroupBy_extensions_grafast_applyPlan8($pgSelect) { $pgSelect.groupBy({ fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) }); } -function OrganizationGroupBy_extensions_grafast_applyPlan6($pgSelect) { +function CommentGroupBy_extensions_grafast_applyPlan9($pgSelect) { $pgSelect.groupBy({ fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) }); } -export const OrganizationGroupBy = new GraphQLEnumType({ - name: "OrganizationGroupBy", - description: "Grouping methods for `Organization` for usage during aggregation.", +export const CommentGroupBy = new GraphQLEnumType({ + name: "CommentGroupBy", + description: "Grouping methods for `Comment` for usage during aggregation.", values: Object.assign(Object.create(null), { + MESSAGE: { + value: "MESSAGE", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: CommentGroupBy_extensions_grafast_applyPlan + } + }) + }, + POST_ID: { + value: "POST_ID", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: CommentGroupBy_extensions_grafast_applyPlan2 + } + }) + }, + USER_ID: { + value: "USER_ID", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: CommentGroupBy_extensions_grafast_applyPlan3 + } + }) + }, CREATED_AT: { value: "CREATED_AT", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan + applyPlan: CommentGroupBy_extensions_grafast_applyPlan4 } }) }, @@ -3101,7 +3795,7 @@ export const OrganizationGroupBy = new GraphQLEnumType({ value: "CREATED_AT_TRUNCATED_TO_HOUR", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan2 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan5 } }) }, @@ -3109,7 +3803,7 @@ export const OrganizationGroupBy = new GraphQLEnumType({ value: "CREATED_AT_TRUNCATED_TO_DAY", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan3 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan6 } }) }, @@ -3117,7 +3811,7 @@ export const OrganizationGroupBy = new GraphQLEnumType({ value: "UPDATED_AT", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan4 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan7 } }) }, @@ -3125,7 +3819,7 @@ export const OrganizationGroupBy = new GraphQLEnumType({ value: "UPDATED_AT_TRUNCATED_TO_HOUR", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan5 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan8 } }) }, @@ -3133,63 +3827,77 @@ export const OrganizationGroupBy = new GraphQLEnumType({ value: "UPDATED_AT_TRUNCATED_TO_DAY", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan6 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan9 } }) } }) }); -const relation3 = registry.pgRelations["organization"]["projectsByTheirOrganizationId"]; -const relation4 = registry.pgRelations["organization"]["userOrganizationsByTheirOrganizationId"]; -function UserGroupBy_extensions_grafast_applyPlan($pgSelect) { +function DownvoteGroupBy_extensions_grafast_applyPlan($pgSelect) { $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("post_id")}` }); } -function UserGroupBy_extensions_grafast_applyPlan2($pgSelect) { +function DownvoteGroupBy_extensions_grafast_applyPlan2($pgSelect) { $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}` }); } -function UserGroupBy_extensions_grafast_applyPlan3($pgSelect) { +function DownvoteGroupBy_extensions_grafast_applyPlan3($pgSelect) { $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` }); } -function UserGroupBy_extensions_grafast_applyPlan4($pgSelect) { +function DownvoteGroupBy_extensions_grafast_applyPlan4($pgSelect) { $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) }); } -function UserGroupBy_extensions_grafast_applyPlan5($pgSelect) { +function DownvoteGroupBy_extensions_grafast_applyPlan5($pgSelect) { $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) }); } -function UserGroupBy_extensions_grafast_applyPlan6($pgSelect) { +function DownvoteGroupBy_extensions_grafast_applyPlan6($pgSelect) { $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` }); } -function UserGroupBy_extensions_grafast_applyPlan7($pgSelect) { +function DownvoteGroupBy_extensions_grafast_applyPlan7($pgSelect) { $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("first_name")}` + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) }); } -function UserGroupBy_extensions_grafast_applyPlan8($pgSelect) { +function DownvoteGroupBy_extensions_grafast_applyPlan8($pgSelect) { $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("last_name")}` + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) }); } -export const UserGroupBy = new GraphQLEnumType({ - name: "UserGroupBy", - description: "Grouping methods for `User` for usage during aggregation.", +export const DownvoteGroupBy = new GraphQLEnumType({ + name: "DownvoteGroupBy", + description: "Grouping methods for `Downvote` for usage during aggregation.", values: Object.assign(Object.create(null), { + POST_ID: { + value: "POST_ID", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan + } + }) + }, + USER_ID: { + value: "USER_ID", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan2 + } + }) + }, CREATED_AT: { value: "CREATED_AT", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan3 } }) }, @@ -3197,7 +3905,7 @@ export const UserGroupBy = new GraphQLEnumType({ value: "CREATED_AT_TRUNCATED_TO_HOUR", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan2 + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan4 } }) }, @@ -3205,7 +3913,7 @@ export const UserGroupBy = new GraphQLEnumType({ value: "CREATED_AT_TRUNCATED_TO_DAY", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan3 + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan5 } }) }, @@ -3213,7 +3921,7 @@ export const UserGroupBy = new GraphQLEnumType({ value: "UPDATED_AT", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan4 + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan6 } }) }, @@ -3221,7 +3929,7 @@ export const UserGroupBy = new GraphQLEnumType({ value: "UPDATED_AT_TRUNCATED_TO_HOUR", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan5 + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan7 } }) }, @@ -3229,20 +3937,201 @@ export const UserGroupBy = new GraphQLEnumType({ value: "UPDATED_AT_TRUNCATED_TO_DAY", extensions: Object.assign(Object.create(null), { grafast: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan6 - } - }) - }, - FIRST_NAME: { - value: "FIRST_NAME", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan7 + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan8 } }) - }, - LAST_NAME: { - value: "LAST_NAME", + } + }) +}); +const relation4 = registry.pgRelations["project"]["postsByTheirProjectId"]; +function OrganizationGroupBy_extensions_grafast_applyPlan($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` + }); +} +function OrganizationGroupBy_extensions_grafast_applyPlan2($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + }); +} +function OrganizationGroupBy_extensions_grafast_applyPlan3($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + }); +} +function OrganizationGroupBy_extensions_grafast_applyPlan4($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` + }); +} +function OrganizationGroupBy_extensions_grafast_applyPlan5($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + }); +} +function OrganizationGroupBy_extensions_grafast_applyPlan6($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + }); +} +export const OrganizationGroupBy = new GraphQLEnumType({ + name: "OrganizationGroupBy", + description: "Grouping methods for `Organization` for usage during aggregation.", + values: Object.assign(Object.create(null), { + CREATED_AT: { + value: "CREATED_AT", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan + } + }) + }, + CREATED_AT_TRUNCATED_TO_HOUR: { + value: "CREATED_AT_TRUNCATED_TO_HOUR", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan2 + } + }) + }, + CREATED_AT_TRUNCATED_TO_DAY: { + value: "CREATED_AT_TRUNCATED_TO_DAY", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan3 + } + }) + }, + UPDATED_AT: { + value: "UPDATED_AT", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan4 + } + }) + }, + UPDATED_AT_TRUNCATED_TO_HOUR: { + value: "UPDATED_AT_TRUNCATED_TO_HOUR", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan5 + } + }) + }, + UPDATED_AT_TRUNCATED_TO_DAY: { + value: "UPDATED_AT_TRUNCATED_TO_DAY", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan6 + } + }) + } + }) +}); +const relation5 = registry.pgRelations["organization"]["projectsByTheirOrganizationId"]; +const relation6 = registry.pgRelations["organization"]["userOrganizationsByTheirOrganizationId"]; +function UserGroupBy_extensions_grafast_applyPlan($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` + }); +} +function UserGroupBy_extensions_grafast_applyPlan2($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + }); +} +function UserGroupBy_extensions_grafast_applyPlan3($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + }); +} +function UserGroupBy_extensions_grafast_applyPlan4($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` + }); +} +function UserGroupBy_extensions_grafast_applyPlan5($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + }); +} +function UserGroupBy_extensions_grafast_applyPlan6($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + }); +} +function UserGroupBy_extensions_grafast_applyPlan7($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("first_name")}` + }); +} +function UserGroupBy_extensions_grafast_applyPlan8($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("last_name")}` + }); +} +export const UserGroupBy = new GraphQLEnumType({ + name: "UserGroupBy", + description: "Grouping methods for `User` for usage during aggregation.", + values: Object.assign(Object.create(null), { + CREATED_AT: { + value: "CREATED_AT", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan + } + }) + }, + CREATED_AT_TRUNCATED_TO_HOUR: { + value: "CREATED_AT_TRUNCATED_TO_HOUR", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan2 + } + }) + }, + CREATED_AT_TRUNCATED_TO_DAY: { + value: "CREATED_AT_TRUNCATED_TO_DAY", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan3 + } + }) + }, + UPDATED_AT: { + value: "UPDATED_AT", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan4 + } + }) + }, + UPDATED_AT_TRUNCATED_TO_HOUR: { + value: "UPDATED_AT_TRUNCATED_TO_HOUR", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan5 + } + }) + }, + UPDATED_AT_TRUNCATED_TO_DAY: { + value: "UPDATED_AT_TRUNCATED_TO_DAY", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan6 + } + }) + }, + FIRST_NAME: { + value: "FIRST_NAME", + extensions: Object.assign(Object.create(null), { + grafast: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan7 + } + }) + }, + LAST_NAME: { + value: "LAST_NAME", extensions: Object.assign(Object.create(null), { grafast: { applyPlan: UserGroupBy_extensions_grafast_applyPlan8 @@ -3251,46 +4140,64 @@ export const UserGroupBy = new GraphQLEnumType({ } }) }); -const relation5 = registry.pgRelations["user"]["postsByTheirUserId"]; -const relation6 = registry.pgRelations["user"]["upvotesByTheirUserId"]; -const relation7 = registry.pgRelations["user"]["userOrganizationsByTheirUserId"]; +const relation7 = registry.pgRelations["user"]["postsByTheirUserId"]; +const relation8 = registry.pgRelations["user"]["upvotesByTheirUserId"]; +const relation9 = registry.pgRelations["user"]["userOrganizationsByTheirUserId"]; +const relation10 = registry.pgRelations["user"]["commentsByTheirUserId"]; +const relation11 = registry.pgRelations["user"]["downvotesByTheirUserId"]; const specFromArgs = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.Upvote, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.Downvote, $nodeId); }; const specFromArgs2 = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.Organization, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.Upvote, $nodeId); }; const specFromArgs3 = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.Post, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.Organization, $nodeId); }; const specFromArgs4 = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.User, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.Comment, $nodeId); }; const specFromArgs5 = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.Project, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.Post, $nodeId); }; const specFromArgs6 = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.Upvote, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.User, $nodeId); }; const specFromArgs7 = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.Organization, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.Project, $nodeId); }; const specFromArgs8 = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.Post, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.Downvote, $nodeId); }; const specFromArgs9 = args => { const $nodeId = args.get(["input", "id"]); - return specFromNodeId(nodeIdHandlerByTypeName.User, $nodeId); + return specFromNodeId(nodeIdHandlerByTypeName.Upvote, $nodeId); }; const specFromArgs10 = args => { + const $nodeId = args.get(["input", "id"]); + return specFromNodeId(nodeIdHandlerByTypeName.Organization, $nodeId); +}; +const specFromArgs11 = args => { + const $nodeId = args.get(["input", "id"]); + return specFromNodeId(nodeIdHandlerByTypeName.Comment, $nodeId); +}; +const specFromArgs12 = args => { + const $nodeId = args.get(["input", "id"]); + return specFromNodeId(nodeIdHandlerByTypeName.Post, $nodeId); +}; +const specFromArgs13 = args => { + const $nodeId = args.get(["input", "id"]); + return specFromNodeId(nodeIdHandlerByTypeName.User, $nodeId); +}; +const specFromArgs14 = args => { const $nodeId = args.get(["input", "id"]); return specFromNodeId(nodeIdHandlerByTypeName.Project, $nodeId); }; @@ -3316,6 +4223,12 @@ type Query implements Node { """Get a single \`UserOrganization\`.""" userOrganizationByUserIdAndOrganizationId(userId: UUID!, organizationId: UUID!): UserOrganization + """Get a single \`Downvote\`.""" + downvote(rowId: UUID!): Downvote + + """Get a single \`Downvote\`.""" + downvoteByPostIdAndUserId(postId: UUID!, userId: UUID!): Downvote + """Get a single \`Upvote\`.""" upvote(rowId: UUID!): Upvote @@ -3331,6 +4244,9 @@ type Query implements Node { """Get a single \`Organization\`.""" organizationBySlug(slug: String!): Organization + """Get a single \`Comment\`.""" + comment(rowId: UUID!): Comment + """Get a single \`Post\`.""" post(rowId: UUID!): Post @@ -3352,6 +4268,12 @@ type Query implements Node { """Get a single \`Project\`.""" projectBySlugAndOrganizationId(slug: String!, organizationId: UUID!): Project + """Reads a single \`Downvote\` using its globally unique \`ID\`.""" + downvoteById( + """The globally unique \`ID\` to be used in selecting a single \`Downvote\`.""" + id: ID! + ): Downvote + """Reads a single \`Upvote\` using its globally unique \`ID\`.""" upvoteById( """The globally unique \`ID\` to be used in selecting a single \`Upvote\`.""" @@ -3366,6 +4288,12 @@ type Query implements Node { id: ID! ): Organization + """Reads a single \`Comment\` using its globally unique \`ID\`.""" + commentById( + """The globally unique \`ID\` to be used in selecting a single \`Comment\`.""" + id: ID! + ): Comment + """Reads a single \`Post\` using its globally unique \`ID\`.""" postById( """The globally unique \`ID\` to be used in selecting a single \`Post\`.""" @@ -3418,6 +4346,40 @@ type Query implements Node { filter: UserOrganizationFilter ): UserOrganizationConnection + """Reads and enables pagination through a set of \`Downvote\`.""" + downvotes( + """Only read the first \`n\` values of the set.""" + first: Int + + """Only read the last \`n\` values of the set.""" + last: Int + + """ + Skip the first \`n\` values from our \`after\` cursor, an alternative to cursor + based pagination. May not be used with \`last\`. + """ + offset: Int + + """Read all values in the set before (above) this cursor.""" + before: Cursor + + """Read all values in the set after (below) this cursor.""" + after: Cursor + + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!] = [PRIMARY_KEY_ASC] + + """ + A condition to be used in determining which values should be returned by the collection. + """ + condition: DownvoteCondition + + """ + A filter to be used in determining which values should be returned by the collection. + """ + filter: DownvoteFilter + ): DownvoteConnection + """Reads and enables pagination through a set of \`Upvote\`.""" upvotes( """Only read the first \`n\` values of the set.""" @@ -3486,8 +4448,8 @@ type Query implements Node { filter: OrganizationFilter ): OrganizationConnection - """Reads and enables pagination through a set of \`Post\`.""" - posts( + """Reads and enables pagination through a set of \`Comment\`.""" + comments( """Only read the first \`n\` values of the set.""" first: Int @@ -3506,19 +4468,53 @@ type Query implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Post\`.""" - orderBy: [PostOrderBy!] = [PRIMARY_KEY_ASC] + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!] = [PRIMARY_KEY_ASC] """ A condition to be used in determining which values should be returned by the collection. """ - condition: PostCondition + condition: CommentCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: PostFilter - ): PostConnection + filter: CommentFilter + ): CommentConnection + + """Reads and enables pagination through a set of \`Post\`.""" + posts( + """Only read the first \`n\` values of the set.""" + first: Int + + """Only read the last \`n\` values of the set.""" + last: Int + + """ + Skip the first \`n\` values from our \`after\` cursor, an alternative to cursor + based pagination. May not be used with \`last\`. + """ + offset: Int + + """Read all values in the set before (above) this cursor.""" + before: Cursor + + """Read all values in the set after (below) this cursor.""" + after: Cursor + + """The method to use when ordering \`Post\`.""" + orderBy: [PostOrderBy!] = [PRIMARY_KEY_ASC] + + """ + A condition to be used in determining which values should be returned by the collection. + """ + condition: PostCondition + + """ + A filter to be used in determining which values should be returned by the collection. + """ + filter: PostFilter + ): PostConnection """Reads and enables pagination through a set of \`User\`.""" users( @@ -3875,6 +4871,74 @@ type Post implements Node { """ filter: UpvoteFilter ): UpvoteConnection! + + """Reads and enables pagination through a set of \`Comment\`.""" + comments( + """Only read the first \`n\` values of the set.""" + first: Int + + """Only read the last \`n\` values of the set.""" + last: Int + + """ + Skip the first \`n\` values from our \`after\` cursor, an alternative to cursor + based pagination. May not be used with \`last\`. + """ + offset: Int + + """Read all values in the set before (above) this cursor.""" + before: Cursor + + """Read all values in the set after (below) this cursor.""" + after: Cursor + + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!] = [PRIMARY_KEY_ASC] + + """ + A condition to be used in determining which values should be returned by the collection. + """ + condition: CommentCondition + + """ + A filter to be used in determining which values should be returned by the collection. + """ + filter: CommentFilter + ): CommentConnection! + + """Reads and enables pagination through a set of \`Downvote\`.""" + downvotes( + """Only read the first \`n\` values of the set.""" + first: Int + + """Only read the last \`n\` values of the set.""" + last: Int + + """ + Skip the first \`n\` values from our \`after\` cursor, an alternative to cursor + based pagination. May not be used with \`last\`. + """ + offset: Int + + """Read all values in the set before (above) this cursor.""" + before: Cursor + + """Read all values in the set after (below) this cursor.""" + after: Cursor + + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!] = [PRIMARY_KEY_ASC] + + """ + A condition to be used in determining which values should be returned by the collection. + """ + condition: DownvoteCondition + + """ + A filter to be used in determining which values should be returned by the collection. + """ + filter: DownvoteFilter + ): DownvoteConnection! } type User implements Node { @@ -3991,6 +5055,74 @@ type User implements Node { """ filter: UserOrganizationFilter ): UserOrganizationConnection! + + """Reads and enables pagination through a set of \`Comment\`.""" + comments( + """Only read the first \`n\` values of the set.""" + first: Int + + """Only read the last \`n\` values of the set.""" + last: Int + + """ + Skip the first \`n\` values from our \`after\` cursor, an alternative to cursor + based pagination. May not be used with \`last\`. + """ + offset: Int + + """Read all values in the set before (above) this cursor.""" + before: Cursor + + """Read all values in the set after (below) this cursor.""" + after: Cursor + + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!] = [PRIMARY_KEY_ASC] + + """ + A condition to be used in determining which values should be returned by the collection. + """ + condition: CommentCondition + + """ + A filter to be used in determining which values should be returned by the collection. + """ + filter: CommentFilter + ): CommentConnection! + + """Reads and enables pagination through a set of \`Downvote\`.""" + downvotes( + """Only read the first \`n\` values of the set.""" + first: Int + + """Only read the last \`n\` values of the set.""" + last: Int + + """ + Skip the first \`n\` values from our \`after\` cursor, an alternative to cursor + based pagination. May not be used with \`last\`. + """ + offset: Int + + """Read all values in the set before (above) this cursor.""" + before: Cursor + + """Read all values in the set after (below) this cursor.""" + after: Cursor + + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!] = [PRIMARY_KEY_ASC] + + """ + A condition to be used in determining which values should be returned by the collection. + """ + condition: DownvoteCondition + + """ + A filter to be used in determining which values should be returned by the collection. + """ + filter: DownvoteFilter + ): DownvoteConnection! } """A location in a connection that can be used for resuming pagination.""" @@ -4027,6 +5159,32 @@ enum PostOrderBy { UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC + COMMENTS_COUNT_ASC + COMMENTS_COUNT_DESC + COMMENTS_DISTINCT_COUNT_ROW_ID_ASC + COMMENTS_DISTINCT_COUNT_ROW_ID_DESC + COMMENTS_DISTINCT_COUNT_MESSAGE_ASC + COMMENTS_DISTINCT_COUNT_MESSAGE_DESC + COMMENTS_DISTINCT_COUNT_POST_ID_ASC + COMMENTS_DISTINCT_COUNT_POST_ID_DESC + COMMENTS_DISTINCT_COUNT_USER_ID_ASC + COMMENTS_DISTINCT_COUNT_USER_ID_DESC + COMMENTS_DISTINCT_COUNT_CREATED_AT_ASC + COMMENTS_DISTINCT_COUNT_CREATED_AT_DESC + COMMENTS_DISTINCT_COUNT_UPDATED_AT_ASC + COMMENTS_DISTINCT_COUNT_UPDATED_AT_DESC + DOWNVOTES_COUNT_ASC + DOWNVOTES_COUNT_DESC + DOWNVOTES_DISTINCT_COUNT_ROW_ID_ASC + DOWNVOTES_DISTINCT_COUNT_ROW_ID_DESC + DOWNVOTES_DISTINCT_COUNT_POST_ID_ASC + DOWNVOTES_DISTINCT_COUNT_POST_ID_DESC + DOWNVOTES_DISTINCT_COUNT_USER_ID_ASC + DOWNVOTES_DISTINCT_COUNT_USER_ID_DESC + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_ASC + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_DESC + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_ASC + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_DESC } """ @@ -4086,6 +5244,18 @@ input PostFilter { """Some related \`upvotes\` exist.""" upvotesExist: Boolean + """Filter by the object’s \`comments\` relation.""" + comments: PostToManyCommentFilter + + """Some related \`comments\` exist.""" + commentsExist: Boolean + + """Filter by the object’s \`downvotes\` relation.""" + downvotes: PostToManyDownvoteFilter + + """Some related \`downvotes\` exist.""" + downvotesExist: Boolean + """Filter by the object’s \`project\` relation.""" project: ProjectFilter @@ -4419,6 +5589,18 @@ input UserFilter { """Some related \`userOrganizations\` exist.""" userOrganizationsExist: Boolean + """Filter by the object’s \`comments\` relation.""" + comments: UserToManyCommentFilter + + """Some related \`comments\` exist.""" + commentsExist: Boolean + + """Filter by the object’s \`downvotes\` relation.""" + downvotes: UserToManyDownvoteFilter + + """Some related \`downvotes\` exist.""" + downvotesExist: Boolean + """Checks for all expressions in this list.""" and: [UserFilter!] @@ -4818,102 +6000,306 @@ input UserOrganizationDistinctCountAggregateFilter { createdAt: BigIntFilter } -"""A connection to a list of \`Upvote\` values.""" -type UpvoteConnection { - """A list of \`Upvote\` objects.""" - nodes: [Upvote]! - +""" +A filter to be used against many \`Comment\` object types. All fields are combined with a logical ‘and.’ +""" +input UserToManyCommentFilter { """ - A list of edges which contains the \`Upvote\` and cursor to aid in pagination. + Every related \`Comment\` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - edges: [UpvoteEdge]! - - """Information to aid in pagination.""" - pageInfo: PageInfo! - - """The count of *all* \`Upvote\` you could get from the connection.""" - totalCount: Int! + every: CommentFilter """ - Aggregates across the matching connection (ignoring before/after/first/last/offset) + Some related \`Comment\` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - aggregates: UpvoteAggregates + some: CommentFilter """ - Grouped aggregates across the matching connection (ignoring before/after/first/last/offset) + No related \`Comment\` matches the filter criteria. All fields are combined with a logical ‘and.’ """ - groupedAggregates( - """The method to use when grouping \`Upvote\` for these aggregates.""" - groupBy: [UpvoteGroupBy!]! + none: CommentFilter - """Conditions on the grouped aggregates.""" - having: UpvoteHavingInput - ): [UpvoteAggregates!] + """Aggregates across related \`Comment\` match the filter criteria.""" + aggregates: CommentAggregatesFilter } -type Upvote implements Node { - """ - A globally unique identifier. Can be used in various places throughout the system to identify this single value. - """ - id: ID! - rowId: UUID! - postId: UUID! - userId: UUID! - createdAt: Datetime - updatedAt: Datetime +""" +A filter to be used against \`Comment\` object types. All fields are combined with a logical ‘and.’ +""" +input CommentFilter { + """Filter by the object’s \`rowId\` field.""" + rowId: UUIDFilter - """Reads a single \`Post\` that is related to this \`Upvote\`.""" - post: Post + """Filter by the object’s \`message\` field.""" + message: StringFilter - """Reads a single \`User\` that is related to this \`Upvote\`.""" - user: User -} + """Filter by the object’s \`postId\` field.""" + postId: UUIDFilter -"""A \`Upvote\` edge in the connection.""" -type UpvoteEdge { - """A cursor for use in pagination.""" - cursor: Cursor + """Filter by the object’s \`userId\` field.""" + userId: UUIDFilter - """The \`Upvote\` at the end of the edge.""" - node: Upvote -} + """Filter by the object’s \`createdAt\` field.""" + createdAt: DatetimeFilter -"""Information about pagination in a connection.""" -type PageInfo { - """When paginating forwards, are there more items?""" - hasNextPage: Boolean! + """Filter by the object’s \`updatedAt\` field.""" + updatedAt: DatetimeFilter - """When paginating backwards, are there more items?""" - hasPreviousPage: Boolean! + """Filter by the object’s \`post\` relation.""" + post: PostFilter - """When paginating backwards, the cursor to continue.""" - startCursor: Cursor + """Filter by the object’s \`user\` relation.""" + user: UserFilter - """When paginating forwards, the cursor to continue.""" - endCursor: Cursor -} + """Checks for all expressions in this list.""" + and: [CommentFilter!] -type UpvoteAggregates { - keys: [String] + """Checks for any expressions in this list.""" + or: [CommentFilter!] + + """Negates the expression.""" + not: CommentFilter +} +"""A filter to be used against aggregates of \`Comment\` object types.""" +input CommentAggregatesFilter { """ - Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) + A filter that must pass for the relevant \`Comment\` object to be included within the aggregate. """ - distinctCount: UpvoteDistinctCountAggregates + filter: CommentFilter + + """Distinct count aggregate over matching \`Comment\` objects.""" + distinctCount: CommentDistinctCountAggregateFilter } -type UpvoteDistinctCountAggregates { - """Distinct count of rowId across the matching connection""" - rowId: BigInt +input CommentDistinctCountAggregateFilter { + rowId: BigIntFilter + message: BigIntFilter + postId: BigIntFilter + userId: BigIntFilter + createdAt: BigIntFilter + updatedAt: BigIntFilter +} - """Distinct count of postId across the matching connection""" - postId: BigInt +""" +A filter to be used against many \`Downvote\` object types. All fields are combined with a logical ‘and.’ +""" +input UserToManyDownvoteFilter { + """ + Every related \`Downvote\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + every: DownvoteFilter - """Distinct count of userId across the matching connection""" - userId: BigInt + """ + Some related \`Downvote\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + some: DownvoteFilter - """Distinct count of createdAt across the matching connection""" - createdAt: BigInt + """ + No related \`Downvote\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + none: DownvoteFilter + + """Aggregates across related \`Downvote\` match the filter criteria.""" + aggregates: DownvoteAggregatesFilter +} + +""" +A filter to be used against \`Downvote\` object types. All fields are combined with a logical ‘and.’ +""" +input DownvoteFilter { + """Filter by the object’s \`rowId\` field.""" + rowId: UUIDFilter + + """Filter by the object’s \`postId\` field.""" + postId: UUIDFilter + + """Filter by the object’s \`userId\` field.""" + userId: UUIDFilter + + """Filter by the object’s \`createdAt\` field.""" + createdAt: DatetimeFilter + + """Filter by the object’s \`updatedAt\` field.""" + updatedAt: DatetimeFilter + + """Filter by the object’s \`post\` relation.""" + post: PostFilter + + """Filter by the object’s \`user\` relation.""" + user: UserFilter + + """Checks for all expressions in this list.""" + and: [DownvoteFilter!] + + """Checks for any expressions in this list.""" + or: [DownvoteFilter!] + + """Negates the expression.""" + not: DownvoteFilter +} + +"""A filter to be used against aggregates of \`Downvote\` object types.""" +input DownvoteAggregatesFilter { + """ + A filter that must pass for the relevant \`Downvote\` object to be included within the aggregate. + """ + filter: DownvoteFilter + + """Distinct count aggregate over matching \`Downvote\` objects.""" + distinctCount: DownvoteDistinctCountAggregateFilter +} + +input DownvoteDistinctCountAggregateFilter { + rowId: BigIntFilter + postId: BigIntFilter + userId: BigIntFilter + createdAt: BigIntFilter + updatedAt: BigIntFilter +} + +""" +A filter to be used against many \`Comment\` object types. All fields are combined with a logical ‘and.’ +""" +input PostToManyCommentFilter { + """ + Every related \`Comment\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + every: CommentFilter + + """ + Some related \`Comment\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + some: CommentFilter + + """ + No related \`Comment\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + none: CommentFilter + + """Aggregates across related \`Comment\` match the filter criteria.""" + aggregates: CommentAggregatesFilter +} + +""" +A filter to be used against many \`Downvote\` object types. All fields are combined with a logical ‘and.’ +""" +input PostToManyDownvoteFilter { + """ + Every related \`Downvote\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + every: DownvoteFilter + + """ + Some related \`Downvote\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + some: DownvoteFilter + + """ + No related \`Downvote\` matches the filter criteria. All fields are combined with a logical ‘and.’ + """ + none: DownvoteFilter + + """Aggregates across related \`Downvote\` match the filter criteria.""" + aggregates: DownvoteAggregatesFilter +} + +"""A connection to a list of \`Upvote\` values.""" +type UpvoteConnection { + """A list of \`Upvote\` objects.""" + nodes: [Upvote]! + + """ + A list of edges which contains the \`Upvote\` and cursor to aid in pagination. + """ + edges: [UpvoteEdge]! + + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """The count of *all* \`Upvote\` you could get from the connection.""" + totalCount: Int! + + """ + Aggregates across the matching connection (ignoring before/after/first/last/offset) + """ + aggregates: UpvoteAggregates + + """ + Grouped aggregates across the matching connection (ignoring before/after/first/last/offset) + """ + groupedAggregates( + """The method to use when grouping \`Upvote\` for these aggregates.""" + groupBy: [UpvoteGroupBy!]! + + """Conditions on the grouped aggregates.""" + having: UpvoteHavingInput + ): [UpvoteAggregates!] +} + +type Upvote implements Node { + """ + A globally unique identifier. Can be used in various places throughout the system to identify this single value. + """ + id: ID! + rowId: UUID! + postId: UUID! + userId: UUID! + createdAt: Datetime + updatedAt: Datetime + + """Reads a single \`Post\` that is related to this \`Upvote\`.""" + post: Post + + """Reads a single \`User\` that is related to this \`Upvote\`.""" + user: User +} + +"""A \`Upvote\` edge in the connection.""" +type UpvoteEdge { + """A cursor for use in pagination.""" + cursor: Cursor + + """The \`Upvote\` at the end of the edge.""" + node: Upvote +} + +"""Information about pagination in a connection.""" +type PageInfo { + """When paginating forwards, are there more items?""" + hasNextPage: Boolean! + + """When paginating backwards, are there more items?""" + hasPreviousPage: Boolean! + + """When paginating backwards, the cursor to continue.""" + startCursor: Cursor + + """When paginating forwards, the cursor to continue.""" + endCursor: Cursor +} + +type UpvoteAggregates { + keys: [String] + + """ + Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) + """ + distinctCount: UpvoteDistinctCountAggregates +} + +type UpvoteDistinctCountAggregates { + """Distinct count of rowId across the matching connection""" + rowId: BigInt + + """Distinct count of postId across the matching connection""" + postId: BigInt + + """Distinct count of userId across the matching connection""" + userId: BigInt + + """Distinct count of createdAt across the matching connection""" + createdAt: BigInt """Distinct count of updatedAt across the matching connection""" updatedAt: BigInt @@ -5189,36 +6575,85 @@ input UserOrganizationCondition { createdAt: Datetime } -"""A \`Post\` edge in the connection.""" -type PostEdge { +"""A connection to a list of \`Comment\` values.""" +type CommentConnection { + """A list of \`Comment\` objects.""" + nodes: [Comment]! + + """ + A list of edges which contains the \`Comment\` and cursor to aid in pagination. + """ + edges: [CommentEdge]! + + """Information to aid in pagination.""" + pageInfo: PageInfo! + + """The count of *all* \`Comment\` you could get from the connection.""" + totalCount: Int! + + """ + Aggregates across the matching connection (ignoring before/after/first/last/offset) + """ + aggregates: CommentAggregates + + """ + Grouped aggregates across the matching connection (ignoring before/after/first/last/offset) + """ + groupedAggregates( + """The method to use when grouping \`Comment\` for these aggregates.""" + groupBy: [CommentGroupBy!]! + + """Conditions on the grouped aggregates.""" + having: CommentHavingInput + ): [CommentAggregates!] +} + +type Comment implements Node { + """ + A globally unique identifier. Can be used in various places throughout the system to identify this single value. + """ + id: ID! + rowId: UUID! + message: String + postId: UUID! + userId: UUID! + createdAt: Datetime + updatedAt: Datetime + + """Reads a single \`Post\` that is related to this \`Comment\`.""" + post: Post + + """Reads a single \`User\` that is related to this \`Comment\`.""" + user: User +} + +"""A \`Comment\` edge in the connection.""" +type CommentEdge { """A cursor for use in pagination.""" cursor: Cursor - """The \`Post\` at the end of the edge.""" - node: Post + """The \`Comment\` at the end of the edge.""" + node: Comment } -type PostAggregates { +type CommentAggregates { keys: [String] """ Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) """ - distinctCount: PostDistinctCountAggregates + distinctCount: CommentDistinctCountAggregates } -type PostDistinctCountAggregates { +type CommentDistinctCountAggregates { """Distinct count of rowId across the matching connection""" rowId: BigInt - """Distinct count of title across the matching connection""" - title: BigInt - - """Distinct count of description across the matching connection""" - description: BigInt + """Distinct count of message across the matching connection""" + message: BigInt - """Distinct count of projectId across the matching connection""" - projectId: BigInt + """Distinct count of postId across the matching connection""" + postId: BigInt """Distinct count of userId across the matching connection""" userId: BigInt @@ -5230,11 +6665,10 @@ type PostDistinctCountAggregates { updatedAt: BigInt } -"""Grouping methods for \`Post\` for usage during aggregation.""" -enum PostGroupBy { - TITLE - DESCRIPTION - PROJECT_ID +"""Grouping methods for \`Comment\` for usage during aggregation.""" +enum CommentGroupBy { + MESSAGE + POST_ID USER_ID CREATED_AT CREATED_AT_TRUNCATED_TO_HOUR @@ -5244,244 +6678,100 @@ enum PostGroupBy { UPDATED_AT_TRUNCATED_TO_DAY } -"""Conditions for \`Post\` aggregates.""" -input PostHavingInput { - AND: [PostHavingInput!] - OR: [PostHavingInput!] - sum: PostHavingSumInput - distinctCount: PostHavingDistinctCountInput - min: PostHavingMinInput - max: PostHavingMaxInput - average: PostHavingAverageInput - stddevSample: PostHavingStddevSampleInput - stddevPopulation: PostHavingStddevPopulationInput - varianceSample: PostHavingVarianceSampleInput - variancePopulation: PostHavingVariancePopulationInput +"""Conditions for \`Comment\` aggregates.""" +input CommentHavingInput { + AND: [CommentHavingInput!] + OR: [CommentHavingInput!] + sum: CommentHavingSumInput + distinctCount: CommentHavingDistinctCountInput + min: CommentHavingMinInput + max: CommentHavingMaxInput + average: CommentHavingAverageInput + stddevSample: CommentHavingStddevSampleInput + stddevPopulation: CommentHavingStddevPopulationInput + varianceSample: CommentHavingVarianceSampleInput + variancePopulation: CommentHavingVariancePopulationInput } -input PostHavingSumInput { +input CommentHavingSumInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input PostHavingDistinctCountInput { +input CommentHavingDistinctCountInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input PostHavingMinInput { +input CommentHavingMinInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input PostHavingMaxInput { +input CommentHavingMaxInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input PostHavingAverageInput { +input CommentHavingAverageInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input PostHavingStddevSampleInput { +input CommentHavingStddevSampleInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input PostHavingStddevPopulationInput { +input CommentHavingStddevPopulationInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input PostHavingVarianceSampleInput { +input CommentHavingVarianceSampleInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input PostHavingVariancePopulationInput { +input CommentHavingVariancePopulationInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -"""A \`Project\` edge in the connection.""" -type ProjectEdge { - """A cursor for use in pagination.""" - cursor: Cursor - - """The \`Project\` at the end of the edge.""" - node: Project -} - -type ProjectAggregates { - keys: [String] - - """ - Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) - """ - distinctCount: ProjectDistinctCountAggregates -} - -type ProjectDistinctCountAggregates { - """Distinct count of rowId across the matching connection""" - rowId: BigInt - - """Distinct count of name across the matching connection""" - name: BigInt - - """Distinct count of image across the matching connection""" - image: BigInt - - """Distinct count of slug across the matching connection""" - slug: BigInt - - """Distinct count of description across the matching connection""" - description: BigInt - - """Distinct count of organizationId across the matching connection""" - organizationId: BigInt - - """Distinct count of createdAt across the matching connection""" - createdAt: BigInt - - """Distinct count of updatedAt across the matching connection""" - updatedAt: BigInt -} - -"""Grouping methods for \`Project\` for usage during aggregation.""" -enum ProjectGroupBy { - IMAGE - SLUG - DESCRIPTION - ORGANIZATION_ID - CREATED_AT - CREATED_AT_TRUNCATED_TO_HOUR - CREATED_AT_TRUNCATED_TO_DAY - UPDATED_AT - UPDATED_AT_TRUNCATED_TO_HOUR - UPDATED_AT_TRUNCATED_TO_DAY -} - -"""Conditions for \`Project\` aggregates.""" -input ProjectHavingInput { - AND: [ProjectHavingInput!] - OR: [ProjectHavingInput!] - sum: ProjectHavingSumInput - distinctCount: ProjectHavingDistinctCountInput - min: ProjectHavingMinInput - max: ProjectHavingMaxInput - average: ProjectHavingAverageInput - stddevSample: ProjectHavingStddevSampleInput - stddevPopulation: ProjectHavingStddevPopulationInput - varianceSample: ProjectHavingVarianceSampleInput - variancePopulation: ProjectHavingVariancePopulationInput -} - -input ProjectHavingSumInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -input ProjectHavingDistinctCountInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -input ProjectHavingMinInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -input ProjectHavingMaxInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -input ProjectHavingAverageInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -input ProjectHavingStddevSampleInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -input ProjectHavingStddevPopulationInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -input ProjectHavingVarianceSampleInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -input ProjectHavingVariancePopulationInput { - createdAt: HavingDatetimeFilter - updatedAt: HavingDatetimeFilter -} - -"""Methods to use when ordering \`Project\`.""" -enum ProjectOrderBy { +"""Methods to use when ordering \`Comment\`.""" +enum CommentOrderBy { NATURAL PRIMARY_KEY_ASC PRIMARY_KEY_DESC ROW_ID_ASC ROW_ID_DESC - NAME_ASC - NAME_DESC - IMAGE_ASC - IMAGE_DESC - SLUG_ASC - SLUG_DESC - DESCRIPTION_ASC - DESCRIPTION_DESC - ORGANIZATION_ID_ASC - ORGANIZATION_ID_DESC + MESSAGE_ASC + MESSAGE_DESC + POST_ID_ASC + POST_ID_DESC + USER_ID_ASC + USER_ID_DESC CREATED_AT_ASC CREATED_AT_DESC UPDATED_AT_ASC UPDATED_AT_DESC - POSTS_COUNT_ASC - POSTS_COUNT_DESC - POSTS_DISTINCT_COUNT_ROW_ID_ASC - POSTS_DISTINCT_COUNT_ROW_ID_DESC - POSTS_DISTINCT_COUNT_TITLE_ASC - POSTS_DISTINCT_COUNT_TITLE_DESC - POSTS_DISTINCT_COUNT_DESCRIPTION_ASC - POSTS_DISTINCT_COUNT_DESCRIPTION_DESC - POSTS_DISTINCT_COUNT_PROJECT_ID_ASC - POSTS_DISTINCT_COUNT_PROJECT_ID_DESC - POSTS_DISTINCT_COUNT_USER_ID_ASC - POSTS_DISTINCT_COUNT_USER_ID_DESC - POSTS_DISTINCT_COUNT_CREATED_AT_ASC - POSTS_DISTINCT_COUNT_CREATED_AT_DESC - POSTS_DISTINCT_COUNT_UPDATED_AT_ASC - POSTS_DISTINCT_COUNT_UPDATED_AT_DESC } """ -A condition to be used against \`Project\` object types. All fields are tested for equality and combined with a logical ‘and.’ +A condition to be used against \`Comment\` object types. All fields are tested for equality and combined with a logical ‘and.’ """ -input ProjectCondition { +input CommentCondition { """Checks for equality with the object’s \`rowId\` field.""" rowId: UUID - """Checks for equality with the object’s \`name\` field.""" - name: String - - """Checks for equality with the object’s \`image\` field.""" - image: String - - """Checks for equality with the object’s \`slug\` field.""" - slug: String + """Checks for equality with the object’s \`message\` field.""" + message: String - """Checks for equality with the object’s \`description\` field.""" - description: String + """Checks for equality with the object’s \`postId\` field.""" + postId: UUID - """Checks for equality with the object’s \`organizationId\` field.""" - organizationId: UUID + """Checks for equality with the object’s \`userId\` field.""" + userId: UUID """Checks for equality with the object’s \`createdAt\` field.""" createdAt: Datetime @@ -5490,66 +6780,84 @@ input ProjectCondition { updatedAt: Datetime } -"""A connection to a list of \`Organization\` values.""" -type OrganizationConnection { - """A list of \`Organization\` objects.""" - nodes: [Organization]! +"""A connection to a list of \`Downvote\` values.""" +type DownvoteConnection { + """A list of \`Downvote\` objects.""" + nodes: [Downvote]! """ - A list of edges which contains the \`Organization\` and cursor to aid in pagination. + A list of edges which contains the \`Downvote\` and cursor to aid in pagination. """ - edges: [OrganizationEdge]! + edges: [DownvoteEdge]! """Information to aid in pagination.""" pageInfo: PageInfo! - """The count of *all* \`Organization\` you could get from the connection.""" + """The count of *all* \`Downvote\` you could get from the connection.""" totalCount: Int! """ Aggregates across the matching connection (ignoring before/after/first/last/offset) """ - aggregates: OrganizationAggregates + aggregates: DownvoteAggregates """ Grouped aggregates across the matching connection (ignoring before/after/first/last/offset) """ groupedAggregates( - """The method to use when grouping \`Organization\` for these aggregates.""" - groupBy: [OrganizationGroupBy!]! + """The method to use when grouping \`Downvote\` for these aggregates.""" + groupBy: [DownvoteGroupBy!]! """Conditions on the grouped aggregates.""" - having: OrganizationHavingInput - ): [OrganizationAggregates!] + having: DownvoteHavingInput + ): [DownvoteAggregates!] } -"""A \`Organization\` edge in the connection.""" -type OrganizationEdge { +type Downvote implements Node { + """ + A globally unique identifier. Can be used in various places throughout the system to identify this single value. + """ + id: ID! + rowId: UUID! + postId: UUID! + userId: UUID! + createdAt: Datetime + updatedAt: Datetime + + """Reads a single \`Post\` that is related to this \`Downvote\`.""" + post: Post + + """Reads a single \`User\` that is related to this \`Downvote\`.""" + user: User +} + +"""A \`Downvote\` edge in the connection.""" +type DownvoteEdge { """A cursor for use in pagination.""" cursor: Cursor - """The \`Organization\` at the end of the edge.""" - node: Organization + """The \`Downvote\` at the end of the edge.""" + node: Downvote } -type OrganizationAggregates { +type DownvoteAggregates { keys: [String] """ Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) """ - distinctCount: OrganizationDistinctCountAggregates + distinctCount: DownvoteDistinctCountAggregates } -type OrganizationDistinctCountAggregates { +type DownvoteDistinctCountAggregates { """Distinct count of rowId across the matching connection""" rowId: BigInt - """Distinct count of name across the matching connection""" - name: BigInt + """Distinct count of postId across the matching connection""" + postId: BigInt - """Distinct count of slug across the matching connection""" - slug: BigInt + """Distinct count of userId across the matching connection""" + userId: BigInt """Distinct count of createdAt across the matching connection""" createdAt: BigInt @@ -5558,8 +6866,10 @@ type OrganizationDistinctCountAggregates { updatedAt: BigInt } -"""Grouping methods for \`Organization\` for usage during aggregation.""" -enum OrganizationGroupBy { +"""Grouping methods for \`Downvote\` for usage during aggregation.""" +enum DownvoteGroupBy { + POST_ID + USER_ID CREATED_AT CREATED_AT_TRUNCATED_TO_HOUR CREATED_AT_TRUNCATED_TO_DAY @@ -5568,122 +6878,96 @@ enum OrganizationGroupBy { UPDATED_AT_TRUNCATED_TO_DAY } -"""Conditions for \`Organization\` aggregates.""" -input OrganizationHavingInput { - AND: [OrganizationHavingInput!] - OR: [OrganizationHavingInput!] - sum: OrganizationHavingSumInput - distinctCount: OrganizationHavingDistinctCountInput - min: OrganizationHavingMinInput - max: OrganizationHavingMaxInput - average: OrganizationHavingAverageInput - stddevSample: OrganizationHavingStddevSampleInput - stddevPopulation: OrganizationHavingStddevPopulationInput - varianceSample: OrganizationHavingVarianceSampleInput - variancePopulation: OrganizationHavingVariancePopulationInput +"""Conditions for \`Downvote\` aggregates.""" +input DownvoteHavingInput { + AND: [DownvoteHavingInput!] + OR: [DownvoteHavingInput!] + sum: DownvoteHavingSumInput + distinctCount: DownvoteHavingDistinctCountInput + min: DownvoteHavingMinInput + max: DownvoteHavingMaxInput + average: DownvoteHavingAverageInput + stddevSample: DownvoteHavingStddevSampleInput + stddevPopulation: DownvoteHavingStddevPopulationInput + varianceSample: DownvoteHavingVarianceSampleInput + variancePopulation: DownvoteHavingVariancePopulationInput } -input OrganizationHavingSumInput { +input DownvoteHavingSumInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input OrganizationHavingDistinctCountInput { +input DownvoteHavingDistinctCountInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input OrganizationHavingMinInput { +input DownvoteHavingMinInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input OrganizationHavingMaxInput { +input DownvoteHavingMaxInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input OrganizationHavingAverageInput { +input DownvoteHavingAverageInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input OrganizationHavingStddevSampleInput { +input DownvoteHavingStddevSampleInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input OrganizationHavingStddevPopulationInput { +input DownvoteHavingStddevPopulationInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input OrganizationHavingVarianceSampleInput { +input DownvoteHavingVarianceSampleInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input OrganizationHavingVariancePopulationInput { +input DownvoteHavingVariancePopulationInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -"""Methods to use when ordering \`Organization\`.""" -enum OrganizationOrderBy { +"""Methods to use when ordering \`Downvote\`.""" +enum DownvoteOrderBy { NATURAL PRIMARY_KEY_ASC PRIMARY_KEY_DESC ROW_ID_ASC ROW_ID_DESC - NAME_ASC - NAME_DESC - SLUG_ASC - SLUG_DESC + POST_ID_ASC + POST_ID_DESC + USER_ID_ASC + USER_ID_DESC CREATED_AT_ASC CREATED_AT_DESC UPDATED_AT_ASC UPDATED_AT_DESC - PROJECTS_COUNT_ASC - PROJECTS_COUNT_DESC - PROJECTS_DISTINCT_COUNT_ROW_ID_ASC - PROJECTS_DISTINCT_COUNT_ROW_ID_DESC - PROJECTS_DISTINCT_COUNT_NAME_ASC - PROJECTS_DISTINCT_COUNT_NAME_DESC - PROJECTS_DISTINCT_COUNT_IMAGE_ASC - PROJECTS_DISTINCT_COUNT_IMAGE_DESC - PROJECTS_DISTINCT_COUNT_SLUG_ASC - PROJECTS_DISTINCT_COUNT_SLUG_DESC - PROJECTS_DISTINCT_COUNT_DESCRIPTION_ASC - PROJECTS_DISTINCT_COUNT_DESCRIPTION_DESC - PROJECTS_DISTINCT_COUNT_ORGANIZATION_ID_ASC - PROJECTS_DISTINCT_COUNT_ORGANIZATION_ID_DESC - PROJECTS_DISTINCT_COUNT_CREATED_AT_ASC - PROJECTS_DISTINCT_COUNT_CREATED_AT_DESC - PROJECTS_DISTINCT_COUNT_UPDATED_AT_ASC - PROJECTS_DISTINCT_COUNT_UPDATED_AT_DESC - USER_ORGANIZATIONS_COUNT_ASC - USER_ORGANIZATIONS_COUNT_DESC - USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_ASC - USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_DESC - USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_ASC - USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_DESC - USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_ASC - USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_DESC } """ -A condition to be used against \`Organization\` object types. All fields are -tested for equality and combined with a logical ‘and.’ +A condition to be used against \`Downvote\` object types. All fields are tested +for equality and combined with a logical ‘and.’ """ -input OrganizationCondition { +input DownvoteCondition { """Checks for equality with the object’s \`rowId\` field.""" rowId: UUID - """Checks for equality with the object’s \`name\` field.""" - name: String + """Checks for equality with the object’s \`postId\` field.""" + postId: UUID - """Checks for equality with the object’s \`slug\` field.""" - slug: String + """Checks for equality with the object’s \`userId\` field.""" + userId: UUID """Checks for equality with the object’s \`createdAt\` field.""" createdAt: Datetime @@ -5692,171 +6976,260 @@ input OrganizationCondition { updatedAt: Datetime } -"""A connection to a list of \`User\` values.""" -type UserConnection { - """A list of \`User\` objects.""" - nodes: [User]! +"""A \`Post\` edge in the connection.""" +type PostEdge { + """A cursor for use in pagination.""" + cursor: Cursor + + """The \`Post\` at the end of the edge.""" + node: Post +} + +type PostAggregates { + keys: [String] """ - A list of edges which contains the \`User\` and cursor to aid in pagination. + Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) """ - edges: [UserEdge]! + distinctCount: PostDistinctCountAggregates +} - """Information to aid in pagination.""" - pageInfo: PageInfo! +type PostDistinctCountAggregates { + """Distinct count of rowId across the matching connection""" + rowId: BigInt - """The count of *all* \`User\` you could get from the connection.""" - totalCount: Int! + """Distinct count of title across the matching connection""" + title: BigInt - """ - Aggregates across the matching connection (ignoring before/after/first/last/offset) - """ - aggregates: UserAggregates + """Distinct count of description across the matching connection""" + description: BigInt - """ - Grouped aggregates across the matching connection (ignoring before/after/first/last/offset) - """ - groupedAggregates( - """The method to use when grouping \`User\` for these aggregates.""" - groupBy: [UserGroupBy!]! + """Distinct count of projectId across the matching connection""" + projectId: BigInt - """Conditions on the grouped aggregates.""" - having: UserHavingInput - ): [UserAggregates!] + """Distinct count of userId across the matching connection""" + userId: BigInt + + """Distinct count of createdAt across the matching connection""" + createdAt: BigInt + + """Distinct count of updatedAt across the matching connection""" + updatedAt: BigInt } -"""A \`User\` edge in the connection.""" -type UserEdge { +"""Grouping methods for \`Post\` for usage during aggregation.""" +enum PostGroupBy { + TITLE + DESCRIPTION + PROJECT_ID + USER_ID + CREATED_AT + CREATED_AT_TRUNCATED_TO_HOUR + CREATED_AT_TRUNCATED_TO_DAY + UPDATED_AT + UPDATED_AT_TRUNCATED_TO_HOUR + UPDATED_AT_TRUNCATED_TO_DAY +} + +"""Conditions for \`Post\` aggregates.""" +input PostHavingInput { + AND: [PostHavingInput!] + OR: [PostHavingInput!] + sum: PostHavingSumInput + distinctCount: PostHavingDistinctCountInput + min: PostHavingMinInput + max: PostHavingMaxInput + average: PostHavingAverageInput + stddevSample: PostHavingStddevSampleInput + stddevPopulation: PostHavingStddevPopulationInput + varianceSample: PostHavingVarianceSampleInput + variancePopulation: PostHavingVariancePopulationInput +} + +input PostHavingSumInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +input PostHavingDistinctCountInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +input PostHavingMinInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +input PostHavingMaxInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +input PostHavingAverageInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +input PostHavingStddevSampleInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +input PostHavingStddevPopulationInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +input PostHavingVarianceSampleInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +input PostHavingVariancePopulationInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} + +"""A \`Project\` edge in the connection.""" +type ProjectEdge { """A cursor for use in pagination.""" cursor: Cursor - """The \`User\` at the end of the edge.""" - node: User + """The \`Project\` at the end of the edge.""" + node: Project } -type UserAggregates { +type ProjectAggregates { keys: [String] """ Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) """ - distinctCount: UserDistinctCountAggregates + distinctCount: ProjectDistinctCountAggregates } -type UserDistinctCountAggregates { +type ProjectDistinctCountAggregates { """Distinct count of rowId across the matching connection""" rowId: BigInt - """Distinct count of createdAt across the matching connection""" - createdAt: BigInt + """Distinct count of name across the matching connection""" + name: BigInt - """Distinct count of updatedAt across the matching connection""" - updatedAt: BigInt + """Distinct count of image across the matching connection""" + image: BigInt - """Distinct count of hidraId across the matching connection""" - hidraId: BigInt + """Distinct count of slug across the matching connection""" + slug: BigInt - """Distinct count of username across the matching connection""" - username: BigInt + """Distinct count of description across the matching connection""" + description: BigInt - """Distinct count of firstName across the matching connection""" - firstName: BigInt + """Distinct count of organizationId across the matching connection""" + organizationId: BigInt - """Distinct count of lastName across the matching connection""" - lastName: BigInt + """Distinct count of createdAt across the matching connection""" + createdAt: BigInt + + """Distinct count of updatedAt across the matching connection""" + updatedAt: BigInt } -"""Grouping methods for \`User\` for usage during aggregation.""" -enum UserGroupBy { +"""Grouping methods for \`Project\` for usage during aggregation.""" +enum ProjectGroupBy { + IMAGE + SLUG + DESCRIPTION + ORGANIZATION_ID CREATED_AT CREATED_AT_TRUNCATED_TO_HOUR CREATED_AT_TRUNCATED_TO_DAY UPDATED_AT UPDATED_AT_TRUNCATED_TO_HOUR UPDATED_AT_TRUNCATED_TO_DAY - FIRST_NAME - LAST_NAME } -"""Conditions for \`User\` aggregates.""" -input UserHavingInput { - AND: [UserHavingInput!] - OR: [UserHavingInput!] - sum: UserHavingSumInput - distinctCount: UserHavingDistinctCountInput - min: UserHavingMinInput - max: UserHavingMaxInput - average: UserHavingAverageInput - stddevSample: UserHavingStddevSampleInput - stddevPopulation: UserHavingStddevPopulationInput - varianceSample: UserHavingVarianceSampleInput - variancePopulation: UserHavingVariancePopulationInput +"""Conditions for \`Project\` aggregates.""" +input ProjectHavingInput { + AND: [ProjectHavingInput!] + OR: [ProjectHavingInput!] + sum: ProjectHavingSumInput + distinctCount: ProjectHavingDistinctCountInput + min: ProjectHavingMinInput + max: ProjectHavingMaxInput + average: ProjectHavingAverageInput + stddevSample: ProjectHavingStddevSampleInput + stddevPopulation: ProjectHavingStddevPopulationInput + varianceSample: ProjectHavingVarianceSampleInput + variancePopulation: ProjectHavingVariancePopulationInput } -input UserHavingSumInput { +input ProjectHavingSumInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input UserHavingDistinctCountInput { +input ProjectHavingDistinctCountInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input UserHavingMinInput { +input ProjectHavingMinInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input UserHavingMaxInput { +input ProjectHavingMaxInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input UserHavingAverageInput { +input ProjectHavingAverageInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input UserHavingStddevSampleInput { +input ProjectHavingStddevSampleInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input UserHavingStddevPopulationInput { +input ProjectHavingStddevPopulationInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input UserHavingVarianceSampleInput { +input ProjectHavingVarianceSampleInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -input UserHavingVariancePopulationInput { +input ProjectHavingVariancePopulationInput { createdAt: HavingDatetimeFilter updatedAt: HavingDatetimeFilter } -"""Methods to use when ordering \`User\`.""" -enum UserOrderBy { +"""Methods to use when ordering \`Project\`.""" +enum ProjectOrderBy { NATURAL PRIMARY_KEY_ASC PRIMARY_KEY_DESC ROW_ID_ASC ROW_ID_DESC + NAME_ASC + NAME_DESC + IMAGE_ASC + IMAGE_DESC + SLUG_ASC + SLUG_DESC + DESCRIPTION_ASC + DESCRIPTION_DESC + ORGANIZATION_ID_ASC + ORGANIZATION_ID_DESC CREATED_AT_ASC CREATED_AT_DESC UPDATED_AT_ASC UPDATED_AT_DESC - HIDRA_ID_ASC - HIDRA_ID_DESC - USERNAME_ASC - USERNAME_DESC - FIRST_NAME_ASC - FIRST_NAME_DESC - LAST_NAME_ASC - LAST_NAME_DESC POSTS_COUNT_ASC POSTS_COUNT_DESC POSTS_DISTINCT_COUNT_ROW_ID_ASC @@ -5873,1163 +7246,1294 @@ enum UserOrderBy { POSTS_DISTINCT_COUNT_CREATED_AT_DESC POSTS_DISTINCT_COUNT_UPDATED_AT_ASC POSTS_DISTINCT_COUNT_UPDATED_AT_DESC - UPVOTES_COUNT_ASC - UPVOTES_COUNT_DESC - UPVOTES_DISTINCT_COUNT_ROW_ID_ASC - UPVOTES_DISTINCT_COUNT_ROW_ID_DESC - UPVOTES_DISTINCT_COUNT_POST_ID_ASC - UPVOTES_DISTINCT_COUNT_POST_ID_DESC - UPVOTES_DISTINCT_COUNT_USER_ID_ASC - UPVOTES_DISTINCT_COUNT_USER_ID_DESC - UPVOTES_DISTINCT_COUNT_CREATED_AT_ASC - UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC - UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC - UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC - USER_ORGANIZATIONS_COUNT_ASC - USER_ORGANIZATIONS_COUNT_DESC - USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_ASC - USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_DESC - USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_ASC - USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_DESC - USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_ASC - USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_DESC } """ -A condition to be used against \`User\` object types. All fields are tested for equality and combined with a logical ‘and.’ +A condition to be used against \`Project\` object types. All fields are tested for equality and combined with a logical ‘and.’ """ -input UserCondition { +input ProjectCondition { """Checks for equality with the object’s \`rowId\` field.""" rowId: UUID - """Checks for equality with the object’s \`createdAt\` field.""" - createdAt: Datetime + """Checks for equality with the object’s \`name\` field.""" + name: String - """Checks for equality with the object’s \`updatedAt\` field.""" - updatedAt: Datetime + """Checks for equality with the object’s \`image\` field.""" + image: String - """Checks for equality with the object’s \`hidraId\` field.""" - hidraId: UUID + """Checks for equality with the object’s \`slug\` field.""" + slug: String - """Checks for equality with the object’s \`username\` field.""" - username: String + """Checks for equality with the object’s \`description\` field.""" + description: String - """Checks for equality with the object’s \`firstName\` field.""" - firstName: String + """Checks for equality with the object’s \`organizationId\` field.""" + organizationId: UUID - """Checks for equality with the object’s \`lastName\` field.""" - lastName: String + """Checks for equality with the object’s \`createdAt\` field.""" + createdAt: Datetime + + """Checks for equality with the object’s \`updatedAt\` field.""" + updatedAt: Datetime } -""" -The root mutation type which contains root level fields which mutate data. -""" -type Mutation { - """Creates a single \`UserOrganization\`.""" - createUserOrganization( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: CreateUserOrganizationInput! - ): CreateUserOrganizationPayload +"""A connection to a list of \`Organization\` values.""" +type OrganizationConnection { + """A list of \`Organization\` objects.""" + nodes: [Organization]! - """Creates a single \`Upvote\`.""" - createUpvote( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: CreateUpvoteInput! - ): CreateUpvotePayload + """ + A list of edges which contains the \`Organization\` and cursor to aid in pagination. + """ + edges: [OrganizationEdge]! - """Creates a single \`Organization\`.""" - createOrganization( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: CreateOrganizationInput! - ): CreateOrganizationPayload + """Information to aid in pagination.""" + pageInfo: PageInfo! - """Creates a single \`Post\`.""" - createPost( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: CreatePostInput! - ): CreatePostPayload + """The count of *all* \`Organization\` you could get from the connection.""" + totalCount: Int! - """Creates a single \`User\`.""" - createUser( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: CreateUserInput! - ): CreateUserPayload + """ + Aggregates across the matching connection (ignoring before/after/first/last/offset) + """ + aggregates: OrganizationAggregates - """Creates a single \`Project\`.""" - createProject( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: CreateProjectInput! - ): CreateProjectPayload + """ + Grouped aggregates across the matching connection (ignoring before/after/first/last/offset) + """ + groupedAggregates( + """The method to use when grouping \`Organization\` for these aggregates.""" + groupBy: [OrganizationGroupBy!]! - """Updates a single \`UserOrganization\` using a unique key and a patch.""" - updateUserOrganizationByUserIdAndOrganizationId( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateUserOrganizationByUserIdAndOrganizationIdInput! - ): UpdateUserOrganizationPayload + """Conditions on the grouped aggregates.""" + having: OrganizationHavingInput + ): [OrganizationAggregates!] +} - """Updates a single \`Upvote\` using its globally unique id and a patch.""" - updateUpvoteById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateUpvoteByIdInput! - ): UpdateUpvotePayload +"""A \`Organization\` edge in the connection.""" +type OrganizationEdge { + """A cursor for use in pagination.""" + cursor: Cursor - """Updates a single \`Upvote\` using a unique key and a patch.""" - updateUpvote( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateUpvoteInput! - ): UpdateUpvotePayload + """The \`Organization\` at the end of the edge.""" + node: Organization +} - """Updates a single \`Upvote\` using a unique key and a patch.""" - updateUpvoteByPostIdAndUserId( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateUpvoteByPostIdAndUserIdInput! - ): UpdateUpvotePayload +type OrganizationAggregates { + keys: [String] """ - Updates a single \`Organization\` using its globally unique id and a patch. + Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) """ - updateOrganizationById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateOrganizationByIdInput! - ): UpdateOrganizationPayload - - """Updates a single \`Organization\` using a unique key and a patch.""" - updateOrganization( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateOrganizationInput! - ): UpdateOrganizationPayload - - """Updates a single \`Organization\` using a unique key and a patch.""" - updateOrganizationByName( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateOrganizationByNameInput! - ): UpdateOrganizationPayload + distinctCount: OrganizationDistinctCountAggregates +} - """Updates a single \`Organization\` using a unique key and a patch.""" - updateOrganizationBySlug( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateOrganizationBySlugInput! - ): UpdateOrganizationPayload +type OrganizationDistinctCountAggregates { + """Distinct count of rowId across the matching connection""" + rowId: BigInt - """Updates a single \`Post\` using its globally unique id and a patch.""" - updatePostById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdatePostByIdInput! - ): UpdatePostPayload + """Distinct count of name across the matching connection""" + name: BigInt - """Updates a single \`Post\` using a unique key and a patch.""" - updatePost( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdatePostInput! - ): UpdatePostPayload + """Distinct count of slug across the matching connection""" + slug: BigInt - """Updates a single \`User\` using its globally unique id and a patch.""" - updateUserById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateUserByIdInput! - ): UpdateUserPayload + """Distinct count of createdAt across the matching connection""" + createdAt: BigInt - """Updates a single \`User\` using a unique key and a patch.""" - updateUser( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateUserInput! - ): UpdateUserPayload + """Distinct count of updatedAt across the matching connection""" + updatedAt: BigInt +} - """Updates a single \`User\` using a unique key and a patch.""" - updateUserByHidraId( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateUserByHidraIdInput! - ): UpdateUserPayload +"""Grouping methods for \`Organization\` for usage during aggregation.""" +enum OrganizationGroupBy { + CREATED_AT + CREATED_AT_TRUNCATED_TO_HOUR + CREATED_AT_TRUNCATED_TO_DAY + UPDATED_AT + UPDATED_AT_TRUNCATED_TO_HOUR + UPDATED_AT_TRUNCATED_TO_DAY +} - """Updates a single \`User\` using a unique key and a patch.""" - updateUserByUsername( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateUserByUsernameInput! - ): UpdateUserPayload +"""Conditions for \`Organization\` aggregates.""" +input OrganizationHavingInput { + AND: [OrganizationHavingInput!] + OR: [OrganizationHavingInput!] + sum: OrganizationHavingSumInput + distinctCount: OrganizationHavingDistinctCountInput + min: OrganizationHavingMinInput + max: OrganizationHavingMaxInput + average: OrganizationHavingAverageInput + stddevSample: OrganizationHavingStddevSampleInput + stddevPopulation: OrganizationHavingStddevPopulationInput + varianceSample: OrganizationHavingVarianceSampleInput + variancePopulation: OrganizationHavingVariancePopulationInput +} - """Updates a single \`Project\` using its globally unique id and a patch.""" - updateProjectById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateProjectByIdInput! - ): UpdateProjectPayload +input OrganizationHavingSumInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Updates a single \`Project\` using a unique key and a patch.""" - updateProject( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateProjectInput! - ): UpdateProjectPayload +input OrganizationHavingDistinctCountInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Updates a single \`Project\` using a unique key and a patch.""" - updateProjectByName( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateProjectByNameInput! - ): UpdateProjectPayload +input OrganizationHavingMinInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Updates a single \`Project\` using a unique key and a patch.""" - updateProjectBySlugAndOrganizationId( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: UpdateProjectBySlugAndOrganizationIdInput! - ): UpdateProjectPayload +input OrganizationHavingMaxInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Deletes a single \`UserOrganization\` using a unique key.""" - deleteUserOrganizationByUserIdAndOrganizationId( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteUserOrganizationByUserIdAndOrganizationIdInput! - ): DeleteUserOrganizationPayload +input OrganizationHavingAverageInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Deletes a single \`Upvote\` using its globally unique id.""" - deleteUpvoteById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteUpvoteByIdInput! - ): DeleteUpvotePayload +input OrganizationHavingStddevSampleInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Deletes a single \`Upvote\` using a unique key.""" - deleteUpvote( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteUpvoteInput! - ): DeleteUpvotePayload +input OrganizationHavingStddevPopulationInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Deletes a single \`Upvote\` using a unique key.""" - deleteUpvoteByPostIdAndUserId( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteUpvoteByPostIdAndUserIdInput! - ): DeleteUpvotePayload +input OrganizationHavingVarianceSampleInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Deletes a single \`Organization\` using its globally unique id.""" - deleteOrganizationById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteOrganizationByIdInput! - ): DeleteOrganizationPayload +input OrganizationHavingVariancePopulationInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """Deletes a single \`Organization\` using a unique key.""" - deleteOrganization( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteOrganizationInput! - ): DeleteOrganizationPayload +"""Methods to use when ordering \`Organization\`.""" +enum OrganizationOrderBy { + NATURAL + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC + ROW_ID_ASC + ROW_ID_DESC + NAME_ASC + NAME_DESC + SLUG_ASC + SLUG_DESC + CREATED_AT_ASC + CREATED_AT_DESC + UPDATED_AT_ASC + UPDATED_AT_DESC + PROJECTS_COUNT_ASC + PROJECTS_COUNT_DESC + PROJECTS_DISTINCT_COUNT_ROW_ID_ASC + PROJECTS_DISTINCT_COUNT_ROW_ID_DESC + PROJECTS_DISTINCT_COUNT_NAME_ASC + PROJECTS_DISTINCT_COUNT_NAME_DESC + PROJECTS_DISTINCT_COUNT_IMAGE_ASC + PROJECTS_DISTINCT_COUNT_IMAGE_DESC + PROJECTS_DISTINCT_COUNT_SLUG_ASC + PROJECTS_DISTINCT_COUNT_SLUG_DESC + PROJECTS_DISTINCT_COUNT_DESCRIPTION_ASC + PROJECTS_DISTINCT_COUNT_DESCRIPTION_DESC + PROJECTS_DISTINCT_COUNT_ORGANIZATION_ID_ASC + PROJECTS_DISTINCT_COUNT_ORGANIZATION_ID_DESC + PROJECTS_DISTINCT_COUNT_CREATED_AT_ASC + PROJECTS_DISTINCT_COUNT_CREATED_AT_DESC + PROJECTS_DISTINCT_COUNT_UPDATED_AT_ASC + PROJECTS_DISTINCT_COUNT_UPDATED_AT_DESC + USER_ORGANIZATIONS_COUNT_ASC + USER_ORGANIZATIONS_COUNT_DESC + USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_ASC + USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_DESC + USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_ASC + USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_DESC + USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_ASC + USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_DESC +} - """Deletes a single \`Organization\` using a unique key.""" - deleteOrganizationByName( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteOrganizationByNameInput! - ): DeleteOrganizationPayload +""" +A condition to be used against \`Organization\` object types. All fields are +tested for equality and combined with a logical ‘and.’ +""" +input OrganizationCondition { + """Checks for equality with the object’s \`rowId\` field.""" + rowId: UUID - """Deletes a single \`Organization\` using a unique key.""" - deleteOrganizationBySlug( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteOrganizationBySlugInput! - ): DeleteOrganizationPayload + """Checks for equality with the object’s \`name\` field.""" + name: String - """Deletes a single \`Post\` using its globally unique id.""" - deletePostById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeletePostByIdInput! - ): DeletePostPayload + """Checks for equality with the object’s \`slug\` field.""" + slug: String - """Deletes a single \`Post\` using a unique key.""" - deletePost( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeletePostInput! - ): DeletePostPayload + """Checks for equality with the object’s \`createdAt\` field.""" + createdAt: Datetime - """Deletes a single \`User\` using its globally unique id.""" - deleteUserById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteUserByIdInput! - ): DeleteUserPayload + """Checks for equality with the object’s \`updatedAt\` field.""" + updatedAt: Datetime +} - """Deletes a single \`User\` using a unique key.""" - deleteUser( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteUserInput! - ): DeleteUserPayload +"""A connection to a list of \`User\` values.""" +type UserConnection { + """A list of \`User\` objects.""" + nodes: [User]! - """Deletes a single \`User\` using a unique key.""" - deleteUserByHidraId( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteUserByHidraIdInput! - ): DeleteUserPayload + """ + A list of edges which contains the \`User\` and cursor to aid in pagination. + """ + edges: [UserEdge]! - """Deletes a single \`User\` using a unique key.""" - deleteUserByUsername( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteUserByUsernameInput! - ): DeleteUserPayload + """Information to aid in pagination.""" + pageInfo: PageInfo! - """Deletes a single \`Project\` using its globally unique id.""" - deleteProjectById( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteProjectByIdInput! - ): DeleteProjectPayload - - """Deletes a single \`Project\` using a unique key.""" - deleteProject( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteProjectInput! - ): DeleteProjectPayload - - """Deletes a single \`Project\` using a unique key.""" - deleteProjectByName( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteProjectByNameInput! - ): DeleteProjectPayload - - """Deletes a single \`Project\` using a unique key.""" - deleteProjectBySlugAndOrganizationId( - """ - The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. - """ - input: DeleteProjectBySlugAndOrganizationIdInput! - ): DeleteProjectPayload -} - -"""The output of our create \`UserOrganization\` mutation.""" -type CreateUserOrganizationPayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String - - """The \`UserOrganization\` that was created by this mutation.""" - userOrganization: UserOrganization + """The count of *all* \`User\` you could get from the connection.""" + totalCount: Int! """ - Our root query field type. Allows us to run any query from our mutation payload. + Aggregates across the matching connection (ignoring before/after/first/last/offset) """ - query: Query -} + aggregates: UserAggregates -"""All input for the create \`UserOrganization\` mutation.""" -input CreateUserOrganizationInput { """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. + Grouped aggregates across the matching connection (ignoring before/after/first/last/offset) """ - clientMutationId: String + groupedAggregates( + """The method to use when grouping \`User\` for these aggregates.""" + groupBy: [UserGroupBy!]! - """The \`UserOrganization\` to be created by this mutation.""" - userOrganization: UserOrganizationInput! + """Conditions on the grouped aggregates.""" + having: UserHavingInput + ): [UserAggregates!] } -"""An input for mutations affecting \`UserOrganization\`""" -input UserOrganizationInput { - userId: UUID! - organizationId: UUID! - createdAt: Datetime -} +"""A \`User\` edge in the connection.""" +type UserEdge { + """A cursor for use in pagination.""" + cursor: Cursor -"""The output of our create \`Upvote\` mutation.""" -type CreateUpvotePayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String + """The \`User\` at the end of the edge.""" + node: User +} - """The \`Upvote\` that was created by this mutation.""" - upvote: Upvote +type UserAggregates { + keys: [String] """ - Our root query field type. Allows us to run any query from our mutation payload. + Distinct count aggregates across the matching connection (ignoring before/after/first/last/offset) """ - query: Query - - """An edge for our \`Upvote\`. May be used by Relay 1.""" - upvoteEdge( - """The method to use when ordering \`Upvote\`.""" - orderBy: [UpvoteOrderBy!]! = [PRIMARY_KEY_ASC] - ): UpvoteEdge + distinctCount: UserDistinctCountAggregates } -"""All input for the create \`Upvote\` mutation.""" -input CreateUpvoteInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String +type UserDistinctCountAggregates { + """Distinct count of rowId across the matching connection""" + rowId: BigInt - """The \`Upvote\` to be created by this mutation.""" - upvote: UpvoteInput! -} + """Distinct count of createdAt across the matching connection""" + createdAt: BigInt -"""An input for mutations affecting \`Upvote\`""" -input UpvoteInput { - rowId: UUID - postId: UUID! - userId: UUID! - createdAt: Datetime - updatedAt: Datetime -} + """Distinct count of updatedAt across the matching connection""" + updatedAt: BigInt -"""The output of our create \`Organization\` mutation.""" -type CreateOrganizationPayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String + """Distinct count of hidraId across the matching connection""" + hidraId: BigInt - """The \`Organization\` that was created by this mutation.""" - organization: Organization + """Distinct count of username across the matching connection""" + username: BigInt - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query + """Distinct count of firstName across the matching connection""" + firstName: BigInt - """An edge for our \`Organization\`. May be used by Relay 1.""" - organizationEdge( - """The method to use when ordering \`Organization\`.""" - orderBy: [OrganizationOrderBy!]! = [PRIMARY_KEY_ASC] - ): OrganizationEdge + """Distinct count of lastName across the matching connection""" + lastName: BigInt } -"""All input for the create \`Organization\` mutation.""" -input CreateOrganizationInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - - """The \`Organization\` to be created by this mutation.""" - organization: OrganizationInput! +"""Grouping methods for \`User\` for usage during aggregation.""" +enum UserGroupBy { + CREATED_AT + CREATED_AT_TRUNCATED_TO_HOUR + CREATED_AT_TRUNCATED_TO_DAY + UPDATED_AT + UPDATED_AT_TRUNCATED_TO_HOUR + UPDATED_AT_TRUNCATED_TO_DAY + FIRST_NAME + LAST_NAME } -"""An input for mutations affecting \`Organization\`""" -input OrganizationInput { - rowId: UUID - name: String - slug: String - createdAt: Datetime - updatedAt: Datetime +"""Conditions for \`User\` aggregates.""" +input UserHavingInput { + AND: [UserHavingInput!] + OR: [UserHavingInput!] + sum: UserHavingSumInput + distinctCount: UserHavingDistinctCountInput + min: UserHavingMinInput + max: UserHavingMaxInput + average: UserHavingAverageInput + stddevSample: UserHavingStddevSampleInput + stddevPopulation: UserHavingStddevPopulationInput + varianceSample: UserHavingVarianceSampleInput + variancePopulation: UserHavingVariancePopulationInput } -"""The output of our create \`Post\` mutation.""" -type CreatePostPayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String +input UserHavingSumInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """The \`Post\` that was created by this mutation.""" - post: Post +input UserHavingDistinctCountInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query +input UserHavingMinInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """An edge for our \`Post\`. May be used by Relay 1.""" - postEdge( - """The method to use when ordering \`Post\`.""" - orderBy: [PostOrderBy!]! = [PRIMARY_KEY_ASC] - ): PostEdge +input UserHavingMaxInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter } -"""All input for the create \`Post\` mutation.""" -input CreatePostInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String +input UserHavingAverageInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """The \`Post\` to be created by this mutation.""" - post: PostInput! +input UserHavingStddevSampleInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter } -"""An input for mutations affecting \`Post\`""" -input PostInput { - rowId: UUID - title: String - description: String - projectId: UUID! - userId: UUID! - createdAt: Datetime - updatedAt: Datetime +input UserHavingStddevPopulationInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter } -"""The output of our create \`User\` mutation.""" -type CreateUserPayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String +input UserHavingVarianceSampleInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter +} - """The \`User\` that was created by this mutation.""" - user: User - - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query - - """An edge for our \`User\`. May be used by Relay 1.""" - userEdge( - """The method to use when ordering \`User\`.""" - orderBy: [UserOrderBy!]! = [PRIMARY_KEY_ASC] - ): UserEdge +input UserHavingVariancePopulationInput { + createdAt: HavingDatetimeFilter + updatedAt: HavingDatetimeFilter } -"""All input for the create \`User\` mutation.""" -input CreateUserInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - - """The \`User\` to be created by this mutation.""" - user: UserInput! +"""Methods to use when ordering \`User\`.""" +enum UserOrderBy { + NATURAL + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC + ROW_ID_ASC + ROW_ID_DESC + CREATED_AT_ASC + CREATED_AT_DESC + UPDATED_AT_ASC + UPDATED_AT_DESC + HIDRA_ID_ASC + HIDRA_ID_DESC + USERNAME_ASC + USERNAME_DESC + FIRST_NAME_ASC + FIRST_NAME_DESC + LAST_NAME_ASC + LAST_NAME_DESC + POSTS_COUNT_ASC + POSTS_COUNT_DESC + POSTS_DISTINCT_COUNT_ROW_ID_ASC + POSTS_DISTINCT_COUNT_ROW_ID_DESC + POSTS_DISTINCT_COUNT_TITLE_ASC + POSTS_DISTINCT_COUNT_TITLE_DESC + POSTS_DISTINCT_COUNT_DESCRIPTION_ASC + POSTS_DISTINCT_COUNT_DESCRIPTION_DESC + POSTS_DISTINCT_COUNT_PROJECT_ID_ASC + POSTS_DISTINCT_COUNT_PROJECT_ID_DESC + POSTS_DISTINCT_COUNT_USER_ID_ASC + POSTS_DISTINCT_COUNT_USER_ID_DESC + POSTS_DISTINCT_COUNT_CREATED_AT_ASC + POSTS_DISTINCT_COUNT_CREATED_AT_DESC + POSTS_DISTINCT_COUNT_UPDATED_AT_ASC + POSTS_DISTINCT_COUNT_UPDATED_AT_DESC + UPVOTES_COUNT_ASC + UPVOTES_COUNT_DESC + UPVOTES_DISTINCT_COUNT_ROW_ID_ASC + UPVOTES_DISTINCT_COUNT_ROW_ID_DESC + UPVOTES_DISTINCT_COUNT_POST_ID_ASC + UPVOTES_DISTINCT_COUNT_POST_ID_DESC + UPVOTES_DISTINCT_COUNT_USER_ID_ASC + UPVOTES_DISTINCT_COUNT_USER_ID_DESC + UPVOTES_DISTINCT_COUNT_CREATED_AT_ASC + UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC + UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC + UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC + USER_ORGANIZATIONS_COUNT_ASC + USER_ORGANIZATIONS_COUNT_DESC + USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_ASC + USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_DESC + USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_ASC + USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_DESC + USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_ASC + USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_DESC + COMMENTS_COUNT_ASC + COMMENTS_COUNT_DESC + COMMENTS_DISTINCT_COUNT_ROW_ID_ASC + COMMENTS_DISTINCT_COUNT_ROW_ID_DESC + COMMENTS_DISTINCT_COUNT_MESSAGE_ASC + COMMENTS_DISTINCT_COUNT_MESSAGE_DESC + COMMENTS_DISTINCT_COUNT_POST_ID_ASC + COMMENTS_DISTINCT_COUNT_POST_ID_DESC + COMMENTS_DISTINCT_COUNT_USER_ID_ASC + COMMENTS_DISTINCT_COUNT_USER_ID_DESC + COMMENTS_DISTINCT_COUNT_CREATED_AT_ASC + COMMENTS_DISTINCT_COUNT_CREATED_AT_DESC + COMMENTS_DISTINCT_COUNT_UPDATED_AT_ASC + COMMENTS_DISTINCT_COUNT_UPDATED_AT_DESC + DOWNVOTES_COUNT_ASC + DOWNVOTES_COUNT_DESC + DOWNVOTES_DISTINCT_COUNT_ROW_ID_ASC + DOWNVOTES_DISTINCT_COUNT_ROW_ID_DESC + DOWNVOTES_DISTINCT_COUNT_POST_ID_ASC + DOWNVOTES_DISTINCT_COUNT_POST_ID_DESC + DOWNVOTES_DISTINCT_COUNT_USER_ID_ASC + DOWNVOTES_DISTINCT_COUNT_USER_ID_DESC + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_ASC + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_DESC + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_ASC + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_DESC } -"""An input for mutations affecting \`User\`""" -input UserInput { +""" +A condition to be used against \`User\` object types. All fields are tested for equality and combined with a logical ‘and.’ +""" +input UserCondition { + """Checks for equality with the object’s \`rowId\` field.""" rowId: UUID + + """Checks for equality with the object’s \`createdAt\` field.""" createdAt: Datetime + + """Checks for equality with the object’s \`updatedAt\` field.""" updatedAt: Datetime - hidraId: UUID! + + """Checks for equality with the object’s \`hidraId\` field.""" + hidraId: UUID + + """Checks for equality with the object’s \`username\` field.""" username: String + + """Checks for equality with the object’s \`firstName\` field.""" firstName: String + + """Checks for equality with the object’s \`lastName\` field.""" lastName: String } -"""The output of our create \`Project\` mutation.""" -type CreateProjectPayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String +""" +The root mutation type which contains root level fields which mutate data. +""" +type Mutation { + """Creates a single \`UserOrganization\`.""" + createUserOrganization( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateUserOrganizationInput! + ): CreateUserOrganizationPayload - """The \`Project\` that was created by this mutation.""" - project: Project + """Creates a single \`Downvote\`.""" + createDownvote( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateDownvoteInput! + ): CreateDownvotePayload - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query + """Creates a single \`Upvote\`.""" + createUpvote( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateUpvoteInput! + ): CreateUpvotePayload - """An edge for our \`Project\`. May be used by Relay 1.""" - projectEdge( - """The method to use when ordering \`Project\`.""" - orderBy: [ProjectOrderBy!]! = [PRIMARY_KEY_ASC] - ): ProjectEdge -} + """Creates a single \`Organization\`.""" + createOrganization( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateOrganizationInput! + ): CreateOrganizationPayload -"""All input for the create \`Project\` mutation.""" -input CreateProjectInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String + """Creates a single \`Comment\`.""" + createComment( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateCommentInput! + ): CreateCommentPayload - """The \`Project\` to be created by this mutation.""" - project: ProjectInput! -} + """Creates a single \`Post\`.""" + createPost( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreatePostInput! + ): CreatePostPayload -"""An input for mutations affecting \`Project\`""" -input ProjectInput { - rowId: UUID - name: String - image: String - slug: String - description: String - organizationId: UUID! - createdAt: Datetime - updatedAt: Datetime -} + """Creates a single \`User\`.""" + createUser( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateUserInput! + ): CreateUserPayload -"""The output of our update \`UserOrganization\` mutation.""" -type UpdateUserOrganizationPayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String + """Creates a single \`Project\`.""" + createProject( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: CreateProjectInput! + ): CreateProjectPayload - """The \`UserOrganization\` that was updated by this mutation.""" - userOrganization: UserOrganization + """Updates a single \`UserOrganization\` using a unique key and a patch.""" + updateUserOrganizationByUserIdAndOrganizationId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateUserOrganizationByUserIdAndOrganizationIdInput! + ): UpdateUserOrganizationPayload - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query -} + """Updates a single \`Downvote\` using its globally unique id and a patch.""" + updateDownvoteById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateDownvoteByIdInput! + ): UpdateDownvotePayload -""" -All input for the \`updateUserOrganizationByUserIdAndOrganizationId\` mutation. -""" -input UpdateUserOrganizationByUserIdAndOrganizationIdInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - userId: UUID! - organizationId: UUID! + """Updates a single \`Downvote\` using a unique key and a patch.""" + updateDownvote( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateDownvoteInput! + ): UpdateDownvotePayload - """ - An object where the defined keys will be set on the \`UserOrganization\` being updated. - """ - patch: UserOrganizationPatch! -} + """Updates a single \`Downvote\` using a unique key and a patch.""" + updateDownvoteByPostIdAndUserId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateDownvoteByPostIdAndUserIdInput! + ): UpdateDownvotePayload -""" -Represents an update to a \`UserOrganization\`. Fields that are set will be updated. -""" -input UserOrganizationPatch { - userId: UUID - organizationId: UUID - createdAt: Datetime -} + """Updates a single \`Upvote\` using its globally unique id and a patch.""" + updateUpvoteById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateUpvoteByIdInput! + ): UpdateUpvotePayload -"""The output of our update \`Upvote\` mutation.""" -type UpdateUpvotePayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String + """Updates a single \`Upvote\` using a unique key and a patch.""" + updateUpvote( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateUpvoteInput! + ): UpdateUpvotePayload - """The \`Upvote\` that was updated by this mutation.""" - upvote: Upvote + """Updates a single \`Upvote\` using a unique key and a patch.""" + updateUpvoteByPostIdAndUserId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateUpvoteByPostIdAndUserIdInput! + ): UpdateUpvotePayload """ - Our root query field type. Allows us to run any query from our mutation payload. + Updates a single \`Organization\` using its globally unique id and a patch. """ - query: Query + updateOrganizationById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateOrganizationByIdInput! + ): UpdateOrganizationPayload - """An edge for our \`Upvote\`. May be used by Relay 1.""" - upvoteEdge( - """The method to use when ordering \`Upvote\`.""" - orderBy: [UpvoteOrderBy!]! = [PRIMARY_KEY_ASC] - ): UpvoteEdge -} + """Updates a single \`Organization\` using a unique key and a patch.""" + updateOrganization( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateOrganizationInput! + ): UpdateOrganizationPayload -"""All input for the \`updateUpvoteById\` mutation.""" -input UpdateUpvoteByIdInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String + """Updates a single \`Organization\` using a unique key and a patch.""" + updateOrganizationByName( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateOrganizationByNameInput! + ): UpdateOrganizationPayload - """ - The globally unique \`ID\` which will identify a single \`Upvote\` to be updated. - """ - id: ID! + """Updates a single \`Organization\` using a unique key and a patch.""" + updateOrganizationBySlug( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateOrganizationBySlugInput! + ): UpdateOrganizationPayload - """ - An object where the defined keys will be set on the \`Upvote\` being updated. - """ - patch: UpvotePatch! -} + """Updates a single \`Comment\` using its globally unique id and a patch.""" + updateCommentById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateCommentByIdInput! + ): UpdateCommentPayload -""" -Represents an update to a \`Upvote\`. Fields that are set will be updated. -""" -input UpvotePatch { - rowId: UUID - postId: UUID - userId: UUID - createdAt: Datetime - updatedAt: Datetime -} + """Updates a single \`Comment\` using a unique key and a patch.""" + updateComment( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateCommentInput! + ): UpdateCommentPayload -"""All input for the \`updateUpvote\` mutation.""" -input UpdateUpvoteInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - rowId: UUID! + """Updates a single \`Post\` using its globally unique id and a patch.""" + updatePostById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdatePostByIdInput! + ): UpdatePostPayload - """ - An object where the defined keys will be set on the \`Upvote\` being updated. - """ - patch: UpvotePatch! -} + """Updates a single \`Post\` using a unique key and a patch.""" + updatePost( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdatePostInput! + ): UpdatePostPayload -"""All input for the \`updateUpvoteByPostIdAndUserId\` mutation.""" -input UpdateUpvoteByPostIdAndUserIdInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - postId: UUID! - userId: UUID! + """Updates a single \`User\` using its globally unique id and a patch.""" + updateUserById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateUserByIdInput! + ): UpdateUserPayload - """ - An object where the defined keys will be set on the \`Upvote\` being updated. - """ - patch: UpvotePatch! -} + """Updates a single \`User\` using a unique key and a patch.""" + updateUser( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateUserInput! + ): UpdateUserPayload -"""The output of our update \`Organization\` mutation.""" -type UpdateOrganizationPayload { - """ - The exact same \`clientMutationId\` that was provided in the mutation input, - unchanged and unused. May be used by a client to track mutations. - """ - clientMutationId: String + """Updates a single \`User\` using a unique key and a patch.""" + updateUserByHidraId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateUserByHidraIdInput! + ): UpdateUserPayload - """The \`Organization\` that was updated by this mutation.""" - organization: Organization + """Updates a single \`User\` using a unique key and a patch.""" + updateUserByUsername( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateUserByUsernameInput! + ): UpdateUserPayload - """ - Our root query field type. Allows us to run any query from our mutation payload. - """ - query: Query + """Updates a single \`Project\` using its globally unique id and a patch.""" + updateProjectById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateProjectByIdInput! + ): UpdateProjectPayload - """An edge for our \`Organization\`. May be used by Relay 1.""" - organizationEdge( - """The method to use when ordering \`Organization\`.""" - orderBy: [OrganizationOrderBy!]! = [PRIMARY_KEY_ASC] - ): OrganizationEdge -} + """Updates a single \`Project\` using a unique key and a patch.""" + updateProject( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateProjectInput! + ): UpdateProjectPayload -"""All input for the \`updateOrganizationById\` mutation.""" -input UpdateOrganizationByIdInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String + """Updates a single \`Project\` using a unique key and a patch.""" + updateProjectByName( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateProjectByNameInput! + ): UpdateProjectPayload - """ - The globally unique \`ID\` which will identify a single \`Organization\` to be updated. - """ - id: ID! + """Updates a single \`Project\` using a unique key and a patch.""" + updateProjectBySlugAndOrganizationId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: UpdateProjectBySlugAndOrganizationIdInput! + ): UpdateProjectPayload - """ - An object where the defined keys will be set on the \`Organization\` being updated. - """ - patch: OrganizationPatch! -} + """Deletes a single \`UserOrganization\` using a unique key.""" + deleteUserOrganizationByUserIdAndOrganizationId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteUserOrganizationByUserIdAndOrganizationIdInput! + ): DeleteUserOrganizationPayload -""" -Represents an update to a \`Organization\`. Fields that are set will be updated. -""" -input OrganizationPatch { - rowId: UUID - name: String - slug: String - createdAt: Datetime - updatedAt: Datetime -} + """Deletes a single \`Downvote\` using its globally unique id.""" + deleteDownvoteById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteDownvoteByIdInput! + ): DeleteDownvotePayload -"""All input for the \`updateOrganization\` mutation.""" -input UpdateOrganizationInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - rowId: UUID! + """Deletes a single \`Downvote\` using a unique key.""" + deleteDownvote( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteDownvoteInput! + ): DeleteDownvotePayload - """ - An object where the defined keys will be set on the \`Organization\` being updated. - """ - patch: OrganizationPatch! + """Deletes a single \`Downvote\` using a unique key.""" + deleteDownvoteByPostIdAndUserId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteDownvoteByPostIdAndUserIdInput! + ): DeleteDownvotePayload + + """Deletes a single \`Upvote\` using its globally unique id.""" + deleteUpvoteById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteUpvoteByIdInput! + ): DeleteUpvotePayload + + """Deletes a single \`Upvote\` using a unique key.""" + deleteUpvote( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteUpvoteInput! + ): DeleteUpvotePayload + + """Deletes a single \`Upvote\` using a unique key.""" + deleteUpvoteByPostIdAndUserId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteUpvoteByPostIdAndUserIdInput! + ): DeleteUpvotePayload + + """Deletes a single \`Organization\` using its globally unique id.""" + deleteOrganizationById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteOrganizationByIdInput! + ): DeleteOrganizationPayload + + """Deletes a single \`Organization\` using a unique key.""" + deleteOrganization( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteOrganizationInput! + ): DeleteOrganizationPayload + + """Deletes a single \`Organization\` using a unique key.""" + deleteOrganizationByName( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteOrganizationByNameInput! + ): DeleteOrganizationPayload + + """Deletes a single \`Organization\` using a unique key.""" + deleteOrganizationBySlug( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteOrganizationBySlugInput! + ): DeleteOrganizationPayload + + """Deletes a single \`Comment\` using its globally unique id.""" + deleteCommentById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteCommentByIdInput! + ): DeleteCommentPayload + + """Deletes a single \`Comment\` using a unique key.""" + deleteComment( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteCommentInput! + ): DeleteCommentPayload + + """Deletes a single \`Post\` using its globally unique id.""" + deletePostById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeletePostByIdInput! + ): DeletePostPayload + + """Deletes a single \`Post\` using a unique key.""" + deletePost( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeletePostInput! + ): DeletePostPayload + + """Deletes a single \`User\` using its globally unique id.""" + deleteUserById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteUserByIdInput! + ): DeleteUserPayload + + """Deletes a single \`User\` using a unique key.""" + deleteUser( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteUserInput! + ): DeleteUserPayload + + """Deletes a single \`User\` using a unique key.""" + deleteUserByHidraId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteUserByHidraIdInput! + ): DeleteUserPayload + + """Deletes a single \`User\` using a unique key.""" + deleteUserByUsername( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteUserByUsernameInput! + ): DeleteUserPayload + + """Deletes a single \`Project\` using its globally unique id.""" + deleteProjectById( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteProjectByIdInput! + ): DeleteProjectPayload + + """Deletes a single \`Project\` using a unique key.""" + deleteProject( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteProjectInput! + ): DeleteProjectPayload + + """Deletes a single \`Project\` using a unique key.""" + deleteProjectByName( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteProjectByNameInput! + ): DeleteProjectPayload + + """Deletes a single \`Project\` using a unique key.""" + deleteProjectBySlugAndOrganizationId( + """ + The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields. + """ + input: DeleteProjectBySlugAndOrganizationIdInput! + ): DeleteProjectPayload } -"""All input for the \`updateOrganizationByName\` mutation.""" -input UpdateOrganizationByNameInput { +"""The output of our create \`UserOrganization\` mutation.""" +type CreateUserOrganizationPayload { """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - name: String! + + """The \`UserOrganization\` that was created by this mutation.""" + userOrganization: UserOrganization """ - An object where the defined keys will be set on the \`Organization\` being updated. + Our root query field type. Allows us to run any query from our mutation payload. """ - patch: OrganizationPatch! + query: Query } -"""All input for the \`updateOrganizationBySlug\` mutation.""" -input UpdateOrganizationBySlugInput { +"""All input for the create \`UserOrganization\` mutation.""" +input CreateUserOrganizationInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - slug: String! - """ - An object where the defined keys will be set on the \`Organization\` being updated. - """ - patch: OrganizationPatch! + """The \`UserOrganization\` to be created by this mutation.""" + userOrganization: UserOrganizationInput! } -"""The output of our update \`Post\` mutation.""" -type UpdatePostPayload { +"""An input for mutations affecting \`UserOrganization\`""" +input UserOrganizationInput { + userId: UUID! + organizationId: UUID! + createdAt: Datetime +} + +"""The output of our create \`Downvote\` mutation.""" +type CreateDownvotePayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`Post\` that was updated by this mutation.""" - post: Post + """The \`Downvote\` that was created by this mutation.""" + downvote: Downvote """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our \`Post\`. May be used by Relay 1.""" - postEdge( - """The method to use when ordering \`Post\`.""" - orderBy: [PostOrderBy!]! = [PRIMARY_KEY_ASC] - ): PostEdge + """An edge for our \`Downvote\`. May be used by Relay 1.""" + downvoteEdge( + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!]! = [PRIMARY_KEY_ASC] + ): DownvoteEdge } -"""All input for the \`updatePostById\` mutation.""" -input UpdatePostByIdInput { +"""All input for the create \`Downvote\` mutation.""" +input CreateDownvoteInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - """ - The globally unique \`ID\` which will identify a single \`Post\` to be updated. - """ - id: ID! - - """ - An object where the defined keys will be set on the \`Post\` being updated. - """ - patch: PostPatch! + """The \`Downvote\` to be created by this mutation.""" + downvote: DownvoteInput! } -"""Represents an update to a \`Post\`. Fields that are set will be updated.""" -input PostPatch { +"""An input for mutations affecting \`Downvote\`""" +input DownvoteInput { rowId: UUID - title: String - description: String - projectId: UUID - userId: UUID + postId: UUID! + userId: UUID! createdAt: Datetime updatedAt: Datetime } -"""All input for the \`updatePost\` mutation.""" -input UpdatePostInput { - """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. - """ - clientMutationId: String - rowId: UUID! - - """ - An object where the defined keys will be set on the \`Post\` being updated. - """ - patch: PostPatch! -} - -"""The output of our update \`User\` mutation.""" -type UpdateUserPayload { +"""The output of our create \`Upvote\` mutation.""" +type CreateUpvotePayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`User\` that was updated by this mutation.""" - user: User + """The \`Upvote\` that was created by this mutation.""" + upvote: Upvote """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our \`User\`. May be used by Relay 1.""" - userEdge( - """The method to use when ordering \`User\`.""" - orderBy: [UserOrderBy!]! = [PRIMARY_KEY_ASC] - ): UserEdge + """An edge for our \`Upvote\`. May be used by Relay 1.""" + upvoteEdge( + """The method to use when ordering \`Upvote\`.""" + orderBy: [UpvoteOrderBy!]! = [PRIMARY_KEY_ASC] + ): UpvoteEdge } -"""All input for the \`updateUserById\` mutation.""" -input UpdateUserByIdInput { +"""All input for the create \`Upvote\` mutation.""" +input CreateUpvoteInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - """ - The globally unique \`ID\` which will identify a single \`User\` to be updated. - """ - id: ID! + """The \`Upvote\` to be created by this mutation.""" + upvote: UpvoteInput! +} - """ - An object where the defined keys will be set on the \`User\` being updated. - """ - patch: UserPatch! -} - -"""Represents an update to a \`User\`. Fields that are set will be updated.""" -input UserPatch { +"""An input for mutations affecting \`Upvote\`""" +input UpvoteInput { rowId: UUID + postId: UUID! + userId: UUID! createdAt: Datetime updatedAt: Datetime - hidraId: UUID - username: String - firstName: String - lastName: String } -"""All input for the \`updateUser\` mutation.""" -input UpdateUserInput { +"""The output of our create \`Organization\` mutation.""" +type CreateOrganizationPayload { """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - rowId: UUID! + + """The \`Organization\` that was created by this mutation.""" + organization: Organization """ - An object where the defined keys will be set on the \`User\` being updated. + Our root query field type. Allows us to run any query from our mutation payload. """ - patch: UserPatch! + query: Query + + """An edge for our \`Organization\`. May be used by Relay 1.""" + organizationEdge( + """The method to use when ordering \`Organization\`.""" + orderBy: [OrganizationOrderBy!]! = [PRIMARY_KEY_ASC] + ): OrganizationEdge } -"""All input for the \`updateUserByHidraId\` mutation.""" -input UpdateUserByHidraIdInput { +"""All input for the create \`Organization\` mutation.""" +input CreateOrganizationInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - hidraId: UUID! + """The \`Organization\` to be created by this mutation.""" + organization: OrganizationInput! +} + +"""An input for mutations affecting \`Organization\`""" +input OrganizationInput { + rowId: UUID + name: String + slug: String + createdAt: Datetime + updatedAt: Datetime +} + +"""The output of our create \`Comment\` mutation.""" +type CreateCommentPayload { """ - An object where the defined keys will be set on the \`User\` being updated. + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. """ - patch: UserPatch! + clientMutationId: String + + """The \`Comment\` that was created by this mutation.""" + comment: Comment + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Comment\`. May be used by Relay 1.""" + commentEdge( + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!]! = [PRIMARY_KEY_ASC] + ): CommentEdge } -"""All input for the \`updateUserByUsername\` mutation.""" -input UpdateUserByUsernameInput { +"""All input for the create \`Comment\` mutation.""" +input CreateCommentInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - username: String! - """ - An object where the defined keys will be set on the \`User\` being updated. - """ - patch: UserPatch! + """The \`Comment\` to be created by this mutation.""" + comment: CommentInput! } -"""The output of our update \`Project\` mutation.""" -type UpdateProjectPayload { +"""An input for mutations affecting \`Comment\`""" +input CommentInput { + rowId: UUID + message: String + postId: UUID! + userId: UUID! + createdAt: Datetime + updatedAt: Datetime +} + +"""The output of our create \`Post\` mutation.""" +type CreatePostPayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`Project\` that was updated by this mutation.""" - project: Project + """The \`Post\` that was created by this mutation.""" + post: Post """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our \`Project\`. May be used by Relay 1.""" - projectEdge( - """The method to use when ordering \`Project\`.""" - orderBy: [ProjectOrderBy!]! = [PRIMARY_KEY_ASC] - ): ProjectEdge + """An edge for our \`Post\`. May be used by Relay 1.""" + postEdge( + """The method to use when ordering \`Post\`.""" + orderBy: [PostOrderBy!]! = [PRIMARY_KEY_ASC] + ): PostEdge } -"""All input for the \`updateProjectById\` mutation.""" -input UpdateProjectByIdInput { +"""All input for the create \`Post\` mutation.""" +input CreatePostInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - """ - The globally unique \`ID\` which will identify a single \`Project\` to be updated. - """ - id: ID! - - """ - An object where the defined keys will be set on the \`Project\` being updated. - """ - patch: ProjectPatch! + """The \`Post\` to be created by this mutation.""" + post: PostInput! } -""" -Represents an update to a \`Project\`. Fields that are set will be updated. -""" -input ProjectPatch { +"""An input for mutations affecting \`Post\`""" +input PostInput { rowId: UUID - name: String - image: String - slug: String + title: String description: String - organizationId: UUID + projectId: UUID! + userId: UUID! createdAt: Datetime updatedAt: Datetime } -"""All input for the \`updateProject\` mutation.""" -input UpdateProjectInput { +"""The output of our create \`User\` mutation.""" +type CreateUserPayload { """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - rowId: UUID! + + """The \`User\` that was created by this mutation.""" + user: User """ - An object where the defined keys will be set on the \`Project\` being updated. + Our root query field type. Allows us to run any query from our mutation payload. """ - patch: ProjectPatch! + query: Query + + """An edge for our \`User\`. May be used by Relay 1.""" + userEdge( + """The method to use when ordering \`User\`.""" + orderBy: [UserOrderBy!]! = [PRIMARY_KEY_ASC] + ): UserEdge } -"""All input for the \`updateProjectByName\` mutation.""" -input UpdateProjectByNameInput { +"""All input for the create \`User\` mutation.""" +input CreateUserInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - name: String! + """The \`User\` to be created by this mutation.""" + user: UserInput! +} + +"""An input for mutations affecting \`User\`""" +input UserInput { + rowId: UUID + createdAt: Datetime + updatedAt: Datetime + hidraId: UUID! + username: String + firstName: String + lastName: String +} + +"""The output of our create \`Project\` mutation.""" +type CreateProjectPayload { """ - An object where the defined keys will be set on the \`Project\` being updated. + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. """ - patch: ProjectPatch! + clientMutationId: String + + """The \`Project\` that was created by this mutation.""" + project: Project + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Project\`. May be used by Relay 1.""" + projectEdge( + """The method to use when ordering \`Project\`.""" + orderBy: [ProjectOrderBy!]! = [PRIMARY_KEY_ASC] + ): ProjectEdge } -"""All input for the \`updateProjectBySlugAndOrganizationId\` mutation.""" -input UpdateProjectBySlugAndOrganizationIdInput { +"""All input for the create \`Project\` mutation.""" +input CreateProjectInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - slug: String! - organizationId: UUID! - """ - An object where the defined keys will be set on the \`Project\` being updated. - """ - patch: ProjectPatch! + """The \`Project\` to be created by this mutation.""" + project: ProjectInput! } -"""The output of our delete \`UserOrganization\` mutation.""" -type DeleteUserOrganizationPayload { +"""An input for mutations affecting \`Project\`""" +input ProjectInput { + rowId: UUID + name: String + image: String + slug: String + description: String + organizationId: UUID! + createdAt: Datetime + updatedAt: Datetime +} + +"""The output of our update \`UserOrganization\` mutation.""" +type UpdateUserOrganizationPayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`UserOrganization\` that was deleted by this mutation.""" + """The \`UserOrganization\` that was updated by this mutation.""" userOrganization: UserOrganization """ @@ -7039,9 +8543,9 @@ type DeleteUserOrganizationPayload { } """ -All input for the \`deleteUserOrganizationByUserIdAndOrganizationId\` mutation. +All input for the \`updateUserOrganizationByUserIdAndOrganizationId\` mutation. """ -input DeleteUserOrganizationByUserIdAndOrganizationIdInput { +input UpdateUserOrganizationByUserIdAndOrganizationIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. @@ -7049,34 +8553,47 @@ input DeleteUserOrganizationByUserIdAndOrganizationIdInput { clientMutationId: String userId: UUID! organizationId: UUID! + + """ + An object where the defined keys will be set on the \`UserOrganization\` being updated. + """ + patch: UserOrganizationPatch! } -"""The output of our delete \`Upvote\` mutation.""" -type DeleteUpvotePayload { +""" +Represents an update to a \`UserOrganization\`. Fields that are set will be updated. +""" +input UserOrganizationPatch { + userId: UUID + organizationId: UUID + createdAt: Datetime +} + +"""The output of our update \`Downvote\` mutation.""" +type UpdateDownvotePayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`Upvote\` that was deleted by this mutation.""" - upvote: Upvote - deletedUpvoteId: ID + """The \`Downvote\` that was updated by this mutation.""" + downvote: Downvote """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our \`Upvote\`. May be used by Relay 1.""" - upvoteEdge( - """The method to use when ordering \`Upvote\`.""" - orderBy: [UpvoteOrderBy!]! = [PRIMARY_KEY_ASC] - ): UpvoteEdge + """An edge for our \`Downvote\`. May be used by Relay 1.""" + downvoteEdge( + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!]! = [PRIMARY_KEY_ASC] + ): DownvoteEdge } -"""All input for the \`deleteUpvoteById\` mutation.""" -input DeleteUpvoteByIdInput { +"""All input for the \`updateDownvoteById\` mutation.""" +input UpdateDownvoteByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. @@ -7084,23 +8601,44 @@ input DeleteUpvoteByIdInput { clientMutationId: String """ - The globally unique \`ID\` which will identify a single \`Upvote\` to be deleted. + The globally unique \`ID\` which will identify a single \`Downvote\` to be updated. """ id: ID! -} -"""All input for the \`deleteUpvote\` mutation.""" -input DeleteUpvoteInput { """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. + An object where the defined keys will be set on the \`Downvote\` being updated. """ - clientMutationId: String + patch: DownvotePatch! +} + +""" +Represents an update to a \`Downvote\`. Fields that are set will be updated. +""" +input DownvotePatch { + rowId: UUID + postId: UUID + userId: UUID + createdAt: Datetime + updatedAt: Datetime +} + +"""All input for the \`updateDownvote\` mutation.""" +input UpdateDownvoteInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String rowId: UUID! + + """ + An object where the defined keys will be set on the \`Downvote\` being updated. + """ + patch: DownvotePatch! } -"""All input for the \`deleteUpvoteByPostIdAndUserId\` mutation.""" -input DeleteUpvoteByPostIdAndUserIdInput { +"""All input for the \`updateDownvoteByPostIdAndUserId\` mutation.""" +input UpdateDownvoteByPostIdAndUserIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. @@ -7108,34 +8646,38 @@ input DeleteUpvoteByPostIdAndUserIdInput { clientMutationId: String postId: UUID! userId: UUID! + + """ + An object where the defined keys will be set on the \`Downvote\` being updated. + """ + patch: DownvotePatch! } -"""The output of our delete \`Organization\` mutation.""" -type DeleteOrganizationPayload { +"""The output of our update \`Upvote\` mutation.""" +type UpdateUpvotePayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`Organization\` that was deleted by this mutation.""" - organization: Organization - deletedOrganizationId: ID + """The \`Upvote\` that was updated by this mutation.""" + upvote: Upvote """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our \`Organization\`. May be used by Relay 1.""" - organizationEdge( - """The method to use when ordering \`Organization\`.""" - orderBy: [OrganizationOrderBy!]! = [PRIMARY_KEY_ASC] - ): OrganizationEdge + """An edge for our \`Upvote\`. May be used by Relay 1.""" + upvoteEdge( + """The method to use when ordering \`Upvote\`.""" + orderBy: [UpvoteOrderBy!]! = [PRIMARY_KEY_ASC] + ): UpvoteEdge } -"""All input for the \`deleteOrganizationById\` mutation.""" -input DeleteOrganizationByIdInput { +"""All input for the \`updateUpvoteById\` mutation.""" +input UpdateUpvoteByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. @@ -7143,67 +8685,83 @@ input DeleteOrganizationByIdInput { clientMutationId: String """ - The globally unique \`ID\` which will identify a single \`Organization\` to be deleted. + The globally unique \`ID\` which will identify a single \`Upvote\` to be updated. """ id: ID! + + """ + An object where the defined keys will be set on the \`Upvote\` being updated. + """ + patch: UpvotePatch! } -"""All input for the \`deleteOrganization\` mutation.""" -input DeleteOrganizationInput { +""" +Represents an update to a \`Upvote\`. Fields that are set will be updated. +""" +input UpvotePatch { + rowId: UUID + postId: UUID + userId: UUID + createdAt: Datetime + updatedAt: Datetime +} + +"""All input for the \`updateUpvote\` mutation.""" +input UpdateUpvoteInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String rowId: UUID! -} -"""All input for the \`deleteOrganizationByName\` mutation.""" -input DeleteOrganizationByNameInput { """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. + An object where the defined keys will be set on the \`Upvote\` being updated. """ - clientMutationId: String - name: String! + patch: UpvotePatch! } -"""All input for the \`deleteOrganizationBySlug\` mutation.""" -input DeleteOrganizationBySlugInput { +"""All input for the \`updateUpvoteByPostIdAndUserId\` mutation.""" +input UpdateUpvoteByPostIdAndUserIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - slug: String! + postId: UUID! + userId: UUID! + + """ + An object where the defined keys will be set on the \`Upvote\` being updated. + """ + patch: UpvotePatch! } -"""The output of our delete \`Post\` mutation.""" -type DeletePostPayload { +"""The output of our update \`Organization\` mutation.""" +type UpdateOrganizationPayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`Post\` that was deleted by this mutation.""" - post: Post - deletedPostId: ID + """The \`Organization\` that was updated by this mutation.""" + organization: Organization """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our \`Post\`. May be used by Relay 1.""" - postEdge( - """The method to use when ordering \`Post\`.""" - orderBy: [PostOrderBy!]! = [PRIMARY_KEY_ASC] - ): PostEdge + """An edge for our \`Organization\`. May be used by Relay 1.""" + organizationEdge( + """The method to use when ordering \`Organization\`.""" + orderBy: [OrganizationOrderBy!]! = [PRIMARY_KEY_ASC] + ): OrganizationEdge } -"""All input for the \`deletePostById\` mutation.""" -input DeletePostByIdInput { +"""All input for the \`updateOrganizationById\` mutation.""" +input UpdateOrganizationByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. @@ -7211,47 +8769,97 @@ input DeletePostByIdInput { clientMutationId: String """ - The globally unique \`ID\` which will identify a single \`Post\` to be deleted. + The globally unique \`ID\` which will identify a single \`Organization\` to be updated. """ id: ID! + + """ + An object where the defined keys will be set on the \`Organization\` being updated. + """ + patch: OrganizationPatch! } -"""All input for the \`deletePost\` mutation.""" -input DeletePostInput { +""" +Represents an update to a \`Organization\`. Fields that are set will be updated. +""" +input OrganizationPatch { + rowId: UUID + name: String + slug: String + createdAt: Datetime + updatedAt: Datetime +} + +"""All input for the \`updateOrganization\` mutation.""" +input UpdateOrganizationInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String rowId: UUID! + + """ + An object where the defined keys will be set on the \`Organization\` being updated. + """ + patch: OrganizationPatch! } -"""The output of our delete \`User\` mutation.""" -type DeleteUserPayload { +"""All input for the \`updateOrganizationByName\` mutation.""" +input UpdateOrganizationByNameInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + name: String! + + """ + An object where the defined keys will be set on the \`Organization\` being updated. + """ + patch: OrganizationPatch! +} + +"""All input for the \`updateOrganizationBySlug\` mutation.""" +input UpdateOrganizationBySlugInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + slug: String! + + """ + An object where the defined keys will be set on the \`Organization\` being updated. + """ + patch: OrganizationPatch! +} + +"""The output of our update \`Comment\` mutation.""" +type UpdateCommentPayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`User\` that was deleted by this mutation.""" - user: User - deletedUserId: ID + """The \`Comment\` that was updated by this mutation.""" + comment: Comment """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our \`User\`. May be used by Relay 1.""" - userEdge( - """The method to use when ordering \`User\`.""" - orderBy: [UserOrderBy!]! = [PRIMARY_KEY_ASC] - ): UserEdge + """An edge for our \`Comment\`. May be used by Relay 1.""" + commentEdge( + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!]! = [PRIMARY_KEY_ASC] + ): CommentEdge } -"""All input for the \`deleteUserById\` mutation.""" -input DeleteUserByIdInput { +"""All input for the \`updateCommentById\` mutation.""" +input UpdateCommentByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. @@ -7259,67 +8867,68 @@ input DeleteUserByIdInput { clientMutationId: String """ - The globally unique \`ID\` which will identify a single \`User\` to be deleted. + The globally unique \`ID\` which will identify a single \`Comment\` to be updated. """ id: ID! -} -"""All input for the \`deleteUser\` mutation.""" -input DeleteUserInput { """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. + An object where the defined keys will be set on the \`Comment\` being updated. """ - clientMutationId: String - rowId: UUID! + patch: CommentPatch! } -"""All input for the \`deleteUserByHidraId\` mutation.""" -input DeleteUserByHidraIdInput { +""" +Represents an update to a \`Comment\`. Fields that are set will be updated. +""" +input CommentPatch { + rowId: UUID + message: String + postId: UUID + userId: UUID + createdAt: Datetime + updatedAt: Datetime +} + +"""All input for the \`updateComment\` mutation.""" +input UpdateCommentInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String - hidraId: UUID! -} + rowId: UUID! -"""All input for the \`deleteUserByUsername\` mutation.""" -input DeleteUserByUsernameInput { """ - An arbitrary string value with no semantic meaning. Will be included in the - payload verbatim. May be used to track mutations by the client. + An object where the defined keys will be set on the \`Comment\` being updated. """ - clientMutationId: String - username: String! + patch: CommentPatch! } -"""The output of our delete \`Project\` mutation.""" -type DeleteProjectPayload { +"""The output of our update \`Post\` mutation.""" +type UpdatePostPayload { """ The exact same \`clientMutationId\` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations. """ clientMutationId: String - """The \`Project\` that was deleted by this mutation.""" - project: Project - deletedProjectId: ID + """The \`Post\` that was updated by this mutation.""" + post: Post """ Our root query field type. Allows us to run any query from our mutation payload. """ query: Query - """An edge for our \`Project\`. May be used by Relay 1.""" - projectEdge( - """The method to use when ordering \`Project\`.""" - orderBy: [ProjectOrderBy!]! = [PRIMARY_KEY_ASC] - ): ProjectEdge + """An edge for our \`Post\`. May be used by Relay 1.""" + postEdge( + """The method to use when ordering \`Post\`.""" + orderBy: [PostOrderBy!]! = [PRIMARY_KEY_ASC] + ): PostEdge } -"""All input for the \`deleteProjectById\` mutation.""" -input DeleteProjectByIdInput { +"""All input for the \`updatePostById\` mutation.""" +input UpdatePostByIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. @@ -7327,33 +8936,228 @@ input DeleteProjectByIdInput { clientMutationId: String """ - The globally unique \`ID\` which will identify a single \`Project\` to be deleted. + The globally unique \`ID\` which will identify a single \`Post\` to be updated. """ id: ID! + + """ + An object where the defined keys will be set on the \`Post\` being updated. + """ + patch: PostPatch! } -"""All input for the \`deleteProject\` mutation.""" -input DeleteProjectInput { +"""Represents an update to a \`Post\`. Fields that are set will be updated.""" +input PostPatch { + rowId: UUID + title: String + description: String + projectId: UUID + userId: UUID + createdAt: Datetime + updatedAt: Datetime +} + +"""All input for the \`updatePost\` mutation.""" +input UpdatePostInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String rowId: UUID! -} -"""All input for the \`deleteProjectByName\` mutation.""" -input DeleteProjectByNameInput { + """ + An object where the defined keys will be set on the \`Post\` being updated. + """ + patch: PostPatch! +} + +"""The output of our update \`User\` mutation.""" +type UpdateUserPayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`User\` that was updated by this mutation.""" + user: User + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`User\`. May be used by Relay 1.""" + userEdge( + """The method to use when ordering \`User\`.""" + orderBy: [UserOrderBy!]! = [PRIMARY_KEY_ASC] + ): UserEdge +} + +"""All input for the \`updateUserById\` mutation.""" +input UpdateUserByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`User\` to be updated. + """ + id: ID! + + """ + An object where the defined keys will be set on the \`User\` being updated. + """ + patch: UserPatch! +} + +"""Represents an update to a \`User\`. Fields that are set will be updated.""" +input UserPatch { + rowId: UUID + createdAt: Datetime + updatedAt: Datetime + hidraId: UUID + username: String + firstName: String + lastName: String +} + +"""All input for the \`updateUser\` mutation.""" +input UpdateUserInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! + + """ + An object where the defined keys will be set on the \`User\` being updated. + """ + patch: UserPatch! +} + +"""All input for the \`updateUserByHidraId\` mutation.""" +input UpdateUserByHidraIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + hidraId: UUID! + + """ + An object where the defined keys will be set on the \`User\` being updated. + """ + patch: UserPatch! +} + +"""All input for the \`updateUserByUsername\` mutation.""" +input UpdateUserByUsernameInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + username: String! + + """ + An object where the defined keys will be set on the \`User\` being updated. + """ + patch: UserPatch! +} + +"""The output of our update \`Project\` mutation.""" +type UpdateProjectPayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`Project\` that was updated by this mutation.""" + project: Project + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Project\`. May be used by Relay 1.""" + projectEdge( + """The method to use when ordering \`Project\`.""" + orderBy: [ProjectOrderBy!]! = [PRIMARY_KEY_ASC] + ): ProjectEdge +} + +"""All input for the \`updateProjectById\` mutation.""" +input UpdateProjectByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`Project\` to be updated. + """ + id: ID! + + """ + An object where the defined keys will be set on the \`Project\` being updated. + """ + patch: ProjectPatch! +} + +""" +Represents an update to a \`Project\`. Fields that are set will be updated. +""" +input ProjectPatch { + rowId: UUID + name: String + image: String + slug: String + description: String + organizationId: UUID + createdAt: Datetime + updatedAt: Datetime +} + +"""All input for the \`updateProject\` mutation.""" +input UpdateProjectInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! + + """ + An object where the defined keys will be set on the \`Project\` being updated. + """ + patch: ProjectPatch! +} + +"""All input for the \`updateProjectByName\` mutation.""" +input UpdateProjectByNameInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. """ clientMutationId: String name: String! + + """ + An object where the defined keys will be set on the \`Project\` being updated. + """ + patch: ProjectPatch! } -"""All input for the \`deleteProjectBySlugAndOrganizationId\` mutation.""" -input DeleteProjectBySlugAndOrganizationIdInput { +"""All input for the \`updateProjectBySlugAndOrganizationId\` mutation.""" +input UpdateProjectBySlugAndOrganizationIdInput { """ An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client. @@ -7361,1926 +9165,5384 @@ input DeleteProjectBySlugAndOrganizationIdInput { clientMutationId: String slug: String! organizationId: UUID! -}`; -export const plans = { - Query: { - __assertStep() { - return !0; - }, - query() { - return rootValue(); - }, - id($parent) { - const specifier = handler.plan($parent); - return lambda(specifier, nodeIdCodecs[handler.codec.name].encode); - }, - node: { - plan(_$root, args) { - return node(nodeIdHandlerByTypeName, args.get("id")); - }, - args: { - id: undefined - } - }, - userOrganizationByUserIdAndOrganizationId: { - plan(_$root, args) { - return resource_user_organizationPgResource.get({ - user_id: args.get("userId"), - organization_id: args.get("organizationId") - }); - }, - args: { - userId: undefined, - organizationId: undefined - } - }, - upvote: { - plan(_$root, args) { - return pgResource_upvotePgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - upvoteByPostIdAndUserId: { - plan(_$root, args) { - return pgResource_upvotePgResource.get({ - post_id: args.get("postId"), - user_id: args.get("userId") - }); - }, - args: { - postId: undefined, - userId: undefined - } - }, - organization: { - plan(_$root, args) { - return pgResource_organizationPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - organizationByName: { - plan(_$root, args) { - return pgResource_organizationPgResource.get({ + + """ + An object where the defined keys will be set on the \`Project\` being updated. + """ + patch: ProjectPatch! +} + +"""The output of our delete \`UserOrganization\` mutation.""" +type DeleteUserOrganizationPayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`UserOrganization\` that was deleted by this mutation.""" + userOrganization: UserOrganization + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query +} + +""" +All input for the \`deleteUserOrganizationByUserIdAndOrganizationId\` mutation. +""" +input DeleteUserOrganizationByUserIdAndOrganizationIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + userId: UUID! + organizationId: UUID! +} + +"""The output of our delete \`Downvote\` mutation.""" +type DeleteDownvotePayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`Downvote\` that was deleted by this mutation.""" + downvote: Downvote + deletedDownvoteId: ID + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Downvote\`. May be used by Relay 1.""" + downvoteEdge( + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!]! = [PRIMARY_KEY_ASC] + ): DownvoteEdge +} + +"""All input for the \`deleteDownvoteById\` mutation.""" +input DeleteDownvoteByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`Downvote\` to be deleted. + """ + id: ID! +} + +"""All input for the \`deleteDownvote\` mutation.""" +input DeleteDownvoteInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! +} + +"""All input for the \`deleteDownvoteByPostIdAndUserId\` mutation.""" +input DeleteDownvoteByPostIdAndUserIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + postId: UUID! + userId: UUID! +} + +"""The output of our delete \`Upvote\` mutation.""" +type DeleteUpvotePayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`Upvote\` that was deleted by this mutation.""" + upvote: Upvote + deletedUpvoteId: ID + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Upvote\`. May be used by Relay 1.""" + upvoteEdge( + """The method to use when ordering \`Upvote\`.""" + orderBy: [UpvoteOrderBy!]! = [PRIMARY_KEY_ASC] + ): UpvoteEdge +} + +"""All input for the \`deleteUpvoteById\` mutation.""" +input DeleteUpvoteByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`Upvote\` to be deleted. + """ + id: ID! +} + +"""All input for the \`deleteUpvote\` mutation.""" +input DeleteUpvoteInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! +} + +"""All input for the \`deleteUpvoteByPostIdAndUserId\` mutation.""" +input DeleteUpvoteByPostIdAndUserIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + postId: UUID! + userId: UUID! +} + +"""The output of our delete \`Organization\` mutation.""" +type DeleteOrganizationPayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`Organization\` that was deleted by this mutation.""" + organization: Organization + deletedOrganizationId: ID + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Organization\`. May be used by Relay 1.""" + organizationEdge( + """The method to use when ordering \`Organization\`.""" + orderBy: [OrganizationOrderBy!]! = [PRIMARY_KEY_ASC] + ): OrganizationEdge +} + +"""All input for the \`deleteOrganizationById\` mutation.""" +input DeleteOrganizationByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`Organization\` to be deleted. + """ + id: ID! +} + +"""All input for the \`deleteOrganization\` mutation.""" +input DeleteOrganizationInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! +} + +"""All input for the \`deleteOrganizationByName\` mutation.""" +input DeleteOrganizationByNameInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + name: String! +} + +"""All input for the \`deleteOrganizationBySlug\` mutation.""" +input DeleteOrganizationBySlugInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + slug: String! +} + +"""The output of our delete \`Comment\` mutation.""" +type DeleteCommentPayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`Comment\` that was deleted by this mutation.""" + comment: Comment + deletedCommentId: ID + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Comment\`. May be used by Relay 1.""" + commentEdge( + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!]! = [PRIMARY_KEY_ASC] + ): CommentEdge +} + +"""All input for the \`deleteCommentById\` mutation.""" +input DeleteCommentByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`Comment\` to be deleted. + """ + id: ID! +} + +"""All input for the \`deleteComment\` mutation.""" +input DeleteCommentInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! +} + +"""The output of our delete \`Post\` mutation.""" +type DeletePostPayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`Post\` that was deleted by this mutation.""" + post: Post + deletedPostId: ID + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Post\`. May be used by Relay 1.""" + postEdge( + """The method to use when ordering \`Post\`.""" + orderBy: [PostOrderBy!]! = [PRIMARY_KEY_ASC] + ): PostEdge +} + +"""All input for the \`deletePostById\` mutation.""" +input DeletePostByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`Post\` to be deleted. + """ + id: ID! +} + +"""All input for the \`deletePost\` mutation.""" +input DeletePostInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! +} + +"""The output of our delete \`User\` mutation.""" +type DeleteUserPayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`User\` that was deleted by this mutation.""" + user: User + deletedUserId: ID + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`User\`. May be used by Relay 1.""" + userEdge( + """The method to use when ordering \`User\`.""" + orderBy: [UserOrderBy!]! = [PRIMARY_KEY_ASC] + ): UserEdge +} + +"""All input for the \`deleteUserById\` mutation.""" +input DeleteUserByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`User\` to be deleted. + """ + id: ID! +} + +"""All input for the \`deleteUser\` mutation.""" +input DeleteUserInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! +} + +"""All input for the \`deleteUserByHidraId\` mutation.""" +input DeleteUserByHidraIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + hidraId: UUID! +} + +"""All input for the \`deleteUserByUsername\` mutation.""" +input DeleteUserByUsernameInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + username: String! +} + +"""The output of our delete \`Project\` mutation.""" +type DeleteProjectPayload { + """ + The exact same \`clientMutationId\` that was provided in the mutation input, + unchanged and unused. May be used by a client to track mutations. + """ + clientMutationId: String + + """The \`Project\` that was deleted by this mutation.""" + project: Project + deletedProjectId: ID + + """ + Our root query field type. Allows us to run any query from our mutation payload. + """ + query: Query + + """An edge for our \`Project\`. May be used by Relay 1.""" + projectEdge( + """The method to use when ordering \`Project\`.""" + orderBy: [ProjectOrderBy!]! = [PRIMARY_KEY_ASC] + ): ProjectEdge +} + +"""All input for the \`deleteProjectById\` mutation.""" +input DeleteProjectByIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + + """ + The globally unique \`ID\` which will identify a single \`Project\` to be deleted. + """ + id: ID! +} + +"""All input for the \`deleteProject\` mutation.""" +input DeleteProjectInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + rowId: UUID! +} + +"""All input for the \`deleteProjectByName\` mutation.""" +input DeleteProjectByNameInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + name: String! +} + +"""All input for the \`deleteProjectBySlugAndOrganizationId\` mutation.""" +input DeleteProjectBySlugAndOrganizationIdInput { + """ + An arbitrary string value with no semantic meaning. Will be included in the + payload verbatim. May be used to track mutations by the client. + """ + clientMutationId: String + slug: String! + organizationId: UUID! +}`; +export const plans = { + Query: { + __assertStep() { + return !0; + }, + query() { + return rootValue(); + }, + id($parent) { + const specifier = handler.plan($parent); + return lambda(specifier, nodeIdCodecs[handler.codec.name].encode); + }, + node: { + plan(_$root, args) { + return node(nodeIdHandlerByTypeName, args.get("id")); + }, + args: { + id: undefined + } + }, + userOrganizationByUserIdAndOrganizationId: { + plan(_$root, args) { + return resource_user_organizationPgResource.get({ + user_id: args.get("userId"), + organization_id: args.get("organizationId") + }); + }, + args: { + userId: undefined, + organizationId: undefined + } + }, + downvote: { + plan(_$root, args) { + return pgResource_downvotePgResource.get({ + id: args.get("rowId") + }); + }, + args: { + rowId: undefined + } + }, + downvoteByPostIdAndUserId: { + plan(_$root, args) { + return pgResource_downvotePgResource.get({ + post_id: args.get("postId"), + user_id: args.get("userId") + }); + }, + args: { + postId: undefined, + userId: undefined + } + }, + upvote: { + plan(_$root, args) { + return pgResource_upvotePgResource.get({ + id: args.get("rowId") + }); + }, + args: { + rowId: undefined + } + }, + upvoteByPostIdAndUserId: { + plan(_$root, args) { + return pgResource_upvotePgResource.get({ + post_id: args.get("postId"), + user_id: args.get("userId") + }); + }, + args: { + postId: undefined, + userId: undefined + } + }, + organization: { + plan(_$root, args) { + return pgResource_organizationPgResource.get({ + id: args.get("rowId") + }); + }, + args: { + rowId: undefined + } + }, + organizationByName: { + plan(_$root, args) { + return pgResource_organizationPgResource.get({ + name: args.get("name") + }); + }, + args: { + name: undefined + } + }, + organizationBySlug: { + plan(_$root, args) { + return pgResource_organizationPgResource.get({ + slug: args.get("slug") + }); + }, + args: { + slug: undefined + } + }, + comment: { + plan(_$root, args) { + return pgResource_commentPgResource.get({ + id: args.get("rowId") + }); + }, + args: { + rowId: undefined + } + }, + post: { + plan(_$root, args) { + return pgResource_postPgResource.get({ + id: args.get("rowId") + }); + }, + args: { + rowId: undefined + } + }, + user: { + plan(_$root, args) { + return pgResource_userPgResource.get({ + id: args.get("rowId") + }); + }, + args: { + rowId: undefined + } + }, + userByHidraId: { + plan(_$root, args) { + return pgResource_userPgResource.get({ + hidra_id: args.get("hidraId") + }); + }, + args: { + hidraId: undefined + } + }, + userByUsername: { + plan(_$root, args) { + return pgResource_userPgResource.get({ + username: args.get("username") + }); + }, + args: { + username: undefined + } + }, + project: { + plan(_$root, args) { + return pgResource_projectPgResource.get({ + id: args.get("rowId") + }); + }, + args: { + rowId: undefined + } + }, + projectByName: { + plan(_$root, args) { + return pgResource_projectPgResource.get({ name: args.get("name") }); - }, - args: { - name: undefined + }, + args: { + name: undefined + } + }, + projectBySlugAndOrganizationId: { + plan(_$root, args) { + return pgResource_projectPgResource.get({ + slug: args.get("slug"), + organization_id: args.get("organizationId") + }); + }, + args: { + slug: undefined, + organizationId: undefined + } + }, + downvoteById: { + plan(_$parent, args) { + const $nodeId = args.get("id"); + return fetcher($nodeId); + }, + args: { + id: undefined + } + }, + upvoteById: { + plan(_$parent, args) { + const $nodeId = args.get("id"); + return fetcher2($nodeId); + }, + args: { + id: undefined + } + }, + organizationById: { + plan(_$parent, args) { + const $nodeId = args.get("id"); + return fetcher3($nodeId); + }, + args: { + id: undefined + } + }, + commentById: { + plan(_$parent, args) { + const $nodeId = args.get("id"); + return fetcher4($nodeId); + }, + args: { + id: undefined + } + }, + postById: { + plan(_$parent, args) { + const $nodeId = args.get("id"); + return fetcher5($nodeId); + }, + args: { + id: undefined + } + }, + userById: { + plan(_$parent, args) { + const $nodeId = args.get("id"); + return fetcher6($nodeId); + }, + args: { + id: undefined + } + }, + projectById: { + plan(_$parent, args) { + const $nodeId = args.get("id"); + return fetcher7($nodeId); + }, + args: { + id: undefined + } + }, + userOrganizations: { + plan() { + return connection(resource_user_organizationPgResource.find()); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("UserOrganizationOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + downvotes: { + plan() { + return connection(pgResource_downvotePgResource.find()); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("DownvoteOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed2(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + upvotes: { + plan() { + return connection(pgResource_upvotePgResource.find()); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed3(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + organizations: { + plan() { + return connection(pgResource_organizationPgResource.find()); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("OrganizationOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed4(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + comments: { + plan() { + return connection(pgResource_commentPgResource.find()); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("CommentOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed5(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + posts: { + plan() { + return connection(pgResource_postPgResource.find()); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed6(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + users: { + plan() { + return connection(pgResource_userPgResource.find()); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("UserOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed7(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + projects: { + plan() { + return connection(pgResource_projectPgResource.find()); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("ProjectOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed8(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + } + }, + UserOrganization: { + __assertStep: assertPgClassSingleStep, + userId($record) { + return $record.get("user_id"); + }, + organizationId($record) { + return $record.get("organization_id"); + }, + createdAt($record) { + return $record.get("created_at"); + }, + organization($record) { + return pgResource_organizationPgResource.get({ + id: $record.get("organization_id") + }); + }, + user($record) { + return pgResource_userPgResource.get({ + id: $record.get("user_id") + }); + } + }, + UUID: { + serialize: UUIDSerialize, + parseValue(value) { + return coerce("" + value); + }, + parseLiteral(ast) { + if (ast.kind !== Kind.STRING) throw new GraphQLError(`${"UUID" ?? "This scalar"} can only parse string values (kind = '${ast.kind}')`); + return coerce(ast.value); + } + }, + Datetime: { + serialize: UUIDSerialize, + parseValue: UUIDSerialize, + parseLiteral(ast) { + if (ast.kind !== Kind.STRING) throw new GraphQLError(`${"Datetime" ?? "This scalar"} can only parse string values (kind='${ast.kind}')`); + return ast.value; + } + }, + Organization: { + __assertStep: assertPgClassSingleStep, + id($parent) { + const specifier = nodeIdHandlerByTypeName.Organization.plan($parent); + return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Organization.codec.name].encode); + }, + rowId($record) { + return $record.get("id"); + }, + name($record) { + return $record.get("name"); + }, + slug($record) { + return $record.get("slug"); + }, + createdAt($record) { + return $record.get("created_at"); + }, + updatedAt($record) { + return $record.get("updated_at"); + }, + projects: { + plan($record) { + const $records = pgResource_projectPgResource.find({ + organization_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("ProjectOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed9(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + userOrganizations: { + plan($record) { + const $records = resource_user_organizationPgResource.find({ + organization_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("UserOrganizationOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed10(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + } + }, + ProjectConnection: { + __assertStep: ConnectionStep, + nodes($connection) { + return $connection.nodes(); + }, + edges($connection) { + return $connection.edges(); + }, + pageInfo($connection) { + return $connection.pageInfo(); + }, + totalCount($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").singleAsRecord().select(sql`count(*)`, TYPES.bigint, !1); + }, + aggregates($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").single(); + }, + groupedAggregates: { + plan($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate"); + }, + args: { + groupBy: { + autoApplyAfterParentPlan: true, + applyPlan(_$parent, $pgSelect, input) { + var _a, _b; + const val = input.getRaw().eval(); + if (!Array.isArray(val)) throw new Error("Invalid!"); + for (const group of val) { + const config = getEnumValueConfig(ProjectGroupBy, group), + plan = (_b = (_a = config === null || config === void 0 ? void 0 : config.extensions) === null || _a === void 0 ? void 0 : _a.grafast) === null || _b === void 0 ? void 0 : _b.applyPlan; + if (typeof plan === "function") plan($pgSelect); + } + return null; + } + }, + having: { + autoApplyAfterParentPlan: true, + applyPlan(_$parent, $pgSelect) { + return $pgSelect.havingPlan(); + } + } + } + } + }, + Project: { + __assertStep: assertPgClassSingleStep, + id($parent) { + const specifier = nodeIdHandlerByTypeName.Project.plan($parent); + return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Project.codec.name].encode); + }, + rowId($record) { + return $record.get("id"); + }, + name($record) { + return $record.get("name"); + }, + image($record) { + return $record.get("image"); + }, + slug($record) { + return $record.get("slug"); + }, + description($record) { + return $record.get("description"); + }, + organizationId($record) { + return $record.get("organization_id"); + }, + createdAt($record) { + return $record.get("created_at"); + }, + updatedAt($record) { + return $record.get("updated_at"); + }, + organization($record) { + return pgResource_organizationPgResource.get({ + id: $record.get("organization_id") + }); + }, + posts: { + plan($record) { + const $records = pgResource_postPgResource.find({ + project_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed11(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + } + }, + PostConnection: { + __assertStep: ConnectionStep, + nodes($connection) { + return $connection.nodes(); + }, + edges($connection) { + return $connection.edges(); + }, + pageInfo($connection) { + return $connection.pageInfo(); + }, + totalCount($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").singleAsRecord().select(sql`count(*)`, TYPES.bigint, !1); + }, + aggregates($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").single(); + }, + groupedAggregates: { + plan($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate"); + }, + args: { + groupBy: { + autoApplyAfterParentPlan: true, + applyPlan(_$parent, $pgSelect, input) { + var _a, _b; + const val = input.getRaw().eval(); + if (!Array.isArray(val)) throw new Error("Invalid!"); + for (const group of val) { + const config = getEnumValueConfig(PostGroupBy, group), + plan = (_b = (_a = config === null || config === void 0 ? void 0 : config.extensions) === null || _a === void 0 ? void 0 : _a.grafast) === null || _b === void 0 ? void 0 : _b.applyPlan; + if (typeof plan === "function") plan($pgSelect); + } + return null; + } + }, + having: { + autoApplyAfterParentPlan: true, + applyPlan(_$parent, $pgSelect) { + return $pgSelect.havingPlan(); + } + } + } + } + }, + Post: { + __assertStep: assertPgClassSingleStep, + id($parent) { + const specifier = nodeIdHandlerByTypeName.Post.plan($parent); + return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Post.codec.name].encode); + }, + rowId($record) { + return $record.get("id"); + }, + title($record) { + return $record.get("title"); + }, + description($record) { + return $record.get("description"); + }, + projectId($record) { + return $record.get("project_id"); + }, + userId($record) { + return $record.get("user_id"); + }, + createdAt($record) { + return $record.get("created_at"); + }, + updatedAt($record) { + return $record.get("updated_at"); + }, + project($record) { + return pgResource_projectPgResource.get({ + id: $record.get("project_id") + }); + }, + user($record) { + return pgResource_userPgResource.get({ + id: $record.get("user_id") + }); + }, + upvotes: { + plan($record) { + const $records = pgResource_upvotePgResource.find({ + post_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed12(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + comments: { + plan($record) { + const $records = pgResource_commentPgResource.find({ + post_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("CommentOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed13(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + downvotes: { + plan($record) { + const $records = pgResource_downvotePgResource.find({ + post_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("DownvoteOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed14(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + } + }, + User: { + __assertStep: assertPgClassSingleStep, + id($parent) { + const specifier = nodeIdHandlerByTypeName.User.plan($parent); + return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.User.codec.name].encode); + }, + rowId($record) { + return $record.get("id"); + }, + createdAt($record) { + return $record.get("created_at"); + }, + updatedAt($record) { + return $record.get("updated_at"); + }, + hidraId($record) { + return $record.get("hidra_id"); + }, + username($record) { + return $record.get("username"); + }, + firstName($record) { + return $record.get("first_name"); + }, + lastName($record) { + return $record.get("last_name"); + }, + posts: { + plan($record) { + const $records = pgResource_postPgResource.find({ + user_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed15(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + upvotes: { + plan($record) { + const $records = pgResource_upvotePgResource.find({ + user_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed16(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + userOrganizations: { + plan($record) { + const $records = resource_user_organizationPgResource.find({ + user_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("UserOrganizationOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed17(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + comments: { + plan($record) { + const $records = pgResource_commentPgResource.find({ + user_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("CommentOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed18(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + }, + downvotes: { + plan($record) { + const $records = pgResource_downvotePgResource.find({ + user_id: $record.get("id") + }); + return connection($records); + }, + args: { + first: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + } + }, + last: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setLast(val.getRaw()); + } + }, + offset: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setOffset(val.getRaw()); + } + }, + before: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setBefore(val.getRaw()); + } + }, + after: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val) { + $connection.setAfter(val.getRaw()); + } + }, + orderBy: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, val, info) { + const $value = val.getRaw(), + $select = $connection.getSubplan(); + applyOrderToPlan($select, $value, info.schema.getType("DownvoteOrderBy")); + return null; + } + }, + condition: { + autoApplyAfterParentPlan: true, + applyPlan(_condition, $connection) { + return $connection.getSubplan().wherePlan(); + } + }, + filter: { + autoApplyAfterParentPlan: true, + applyPlan(_, $connection, fieldArgs) { + assertAllowed19(fieldArgs, "object"); + const $where = $connection.getSubplan().wherePlan(); + if (null) $where.extensions.pgFilterAttribute = { + codec: null + }; + fieldArgs.apply($where); + } + } + } + } + }, + Cursor: { + serialize: UUIDSerialize, + parseValue: UUIDSerialize, + parseLiteral(ast) { + if (ast.kind !== Kind.STRING) throw new GraphQLError(`${"Cursor" ?? "This scalar"} can only parse string values (kind='${ast.kind}')`); + return ast.value; + } + }, + PostOrderBy: { + NATURAL: { + applyPlan() {} + }, + PRIMARY_KEY_ASC: { + applyPlan(step) { + postUniques[0].attributes.forEach(attributeName => { + const attribute = postCodec.attributes[attributeName]; + step.orderBy({ + codec: attribute.codec, + fragment: sql`${step}.${sql.identifier(attributeName)}`, + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + }); + step.setOrderIsUnique(); + } + }, + PRIMARY_KEY_DESC: { + applyPlan(step) { + postUniques[0].attributes.forEach(attributeName => { + const attribute = postCodec.attributes[attributeName]; + step.orderBy({ + codec: attribute.codec, + fragment: sql`${step}.${sql.identifier(attributeName)}`, + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + }); + step.setOrderIsUnique(); + } + }, + ROW_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); + } + }, + ROW_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); + } + }, + TITLE_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "title", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + TITLE_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "title", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + DESCRIPTION_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "description", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + DESCRIPTION_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "description", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + PROJECT_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "project_id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + PROJECT_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "project_id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + USER_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "user_id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + USER_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "user_id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + CREATED_AT_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "created_at", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + CREATED_AT_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "created_at", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + UPDATED_AT_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "updated_at", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + UPDATED_AT_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "updated_at", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + UPVOTES_COUNT_ASC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); + } + }, + UPVOTES_COUNT_DESC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); + } + }, + UPVOTES_DISTINCT_COUNT_ROW_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, + direction: "ASC" + }); + } + }, + UPVOTES_DISTINCT_COUNT_ROW_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, + direction: "DESC" + }); + } + }, + UPVOTES_DISTINCT_COUNT_POST_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, + direction: "ASC" + }); + } + }, + UPVOTES_DISTINCT_COUNT_POST_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, + direction: "DESC" + }); + } + }, + UPVOTES_DISTINCT_COUNT_USER_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, + direction: "ASC" + }); + } + }, + UPVOTES_DISTINCT_COUNT_USER_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, + direction: "DESC" + }); + } + }, + UPVOTES_DISTINCT_COUNT_CREATED_AT_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, + direction: "ASC" + }); + } + }, + UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, + direction: "DESC" + }); } }, - organizationBySlug: { - plan(_$root, args) { - return pgResource_organizationPgResource.get({ - slug: args.get("slug") + UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, + direction: "ASC" }); - }, - args: { - slug: undefined } }, - post: { - plan(_$root, args) { - return pgResource_postPgResource.get({ - id: args.get("rowId") + UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, + direction: "DESC" }); - }, - args: { - rowId: undefined } }, - user: { - plan(_$root, args) { - return pgResource_userPgResource.get({ - id: args.get("rowId") + COMMENTS_COUNT_ASC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" }); - }, - args: { - rowId: undefined } }, - userByHidraId: { - plan(_$root, args) { - return pgResource_userPgResource.get({ - hidra_id: args.get("hidraId") + COMMENTS_COUNT_DESC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_ROW_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.id.codec, + direction: "ASC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_ROW_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.id.codec, + direction: "DESC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_MESSAGE_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.message.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.message.codec, + direction: "ASC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_MESSAGE_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.message.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.message.codec, + direction: "DESC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_POST_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.post_id.codec, + direction: "ASC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_POST_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.post_id.codec, + direction: "DESC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_USER_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.user_id.codec, + direction: "ASC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_USER_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.user_id.codec, + direction: "DESC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_CREATED_AT_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.created_at.codec, + direction: "ASC" + }); + } + }, + COMMENTS_DISTINCT_COUNT_CREATED_AT_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.created_at.codec, + direction: "DESC" }); - }, - args: { - hidraId: undefined } }, - userByUsername: { - plan(_$root, args) { - return pgResource_userPgResource.get({ - username: args.get("username") + COMMENTS_DISTINCT_COUNT_UPDATED_AT_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - }, - args: { - username: undefined - } - }, - project: { - plan(_$root, args) { - return pgResource_projectPgResource.get({ - id: args.get("rowId") + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.updated_at.codec, + direction: "ASC" }); - }, - args: { - rowId: undefined } }, - projectByName: { - plan(_$root, args) { - return pgResource_projectPgResource.get({ - name: args.get("name") + COMMENTS_DISTINCT_COUNT_UPDATED_AT_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation2.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation2.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.updated_at.codec, + direction: "DESC" }); - }, - args: { - name: undefined } }, - projectBySlugAndOrganizationId: { - plan(_$root, args) { - return pgResource_projectPgResource.get({ - slug: args.get("slug"), - organization_id: args.get("organizationId") + DOWNVOTES_COUNT_ASC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" }); - }, - args: { - slug: undefined, - organizationId: undefined } }, - upvoteById: { - plan(_$parent, args) { - const $nodeId = args.get("id"); - return fetcher($nodeId); - }, - args: { - id: undefined + DOWNVOTES_COUNT_DESC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); } }, - organizationById: { - plan(_$parent, args) { - const $nodeId = args.get("id"); - return fetcher2($nodeId); - }, - args: { - id: undefined + DOWNVOTES_DISTINCT_COUNT_ROW_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.id.codec, + direction: "ASC" + }); } }, - postById: { - plan(_$parent, args) { - const $nodeId = args.get("id"); - return fetcher3($nodeId); - }, - args: { - id: undefined + DOWNVOTES_DISTINCT_COUNT_ROW_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.id.codec, + direction: "DESC" + }); } }, - userById: { - plan(_$parent, args) { - const $nodeId = args.get("id"); - return fetcher4($nodeId); - }, - args: { - id: undefined + DOWNVOTES_DISTINCT_COUNT_POST_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.post_id.codec, + direction: "ASC" + }); } }, - projectById: { - plan(_$parent, args) { - const $nodeId = args.get("id"); - return fetcher5($nodeId); - }, - args: { - id: undefined + DOWNVOTES_DISTINCT_COUNT_POST_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.post_id.codec, + direction: "DESC" + }); } }, - userOrganizations: { - plan() { - return connection(resource_user_organizationPgResource.find()); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("UserOrganizationOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + DOWNVOTES_DISTINCT_COUNT_USER_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.user_id.codec, + direction: "ASC" + }); } }, - upvotes: { - plan() { - return connection(pgResource_upvotePgResource.find()); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed2(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + DOWNVOTES_DISTINCT_COUNT_USER_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.user_id.codec, + direction: "DESC" + }); } }, - organizations: { - plan() { - return connection(pgResource_organizationPgResource.find()); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("OrganizationOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed3(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.created_at.codec, + direction: "ASC" + }); } }, - posts: { - plan() { - return connection(pgResource_postPgResource.find()); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.created_at.codec, + direction: "DESC" + }); + } + }, + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.updated_at.codec, + direction: "ASC" + }); + } + }, + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation3.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation3.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.updated_at.codec, + direction: "DESC" + }); + } + } + }, + PostCondition: { + rowId: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return sql`${expression} is null`; } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); + });else $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.id.codec)}`; } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + title: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "title", + callback(expression) { + return sql`${expression} is null`; } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); - return null; + });else $condition.where({ + type: "attribute", + attribute: "title", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.title.codec)}`; } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + description: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "description", + callback(expression) { + return sql`${expression} is null`; } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed4(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); + });else $condition.where({ + type: "attribute", + attribute: "description", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.description.codec)}`; } - } - } - }, - users: { - plan() { - return connection(pgResource_userPgResource.find()); + }); }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + projectId: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "project_id", + callback(expression) { + return sql`${expression} is null`; } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); + });else $condition.where({ + type: "attribute", + attribute: "project_id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.project_id.codec)}`; } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + userId: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return sql`${expression} is null`; } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); + });else $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.user_id.codec)}`; } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + createdAt: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return sql`${expression} is null`; } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("UserOrderBy")); - return null; + });else $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.created_at.codec)}`; } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + updatedAt: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return sql`${expression} is null`; } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed5(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); + });else $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.updated_at.codec)}`; } - } + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + } + }, + PostFilter: { + rowId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec; + fieldArgs.apply($col); + } + }, + title: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec2; + fieldArgs.apply($col); + } + }, + description: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec3; + fieldArgs.apply($col); + } + }, + projectId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec4; + fieldArgs.apply($col); + } + }, + userId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec5; + fieldArgs.apply($col); + } + }, + createdAt: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec6; + fieldArgs.apply($col); + } + }, + updatedAt: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec7; + fieldArgs.apply($col); + } + }, + upvotes: { + applyPlan($where, fieldArgs) { + assertAllowed20(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: upvoteIdentifier, + alias: pgResource_upvotePgResource.name, + localAttributes: registryConfig.pgRelations.post.upvotesByTheirPostId.localAttributes, + remoteAttributes: registryConfig.pgRelations.post.upvotesByTheirPostId.remoteAttributes + }; + fieldArgs.apply($rel); } }, - projects: { - plan() { - return connection(pgResource_projectPgResource.find()); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("ProjectOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed6(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + upvotesExist: { + applyPlan($where, fieldArgs) { + assertAllowed20(fieldArgs, "scalar"); + const $subQuery = $where.existsPlan({ + tableExpression: upvoteIdentifier, + alias: pgResource_upvotePgResource.name, + $equals: fieldArgs.get() + }); + registryConfig.pgRelations.post.upvotesByTheirPostId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.post.upvotesByTheirPostId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); } - } - }, - UserOrganization: { - __assertStep: assertPgClassSingleStep, - userId($record) { - return $record.get("user_id"); }, - organizationId($record) { - return $record.get("organization_id"); + comments: { + applyPlan($where, fieldArgs) { + assertAllowed20(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: commentIdentifier, + alias: pgResource_commentPgResource.name, + localAttributes: registryConfig.pgRelations.post.commentsByTheirPostId.localAttributes, + remoteAttributes: registryConfig.pgRelations.post.commentsByTheirPostId.remoteAttributes + }; + fieldArgs.apply($rel); + } }, - createdAt($record) { - return $record.get("created_at"); + commentsExist: { + applyPlan($where, fieldArgs) { + assertAllowed20(fieldArgs, "scalar"); + const $subQuery = $where.existsPlan({ + tableExpression: commentIdentifier, + alias: pgResource_commentPgResource.name, + $equals: fieldArgs.get() + }); + registryConfig.pgRelations.post.commentsByTheirPostId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.post.commentsByTheirPostId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + } }, - organization($record) { - return pgResource_organizationPgResource.get({ - id: $record.get("organization_id") - }); + downvotes: { + applyPlan($where, fieldArgs) { + assertAllowed20(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: downvoteIdentifier, + alias: pgResource_downvotePgResource.name, + localAttributes: registryConfig.pgRelations.post.downvotesByTheirPostId.localAttributes, + remoteAttributes: registryConfig.pgRelations.post.downvotesByTheirPostId.remoteAttributes + }; + fieldArgs.apply($rel); + } }, - user($record) { - return pgResource_userPgResource.get({ - id: $record.get("user_id") - }); - } - }, - UUID: { - serialize: UUIDSerialize, - parseValue(value) { - return coerce("" + value); + downvotesExist: { + applyPlan($where, fieldArgs) { + assertAllowed20(fieldArgs, "scalar"); + const $subQuery = $where.existsPlan({ + tableExpression: downvoteIdentifier, + alias: pgResource_downvotePgResource.name, + $equals: fieldArgs.get() + }); + registryConfig.pgRelations.post.downvotesByTheirPostId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.post.downvotesByTheirPostId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + } }, - parseLiteral(ast) { - if (ast.kind !== Kind.STRING) throw new GraphQLError(`${"UUID" ?? "This scalar"} can only parse string values (kind = '${ast.kind}')`); - return coerce(ast.value); - } - }, - Datetime: { - serialize: UUIDSerialize, - parseValue: UUIDSerialize, - parseLiteral(ast) { - if (ast.kind !== Kind.STRING) throw new GraphQLError(`${"Datetime" ?? "This scalar"} can only parse string values (kind='${ast.kind}')`); - return ast.value; + project: { + applyPlan($where, fieldArgs) { + assertAllowed21(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: projectIdentifier, + alias: pgResource_projectPgResource.name + }); + registryConfig.pgRelations.post.projectByMyProjectId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.post.projectByMyProjectId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + }, + user: { + applyPlan($where, fieldArgs) { + assertAllowed21(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: pgResource_userPgResource.name + }); + registryConfig.pgRelations.post.userByMyUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.post.userByMyUserId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + }, + and: { + applyPlan($where, fieldArgs) { + assertAllowed22(fieldArgs, "list"); + const $and = $where.andPlan(); + fieldArgs.apply($and); + } + }, + or: { + applyPlan($where, fieldArgs) { + assertAllowed22(fieldArgs, "list"); + const $or = $where.orPlan(); + fieldArgs.apply(() => $or.andPlan()); + } + }, + not: { + applyPlan($where, fieldArgs) { + assertAllowed22(fieldArgs, "object"); + const $and = $where.notPlan().andPlan(); + fieldArgs.apply($and); + } } }, - Organization: { - __assertStep: assertPgClassSingleStep, - id($parent) { - const specifier = nodeIdHandlerByTypeName.Organization.plan($parent); - return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Organization.codec.name].encode); - }, - rowId($record) { - return $record.get("id"); + UUIDFilter: { + isNull: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = undefined ? undefined(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec ? resolveInputCodec(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue ? resolveSqlValue($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + } }, - name($record) { - return $record.get("name"); + equalTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve2(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + } }, - slug($record) { - return $record.get("slug"); + notEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve3(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + } }, - createdAt($record) { - return $record.get("created_at"); + distinctFrom: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve4(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); + } }, - updatedAt($record) { - return $record.get("updated_at"); + notDistinctFrom: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve5(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + } }, - projects: { - plan($record) { - const $records = pgResource_projectPgResource.find({ - organization_id: $record.get("id") - }); - return connection($records); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("ProjectOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed7(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + in: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec3 ? resolveInputCodec3(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve6(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); } }, - userOrganizations: { - plan($record) { - const $records = resource_user_organizationPgResource.find({ - organization_id: $record.get("id") - }); - return connection($records); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("UserOrganizationOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed8(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + notIn: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec3 ? resolveInputCodec3(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve7(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); } - } - }, - ProjectConnection: { - __assertStep: ConnectionStep, - nodes($connection) { - return $connection.nodes(); - }, - edges($connection) { - return $connection.edges(); }, - pageInfo($connection) { - return $connection.pageInfo(); + lessThan: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve8(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + } }, - totalCount($connection) { - return $connection.cloneSubplanWithoutPagination("aggregate").singleAsRecord().select(sql`count(*)`, TYPES.bigint, !1); + lessThanOrEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve9(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); + } }, - aggregates($connection) { - return $connection.cloneSubplanWithoutPagination("aggregate").single(); + greaterThan: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve10(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + } }, - groupedAggregates: { - plan($connection) { - return $connection.cloneSubplanWithoutPagination("aggregate"); - }, - args: { - groupBy: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect, input) { - var _a, _b; - const val = input.getRaw().eval(); - if (!Array.isArray(val)) throw new Error("Invalid!"); - for (const group of val) { - const config = getEnumValueConfig(ProjectGroupBy, group), - plan = (_b = (_a = config === null || config === void 0 ? void 0 : config.extensions) === null || _a === void 0 ? void 0 : _a.grafast) === null || _b === void 0 ? void 0 : _b.applyPlan; - if (typeof plan === "function") plan($pgSelect); - } - return null; - } - }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } - } + greaterThanOrEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve11(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); } } }, - Project: { - __assertStep: assertPgClassSingleStep, - id($parent) { - const specifier = nodeIdHandlerByTypeName.Project.plan($parent); - return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Project.codec.name].encode); - }, - rowId($record) { - return $record.get("id"); - }, - name($record) { - return $record.get("name"); - }, - image($record) { - return $record.get("image"); - }, - slug($record) { - return $record.get("slug"); - }, - description($record) { - return $record.get("description"); - }, - organizationId($record) { - return $record.get("organization_id"); - }, - createdAt($record) { - return $record.get("created_at"); + StringFilter: { + isNull: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = undefined ? undefined(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec4 ? resolveInputCodec4(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue2 ? resolveSqlValue2($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve12(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + } }, - updatedAt($record) { - return $record.get("updated_at"); + equalTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve13(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + } }, - organization($record) { - return pgResource_organizationPgResource.get({ - id: $record.get("organization_id") - }); + notEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve14(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + } }, - posts: { - plan($record) { - const $records = pgResource_postPgResource.find({ - project_id: $record.get("id") - }); - return connection($records); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed9(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + distinctFrom: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve15(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); } - } - }, - PostConnection: { - __assertStep: ConnectionStep, - nodes($connection) { - return $connection.nodes(); }, - edges($connection) { - return $connection.edges(); + notDistinctFrom: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve16(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + } }, - pageInfo($connection) { - return $connection.pageInfo(); + in: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec6 ? resolveInputCodec6(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve17(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); + } }, - totalCount($connection) { - return $connection.cloneSubplanWithoutPagination("aggregate").singleAsRecord().select(sql`count(*)`, TYPES.bigint, !1); + notIn: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec6 ? resolveInputCodec6(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve18(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); + } }, - aggregates($connection) { - return $connection.cloneSubplanWithoutPagination("aggregate").single(); + lessThan: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve19(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + } }, - groupedAggregates: { - plan($connection) { - return $connection.cloneSubplanWithoutPagination("aggregate"); - }, - args: { - groupBy: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect, input) { - var _a, _b; - const val = input.getRaw().eval(); - if (!Array.isArray(val)) throw new Error("Invalid!"); - for (const group of val) { - const config = getEnumValueConfig(PostGroupBy, group), - plan = (_b = (_a = config === null || config === void 0 ? void 0 : config.extensions) === null || _a === void 0 ? void 0 : _a.grafast) === null || _b === void 0 ? void 0 : _b.applyPlan; - if (typeof plan === "function") plan($pgSelect); - } - return null; - } - }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } - } + lessThanOrEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve20(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); } - } - }, - Post: { - __assertStep: assertPgClassSingleStep, - id($parent) { - const specifier = nodeIdHandlerByTypeName.Post.plan($parent); - return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Post.codec.name].encode); - }, - rowId($record) { - return $record.get("id"); - }, - title($record) { - return $record.get("title"); }, - description($record) { - return $record.get("description"); - }, - projectId($record) { - return $record.get("project_id"); - }, - userId($record) { - return $record.get("user_id"); + greaterThan: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve21(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + } }, - createdAt($record) { - return $record.get("created_at"); + greaterThanOrEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve22(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); + } }, - updatedAt($record) { - return $record.get("updated_at"); + includes: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput ? lambda($input, resolveInput) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve23(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "includes" + }); + $where.where(fragment); + } }, - project($record) { - return pgResource_projectPgResource.get({ - id: $record.get("project_id") - }); + notIncludes: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput2 ? lambda($input, resolveInput2) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve24(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIncludes" + }); + $where.where(fragment); + } }, - user($record) { - return pgResource_userPgResource.get({ - id: $record.get("user_id") - }); + includesInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput3 ? lambda($input, resolveInput3) : $input, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve25(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "includesInsensitive" + }); + $where.where(fragment); + } }, - upvotes: { - plan($record) { - const $records = pgResource_upvotePgResource.find({ - post_id: $record.get("id") - }); - return connection($records); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed10(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + notIncludesInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput4 ? lambda($input, resolveInput4) : $input, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve26(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIncludesInsensitive" + }); + $where.where(fragment); + } + }, + startsWith: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput5 ? lambda($input, resolveInput5) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve27(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "startsWith" + }); + $where.where(fragment); } - } - }, - User: { - __assertStep: assertPgClassSingleStep, - id($parent) { - const specifier = nodeIdHandlerByTypeName.User.plan($parent); - return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.User.codec.name].encode); }, - rowId($record) { - return $record.get("id"); + notStartsWith: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput6 ? lambda($input, resolveInput6) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve28(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notStartsWith" + }); + $where.where(fragment); + } }, - createdAt($record) { - return $record.get("created_at"); + startsWithInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput7 ? lambda($input, resolveInput7) : $input, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve29(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "startsWithInsensitive" + }); + $where.where(fragment); + } }, - updatedAt($record) { - return $record.get("updated_at"); + notStartsWithInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput8 ? lambda($input, resolveInput8) : $input, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve30(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notStartsWithInsensitive" + }); + $where.where(fragment); + } }, - hidraId($record) { - return $record.get("hidra_id"); + endsWith: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput9 ? lambda($input, resolveInput9) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve31(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "endsWith" + }); + $where.where(fragment); + } }, - username($record) { - return $record.get("username"); + notEndsWith: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput10 ? lambda($input, resolveInput10) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve32(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEndsWith" + }); + $where.where(fragment); + } }, - firstName($record) { - return $record.get("first_name"); + endsWithInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput11 ? lambda($input, resolveInput11) : $input, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve33(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "endsWithInsensitive" + }); + $where.where(fragment); + } }, - lastName($record) { - return $record.get("last_name"); + notEndsWithInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = resolveInput12 ? lambda($input, resolveInput12) : $input, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve34(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEndsWithInsensitive" + }); + $where.where(fragment); + } + }, + like: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve35(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "like" + }); + $where.where(fragment); + } }, - posts: { - plan($record) { - const $records = pgResource_postPgResource.find({ - user_id: $record.get("id") - }); - return connection($records); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed11(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + notLike: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve36(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notLike" + }); + $where.where(fragment); } }, - upvotes: { - plan($record) { - const $records = pgResource_upvotePgResource.find({ - user_id: $record.get("id") - }); - return connection($records); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed12(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + likeInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve37(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "likeInsensitive" + }); + $where.where(fragment); } }, - userOrganizations: { - plan($record) { - const $records = resource_user_organizationPgResource.find({ - user_id: $record.get("id") - }); - return connection($records); - }, - args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } - }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } - }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } - }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } - }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } - }, - orderBy: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val, info) { - const $value = val.getRaw(), - $select = $connection.getSubplan(); - applyOrderToPlan($select, $value, info.schema.getType("UserOrganizationOrderBy")); - return null; - } - }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } - }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed13(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } + notLikeInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve38(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notLikeInsensitive" + }); + $where.where(fragment); } - } - }, - Cursor: { - serialize: UUIDSerialize, - parseValue: UUIDSerialize, - parseLiteral(ast) { - if (ast.kind !== Kind.STRING) throw new GraphQLError(`${"Cursor" ?? "This scalar"} can only parse string values (kind='${ast.kind}')`); - return ast.value; - } - }, - PostOrderBy: { - NATURAL: { - applyPlan() {} }, - PRIMARY_KEY_ASC: { - applyPlan(step) { - postUniques[0].attributes.forEach(attributeName => { - const attribute = postCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + equalToInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier4 ? resolveSqlIdentifier4(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec8 ? resolveInputCodec8(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue3 ? resolveSqlValue3($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve13(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalToInsensitive" }); - }); - step.setOrderIsUnique(); + $where.where(fragment); } }, - PRIMARY_KEY_DESC: { - applyPlan(step) { - postUniques[0].attributes.forEach(attributeName => { - const attribute = postCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + notEqualToInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier5 ? resolveSqlIdentifier5(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec9 ? resolveInputCodec9(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue4 ? resolveSqlValue4($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve14(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualToInsensitive" }); - }); - step.setOrderIsUnique(); + $where.where(fragment); } }, - ROW_ID_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); + distinctFromInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier6 ? resolveSqlIdentifier6(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec10 ? resolveInputCodec10(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue5 ? resolveSqlValue5($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve15(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFromInsensitive" + }); + $where.where(fragment); } }, - ROW_ID_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "id", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); + notDistinctFromInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier7 ? resolveSqlIdentifier7(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec11 ? resolveInputCodec11(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue6 ? resolveSqlValue6($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve16(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFromInsensitive" + }); + $where.where(fragment); } }, - TITLE_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "title", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + inInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier8 ? resolveSqlIdentifier8(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec12 ? resolveInputCodec12(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue7 ? resolveSqlValue7($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve17(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "inInsensitive" + }); + $where.where(fragment); + } + }, + notInInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier9 ? resolveSqlIdentifier9(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec13 ? resolveInputCodec13(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue8 ? resolveSqlValue8($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve18(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notInInsensitive" + }); + $where.where(fragment); + } + }, + lessThanInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier10 ? resolveSqlIdentifier10(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec14 ? resolveInputCodec14(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue9 ? resolveSqlValue9($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve19(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanInsensitive" + }); + $where.where(fragment); } }, - TITLE_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "title", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + lessThanOrEqualToInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier11 ? resolveSqlIdentifier11(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec15 ? resolveInputCodec15(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue10 ? resolveSqlValue10($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve20(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualToInsensitive" + }); + $where.where(fragment); } }, - DESCRIPTION_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "description", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + greaterThanInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier12 ? resolveSqlIdentifier12(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec16 ? resolveInputCodec16(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue11 ? resolveSqlValue11($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve21(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanInsensitive" + }); + $where.where(fragment); } }, - DESCRIPTION_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "description", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + greaterThanOrEqualToInsensitive: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier13 ? resolveSqlIdentifier13(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec17 ? resolveInputCodec17(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue12 ? resolveSqlValue12($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve22(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualToInsensitive" + }); + $where.where(fragment); } - }, - PROJECT_ID_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "project_id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + } + }, + DatetimeFilter: { + isNull: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = undefined ? undefined(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec18 ? resolveInputCodec18(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue13 ? resolveSqlValue13($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve39(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); } }, - PROJECT_ID_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "project_id", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + equalTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve40(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); } }, - USER_ID_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "user_id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + notEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve41(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); } }, - USER_ID_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "user_id", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + distinctFrom: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve42(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); } }, - CREATED_AT_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "created_at", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + notDistinctFrom: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve43(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); } }, - CREATED_AT_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "created_at", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + in: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec20 ? resolveInputCodec20(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve44(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); } }, - UPDATED_AT_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "updated_at", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + notIn: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec20 ? resolveInputCodec20(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve45(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); } }, - UPDATED_AT_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "updated_at", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); + lessThan: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve46(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); } }, - UPVOTES_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); + lessThanOrEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve47(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); } }, - UPVOTES_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); + greaterThan: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve48(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + } + }, + greaterThanOrEqualTo: { + applyPlan($where, fieldArgs) { + if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); + const $input = fieldArgs.getRaw(); + if ($input.evalIs(void 0)) return; + const { + fieldName: parentFieldName, + attributeName, + attribute, + codec, + expression + } = $where.extensions.pgFilterAttribute, + sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, + sourceCodec = codec ?? attribute.codec, + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (false && $input.evalIs(null)) return; + if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $resolvedInput = undefined ? lambda($input, undefined) : $input, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve49(sqlIdentifier, sqlValue, $input, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); } - }, - UPVOTES_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, - direction: "ASC" + } + }, + PostToManyUpvoteFilter: { + every: { + applyPlan($where, fieldArgs) { + assertAllowed23(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); + fieldArgs.apply($subQuery.notPlan().andPlan()); } }, - UPVOTES_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, - direction: "DESC" + some: { + applyPlan($where, fieldArgs) { + assertAllowed23(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); + fieldArgs.apply($subQuery); } }, - UPVOTES_DISTINCT_COUNT_POST_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, - direction: "ASC" + none: { + applyPlan($where, fieldArgs) { + assertAllowed23(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); + fieldArgs.apply($subQuery); } }, - UPVOTES_DISTINCT_COUNT_POST_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, - direction: "DESC" + aggregates: { + applyPlan($where, fieldArgs) { + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateConditionStep($where, { + sql, + tableExpression, + alias + }, pgWhereConditionSpecListToSQL); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); + fieldArgs.apply($subQuery); + } + } + }, + UpvoteFilter: { + rowId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec8; + fieldArgs.apply($col); } }, - UPVOTES_DISTINCT_COUNT_USER_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, - direction: "ASC" - }); + postId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec9; + fieldArgs.apply($col); } }, - UPVOTES_DISTINCT_COUNT_USER_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, - direction: "DESC" - }); + userId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec10; + fieldArgs.apply($col); } }, - UPVOTES_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, - direction: "ASC" - }); + createdAt: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec11; + fieldArgs.apply($col); } }, - UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, - direction: "DESC" - }); + updatedAt: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec12; + fieldArgs.apply($col); } }, - UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + post: { + applyPlan($where, fieldArgs) { + assertAllowed24(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: pgResource_postPgResource.name }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, - direction: "ASC" + registryConfig.pgRelations.upvote.postByMyPostId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.upvote.postByMyPostId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); + fieldArgs.apply($subQuery); } }, - UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + user: { + applyPlan($where, fieldArgs) { + assertAllowed24(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: pgResource_userPgResource.name }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, - direction: "DESC" + registryConfig.pgRelations.upvote.userByMyUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.upvote.userByMyUserId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); + fieldArgs.apply($subQuery); } - } - }, - PostCondition: { - rowId: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "id", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "id", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - title: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "title", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "title", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.title.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - description: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "description", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "description", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.description.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - projectId: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "project_id", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "project_id", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.project_id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true }, - userId: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "user_id", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "user_id", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.user_id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + and: { + applyPlan($where, fieldArgs) { + assertAllowed25(fieldArgs, "list"); + const $and = $where.andPlan(); + fieldArgs.apply($and); + } }, - createdAt: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.created_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + or: { + applyPlan($where, fieldArgs) { + assertAllowed25(fieldArgs, "list"); + const $or = $where.orPlan(); + fieldArgs.apply(() => $or.andPlan()); + } }, - updatedAt: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "updated_at", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "updated_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.updated_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + not: { + applyPlan($where, fieldArgs) { + assertAllowed25(fieldArgs, "object"); + const $and = $where.notPlan().andPlan(); + fieldArgs.apply($and); + } } }, - PostFilter: { + UserFilter: { rowId: { applyPlan($where, fieldArgs) { const $raw = fieldArgs.getRaw(); @@ -9288,154 +14550,405 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec; + $col.extensions.pgFilterAttribute = colSpec13; fieldArgs.apply($col); } }, - title: { + createdAt: { applyPlan($where, fieldArgs) { const $raw = fieldArgs.getRaw(); if ($raw.evalIs(void 0)) return; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec2; + $col.extensions.pgFilterAttribute = colSpec14; fieldArgs.apply($col); } }, - description: { + updatedAt: { applyPlan($where, fieldArgs) { const $raw = fieldArgs.getRaw(); if ($raw.evalIs(void 0)) return; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec3; + $col.extensions.pgFilterAttribute = colSpec15; fieldArgs.apply($col); } }, - projectId: { + hidraId: { applyPlan($where, fieldArgs) { const $raw = fieldArgs.getRaw(); if ($raw.evalIs(void 0)) return; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec4; + $col.extensions.pgFilterAttribute = colSpec16; fieldArgs.apply($col); } }, - userId: { + username: { applyPlan($where, fieldArgs) { const $raw = fieldArgs.getRaw(); if ($raw.evalIs(void 0)) return; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec5; + $col.extensions.pgFilterAttribute = colSpec17; fieldArgs.apply($col); } }, - createdAt: { + firstName: { applyPlan($where, fieldArgs) { const $raw = fieldArgs.getRaw(); if ($raw.evalIs(void 0)) return; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec6; + $col.extensions.pgFilterAttribute = colSpec18; fieldArgs.apply($col); } }, - updatedAt: { + lastName: { applyPlan($where, fieldArgs) { const $raw = fieldArgs.getRaw(); if ($raw.evalIs(void 0)) return; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec7; + $col.extensions.pgFilterAttribute = colSpec19; fieldArgs.apply($col); } }, + posts: { + applyPlan($where, fieldArgs) { + assertAllowed26(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: postIdentifier, + alias: pgResource_postPgResource.name, + localAttributes: registryConfig.pgRelations.user.postsByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.postsByTheirUserId.remoteAttributes + }; + fieldArgs.apply($rel); + } + }, + postsExist: { + applyPlan($where, fieldArgs) { + assertAllowed26(fieldArgs, "scalar"); + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: pgResource_postPgResource.name, + $equals: fieldArgs.get() + }); + registryConfig.pgRelations.user.postsByTheirUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.user.postsByTheirUserId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + } + }, upvotes: { applyPlan($where, fieldArgs) { - assertAllowed14(fieldArgs, "object"); + assertAllowed26(fieldArgs, "object"); const $rel = $where.andPlan(); $rel.extensions.pgFilterRelation = { tableExpression: upvoteIdentifier, alias: pgResource_upvotePgResource.name, - localAttributes: registryConfig.pgRelations.post.upvotesByTheirPostId.localAttributes, - remoteAttributes: registryConfig.pgRelations.post.upvotesByTheirPostId.remoteAttributes + localAttributes: registryConfig.pgRelations.user.upvotesByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.upvotesByTheirUserId.remoteAttributes }; fieldArgs.apply($rel); } }, upvotesExist: { applyPlan($where, fieldArgs) { - assertAllowed14(fieldArgs, "scalar"); + assertAllowed26(fieldArgs, "scalar"); const $subQuery = $where.existsPlan({ tableExpression: upvoteIdentifier, alias: pgResource_upvotePgResource.name, $equals: fieldArgs.get() }); - registryConfig.pgRelations.post.upvotesByTheirPostId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.post.upvotesByTheirPostId.remoteAttributes[i]; + registryConfig.pgRelations.user.upvotesByTheirUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.user.upvotesByTheirUserId.remoteAttributes[i]; $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); } }, - project: { + userOrganizations: { + applyPlan($where, fieldArgs) { + assertAllowed26(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: userOrganizationIdentifier, + alias: resource_user_organizationPgResource.name, + localAttributes: registryConfig.pgRelations.user.userOrganizationsByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.userOrganizationsByTheirUserId.remoteAttributes + }; + fieldArgs.apply($rel); + } + }, + userOrganizationsExist: { applyPlan($where, fieldArgs) { - assertAllowed15(fieldArgs, "object"); + assertAllowed26(fieldArgs, "scalar"); const $subQuery = $where.existsPlan({ - tableExpression: projectIdentifier, - alias: pgResource_projectPgResource.name + tableExpression: userOrganizationIdentifier, + alias: resource_user_organizationPgResource.name, + $equals: fieldArgs.get() }); - registryConfig.pgRelations.post.projectByMyProjectId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.post.projectByMyProjectId.remoteAttributes[i]; + registryConfig.pgRelations.user.userOrganizationsByTheirUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.user.userOrganizationsByTheirUserId.remoteAttributes[i]; $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); - fieldArgs.apply($subQuery); } }, - user: { + comments: { + applyPlan($where, fieldArgs) { + assertAllowed26(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: commentIdentifier, + alias: pgResource_commentPgResource.name, + localAttributes: registryConfig.pgRelations.user.commentsByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.commentsByTheirUserId.remoteAttributes + }; + fieldArgs.apply($rel); + } + }, + commentsExist: { applyPlan($where, fieldArgs) { - assertAllowed15(fieldArgs, "object"); + assertAllowed26(fieldArgs, "scalar"); const $subQuery = $where.existsPlan({ - tableExpression: userIdentifier, - alias: pgResource_userPgResource.name + tableExpression: commentIdentifier, + alias: pgResource_commentPgResource.name, + $equals: fieldArgs.get() }); - registryConfig.pgRelations.post.userByMyUserId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.post.userByMyUserId.remoteAttributes[i]; + registryConfig.pgRelations.user.commentsByTheirUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.user.commentsByTheirUserId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + } + }, + downvotes: { + applyPlan($where, fieldArgs) { + assertAllowed26(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: downvoteIdentifier, + alias: pgResource_downvotePgResource.name, + localAttributes: registryConfig.pgRelations.user.downvotesByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.downvotesByTheirUserId.remoteAttributes + }; + fieldArgs.apply($rel); + } + }, + downvotesExist: { + applyPlan($where, fieldArgs) { + assertAllowed26(fieldArgs, "scalar"); + const $subQuery = $where.existsPlan({ + tableExpression: downvoteIdentifier, + alias: pgResource_downvotePgResource.name, + $equals: fieldArgs.get() + }); + registryConfig.pgRelations.user.downvotesByTheirUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.user.downvotesByTheirUserId.remoteAttributes[i]; $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); - fieldArgs.apply($subQuery); } }, and: { applyPlan($where, fieldArgs) { - assertAllowed16(fieldArgs, "list"); + assertAllowed27(fieldArgs, "list"); const $and = $where.andPlan(); fieldArgs.apply($and); } }, or: { applyPlan($where, fieldArgs) { - assertAllowed16(fieldArgs, "list"); + assertAllowed27(fieldArgs, "list"); const $or = $where.orPlan(); fieldArgs.apply(() => $or.andPlan()); } }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed16(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); + not: { + applyPlan($where, fieldArgs) { + assertAllowed27(fieldArgs, "object"); + const $and = $where.notPlan().andPlan(); + fieldArgs.apply($and); + } + } + }, + UserToManyPostFilter: { + every: { + applyPlan($where, fieldArgs) { + assertAllowed28(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery.notPlan().andPlan()); + } + }, + some: { + applyPlan($where, fieldArgs) { + assertAllowed28(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + }, + none: { + applyPlan($where, fieldArgs) { + assertAllowed28(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + }, + aggregates: { + applyPlan($where, fieldArgs) { + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateConditionStep($where, { + sql, + tableExpression, + alias + }, pgWhereConditionSpecListToSQL); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + } + }, + PostAggregatesFilter: { + filter: { + applyPlan($subquery, fieldArgs) { + const $condition = new PgConditionStep($subquery, !1, "AND"); + fieldArgs.apply($condition); + } + }, + distinctCount: { + applyPlan($subquery, fieldArgs) { + fieldArgs.apply($subquery.forAggregate(aggregateSpec)); + } + } + }, + PostDistinctCountAggregateFilter: { + rowId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_post.attributes.id.codec) + }; + fieldArgs.apply($col); + } + }, + title: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("title")}`, spec_post.attributes.title.codec) + }; + fieldArgs.apply($col); + } + }, + description: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_post.attributes.description.codec) + }; + fieldArgs.apply($col); + } + }, + projectId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec) + }; + fieldArgs.apply($col); + } + }, + userId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec) + }; + fieldArgs.apply($col); + } + }, + createdAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec) + }; + fieldArgs.apply($col); + } + }, + updatedAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec) + }; + fieldArgs.apply($col); } } }, - UUIDFilter: { + BigIntFilter: { isNull: { applyPlan($where, fieldArgs) { if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); @@ -9454,9 +14967,9 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec ? resolveInputCodec(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue ? resolveSqlValue($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve(sqlIdentifier, sqlValue, $input, $where, { + inputCodec = resolveInputCodec21 ? resolveInputCodec21(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue14 ? resolveSqlValue14($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), + fragment = resolve50(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, operatorName: "isNull" }); @@ -9477,13 +14990,13 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve2(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve51(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, operatorName: "equalTo" }); @@ -9504,13 +15017,13 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve3(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve52(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, operatorName: "notEqualTo" }); @@ -9531,13 +15044,13 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve4(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve53(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, operatorName: "distinctFrom" }); @@ -9558,13 +15071,13 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve5(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve54(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, operatorName: "notDistinctFrom" }); @@ -9585,13 +15098,13 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec3 ? resolveInputCodec3(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec23 ? resolveInputCodec23(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve6(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve55(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, operatorName: "in" }); @@ -9612,13 +15125,13 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec3 ? resolveInputCodec3(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec23 ? resolveInputCodec23(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve7(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve56(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, operatorName: "notIn" }); @@ -9639,211 +15152,20 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve8(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThan" - }); - $where.where(fragment); - } - }, - lessThanOrEqualTo: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve9(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThanOrEqualTo" - }); - $where.where(fragment); - } - }, - greaterThan: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve10(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThan" - }); - $where.where(fragment); - } - }, - greaterThanOrEqualTo: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier ? resolveSqlIdentifier(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve11(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThanOrEqualTo" - }); - $where.where(fragment); - } - } - }, - StringFilter: { - isNull: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = undefined ? undefined(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec4 ? resolveInputCodec4(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue2 ? resolveSqlValue2($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve12(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "isNull" - }); - $where.where(fragment); - } - }, - equalTo: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve13(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "equalTo" - }); - $where.where(fragment); - } - }, - notEqualTo: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve14(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notEqualTo" - }); - $where.where(fragment); - } - }, - distinctFrom: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve15(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve57(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, - operatorName: "distinctFrom" + operatorName: "lessThan" }); $where.where(fragment); } }, - notDistinctFrom: { + lessThanOrEqualTo: { applyPlan($where, fieldArgs) { if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); const $input = fieldArgs.getRaw(); @@ -9857,20 +15179,20 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve16(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve58(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, - operatorName: "notDistinctFrom" + operatorName: "lessThanOrEqualTo" }); $where.where(fragment); } }, - in: { + greaterThan: { applyPlan($where, fieldArgs) { if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); const $input = fieldArgs.getRaw(); @@ -9884,20 +15206,20 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec6 ? resolveInputCodec6(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve17(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve59(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, - operatorName: "in" + operatorName: "greaterThan" }); $where.where(fragment); } }, - notIn: { + greaterThanOrEqualTo: { applyPlan($where, fieldArgs) { if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); const $input = fieldArgs.getRaw(); @@ -9911,1133 +15233,1035 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } = $where.extensions.pgFilterAttribute, sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; if (false && $input.evalIs(null)) return; if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec6 ? resolveInputCodec6(codec ?? attribute.codec) : codec ?? attribute.codec, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve18(sqlIdentifier, sqlValue, $input, $where, { + fragment = resolve60(sqlIdentifier, sqlValue, $input, $where, { fieldName: parentFieldName ?? null, - operatorName: "notIn" + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); + } + } + }, + BigInt: { + serialize: UUIDSerialize, + parseValue: UUIDSerialize, + parseLiteral(ast) { + if (ast.kind !== Kind.STRING) throw new GraphQLError(`${"BigInt" ?? "This scalar"} can only parse string values (kind='${ast.kind}')`); + return ast.value; + } + }, + UserToManyUpvoteFilter: { + every: { + applyPlan($where, fieldArgs) { + assertAllowed29(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery.notPlan().andPlan()); + } + }, + some: { + applyPlan($where, fieldArgs) { + assertAllowed29(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + }, + none: { + applyPlan($where, fieldArgs) { + assertAllowed29(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + }, + aggregates: { + applyPlan($where, fieldArgs) { + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateConditionStep($where, { + sql, + tableExpression, + alias + }, pgWhereConditionSpecListToSQL); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + } + }, + UpvoteAggregatesFilter: { + filter: { + applyPlan($subquery, fieldArgs) { + const $condition = new PgConditionStep($subquery, !1, "AND"); + fieldArgs.apply($condition); + } + }, + distinctCount: { + applyPlan($subquery, fieldArgs) { + fieldArgs.apply($subquery.forAggregate(aggregateSpec)); + } + } + }, + UpvoteDistinctCountAggregateFilter: { + rowId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec) + }; + fieldArgs.apply($col); + } + }, + postId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec) + }; + fieldArgs.apply($col); + } + }, + userId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec) + }; + fieldArgs.apply($col); + } + }, + createdAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec) + }; + fieldArgs.apply($col); + } + }, + updatedAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec) + }; + fieldArgs.apply($col); + } + } + }, + UserToManyUserOrganizationFilter: { + every: { + applyPlan($where, fieldArgs) { + assertAllowed30(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery.notPlan().andPlan()); + } + }, + some: { + applyPlan($where, fieldArgs) { + assertAllowed30(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.existsPlan({ + tableExpression, + alias + }); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + }, + none: { + applyPlan($where, fieldArgs) { + assertAllowed30(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - lessThan: { + aggregates: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve19(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThan" - }); - $where.where(fragment); + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateConditionStep($where, { + sql, + tableExpression, + alias + }, pgWhereConditionSpecListToSQL); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + } + }, + UserOrganizationFilter: { + userId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec20; + fieldArgs.apply($col); } }, - lessThanOrEqualTo: { + organizationId: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve20(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThanOrEqualTo" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec21; + fieldArgs.apply($col); } }, - greaterThan: { + createdAt: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve21(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThan" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec22; + fieldArgs.apply($col); } }, - greaterThanOrEqualTo: { + organization: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve22(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThanOrEqualTo" - }); - $where.where(fragment); + assertAllowed31(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: organizationIdentifier, + alias: pgResource_organizationPgResource.name + }); + registryConfig.pgRelations.userOrganization.organizationByMyOrganizationId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.userOrganization.organizationByMyOrganizationId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - includes: { + user: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput ? lambda($input, resolveInput) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve23(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "includes" - }); - $where.where(fragment); + assertAllowed31(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: pgResource_userPgResource.name + }); + registryConfig.pgRelations.userOrganization.userByMyUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.userOrganization.userByMyUserId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - notIncludes: { + and: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput2 ? lambda($input, resolveInput2) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve24(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notIncludes" - }); - $where.where(fragment); + assertAllowed32(fieldArgs, "list"); + const $and = $where.andPlan(); + fieldArgs.apply($and); } }, - includesInsensitive: { + or: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput3 ? lambda($input, resolveInput3) : $input, - inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve25(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "includesInsensitive" - }); - $where.where(fragment); + assertAllowed32(fieldArgs, "list"); + const $or = $where.orPlan(); + fieldArgs.apply(() => $or.andPlan()); + } + }, + not: { + applyPlan($where, fieldArgs) { + assertAllowed32(fieldArgs, "object"); + const $and = $where.notPlan().andPlan(); + fieldArgs.apply($and); + } + } + }, + OrganizationFilter: { + rowId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec23; + fieldArgs.apply($col); } }, - notIncludesInsensitive: { + name: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput4 ? lambda($input, resolveInput4) : $input, - inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve26(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notIncludesInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec24; + fieldArgs.apply($col); } }, - startsWith: { + slug: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput5 ? lambda($input, resolveInput5) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve27(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "startsWith" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec25; + fieldArgs.apply($col); } }, - notStartsWith: { + createdAt: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput6 ? lambda($input, resolveInput6) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve28(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notStartsWith" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec26; + fieldArgs.apply($col); } }, - startsWithInsensitive: { + updatedAt: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput7 ? lambda($input, resolveInput7) : $input, - inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve29(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "startsWithInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec27; + fieldArgs.apply($col); } }, - notStartsWithInsensitive: { + projects: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput8 ? lambda($input, resolveInput8) : $input, - inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve30(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notStartsWithInsensitive" - }); - $where.where(fragment); + assertAllowed33(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: projectIdentifier, + alias: pgResource_projectPgResource.name, + localAttributes: registryConfig.pgRelations.organization.projectsByTheirOrganizationId.localAttributes, + remoteAttributes: registryConfig.pgRelations.organization.projectsByTheirOrganizationId.remoteAttributes + }; + fieldArgs.apply($rel); } }, - endsWith: { + projectsExist: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput9 ? lambda($input, resolveInput9) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve31(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "endsWith" - }); - $where.where(fragment); + assertAllowed33(fieldArgs, "scalar"); + const $subQuery = $where.existsPlan({ + tableExpression: projectIdentifier, + alias: pgResource_projectPgResource.name, + $equals: fieldArgs.get() + }); + registryConfig.pgRelations.organization.projectsByTheirOrganizationId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.organization.projectsByTheirOrganizationId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); } }, - notEndsWith: { + userOrganizations: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput10 ? lambda($input, resolveInput10) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve32(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notEndsWith" - }); - $where.where(fragment); + assertAllowed33(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: userOrganizationIdentifier, + alias: resource_user_organizationPgResource.name, + localAttributes: registryConfig.pgRelations.organization.userOrganizationsByTheirOrganizationId.localAttributes, + remoteAttributes: registryConfig.pgRelations.organization.userOrganizationsByTheirOrganizationId.remoteAttributes + }; + fieldArgs.apply($rel); + } + }, + userOrganizationsExist: { + applyPlan($where, fieldArgs) { + assertAllowed33(fieldArgs, "scalar"); + const $subQuery = $where.existsPlan({ + tableExpression: userOrganizationIdentifier, + alias: resource_user_organizationPgResource.name, + $equals: fieldArgs.get() + }); + registryConfig.pgRelations.organization.userOrganizationsByTheirOrganizationId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.organization.userOrganizationsByTheirOrganizationId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); } }, - endsWithInsensitive: { + and: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput11 ? lambda($input, resolveInput11) : $input, - inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve33(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "endsWithInsensitive" - }); - $where.where(fragment); + assertAllowed34(fieldArgs, "list"); + const $and = $where.andPlan(); + fieldArgs.apply($and); } }, - notEndsWithInsensitive: { + or: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = resolveInput12 ? lambda($input, resolveInput12) : $input, - inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve34(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notEndsWithInsensitive" - }); - $where.where(fragment); + assertAllowed34(fieldArgs, "list"); + const $or = $where.orPlan(); + fieldArgs.apply(() => $or.andPlan()); } }, - like: { + not: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed34(fieldArgs, "object"); + const $and = $where.notPlan().andPlan(); + fieldArgs.apply($and); + } + } + }, + OrganizationToManyProjectFilter: { + every: { + applyPlan($where, fieldArgs) { + assertAllowed35(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve35(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "like" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery.notPlan().andPlan()); } }, - notLike: { + some: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed35(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier2 ? resolveSqlIdentifier2(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve36(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notLike" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - likeInsensitive: { + none: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed35(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve37(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "likeInsensitive" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - notLikeInsensitive: { + aggregates: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier3 ? resolveSqlIdentifier3(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve38(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notLikeInsensitive" - }); - $where.where(fragment); + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateConditionStep($where, { + sql, + tableExpression, + alias + }, pgWhereConditionSpecListToSQL); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + } + }, + ProjectFilter: { + rowId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec28; + fieldArgs.apply($col); } }, - equalToInsensitive: { + name: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier4 ? resolveSqlIdentifier4(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec8 ? resolveInputCodec8(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue3 ? resolveSqlValue3($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve13(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "equalToInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec29; + fieldArgs.apply($col); } }, - notEqualToInsensitive: { + image: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier5 ? resolveSqlIdentifier5(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec9 ? resolveInputCodec9(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue4 ? resolveSqlValue4($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve14(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notEqualToInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec30; + fieldArgs.apply($col); } }, - distinctFromInsensitive: { + slug: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier6 ? resolveSqlIdentifier6(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec10 ? resolveInputCodec10(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue5 ? resolveSqlValue5($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve15(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "distinctFromInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec31; + fieldArgs.apply($col); } }, - notDistinctFromInsensitive: { + description: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier7 ? resolveSqlIdentifier7(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec11 ? resolveInputCodec11(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue6 ? resolveSqlValue6($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve16(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notDistinctFromInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec32; + fieldArgs.apply($col); } }, - inInsensitive: { + organizationId: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier8 ? resolveSqlIdentifier8(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec12 ? resolveInputCodec12(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue7 ? resolveSqlValue7($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve17(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "inInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec33; + fieldArgs.apply($col); } }, - notInInsensitive: { + createdAt: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier9 ? resolveSqlIdentifier9(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec13 ? resolveInputCodec13(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue8 ? resolveSqlValue8($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve18(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notInInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec34; + fieldArgs.apply($col); } }, - lessThanInsensitive: { + updatedAt: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier10 ? resolveSqlIdentifier10(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec14 ? resolveInputCodec14(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue9 ? resolveSqlValue9($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve19(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThanInsensitive" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec35; + fieldArgs.apply($col); } }, - lessThanOrEqualToInsensitive: { + posts: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier11 ? resolveSqlIdentifier11(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec15 ? resolveInputCodec15(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue10 ? resolveSqlValue10($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve20(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThanOrEqualToInsensitive" - }); - $where.where(fragment); + assertAllowed36(fieldArgs, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: postIdentifier, + alias: pgResource_postPgResource.name, + localAttributes: registryConfig.pgRelations.project.postsByTheirProjectId.localAttributes, + remoteAttributes: registryConfig.pgRelations.project.postsByTheirProjectId.remoteAttributes + }; + fieldArgs.apply($rel); + } + }, + postsExist: { + applyPlan($where, fieldArgs) { + assertAllowed36(fieldArgs, "scalar"); + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: pgResource_postPgResource.name, + $equals: fieldArgs.get() + }); + registryConfig.pgRelations.project.postsByTheirProjectId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.project.postsByTheirProjectId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + } + }, + organization: { + applyPlan($where, fieldArgs) { + assertAllowed37(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: organizationIdentifier, + alias: pgResource_organizationPgResource.name + }); + registryConfig.pgRelations.project.organizationByMyOrganizationId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.project.organizationByMyOrganizationId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - greaterThanInsensitive: { + and: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier12 ? resolveSqlIdentifier12(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec16 ? resolveInputCodec16(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue11 ? resolveSqlValue11($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve21(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThanInsensitive" - }); - $where.where(fragment); + assertAllowed38(fieldArgs, "list"); + const $and = $where.andPlan(); + fieldArgs.apply($and); } }, - greaterThanOrEqualToInsensitive: { + or: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier13 ? resolveSqlIdentifier13(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec17 ? resolveInputCodec17(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue12 ? resolveSqlValue12($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve22(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThanOrEqualToInsensitive" - }); - $where.where(fragment); + assertAllowed38(fieldArgs, "list"); + const $or = $where.orPlan(); + fieldArgs.apply(() => $or.andPlan()); + } + }, + not: { + applyPlan($where, fieldArgs) { + assertAllowed38(fieldArgs, "object"); + const $and = $where.notPlan().andPlan(); + fieldArgs.apply($and); } } }, - DatetimeFilter: { - isNull: { + ProjectToManyPostFilter: { + every: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed39(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = undefined ? undefined(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec18 ? resolveInputCodec18(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue13 ? resolveSqlValue13($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve39(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "isNull" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery.notPlan().andPlan()); } }, - equalTo: { + some: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed39(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve40(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "equalTo" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - notEqualTo: { + none: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed39(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve41(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notEqualTo" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - distinctFrom: { + aggregates: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve42(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "distinctFrom" - }); - $where.where(fragment); + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateConditionStep($where, { + sql, + tableExpression, + alias + }, pgWhereConditionSpecListToSQL); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + } + }, + ProjectAggregatesFilter: { + filter: { + applyPlan($subquery, fieldArgs) { + const $condition = new PgConditionStep($subquery, !1, "AND"); + fieldArgs.apply($condition); + } + }, + distinctCount: { + applyPlan($subquery, fieldArgs) { + fieldArgs.apply($subquery.forAggregate(aggregateSpec)); + } + } + }, + ProjectDistinctCountAggregateFilter: { + rowId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_project.attributes.id.codec) + }; + fieldArgs.apply($col); + } + }, + name: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("name")}`, spec_project.attributes.name.codec) + }; + fieldArgs.apply($col); + } + }, + image: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("image")}`, spec_project.attributes.image.codec) + }; + fieldArgs.apply($col); } }, - notDistinctFrom: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve43(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notDistinctFrom" - }); - $where.where(fragment); + slug: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("slug")}`, spec_project.attributes.slug.codec) + }; + fieldArgs.apply($col); } }, - in: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec20 ? resolveInputCodec20(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve44(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "in" - }); - $where.where(fragment); + description: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_project.attributes.description.codec) + }; + fieldArgs.apply($col); } }, - notIn: { + organizationId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_project.attributes.organization_id.codec) + }; + fieldArgs.apply($col); + } + }, + createdAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_project.attributes.created_at.codec) + }; + fieldArgs.apply($col); + } + }, + updatedAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_project.attributes.updated_at.codec) + }; + fieldArgs.apply($col); + } + } + }, + OrganizationToManyUserOrganizationFilter: { + every: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed40(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec20 ? resolveInputCodec20(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve45(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notIn" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery.notPlan().andPlan()); } }, - lessThan: { + some: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed40(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve46(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThan" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - lessThanOrEqualTo: { + none: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed40(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve47(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThanOrEqualTo" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - greaterThan: { + aggregates: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve48(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThan" - }); - $where.where(fragment); + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateConditionStep($where, { + sql, + tableExpression, + alias + }, pgWhereConditionSpecListToSQL); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + } + }, + UserOrganizationAggregatesFilter: { + filter: { + applyPlan($subquery, fieldArgs) { + const $condition = new PgConditionStep($subquery, !1, "AND"); + fieldArgs.apply($condition); } }, - greaterThanOrEqualTo: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier14 ? resolveSqlIdentifier14(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve49(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThanOrEqualTo" - }); - $where.where(fragment); + distinctCount: { + applyPlan($subquery, fieldArgs) { + fieldArgs.apply($subquery.forAggregate(aggregateSpec)); } } }, - PostToManyUpvoteFilter: { + UserOrganizationDistinctCountAggregateFilter: { + userId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_userOrganization.attributes.user_id.codec) + }; + fieldArgs.apply($col); + } + }, + organizationId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_userOrganization.attributes.organization_id.codec) + }; + fieldArgs.apply($col); + } + }, + createdAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_userOrganization.attributes.created_at.codec) + }; + fieldArgs.apply($col); + } + } + }, + UserToManyCommentFilter: { every: { applyPlan($where, fieldArgs) { - assertAllowed17(fieldArgs, "object"); + assertAllowed41(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11058,7 +16282,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, some: { applyPlan($where, fieldArgs) { - assertAllowed17(fieldArgs, "object"); + assertAllowed41(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11079,7 +16303,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, none: { applyPlan($where, fieldArgs) { - assertAllowed17(fieldArgs, "object"); + assertAllowed41(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11120,7 +16344,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - UpvoteFilter: { + CommentFilter: { rowId: { applyPlan($where, fieldArgs) { const $raw = fieldArgs.getRaw(); @@ -11128,7 +16352,18 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec8; + $col.extensions.pgFilterAttribute = colSpec36; + fieldArgs.apply($col); + } + }, + message: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec37; fieldArgs.apply($col); } }, @@ -11139,7 +16374,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec9; + $col.extensions.pgFilterAttribute = colSpec38; fieldArgs.apply($col); } }, @@ -11150,7 +16385,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec10; + $col.extensions.pgFilterAttribute = colSpec39; fieldArgs.apply($col); } }, @@ -11161,7 +16396,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec11; + $col.extensions.pgFilterAttribute = colSpec40; fieldArgs.apply($col); } }, @@ -11172,19 +16407,19 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec12; + $col.extensions.pgFilterAttribute = colSpec41; fieldArgs.apply($col); } }, post: { applyPlan($where, fieldArgs) { - assertAllowed18(fieldArgs, "object"); + assertAllowed42(fieldArgs, "object"); const $subQuery = $where.existsPlan({ tableExpression: postIdentifier, alias: pgResource_postPgResource.name }); - registryConfig.pgRelations.upvote.postByMyPostId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.upvote.postByMyPostId.remoteAttributes[i]; + registryConfig.pgRelations.comment.postByMyPostId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.comment.postByMyPostId.remoteAttributes[i]; $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); fieldArgs.apply($subQuery); @@ -11192,13 +16427,13 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, user: { applyPlan($where, fieldArgs) { - assertAllowed18(fieldArgs, "object"); + assertAllowed42(fieldArgs, "object"); const $subQuery = $where.existsPlan({ tableExpression: userIdentifier, alias: pgResource_userPgResource.name }); - registryConfig.pgRelations.upvote.userByMyUserId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.upvote.userByMyUserId.remoteAttributes[i]; + registryConfig.pgRelations.comment.userByMyUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.comment.userByMyUserId.remoteAttributes[i]; $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); fieldArgs.apply($subQuery); @@ -11206,211 +16441,105 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, and: { applyPlan($where, fieldArgs) { - assertAllowed19(fieldArgs, "list"); + assertAllowed43(fieldArgs, "list"); const $and = $where.andPlan(); fieldArgs.apply($and); } }, or: { applyPlan($where, fieldArgs) { - assertAllowed19(fieldArgs, "list"); + assertAllowed43(fieldArgs, "list"); const $or = $where.orPlan(); fieldArgs.apply(() => $or.andPlan()); } }, not: { applyPlan($where, fieldArgs) { - assertAllowed19(fieldArgs, "object"); + assertAllowed43(fieldArgs, "object"); const $and = $where.notPlan().andPlan(); fieldArgs.apply($and); } } }, - UserFilter: { - rowId: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec13; - fieldArgs.apply($col); - } - }, - createdAt: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec14; - fieldArgs.apply($col); - } - }, - updatedAt: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec15; - fieldArgs.apply($col); - } - }, - hidraId: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec16; - fieldArgs.apply($col); - } - }, - username: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec17; - fieldArgs.apply($col); - } - }, - firstName: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec18; - fieldArgs.apply($col); - } - }, - lastName: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec19; - fieldArgs.apply($col); - } - }, - posts: { - applyPlan($where, fieldArgs) { - assertAllowed20(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: postIdentifier, - alias: pgResource_postPgResource.name, - localAttributes: registryConfig.pgRelations.user.postsByTheirUserId.localAttributes, - remoteAttributes: registryConfig.pgRelations.user.postsByTheirUserId.remoteAttributes - }; - fieldArgs.apply($rel); + CommentAggregatesFilter: { + filter: { + applyPlan($subquery, fieldArgs) { + const $condition = new PgConditionStep($subquery, !1, "AND"); + fieldArgs.apply($condition); } }, - postsExist: { - applyPlan($where, fieldArgs) { - assertAllowed20(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: postIdentifier, - alias: pgResource_postPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.user.postsByTheirUserId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.user.postsByTheirUserId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); + distinctCount: { + applyPlan($subquery, fieldArgs) { + fieldArgs.apply($subquery.forAggregate(aggregateSpec)); } - }, - upvotes: { - applyPlan($where, fieldArgs) { - assertAllowed20(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: upvoteIdentifier, - alias: pgResource_upvotePgResource.name, - localAttributes: registryConfig.pgRelations.user.upvotesByTheirUserId.localAttributes, - remoteAttributes: registryConfig.pgRelations.user.upvotesByTheirUserId.remoteAttributes + } + }, + CommentDistinctCountAggregateFilter: { + rowId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec) }; - fieldArgs.apply($rel); - } - }, - upvotesExist: { - applyPlan($where, fieldArgs) { - assertAllowed20(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: upvoteIdentifier, - alias: pgResource_upvotePgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.user.upvotesByTheirUserId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.user.upvotesByTheirUserId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); + fieldArgs.apply($col); } }, - userOrganizations: { - applyPlan($where, fieldArgs) { - assertAllowed20(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: userOrganizationIdentifier, - alias: resource_user_organizationPgResource.name, - localAttributes: registryConfig.pgRelations.user.userOrganizationsByTheirUserId.localAttributes, - remoteAttributes: registryConfig.pgRelations.user.userOrganizationsByTheirUserId.remoteAttributes + message: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec) }; - fieldArgs.apply($rel); + fieldArgs.apply($col); } }, - userOrganizationsExist: { - applyPlan($where, fieldArgs) { - assertAllowed20(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: userOrganizationIdentifier, - alias: resource_user_organizationPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.user.userOrganizationsByTheirUserId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.user.userOrganizationsByTheirUserId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); + postId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec) + }; + fieldArgs.apply($col); } }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed21(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); + userId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec) + }; + fieldArgs.apply($col); } }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed21(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); + createdAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec) + }; + fieldArgs.apply($col); } }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed21(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); + updatedAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec) + }; + fieldArgs.apply($col); } } }, - UserToManyPostFilter: { + UserToManyDownvoteFilter: { every: { applyPlan($where, fieldArgs) { - assertAllowed22(fieldArgs, "object"); + assertAllowed44(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11431,7 +16560,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, some: { applyPlan($where, fieldArgs) { - assertAllowed22(fieldArgs, "object"); + assertAllowed44(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11452,7 +16581,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, none: { applyPlan($where, fieldArgs) { - assertAllowed22(fieldArgs, "object"); + assertAllowed44(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11493,402 +16622,267 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - PostAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } - }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(aggregateSpec)); - } - } - }, - PostDistinctCountAggregateFilter: { + DownvoteFilter: { rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_post.attributes.id.codec) - }; - fieldArgs.apply($col); - } - }, - title: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("title")}`, spec_post.attributes.title.codec) - }; - fieldArgs.apply($col); - } - }, - description: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_post.attributes.description.codec) - }; + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec42; fieldArgs.apply($col); } }, - projectId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec) - }; + postId: { + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec43; fieldArgs.apply($col); } }, userId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec) - }; + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec44; fieldArgs.apply($col); } }, createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec) - }; + applyPlan($where, fieldArgs) { + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec45; fieldArgs.apply($col); } }, updatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec) - }; - fieldArgs.apply($col); - } - } - }, - BigIntFilter: { - isNull: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = undefined ? undefined(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec21 ? resolveInputCodec21(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue14 ? resolveSqlValue14($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve50(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "isNull" - }); - $where.where(fragment); + const $raw = fieldArgs.getRaw(); + if ($raw.evalIs(void 0)) return; + if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const $col = new PgConditionStep($where); + $col.extensions.pgFilterAttribute = colSpec46; + fieldArgs.apply($col); } }, - equalTo: { + post: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve51(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "equalTo" - }); - $where.where(fragment); + assertAllowed45(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: pgResource_postPgResource.name + }); + registryConfig.pgRelations.downvote.postByMyPostId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.downvote.postByMyPostId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - notEqualTo: { + user: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve52(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notEqualTo" - }); - $where.where(fragment); + assertAllowed45(fieldArgs, "object"); + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: pgResource_userPgResource.name + }); + registryConfig.pgRelations.downvote.userByMyUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.downvote.userByMyUserId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - distinctFrom: { + and: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve53(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "distinctFrom" - }); - $where.where(fragment); + assertAllowed46(fieldArgs, "list"); + const $and = $where.andPlan(); + fieldArgs.apply($and); } }, - notDistinctFrom: { + or: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve54(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notDistinctFrom" - }); - $where.where(fragment); + assertAllowed46(fieldArgs, "list"); + const $or = $where.orPlan(); + fieldArgs.apply(() => $or.andPlan()); } }, - in: { + not: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec23 ? resolveInputCodec23(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve55(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "in" - }); - $where.where(fragment); + assertAllowed46(fieldArgs, "object"); + const $and = $where.notPlan().andPlan(); + fieldArgs.apply($and); + } + } + }, + DownvoteAggregatesFilter: { + filter: { + applyPlan($subquery, fieldArgs) { + const $condition = new PgConditionStep($subquery, !1, "AND"); + fieldArgs.apply($condition); } }, - notIn: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec23 ? resolveInputCodec23(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve56(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notIn" - }); - $where.where(fragment); + distinctCount: { + applyPlan($subquery, fieldArgs) { + fieldArgs.apply($subquery.forAggregate(aggregateSpec)); + } + } + }, + DownvoteDistinctCountAggregateFilter: { + rowId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec) + }; + fieldArgs.apply($col); } }, - lessThan: { - applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve57(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThan" - }); - $where.where(fragment); + postId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec) + }; + fieldArgs.apply($col); } }, - lessThanOrEqualTo: { + userId: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec) + }; + fieldArgs.apply($col); + } + }, + createdAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec) + }; + fieldArgs.apply($col); + } + }, + updatedAt: { + applyPlan($parent, fieldArgs) { + const $col = new PgConditionStep($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec) + }; + fieldArgs.apply($col); + } + } + }, + PostToManyCommentFilter: { + every: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed47(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve58(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThanOrEqualTo" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery.notPlan().andPlan()); } }, - greaterThan: { + some: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; + assertAllowed47(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve59(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThan" + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } }, - greaterThanOrEqualTo: { + none: { applyPlan($where, fieldArgs) { - if (!$where.extensions?.pgFilterAttribute) throw new Error("Planning error: expected 'pgFilterAttribute' to be present on the $where plan's extensions; your extensions to `postgraphile-plugin-connection-filter` does not implement the required interfaces."); - const $input = fieldArgs.getRaw(); - if ($input.evalIs(void 0)) return; - const { - fieldName: parentFieldName, - attributeName, - attribute, - codec, - expression - } = $where.extensions.pgFilterAttribute, - sourceAlias = attribute ? attribute.expression ? attribute.expression($where.alias) : sql`${$where.alias}.${sql.identifier(attributeName)}` : expression ? expression : $where.alias, - sourceCodec = codec ?? attribute.codec, - [sqlIdentifier, identifierCodec] = resolveSqlIdentifier15 ? resolveSqlIdentifier15(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; - if (false && $input.evalIs(null)) return; - if (!false && $input.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $resolvedInput = undefined ? lambda($input, undefined) : $input, - inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve60(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThanOrEqualTo" + assertAllowed47(fieldArgs, "object"); + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = $where.notPlan().existsPlan({ + tableExpression, + alias }); - $where.where(fragment); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); + } + }, + aggregates: { + applyPlan($where, fieldArgs) { + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateConditionStep($where, { + sql, + tableExpression, + alias + }, pgWhereConditionSpecListToSQL); + localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + fieldArgs.apply($subQuery); } } }, - BigInt: { - serialize: UUIDSerialize, - parseValue: UUIDSerialize, - parseLiteral(ast) { - if (ast.kind !== Kind.STRING) throw new GraphQLError(`${"BigInt" ?? "This scalar"} can only parse string values (kind='${ast.kind}')`); - return ast.value; - } - }, - UserToManyUpvoteFilter: { + PostToManyDownvoteFilter: { every: { applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "object"); + assertAllowed48(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11909,7 +16903,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, some: { applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "object"); + assertAllowed48(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11930,7 +16924,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, none: { applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "object"); + assertAllowed48(fieldArgs, "object"); if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); const { localAttributes, @@ -11971,924 +16965,1058 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - UpvoteAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } + UpvoteConnection: { + __assertStep: ConnectionStep, + nodes($connection) { + return $connection.nodes(); }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(aggregateSpec)); + edges($connection) { + return $connection.edges(); + }, + pageInfo($connection) { + return $connection.pageInfo(); + }, + totalCount($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").singleAsRecord().select(sql`count(*)`, TYPES.bigint, !1); + }, + aggregates($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").single(); + }, + groupedAggregates: { + plan($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate"); + }, + args: { + groupBy: { + autoApplyAfterParentPlan: true, + applyPlan(_$parent, $pgSelect, input) { + var _a, _b; + const val = input.getRaw().eval(); + if (!Array.isArray(val)) throw new Error("Invalid!"); + for (const group of val) { + const config = getEnumValueConfig(UpvoteGroupBy, group), + plan = (_b = (_a = config === null || config === void 0 ? void 0 : config.extensions) === null || _a === void 0 ? void 0 : _a.grafast) === null || _b === void 0 ? void 0 : _b.applyPlan; + if (typeof plan === "function") plan($pgSelect); + } + return null; + } + }, + having: { + autoApplyAfterParentPlan: true, + applyPlan(_$parent, $pgSelect) { + return $pgSelect.havingPlan(); + } + } } } }, - UpvoteDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec) - }; - fieldArgs.apply($col); + Upvote: { + __assertStep: assertPgClassSingleStep, + id($parent) { + const specifier = nodeIdHandlerByTypeName.Upvote.plan($parent); + return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Upvote.codec.name].encode); + }, + rowId($record) { + return $record.get("id"); + }, + postId($record) { + return $record.get("post_id"); + }, + userId($record) { + return $record.get("user_id"); + }, + createdAt($record) { + return $record.get("created_at"); + }, + updatedAt($record) { + return $record.get("updated_at"); + }, + post($record) { + return pgResource_postPgResource.get({ + id: $record.get("post_id") + }); + }, + user($record) { + return pgResource_userPgResource.get({ + id: $record.get("user_id") + }); + } + }, + UpvoteEdge: { + __assertStep: assertEdgeCapableStep, + cursor($edge) { + return $edge.cursor(); + }, + node($edge) { + return $edge.node(); + } + }, + PageInfo: { + __assertStep: assertPageInfoCapableStep, + hasNextPage($pageInfo) { + return $pageInfo.hasNextPage(); + }, + hasPreviousPage($pageInfo) { + return $pageInfo.hasPreviousPage(); + }, + startCursor($pageInfo) { + return $pageInfo.startCursor(); + }, + endCursor($pageInfo) { + return $pageInfo.endCursor(); + } + }, + UpvoteAggregates: { + __assertStep: assertPgClassSingleStep, + keys($pgSelectSingle) { + const groups = $pgSelectSingle.getClassStep().getGroups(); + if (groups.length > 0) return $pgSelectSingle.select(sql`json_build_array(${sql.join(groups.map(g => g.fragment), ", ")})`, TYPES.json);else return constant(null); + }, + distinctCount($pgSelectSingle) { + return $pgSelectSingle; + } + }, + UpvoteDistinctCountAggregates: { + rowId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("id")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + postId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("post_id")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + userId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("user_id")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + createdAt($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("created_at")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + updatedAt($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("updated_at")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + } + }, + UpvoteGroupBy: { + POST_ID: { + applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan + }, + USER_ID: { + applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan2 + }, + CREATED_AT: { + applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan3 + }, + CREATED_AT_TRUNCATED_TO_HOUR: { + applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan4 + }, + CREATED_AT_TRUNCATED_TO_DAY: { + applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan5 + }, + UPDATED_AT: { + applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan6 + }, + UPDATED_AT_TRUNCATED_TO_HOUR: { + applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan7 + }, + UPDATED_AT_TRUNCATED_TO_DAY: { + applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan8 + } + }, + UpvoteHavingInput: { + AND: { + applyPlan($where, input) { + input.apply($where); + return null; } }, - postId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec) - }; - fieldArgs.apply($col); + OR: { + applyPlan($where, input) { + const $or = new PgOrFilterStep($where); + input.apply($or); + return null; + } + }, + sum: { + applyPlan($having) { + return $having; + } + }, + distinctCount: { + applyPlan($having) { + return $having; + } + }, + min: { + applyPlan($having) { + return $having; } }, - userId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec) - }; - fieldArgs.apply($col); + max: { + applyPlan($having) { + return $having; } }, - createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec) - }; - fieldArgs.apply($col); + average: { + applyPlan($having) { + return $having; } }, - updatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec) - }; - fieldArgs.apply($col); + stddevSample: { + applyPlan($having) { + return $having; } - } - }, - UserToManyUserOrganizationFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed24(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.notPlan().existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery.notPlan().andPlan()); + }, + stddevPopulation: { + applyPlan($having) { + return $having; } }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed24(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); + varianceSample: { + applyPlan($having) { + return $having; } }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed24(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.notPlan().existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); + variancePopulation: { + applyPlan($having) { + return $having; + } + } + }, + UpvoteHavingSumInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, - aggregates: { - applyPlan($where, fieldArgs) { - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = new PgAggregateConditionStep($where, { - sql, - tableExpression, - alias - }, pgWhereConditionSpecListToSQL); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UserOrganizationFilter: { - userId: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec20; - fieldArgs.apply($col); + HavingDatetimeFilter: { + equalTo: { + applyPlan($booleanFilter, input) { + const val = input.get(); + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); } }, - organizationId: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec21; - fieldArgs.apply($col); + notEqualTo: { + applyPlan($booleanFilter, input) { + const val = input.get(); + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix2()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); } }, - createdAt: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec22; - fieldArgs.apply($col); + greaterThan: { + applyPlan($booleanFilter, input) { + const val = input.get(); + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix3()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); } }, - organization: { - applyPlan($where, fieldArgs) { - assertAllowed25(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: organizationIdentifier, - alias: pgResource_organizationPgResource.name - }); - registryConfig.pgRelations.userOrganization.organizationByMyOrganizationId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.userOrganization.organizationByMyOrganizationId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); + greaterThanOrEqualTo: { + applyPlan($booleanFilter, input) { + const val = input.get(); + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix4()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); } }, - user: { - applyPlan($where, fieldArgs) { - assertAllowed25(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: userIdentifier, - alias: pgResource_userPgResource.name - }); - registryConfig.pgRelations.userOrganization.userByMyUserId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.userOrganization.userByMyUserId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); + lessThan: { + applyPlan($booleanFilter, input) { + const val = input.get(); + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix5()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); } }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed26(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); + lessThanOrEqualTo: { + applyPlan($booleanFilter, input) { + const val = input.get(); + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix6()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); + } + } + }, + UpvoteHavingDistinctCountInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed26(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UpvoteHavingMinInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed26(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } } }, - OrganizationFilter: { - rowId: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec23; - fieldArgs.apply($col); - } - }, - name: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec24; - fieldArgs.apply($col); + UpvoteHavingMaxInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, - slug: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec25; - fieldArgs.apply($col); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } - }, + } + }, + UpvoteHavingAverageInput: { createdAt: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec26; - fieldArgs.apply($col); + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec27; - fieldArgs.apply($col); + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } - }, - projects: { - applyPlan($where, fieldArgs) { - assertAllowed27(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: projectIdentifier, - alias: pgResource_projectPgResource.name, - localAttributes: registryConfig.pgRelations.organization.projectsByTheirOrganizationId.localAttributes, - remoteAttributes: registryConfig.pgRelations.organization.projectsByTheirOrganizationId.remoteAttributes - }; - fieldArgs.apply($rel); + } + }, + UpvoteHavingStddevSampleInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, - projectsExist: { - applyPlan($where, fieldArgs) { - assertAllowed27(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: projectIdentifier, - alias: pgResource_projectPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.organization.projectsByTheirOrganizationId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.organization.projectsByTheirOrganizationId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } - }, - userOrganizations: { - applyPlan($where, fieldArgs) { - assertAllowed27(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: userOrganizationIdentifier, - alias: resource_user_organizationPgResource.name, - localAttributes: registryConfig.pgRelations.organization.userOrganizationsByTheirOrganizationId.localAttributes, - remoteAttributes: registryConfig.pgRelations.organization.userOrganizationsByTheirOrganizationId.remoteAttributes - }; - fieldArgs.apply($rel); + } + }, + UpvoteHavingStddevPopulationInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, - userOrganizationsExist: { - applyPlan($where, fieldArgs) { - assertAllowed27(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: userOrganizationIdentifier, - alias: resource_user_organizationPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.organization.userOrganizationsByTheirOrganizationId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.organization.userOrganizationsByTheirOrganizationId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } - }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed28(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); + } + }, + UpvoteHavingVarianceSampleInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed28(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UpvoteHavingVariancePopulationInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed28(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } } }, - OrganizationToManyProjectFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.notPlan().existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery.notPlan().andPlan()); - } + UpvoteOrderBy: { + NATURAL: { + applyPlan() {} }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.existsPlan({ - tableExpression, - alias + PRIMARY_KEY_ASC: { + applyPlan(step) { + upvoteUniques[0].attributes.forEach(attributeName => { + const attribute = upvoteCodec.attributes[attributeName]; + step.orderBy({ + codec: attribute.codec, + fragment: sql`${step}.${sql.identifier(attributeName)}`, + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); - fieldArgs.apply($subQuery); + step.setOrderIsUnique(); } }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.notPlan().existsPlan({ - tableExpression, - alias + PRIMARY_KEY_DESC: { + applyPlan(step) { + upvoteUniques[0].attributes.forEach(attributeName => { + const attribute = upvoteCodec.attributes[attributeName]; + step.orderBy({ + codec: attribute.codec, + fragment: sql`${step}.${sql.identifier(attributeName)}`, + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); }); - fieldArgs.apply($subQuery); + step.setOrderIsUnique(); } }, - aggregates: { - applyPlan($where, fieldArgs) { - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = new PgAggregateConditionStep($where, { - sql, - tableExpression, - alias - }, pgWhereConditionSpecListToSQL); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + ROW_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) }); - fieldArgs.apply($subQuery); + if (true) plan.setOrderIsUnique(); } - } - }, - ProjectFilter: { - rowId: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec28; - fieldArgs.apply($col); + }, + ROW_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); } }, - name: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec29; - fieldArgs.apply($col); + POST_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "post_id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); } }, - image: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec30; - fieldArgs.apply($col); + POST_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "post_id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); } }, - slug: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec31; - fieldArgs.apply($col); + USER_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "user_id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - description: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec32; - fieldArgs.apply($col); + USER_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "user_id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - organizationId: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec33; - fieldArgs.apply($col); + CREATED_AT_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "created_at", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - createdAt: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec34; - fieldArgs.apply($col); + CREATED_AT_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "created_at", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - updatedAt: { - applyPlan($where, fieldArgs) { - const $raw = fieldArgs.getRaw(); - if ($raw.evalIs(void 0)) return; - if (!false && "evalIsEmpty" in $raw && $raw.evalIsEmpty()) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); - if (!false && $raw.evalIs(null)) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); - const $col = new PgConditionStep($where); - $col.extensions.pgFilterAttribute = colSpec35; - fieldArgs.apply($col); + UPDATED_AT_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "updated_at", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - posts: { - applyPlan($where, fieldArgs) { - assertAllowed30(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: postIdentifier, - alias: pgResource_postPgResource.name, - localAttributes: registryConfig.pgRelations.project.postsByTheirProjectId.localAttributes, - remoteAttributes: registryConfig.pgRelations.project.postsByTheirProjectId.remoteAttributes - }; - fieldArgs.apply($rel); + UPDATED_AT_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "updated_at", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } + } + }, + UpvoteCondition: { + rowId: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.id.codec)}`; + } + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true }, - postsExist: { - applyPlan($where, fieldArgs) { - assertAllowed30(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: postIdentifier, - alias: pgResource_postPgResource.name, - $equals: fieldArgs.get() + postId: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "post_id", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "post_id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.post_id.codec)}`; + } }); - registryConfig.pgRelations.project.postsByTheirProjectId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.project.postsByTheirProjectId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + userId: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.user_id.codec)}`; + } }); - } + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true }, - organization: { - applyPlan($where, fieldArgs) { - assertAllowed31(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: organizationIdentifier, - alias: pgResource_organizationPgResource.name + createdAt: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.created_at.codec)}`; + } }); - registryConfig.pgRelations.project.organizationByMyOrganizationId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.project.organizationByMyOrganizationId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + updatedAt: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.updated_at.codec)}`; + } }); - fieldArgs.apply($subQuery); - } + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + } + }, + UserOrganizationConnection: { + __assertStep: ConnectionStep, + nodes($connection) { + return $connection.nodes(); }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed32(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + edges($connection) { + return $connection.edges(); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed32(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + pageInfo($connection) { + return $connection.pageInfo(); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed32(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); + totalCount($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").singleAsRecord().select(sql`count(*)`, TYPES.bigint, !1); + }, + aggregates($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").single(); + }, + groupedAggregates: { + plan($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate"); + }, + args: { + groupBy: { + autoApplyAfterParentPlan: true, + applyPlan(_$parent, $pgSelect, input) { + var _a, _b; + const val = input.getRaw().eval(); + if (!Array.isArray(val)) throw new Error("Invalid!"); + for (const group of val) { + const config = getEnumValueConfig(UserOrganizationGroupBy, group), + plan = (_b = (_a = config === null || config === void 0 ? void 0 : config.extensions) === null || _a === void 0 ? void 0 : _a.grafast) === null || _b === void 0 ? void 0 : _b.applyPlan; + if (typeof plan === "function") plan($pgSelect); + } + return null; + } + }, + having: { + autoApplyAfterParentPlan: true, + applyPlan(_$parent, $pgSelect) { + return $pgSelect.havingPlan(); + } + } } } }, - ProjectToManyPostFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed33(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.notPlan().existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery.notPlan().andPlan()); - } + UserOrganizationEdge: { + __assertStep: assertEdgeCapableStep, + cursor($edge) { + return $edge.cursor(); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed33(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); - } + node($edge) { + return $edge.node(); + } + }, + UserOrganizationAggregates: { + __assertStep: assertPgClassSingleStep, + keys($pgSelectSingle) { + const groups = $pgSelectSingle.getClassStep().getGroups(); + if (groups.length > 0) return $pgSelectSingle.select(sql`json_build_array(${sql.join(groups.map(g => g.fragment), ", ")})`, TYPES.json);else return constant(null); }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed33(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.notPlan().existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); - } + distinctCount($pgSelectSingle) { + return $pgSelectSingle; + } + }, + UserOrganizationDistinctCountAggregates: { + userId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("user_id")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, - aggregates: { - applyPlan($where, fieldArgs) { - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = new PgAggregateConditionStep($where, { - sql, - tableExpression, - alias - }, pgWhereConditionSpecListToSQL); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); - } + organizationId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("organization_id")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + createdAt($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("created_at")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + } + }, + UserOrganizationGroupBy: { + USER_ID: { + applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan + }, + ORGANIZATION_ID: { + applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan2 + }, + CREATED_AT: { + applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan3 + }, + CREATED_AT_TRUNCATED_TO_HOUR: { + applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan4 + }, + CREATED_AT_TRUNCATED_TO_DAY: { + applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan5 } }, - ProjectAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); + UserOrganizationHavingInput: { + AND: { + applyPlan($where, input) { + input.apply($where); + return null; + } + }, + OR: { + applyPlan($where, input) { + const $or = new PgOrFilterStep($where); + input.apply($or); + return null; + } + }, + sum: { + applyPlan($having) { + return $having; } }, distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(aggregateSpec)); + applyPlan($having) { + return $having; } - } - }, - ProjectDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_project.attributes.id.codec) - }; - fieldArgs.apply($col); + }, + min: { + applyPlan($having) { + return $having; } }, - name: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("name")}`, spec_project.attributes.name.codec) - }; - fieldArgs.apply($col); + max: { + applyPlan($having) { + return $having; } }, - image: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("image")}`, spec_project.attributes.image.codec) - }; - fieldArgs.apply($col); + average: { + applyPlan($having) { + return $having; } }, - slug: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("slug")}`, spec_project.attributes.slug.codec) - }; - fieldArgs.apply($col); + stddevSample: { + applyPlan($having) { + return $having; } }, - description: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_project.attributes.description.codec) - }; - fieldArgs.apply($col); + stddevPopulation: { + applyPlan($having) { + return $having; } }, - organizationId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_project.attributes.organization_id.codec) - }; - fieldArgs.apply($col); + varianceSample: { + applyPlan($having) { + return $having; } }, + variancePopulation: { + applyPlan($having) { + return $having; + } + } + }, + UserOrganizationHavingSumInput: { createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_project.attributes.created_at.codec) - }; - fieldArgs.apply($col); + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } - }, - updatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_project.attributes.updated_at.codec) - }; - fieldArgs.apply($col); + } + }, + UserOrganizationHavingDistinctCountInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); } } }, - OrganizationToManyUserOrganizationFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed34(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.notPlan().existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + UserOrganizationHavingMinInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserOrganizationHavingMaxInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserOrganizationHavingAverageInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserOrganizationHavingStddevSampleInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserOrganizationHavingStddevPopulationInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserOrganizationHavingVarianceSampleInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserOrganizationHavingVariancePopulationInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserOrganizationOrderBy: { + NATURAL: { + applyPlan() {} + }, + USER_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "user_id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) }); - fieldArgs.apply($subQuery.notPlan().andPlan()); + if (true) plan.setOrderIsUnique(); } }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed34(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + USER_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "user_id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) }); - fieldArgs.apply($subQuery); + if (true) plan.setOrderIsUnique(); } }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed34(fieldArgs, "object"); - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = $where.notPlan().existsPlan({ - tableExpression, - alias - }); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + ORGANIZATION_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "organization_id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) }); - fieldArgs.apply($subQuery); + if (false) plan.setOrderIsUnique(); } }, - aggregates: { - applyPlan($where, fieldArgs) { - if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); - const { - localAttributes, - remoteAttributes, - tableExpression, - alias - } = $where.extensions.pgFilterRelation, - $subQuery = new PgAggregateConditionStep($where, { - sql, - tableExpression, - alias - }, pgWhereConditionSpecListToSQL); - localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + ORGANIZATION_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "organization_id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) }); - fieldArgs.apply($subQuery); + if (false) plan.setOrderIsUnique(); } - } - }, - UserOrganizationAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); + }, + CREATED_AT_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "created_at", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(aggregateSpec)); + CREATED_AT_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "created_at", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } } }, - UserOrganizationDistinctCountAggregateFilter: { + UserOrganizationCondition: { userId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_userOrganization.attributes.user_id.codec) - }; - fieldArgs.apply($col); - } + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_userOrganization.attributes.user_id.codec)}`; + } + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true }, organizationId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_userOrganization.attributes.organization_id.codec) - }; - fieldArgs.apply($col); - } + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "organization_id", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "organization_id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_userOrganization.attributes.organization_id.codec)}`; + } + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true }, createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: aggregateSpec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_userOrganization.attributes.created_at.codec) - }; - fieldArgs.apply($col); - } + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_userOrganization.attributes.created_at.codec)}`; + } + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true } }, - UpvoteConnection: { + CommentConnection: { __assertStep: ConnectionStep, nodes($connection) { return $connection.nodes(); @@ -12917,7 +18045,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const val = input.getRaw().eval(); if (!Array.isArray(val)) throw new Error("Invalid!"); for (const group of val) { - const config = getEnumValueConfig(UpvoteGroupBy, group), + const config = getEnumValueConfig(CommentGroupBy, group), plan = (_b = (_a = config === null || config === void 0 ? void 0 : config.extensions) === null || _a === void 0 ? void 0 : _a.grafast) === null || _b === void 0 ? void 0 : _b.applyPlan; if (typeof plan === "function") plan($pgSelect); } @@ -12933,15 +18061,18 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - Upvote: { + Comment: { __assertStep: assertPgClassSingleStep, id($parent) { - const specifier = nodeIdHandlerByTypeName.Upvote.plan($parent); - return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Upvote.codec.name].encode); + const specifier = nodeIdHandlerByTypeName.Comment.plan($parent); + return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Comment.codec.name].encode); }, rowId($record) { return $record.get("id"); }, + message($record) { + return $record.get("message"); + }, postId($record) { return $record.get("post_id"); }, @@ -12965,7 +18096,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }); } }, - UpvoteEdge: { + CommentEdge: { __assertStep: assertEdgeCapableStep, cursor($edge) { return $edge.cursor(); @@ -12974,22 +18105,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return $edge.node(); } }, - PageInfo: { - __assertStep: assertPageInfoCapableStep, - hasNextPage($pageInfo) { - return $pageInfo.hasNextPage(); - }, - hasPreviousPage($pageInfo) { - return $pageInfo.hasPreviousPage(); - }, - startCursor($pageInfo) { - return $pageInfo.startCursor(); - }, - endCursor($pageInfo) { - return $pageInfo.endCursor(); - } - }, - UpvoteAggregates: { + CommentAggregates: { __assertStep: assertPgClassSingleStep, keys($pgSelectSingle) { const groups = $pgSelectSingle.getClassStep().getGroups(); @@ -12999,12 +18115,17 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return $pgSelectSingle; } }, - UpvoteDistinctCountAggregates: { + CommentDistinctCountAggregates: { rowId($pgSelectSingle) { const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("id")}`, sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, + message($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("message")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.text); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, postId($pgSelectSingle) { const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("post_id")}`, sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); @@ -13026,33 +18147,36 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); } }, - UpvoteGroupBy: { + CommentGroupBy: { + MESSAGE: { + applyPlan: CommentGroupBy_extensions_grafast_applyPlan + }, POST_ID: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan + applyPlan: CommentGroupBy_extensions_grafast_applyPlan2 }, USER_ID: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan2 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan3 }, CREATED_AT: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan3 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan4 }, CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan4 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan5 }, CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan5 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan6 }, UPDATED_AT: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan6 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan7 }, UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan7 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan8 }, UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan8 + applyPlan: CommentGroupBy_extensions_grafast_applyPlan9 } }, - UpvoteHavingInput: { + CommentHavingInput: { AND: { applyPlan($where, input) { input.apply($where); @@ -13112,196 +18236,158 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - UpvoteHavingSumInput: { + CommentHavingSumInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - HavingDatetimeFilter: { - equalTo: { - applyPlan($booleanFilter, input) { - const val = input.get(); - $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); - } - }, - notEqualTo: { - applyPlan($booleanFilter, input) { - const val = input.get(); - $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix2()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); - } - }, - greaterThan: { - applyPlan($booleanFilter, input) { - const val = input.get(); - $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix3()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); - } - }, - greaterThanOrEqualTo: { - applyPlan($booleanFilter, input) { - const val = input.get(); - $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix4()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); - } - }, - lessThan: { - applyPlan($booleanFilter, input) { - const val = input.get(); - $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix5()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); - } - }, - lessThanOrEqualTo: { - applyPlan($booleanFilter, input) { - const val = input.get(); - $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix6()} ${$booleanFilter.placeholder(val, TYPES.timestamptz)})`); - } - } - }, - UpvoteHavingDistinctCountInput: { + CommentHavingDistinctCountInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UpvoteHavingMinInput: { + CommentHavingMinInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UpvoteHavingMaxInput: { + CommentHavingMaxInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UpvoteHavingAverageInput: { + CommentHavingAverageInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UpvoteHavingStddevSampleInput: { + CommentHavingStddevSampleInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UpvoteHavingStddevPopulationInput: { + CommentHavingStddevPopulationInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UpvoteHavingVarianceSampleInput: { + CommentHavingVarianceSampleInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UpvoteHavingVariancePopulationInput: { + CommentHavingVariancePopulationInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } }, updatedAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UpvoteOrderBy: { + CommentOrderBy: { NATURAL: { applyPlan() {} }, PRIMARY_KEY_ASC: { applyPlan(step) { - upvoteUniques[0].attributes.forEach(attributeName => { - const attribute = upvoteCodec.attributes[attributeName]; + commentUniques[0].attributes.forEach(attributeName => { + const attribute = commentCodec.attributes[attributeName]; step.orderBy({ codec: attribute.codec, fragment: sql`${step}.${sql.identifier(attributeName)}`, @@ -13316,8 +18402,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, PRIMARY_KEY_DESC: { applyPlan(step) { - upvoteUniques[0].attributes.forEach(attributeName => { - const attribute = upvoteCodec.attributes[attributeName]; + commentUniques[0].attributes.forEach(attributeName => { + const attribute = commentCodec.attributes[attributeName]; step.orderBy({ codec: attribute.codec, fragment: sql`${step}.${sql.identifier(attributeName)}`, @@ -13356,6 +18442,32 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (true) plan.setOrderIsUnique(); } }, + MESSAGE_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "message", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + MESSAGE_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "message", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, POST_ID_ASC: { applyPlan(plan) { if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); @@ -13366,7 +18478,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; nulls: undefined ? "LAST" : "FIRST" } : null) }); - if (true) plan.setOrderIsUnique(); + if (false) plan.setOrderIsUnique(); } }, POST_ID_DESC: { @@ -13379,7 +18491,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; nulls: undefined ? "LAST" : "FIRST" } : null) }); - if (true) plan.setOrderIsUnique(); + if (false) plan.setOrderIsUnique(); } }, USER_ID_ASC: { @@ -13461,7 +18573,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - UpvoteCondition: { + CommentCondition: { rowId: { applyPlan($condition, val) { if (val.getRaw().evalIs(null)) $condition.where({ @@ -13474,7 +18586,26 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; type: "attribute", attribute: "id", callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.id.codec)}`; + return sql`${expression} = ${$condition.placeholder(val.get(), spec_comment.attributes.id.codec)}`; + } + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + message: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "message", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "message", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_comment.attributes.message.codec)}`; } }); }, @@ -13493,7 +18624,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; type: "attribute", attribute: "post_id", callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.post_id.codec)}`; + return sql`${expression} = ${$condition.placeholder(val.get(), spec_comment.attributes.post_id.codec)}`; } }); }, @@ -13512,7 +18643,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; type: "attribute", attribute: "user_id", callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.user_id.codec)}`; + return sql`${expression} = ${$condition.placeholder(val.get(), spec_comment.attributes.user_id.codec)}`; } }); }, @@ -13531,7 +18662,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; type: "attribute", attribute: "created_at", callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.created_at.codec)}`; + return sql`${expression} = ${$condition.placeholder(val.get(), spec_comment.attributes.created_at.codec)}`; } }); }, @@ -13550,7 +18681,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; type: "attribute", attribute: "updated_at", callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_upvote.attributes.updated_at.codec)}`; + return sql`${expression} = ${$condition.placeholder(val.get(), spec_comment.attributes.updated_at.codec)}`; } }); }, @@ -13558,7 +18689,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; autoApplyAfterParentApplyPlan: true } }, - UserOrganizationConnection: { + DownvoteConnection: { __assertStep: ConnectionStep, nodes($connection) { return $connection.nodes(); @@ -13587,7 +18718,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const val = input.getRaw().eval(); if (!Array.isArray(val)) throw new Error("Invalid!"); for (const group of val) { - const config = getEnumValueConfig(UserOrganizationGroupBy, group), + const config = getEnumValueConfig(DownvoteGroupBy, group), plan = (_b = (_a = config === null || config === void 0 ? void 0 : config.extensions) === null || _a === void 0 ? void 0 : _a.grafast) === null || _b === void 0 ? void 0 : _b.applyPlan; if (typeof plan === "function") plan($pgSelect); } @@ -13603,7 +18734,39 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - UserOrganizationEdge: { + Downvote: { + __assertStep: assertPgClassSingleStep, + id($parent) { + const specifier = nodeIdHandlerByTypeName.Downvote.plan($parent); + return lambda(specifier, nodeIdCodecs[nodeIdHandlerByTypeName.Downvote.codec.name].encode); + }, + rowId($record) { + return $record.get("id"); + }, + postId($record) { + return $record.get("post_id"); + }, + userId($record) { + return $record.get("user_id"); + }, + createdAt($record) { + return $record.get("created_at"); + }, + updatedAt($record) { + return $record.get("updated_at"); + }, + post($record) { + return pgResource_postPgResource.get({ + id: $record.get("post_id") + }); + }, + user($record) { + return pgResource_userPgResource.get({ + id: $record.get("user_id") + }); + } + }, + DownvoteEdge: { __assertStep: assertEdgeCapableStep, cursor($edge) { return $edge.cursor(); @@ -13612,7 +18775,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return $edge.node(); } }, - UserOrganizationAggregates: { + DownvoteAggregates: { __assertStep: assertPgClassSingleStep, keys($pgSelectSingle) { const groups = $pgSelectSingle.getClassStep().getGroups(); @@ -13622,14 +18785,19 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return $pgSelectSingle; } }, - UserOrganizationDistinctCountAggregates: { - userId($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("user_id")}`, + DownvoteDistinctCountAggregates: { + rowId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("id")}`, sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, - organizationId($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("organization_id")}`, + postId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("post_id")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + userId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("user_id")}`, sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, @@ -13637,26 +18805,40 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("created_at")}`, sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + updatedAt($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("updated_at")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); } }, - UserOrganizationGroupBy: { - USER_ID: { - applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan + DownvoteGroupBy: { + POST_ID: { + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan }, - ORGANIZATION_ID: { - applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan2 + USER_ID: { + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan2 }, CREATED_AT: { - applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan3 + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan3 }, CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan4 + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan4 }, CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UserOrganizationGroupBy_extensions_grafast_applyPlan5 + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan5 + }, + UPDATED_AT: { + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan6 + }, + UPDATED_AT_TRUNCATED_TO_HOUR: { + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan7 + }, + UPDATED_AT_TRUNCATED_TO_DAY: { + applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan8 } }, - UserOrganizationHavingInput: { + DownvoteHavingInput: { AND: { applyPlan($where, input) { input.apply($where); @@ -13716,96 +18898,217 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - UserOrganizationHavingSumInput: { + DownvoteHavingSumInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UserOrganizationHavingDistinctCountInput: { + DownvoteHavingDistinctCountInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UserOrganizationHavingMinInput: { + DownvoteHavingMinInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UserOrganizationHavingMaxInput: { + DownvoteHavingMaxInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UserOrganizationHavingAverageInput: { + DownvoteHavingAverageInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UserOrganizationHavingStddevSampleInput: { + DownvoteHavingStddevSampleInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UserOrganizationHavingStddevPopulationInput: { + DownvoteHavingStddevPopulationInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } } }, - UserOrganizationHavingVarianceSampleInput: { + DownvoteHavingVarianceSampleInput: { createdAt: { applyPlan($having) { const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); return new PgBooleanFilterStep($having, aggregateExpression); } - } - }, - UserOrganizationHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_userOrganization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + DownvoteHavingVariancePopulationInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + DownvoteOrderBy: { + NATURAL: { + applyPlan() {} + }, + PRIMARY_KEY_ASC: { + applyPlan(step) { + downvoteUniques[0].attributes.forEach(attributeName => { + const attribute = downvoteCodec.attributes[attributeName]; + step.orderBy({ + codec: attribute.codec, + fragment: sql`${step}.${sql.identifier(attributeName)}`, + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + }); + step.setOrderIsUnique(); + } + }, + PRIMARY_KEY_DESC: { + applyPlan(step) { + downvoteUniques[0].attributes.forEach(attributeName => { + const attribute = downvoteCodec.attributes[attributeName]; + step.orderBy({ + codec: attribute.codec, + fragment: sql`${step}.${sql.identifier(attributeName)}`, + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + }); + step.setOrderIsUnique(); + } + }, + ROW_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); + } + }, + ROW_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); } - } - }, - UserOrganizationOrderBy: { - NATURAL: { - applyPlan() {} }, - USER_ID_ASC: { + POST_ID_ASC: { applyPlan(plan) { if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); plan.orderBy({ - attribute: "user_id", + attribute: "post_id", direction: "ASC", ...(undefined != null ? { nulls: undefined ? "LAST" : "FIRST" @@ -13814,11 +19117,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (true) plan.setOrderIsUnique(); } }, - USER_ID_DESC: { + POST_ID_DESC: { applyPlan(plan) { if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); plan.orderBy({ - attribute: "user_id", + attribute: "post_id", direction: "DESC", ...(undefined != null ? { nulls: undefined ? "LAST" : "FIRST" @@ -13827,11 +19130,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (true) plan.setOrderIsUnique(); } }, - ORGANIZATION_ID_ASC: { + USER_ID_ASC: { applyPlan(plan) { if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); plan.orderBy({ - attribute: "organization_id", + attribute: "user_id", direction: "ASC", ...(undefined != null ? { nulls: undefined ? "LAST" : "FIRST" @@ -13840,11 +19143,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; if (false) plan.setOrderIsUnique(); } }, - ORGANIZATION_ID_DESC: { + USER_ID_DESC: { applyPlan(plan) { if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); plan.orderBy({ - attribute: "organization_id", + attribute: "user_id", direction: "DESC", ...(undefined != null ? { nulls: undefined ? "LAST" : "FIRST" @@ -13878,41 +19181,86 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }); if (false) plan.setOrderIsUnique(); } + }, + UPDATED_AT_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "updated_at", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } + }, + UPDATED_AT_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "updated_at", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } } }, - UserOrganizationCondition: { - userId: { + DownvoteCondition: { + rowId: { applyPlan($condition, val) { if (val.getRaw().evalIs(null)) $condition.where({ type: "attribute", - attribute: "user_id", + attribute: "id", callback(expression) { return sql`${expression} is null`; } });else $condition.where({ type: "attribute", - attribute: "user_id", + attribute: "id", callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_userOrganization.attributes.user_id.codec)}`; + return sql`${expression} = ${$condition.placeholder(val.get(), spec_downvote.attributes.id.codec)}`; } }); }, autoApplyAfterParentInputPlan: true, autoApplyAfterParentApplyPlan: true }, - organizationId: { + postId: { applyPlan($condition, val) { if (val.getRaw().evalIs(null)) $condition.where({ type: "attribute", - attribute: "organization_id", + attribute: "post_id", callback(expression) { return sql`${expression} is null`; } });else $condition.where({ type: "attribute", - attribute: "organization_id", + attribute: "post_id", callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_userOrganization.attributes.organization_id.codec)}`; + return sql`${expression} = ${$condition.placeholder(val.get(), spec_downvote.attributes.post_id.codec)}`; + } + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + userId: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_downvote.attributes.user_id.codec)}`; } }); }, @@ -13931,7 +19279,26 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; type: "attribute", attribute: "created_at", callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_userOrganization.attributes.created_at.codec)}`; + return sql`${expression} = ${$condition.placeholder(val.get(), spec_downvote.attributes.created_at.codec)}`; + } + }); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + updatedAt: { + applyPlan($condition, val) { + if (val.getRaw().evalIs(null)) $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return sql`${expression} is null`; + } + });else $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return sql`${expression} = ${$condition.placeholder(val.get(), spec_downvote.attributes.updated_at.codec)}`; } }); }, @@ -14777,8 +20144,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14797,8 +20164,8 @@ where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14818,8 +20185,8 @@ where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14840,8 +20207,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14862,8 +20229,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14884,8 +20251,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14906,8 +20273,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14928,8 +20295,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14950,8 +20317,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14972,8 +20339,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -14994,8 +20361,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15016,8 +20383,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15038,8 +20405,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15060,8 +20427,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15082,8 +20449,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15104,8 +20471,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation2.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation2.remoteAttributes[i]; + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15761,8 +21128,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15781,8 +21148,8 @@ where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15802,8 +21169,8 @@ where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15824,8 +21191,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15846,8 +21213,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15868,8 +21235,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15890,8 +21257,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15912,8 +21279,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15934,8 +21301,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15956,8 +21323,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -15978,8 +21345,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16000,8 +21367,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16022,8 +21389,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16044,8 +21411,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16066,8 +21433,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16087,9 +21454,9 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16110,8 +21477,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16132,8 +21499,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(pgResource_projectPgResource.name)); - relation3.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation3.remoteAttributes[i]; + relation5.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation5.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof pgResource_projectPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16153,8 +21520,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; + relation6.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation6.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16173,8 +21540,8 @@ where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; + relation6.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation6.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16194,8 +21561,8 @@ where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; + relation6.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation6.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16216,8 +21583,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; + relation6.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation6.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16238,8 +21605,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; + relation6.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation6.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16260,8 +21627,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; + relation6.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation6.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16282,8 +21649,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; + relation6.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation6.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16304,8 +21671,8 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const foreignTableAlias = $select.alias, conditions = [], tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; + relation6.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation6.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); @@ -16463,1286 +21830,1850 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - UserEdge: { - __assertStep: assertEdgeCapableStep, - cursor($edge) { - return $edge.cursor(); + UserEdge: { + __assertStep: assertEdgeCapableStep, + cursor($edge) { + return $edge.cursor(); + }, + node($edge) { + return $edge.node(); + } + }, + UserAggregates: { + __assertStep: assertPgClassSingleStep, + keys($pgSelectSingle) { + const groups = $pgSelectSingle.getClassStep().getGroups(); + if (groups.length > 0) return $pgSelectSingle.select(sql`json_build_array(${sql.join(groups.map(g => g.fragment), ", ")})`, TYPES.json);else return constant(null); + }, + distinctCount($pgSelectSingle) { + return $pgSelectSingle; + } + }, + UserDistinctCountAggregates: { + rowId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("id")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + createdAt($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("created_at")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + updatedAt($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("updated_at")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + hidraId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("hidra_id")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + username($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("username")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.text); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + firstName($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("first_name")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.text); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + lastName($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("last_name")}`, + sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.text); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + } + }, + UserGroupBy: { + CREATED_AT: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan + }, + CREATED_AT_TRUNCATED_TO_HOUR: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan2 + }, + CREATED_AT_TRUNCATED_TO_DAY: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan3 + }, + UPDATED_AT: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan4 + }, + UPDATED_AT_TRUNCATED_TO_HOUR: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan5 + }, + UPDATED_AT_TRUNCATED_TO_DAY: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan6 + }, + FIRST_NAME: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan7 + }, + LAST_NAME: { + applyPlan: UserGroupBy_extensions_grafast_applyPlan8 + } + }, + UserHavingInput: { + AND: { + applyPlan($where, input) { + input.apply($where); + return null; + } + }, + OR: { + applyPlan($where, input) { + const $or = new PgOrFilterStep($where); + input.apply($or); + return null; + } + }, + sum: { + applyPlan($having) { + return $having; + } + }, + distinctCount: { + applyPlan($having) { + return $having; + } + }, + min: { + applyPlan($having) { + return $having; + } + }, + max: { + applyPlan($having) { + return $having; + } + }, + average: { + applyPlan($having) { + return $having; + } + }, + stddevSample: { + applyPlan($having) { + return $having; + } + }, + stddevPopulation: { + applyPlan($having) { + return $having; + } + }, + varianceSample: { + applyPlan($having) { + return $having; + } + }, + variancePopulation: { + applyPlan($having) { + return $having; + } + } + }, + UserHavingSumInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserHavingDistinctCountInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserHavingMinInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserHavingMaxInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserHavingAverageInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + }, + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserHavingStddevSampleInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } }, - node($edge) { - return $edge.node(); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } } }, - UserAggregates: { - __assertStep: assertPgClassSingleStep, - keys($pgSelectSingle) { - const groups = $pgSelectSingle.getClassStep().getGroups(); - if (groups.length > 0) return $pgSelectSingle.select(sql`json_build_array(${sql.join(groups.map(g => g.fragment), ", ")})`, TYPES.json);else return constant(null); + UserHavingStddevPopulationInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } }, - distinctCount($pgSelectSingle) { - return $pgSelectSingle; + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } } }, - UserDistinctCountAggregates: { - rowId($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("id")}`, - sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - createdAt($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("created_at")}`, - sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - updatedAt($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("updated_at")}`, - sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - hidraId($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("hidra_id")}`, - sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - username($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("username")}`, - sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.text); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - firstName($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("first_name")}`, - sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.text); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + UserHavingVarianceSampleInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } }, - lastName($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("last_name")}`, - sqlAggregate = aggregateSpec.sqlAggregateWrap(sqlAttribute, TYPES.text); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } } }, - UserGroupBy: { - CREATED_AT: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan + UserHavingVariancePopulationInput: { + createdAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan2 + updatedAt: { + applyPlan($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilterStep($having, aggregateExpression); + } + } + }, + UserOrderBy: { + NATURAL: { + applyPlan() {} }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan3 + PRIMARY_KEY_ASC: { + applyPlan(step) { + userUniques[0].attributes.forEach(attributeName => { + const attribute = userCodec.attributes[attributeName]; + step.orderBy({ + codec: attribute.codec, + fragment: sql`${step}.${sql.identifier(attributeName)}`, + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + }); + step.setOrderIsUnique(); + } }, - UPDATED_AT: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan4 + PRIMARY_KEY_DESC: { + applyPlan(step) { + userUniques[0].attributes.forEach(attributeName => { + const attribute = userCodec.attributes[attributeName]; + step.orderBy({ + codec: attribute.codec, + fragment: sql`${step}.${sql.identifier(attributeName)}`, + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + }); + step.setOrderIsUnique(); + } }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan5 + ROW_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); + } }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan6 + ROW_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); + } }, - FIRST_NAME: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan7 + CREATED_AT_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "created_at", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); + } }, - LAST_NAME: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan8 - } - }, - UserHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; + CREATED_AT_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "created_at", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; + UPDATED_AT_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "updated_at", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - sum: { - applyPlan($having) { - return $having; + UPDATED_AT_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "updated_at", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - distinctCount: { - applyPlan($having) { - return $having; + HIDRA_ID_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "hidra_id", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); } }, - min: { - applyPlan($having) { - return $having; + HIDRA_ID_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "hidra_id", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); } }, - max: { - applyPlan($having) { - return $having; + USERNAME_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "username", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); } }, - average: { - applyPlan($having) { - return $having; + USERNAME_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "username", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (true) plan.setOrderIsUnique(); } }, - stddevSample: { - applyPlan($having) { - return $having; + FIRST_NAME_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "first_name", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - stddevPopulation: { - applyPlan($having) { - return $having; + FIRST_NAME_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "first_name", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - varianceSample: { - applyPlan($having) { - return $having; + LAST_NAME_ASC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "last_name", + direction: "ASC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - variancePopulation: { - applyPlan($having) { - return $having; - } - } - }, - UserHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + LAST_NAME_DESC: { + applyPlan(plan) { + if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); + plan.orderBy({ + attribute: "last_name", + direction: "DESC", + ...(undefined != null ? { + nulls: undefined ? "LAST" : "FIRST" + } : null) + }); + if (false) plan.setOrderIsUnique(); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - UserHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_COUNT_ASC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - UserHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_COUNT_DESC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - UserHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_DISTINCT_COUNT_ROW_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, + direction: "ASC" + }); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_DISTINCT_COUNT_ROW_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, + direction: "DESC" + }); } - } - }, - UserHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + }, + POSTS_DISTINCT_COUNT_TITLE_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, + direction: "ASC" + }); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - UserHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_DISTINCT_COUNT_TITLE_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, + direction: "DESC" + }); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - UserHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_DISTINCT_COUNT_DESCRIPTION_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, + direction: "ASC" + }); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - UserHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_DISTINCT_COUNT_DESCRIPTION_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, + direction: "DESC" + }); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - UserHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_DISTINCT_COUNT_PROJECT_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, + direction: "ASC" + }); } }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec9.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); + POSTS_DISTINCT_COUNT_PROJECT_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, + direction: "DESC" + }); } - } - }, - UserOrderBy: { - NATURAL: { - applyPlan() {} }, - PRIMARY_KEY_ASC: { - applyPlan(step) { - userUniques[0].attributes.forEach(attributeName => { - const attribute = userCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); + POSTS_DISTINCT_COUNT_USER_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, + direction: "ASC" }); - step.setOrderIsUnique(); } }, - PRIMARY_KEY_DESC: { - applyPlan(step) { - userUniques[0].attributes.forEach(attributeName => { - const attribute = userCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); + POSTS_DISTINCT_COUNT_USER_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, + direction: "DESC" }); - step.setOrderIsUnique(); } }, - ROW_ID_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + POSTS_DISTINCT_COUNT_CREATED_AT_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, + direction: "ASC" }); - if (true) plan.setOrderIsUnique(); } }, - ROW_ID_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "id", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + POSTS_DISTINCT_COUNT_CREATED_AT_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (true) plan.setOrderIsUnique(); - } - }, - CREATED_AT_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "created_at", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, + direction: "DESC" }); - if (false) plan.setOrderIsUnique(); } }, - CREATED_AT_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "created_at", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + POSTS_DISTINCT_COUNT_UPDATED_AT_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, + direction: "ASC" }); - if (false) plan.setOrderIsUnique(); } }, - UPDATED_AT_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "updated_at", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + POSTS_DISTINCT_COUNT_UPDATED_AT_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); + relation7.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation7.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} +from ${pgResource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, + direction: "DESC" }); - if (false) plan.setOrderIsUnique(); } }, - UPDATED_AT_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "updated_at", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + UPVOTES_COUNT_ASC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" }); - if (false) plan.setOrderIsUnique(); } }, - HIDRA_ID_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "hidra_id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + UPVOTES_COUNT_DESC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" }); - if (true) plan.setOrderIsUnique(); } }, - HIDRA_ID_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "hidra_id", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + UPVOTES_DISTINCT_COUNT_ROW_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, + direction: "ASC" }); - if (true) plan.setOrderIsUnique(); } }, - USERNAME_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "username", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + UPVOTES_DISTINCT_COUNT_ROW_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, + direction: "DESC" }); - if (true) plan.setOrderIsUnique(); } }, - USERNAME_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "username", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + UPVOTES_DISTINCT_COUNT_POST_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, + direction: "ASC" }); - if (true) plan.setOrderIsUnique(); } }, - FIRST_NAME_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "first_name", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + UPVOTES_DISTINCT_COUNT_POST_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, + direction: "DESC" }); - if (false) plan.setOrderIsUnique(); } }, - FIRST_NAME_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "first_name", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + UPVOTES_DISTINCT_COUNT_USER_ID_ASC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (false) plan.setOrderIsUnique(); - } - }, - LAST_NAME_ASC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "last_name", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, + direction: "ASC" }); - if (false) plan.setOrderIsUnique(); } }, - LAST_NAME_DESC: { - applyPlan(plan) { - if (!(plan instanceof PgSelectStep) && !(plan instanceof PgUnionAllStep)) throw new Error("Expected a PgSelectStep or PgUnionAllStep when applying ordering value"); - plan.orderBy({ - attribute: "last_name", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + UPVOTES_DISTINCT_COUNT_USER_ID_DESC: { + applyPlan($select) { + var _a, _b; + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, + direction: "DESC" }); - if (false) plan.setOrderIsUnique(); } }, - POSTS_COUNT_ASC: { + UPVOTES_DISTINCT_COUNT_CREATED_AT_ASC: { applyPlan($select) { + var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${pgResource_postPgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: TYPES.bigint, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, direction: "ASC" }); } }, - POSTS_COUNT_DESC: { + UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC: { applyPlan($select) { + var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${pgResource_postPgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: TYPES.bigint, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, direction: "DESC" }); } }, - POSTS_DISTINCT_COUNT_ROW_ID_ASC: { + UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, direction: "ASC" }); } }, - POSTS_DISTINCT_COUNT_ROW_ID_DESC: { + UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); + relation8.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation8.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} +from ${pgResource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, direction: "DESC" }); } }, - POSTS_DISTINCT_COUNT_TITLE_ASC: { + USER_ORGANIZATIONS_COUNT_ASC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); + relation9.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation9.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${resource_user_organizationPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); + } + }, + USER_ORGANIZATIONS_COUNT_DESC: { + applyPlan($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); + relation9.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation9.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${resource_user_organizationPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); + } + }, + USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); + relation9.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation9.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_userOrganization.attributes.user_id.codec)} +from ${resource_user_organizationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.user_id.codec, direction: "ASC" }); } }, - POSTS_DISTINCT_COUNT_TITLE_DESC: { + USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); + relation9.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation9.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_userOrganization.attributes.user_id.codec)} +from ${resource_user_organizationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.user_id.codec, direction: "DESC" }); } }, - POSTS_DISTINCT_COUNT_DESCRIPTION_ASC: { + USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); + relation9.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation9.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_userOrganization.attributes.organization_id.codec)} +from ${resource_user_organizationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.organization_id.codec, direction: "ASC" }); } }, - POSTS_DISTINCT_COUNT_DESCRIPTION_DESC: { + USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); + relation9.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation9.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_userOrganization.attributes.organization_id.codec)} +from ${resource_user_organizationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.organization_id.codec, direction: "DESC" }); } }, - POSTS_DISTINCT_COUNT_PROJECT_ID_ASC: { + USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); + relation9.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation9.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_userOrganization.attributes.created_at.codec)} +from ${resource_user_organizationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.created_at.codec, direction: "ASC" }); } }, - POSTS_DISTINCT_COUNT_PROJECT_ID_DESC: { + USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); + relation9.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation9.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_userOrganization.attributes.created_at.codec)} +from ${resource_user_organizationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.created_at.codec, direction: "DESC" }); } }, - POSTS_DISTINCT_COUNT_USER_ID_ASC: { + COMMENTS_COUNT_ASC: { applyPlan($select) { - var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, + codec: TYPES.bigint, direction: "ASC" }); } }, - POSTS_DISTINCT_COUNT_USER_ID_DESC: { + COMMENTS_COUNT_DESC: { applyPlan($select) { - var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, + codec: TYPES.bigint, direction: "DESC" }); } }, - POSTS_DISTINCT_COUNT_CREATED_AT_ASC: { + COMMENTS_DISTINCT_COUNT_ROW_ID_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.id.codec, direction: "ASC" }); } }, - POSTS_DISTINCT_COUNT_CREATED_AT_DESC: { + COMMENTS_DISTINCT_COUNT_ROW_ID_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.id.codec, direction: "DESC" }); } }, - POSTS_DISTINCT_COUNT_UPDATED_AT_ASC: { + COMMENTS_DISTINCT_COUNT_MESSAGE_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.message.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.message.codec, direction: "ASC" }); } }, - POSTS_DISTINCT_COUNT_UPDATED_AT_DESC: { + COMMENTS_DISTINCT_COUNT_MESSAGE_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_postPgResource.name)); - relation5.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation5.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_postPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} -from ${pgResource_postPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.message.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.message.codec, direction: "DESC" }); } }, - UPVOTES_COUNT_ASC: { + COMMENTS_DISTINCT_COUNT_POST_ID_ASC: { applyPlan($select) { + var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: TYPES.bigint, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.post_id.codec, direction: "ASC" }); } }, - UPVOTES_COUNT_DESC: { + COMMENTS_DISTINCT_COUNT_POST_ID_DESC: { applyPlan($select) { + var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: TYPES.bigint, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.post_id.codec, direction: "DESC" }); } }, - UPVOTES_DISTINCT_COUNT_ROW_ID_ASC: { + COMMENTS_DISTINCT_COUNT_USER_ID_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.user_id.codec, direction: "ASC" }); } }, - UPVOTES_DISTINCT_COUNT_ROW_ID_DESC: { + COMMENTS_DISTINCT_COUNT_USER_ID_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.user_id.codec, direction: "DESC" }); } }, - UPVOTES_DISTINCT_COUNT_POST_ID_ASC: { + COMMENTS_DISTINCT_COUNT_CREATED_AT_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.created_at.codec, direction: "ASC" }); } }, - UPVOTES_DISTINCT_COUNT_POST_ID_DESC: { + COMMENTS_DISTINCT_COUNT_CREATED_AT_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.created_at.codec, direction: "DESC" }); } }, - UPVOTES_DISTINCT_COUNT_USER_ID_ASC: { + COMMENTS_DISTINCT_COUNT_UPDATED_AT_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.updated_at.codec, direction: "ASC" }); } }, - UPVOTES_DISTINCT_COUNT_USER_ID_DESC: { + COMMENTS_DISTINCT_COUNT_UPDATED_AT_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_commentPgResource.name)); + relation10.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation10.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_commentPgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec)} +from ${pgResource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_comment.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.updated_at.codec, direction: "DESC" }); } }, - UPVOTES_DISTINCT_COUNT_CREATED_AT_ASC: { + DOWNVOTES_COUNT_ASC: { applyPlan($select) { - var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, + codec: TYPES.bigint, direction: "ASC" }); } }, - UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC: { + DOWNVOTES_COUNT_DESC: { applyPlan($select) { - var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, + codec: TYPES.bigint, direction: "DESC" }); } }, - UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC: { + DOWNVOTES_DISTINCT_COUNT_ROW_ID_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.id.codec, direction: "ASC" }); } }, - UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { + DOWNVOTES_DISTINCT_COUNT_ROW_ID_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(pgResource_upvotePgResource.name)); - relation6.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation6.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof pgResource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} -from ${pgResource_upvotePgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.id.codec, direction: "DESC" }); } }, - USER_ORGANIZATIONS_COUNT_ASC: { + DOWNVOTES_DISTINCT_COUNT_POST_ID_ASC: { applyPlan($select) { + var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation7.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation7.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${resource_user_organizationPgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: TYPES.bigint, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.post_id.codec, direction: "ASC" }); } }, - USER_ORGANIZATIONS_COUNT_DESC: { + DOWNVOTES_DISTINCT_COUNT_POST_ID_DESC: { applyPlan($select) { + var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation7.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation7.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${resource_user_organizationPgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: TYPES.bigint, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.post_id.codec, direction: "DESC" }); } }, - USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_ASC: { + DOWNVOTES_DISTINCT_COUNT_USER_ID_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation7.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation7.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_userOrganization.attributes.user_id.codec)} -from ${resource_user_organizationPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.user_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.user_id.codec, direction: "ASC" }); } }, - USER_ORGANIZATIONS_DISTINCT_COUNT_USER_ID_DESC: { + DOWNVOTES_DISTINCT_COUNT_USER_ID_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation7.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation7.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_userOrganization.attributes.user_id.codec)} -from ${resource_user_organizationPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.user_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.user_id.codec, direction: "DESC" }); } }, - USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_ASC: { + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation7.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation7.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_userOrganization.attributes.organization_id.codec)} -from ${resource_user_organizationPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.organization_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.created_at.codec, direction: "ASC" }); } }, - USER_ORGANIZATIONS_DISTINCT_COUNT_ORGANIZATION_ID_DESC: { + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation7.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation7.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_userOrganization.attributes.organization_id.codec)} -from ${resource_user_organizationPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.organization_id.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.created_at.codec, direction: "DESC" }); } }, - USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_ASC: { + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_ASC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation7.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation7.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_userOrganization.attributes.created_at.codec)} -from ${resource_user_organizationPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.created_at.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.updated_at.codec, direction: "ASC" }); } }, - USER_ORGANIZATIONS_DISTINCT_COUNT_CREATED_AT_DESC: { + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { applyPlan($select) { var _a, _b; const foreignTableAlias = $select.alias, conditions = [], - tableAlias = sql.identifier(Symbol(resource_user_organizationPgResource.name)); - relation7.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation7.remoteAttributes[i]; + tableAlias = sql.identifier(Symbol(pgResource_downvotePgResource.name)); + relation11.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation11.remoteAttributes[i]; conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); }); - if (typeof resource_user_organizationPgResource.from === "function") throw new Error("Function source unsupported"); + if (typeof pgResource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); const fragment = sql`(${sql.indent` -select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_userOrganization.attributes.created_at.codec)} -from ${resource_user_organizationPgResource.from} ${tableAlias} +select ${aggregateSpec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} +from ${pgResource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; $select.orderBy({ fragment, - codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_userOrganization.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_userOrganization.attributes.created_at.codec, + codec: (_b = (_a = aggregateSpec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(aggregateSpec, spec_downvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.updated_at.codec, direction: "DESC" }); } @@ -17888,7 +23819,24 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; createUserOrganization: { plan(_, args) { const plan = object({ - result: pgInsertSingle(resource_user_organizationPgResource, Object.create(null)) + result: pgInsertSingle(resource_user_organizationPgResource, Object.create(null)) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + autoApplyAfterParentPlan: true, + applyPlan(_, $object) { + return $object; + } + } + } + }, + createDownvote: { + plan(_, args) { + const plan = object({ + result: pgInsertSingle(pgResource_downvotePgResource, Object.create(null)) }); args.apply(plan); return plan; @@ -17936,6 +23884,23 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, + createComment: { + plan(_, args) { + const plan = object({ + result: pgInsertSingle(pgResource_commentPgResource, Object.create(null)) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + autoApplyAfterParentPlan: true, + applyPlan(_, $object) { + return $object; + } + } + } + }, createPost: { plan(_, args) { const plan = object({ @@ -18006,10 +23971,63 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, + updateDownvoteById: { + plan(_$root, args) { + const plan = object({ + result: pgUpdateSingle(pgResource_downvotePgResource, specFromArgs(args)) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, + updateDownvote: { + plan(_$root, args) { + const plan = object({ + result: pgUpdateSingle(pgResource_downvotePgResource, { + id: args.get(['input', "rowId"]) + }) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, + updateDownvoteByPostIdAndUserId: { + plan(_$root, args) { + const plan = object({ + result: pgUpdateSingle(pgResource_downvotePgResource, { + post_id: args.get(['input', "postId"]), + user_id: args.get(['input', "userId"]) + }) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, updateUpvoteById: { plan(_$root, args) { const plan = object({ - result: pgUpdateSingle(pgResource_upvotePgResource, specFromArgs(args)) + result: pgUpdateSingle(pgResource_upvotePgResource, specFromArgs2(args)) }); args.apply(plan); return plan; @@ -18062,7 +24080,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; updateOrganizationById: { plan(_$root, args) { const plan = object({ - result: pgUpdateSingle(pgResource_organizationPgResource, specFromArgs2(args)) + result: pgUpdateSingle(pgResource_organizationPgResource, specFromArgs3(args)) }); args.apply(plan); return plan; @@ -18129,10 +24147,44 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, + updateCommentById: { + plan(_$root, args) { + const plan = object({ + result: pgUpdateSingle(pgResource_commentPgResource, specFromArgs4(args)) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, + updateComment: { + plan(_$root, args) { + const plan = object({ + result: pgUpdateSingle(pgResource_commentPgResource, { + id: args.get(['input', "rowId"]) + }) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, updatePostById: { plan(_$root, args) { const plan = object({ - result: pgUpdateSingle(pgResource_postPgResource, specFromArgs3(args)) + result: pgUpdateSingle(pgResource_postPgResource, specFromArgs5(args)) }); args.apply(plan); return plan; @@ -18166,7 +24218,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; updateUserById: { plan(_$root, args) { const plan = object({ - result: pgUpdateSingle(pgResource_userPgResource, specFromArgs4(args)) + result: pgUpdateSingle(pgResource_userPgResource, specFromArgs6(args)) }); args.apply(plan); return plan; @@ -18236,7 +24288,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; updateProjectById: { plan(_$root, args) { const plan = object({ - result: pgUpdateSingle(pgResource_projectPgResource, specFromArgs5(args)) + result: pgUpdateSingle(pgResource_projectPgResource, specFromArgs7(args)) }); args.apply(plan); return plan; @@ -18323,10 +24375,63 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, + deleteDownvoteById: { + plan(_$root, args) { + const plan = object({ + result: pgDeleteSingle(pgResource_downvotePgResource, specFromArgs8(args)) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, + deleteDownvote: { + plan(_$root, args) { + const plan = object({ + result: pgDeleteSingle(pgResource_downvotePgResource, { + id: args.get(['input', "rowId"]) + }) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, + deleteDownvoteByPostIdAndUserId: { + plan(_$root, args) { + const plan = object({ + result: pgDeleteSingle(pgResource_downvotePgResource, { + post_id: args.get(['input', "postId"]), + user_id: args.get(['input', "userId"]) + }) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, deleteUpvoteById: { plan(_$root, args) { const plan = object({ - result: pgDeleteSingle(pgResource_upvotePgResource, specFromArgs6(args)) + result: pgDeleteSingle(pgResource_upvotePgResource, specFromArgs9(args)) }); args.apply(plan); return plan; @@ -18379,7 +24484,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; deleteOrganizationById: { plan(_$root, args) { const plan = object({ - result: pgDeleteSingle(pgResource_organizationPgResource, specFromArgs7(args)) + result: pgDeleteSingle(pgResource_organizationPgResource, specFromArgs10(args)) }); args.apply(plan); return plan; @@ -18446,10 +24551,44 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, + deleteCommentById: { + plan(_$root, args) { + const plan = object({ + result: pgDeleteSingle(pgResource_commentPgResource, specFromArgs11(args)) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, + deleteComment: { + plan(_$root, args) { + const plan = object({ + result: pgDeleteSingle(pgResource_commentPgResource, { + id: args.get(['input', "rowId"]) + }) + }); + args.apply(plan); + return plan; + }, + args: { + input: { + applyPlan(_, $object) { + return $object; + } + } + } + }, deletePostById: { plan(_$root, args) { const plan = object({ - result: pgDeleteSingle(pgResource_postPgResource, specFromArgs8(args)) + result: pgDeleteSingle(pgResource_postPgResource, specFromArgs12(args)) }); args.apply(plan); return plan; @@ -18483,7 +24622,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; deleteUserById: { plan(_$root, args) { const plan = object({ - result: pgDeleteSingle(pgResource_userPgResource, specFromArgs9(args)) + result: pgDeleteSingle(pgResource_userPgResource, specFromArgs13(args)) }); args.apply(plan); return plan; @@ -18553,7 +24692,7 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; deleteProjectById: { plan(_$root, args) { const plan = object({ - result: pgDeleteSingle(pgResource_projectPgResource, specFromArgs10(args)) + result: pgDeleteSingle(pgResource_projectPgResource, specFromArgs14(args)) }); args.apply(plan); return plan; @@ -18622,46 +24761,128 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, - CreateUserOrganizationPayload: { - __assertStep: assertExecutableStep, - clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); - }, - userOrganization($object) { - return $object.get("result"); - }, - query() { - return rootValue(); - } - }, - CreateUserOrganizationInput: { + CreateUserOrganizationPayload: { + __assertStep: assertExecutableStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + }, + userOrganization($object) { + return $object.get("result"); + }, + query() { + return rootValue(); + } + }, + CreateUserOrganizationInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + }, + autoApplyAfterParentApplyPlan: true + }, + userOrganization: { + applyPlan($object) { + return $object.getStepForKey("result").setPlan(); + }, + autoApplyAfterParentApplyPlan: true + } + }, + UserOrganizationInput: { + "__inputPlan": function UserOrganizationInput_inputPlan() { + return object(Object.create(null)); + }, + userId: { + applyPlan($insert, val) { + $insert.set("user_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + organizationId: { + applyPlan($insert, val) { + $insert.set("organization_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + createdAt: { + applyPlan($insert, val) { + $insert.set("created_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + } + }, + CreateDownvotePayload: { + __assertStep: assertExecutableStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + }, + downvote($object) { + return $object.get("result"); + }, + query() { + return rootValue(); + }, + downvoteEdge: { + plan($mutation, args, info) { + const $result = $mutation.getStepForKey("result", !0); + if (!$result) return constant(null); + const $select = (() => { + if ($result instanceof PgDeleteSingleStep) return pgSelectFromRecord($result.resource, $result.record());else { + const spec = downvoteUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return pgResource_downvotePgResource.find(spec); + } + })(), + $value = args.getRaw("orderBy"); + applyOrderToPlan($select, $value, info.schema.getType("DownvoteOrderBy")); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + }, + args: { + orderBy: undefined + } + } + }, + CreateDownvoteInput: { clientMutationId: { applyPlan($input, val) { $input.set("clientMutationId", val.get()); }, autoApplyAfterParentApplyPlan: true }, - userOrganization: { + downvote: { applyPlan($object) { return $object.getStepForKey("result").setPlan(); }, autoApplyAfterParentApplyPlan: true } }, - UserOrganizationInput: { - "__inputPlan": function UserOrganizationInput_inputPlan() { + DownvoteInput: { + "__inputPlan": function DownvoteInput_inputPlan() { return object(Object.create(null)); }, - userId: { + rowId: { applyPlan($insert, val) { - $insert.set("user_id", val.get()); + $insert.set("id", val.get()); }, autoApplyAfterParentInputPlan: true, autoApplyAfterParentApplyPlan: true }, - organizationId: { + postId: { applyPlan($insert, val) { - $insert.set("organization_id", val.get()); + $insert.set("post_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + userId: { + applyPlan($insert, val) { + $insert.set("user_id", val.get()); }, autoApplyAfterParentInputPlan: true, autoApplyAfterParentApplyPlan: true @@ -18672,6 +24893,13 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, autoApplyAfterParentInputPlan: true, autoApplyAfterParentApplyPlan: true + }, + updatedAt: { + applyPlan($insert, val) { + $insert.set("updated_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true } }, CreateUpvotePayload: { @@ -18852,6 +25080,102 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; autoApplyAfterParentApplyPlan: true } }, + CreateCommentPayload: { + __assertStep: assertExecutableStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + }, + comment($object) { + return $object.get("result"); + }, + query() { + return rootValue(); + }, + commentEdge: { + plan($mutation, args, info) { + const $result = $mutation.getStepForKey("result", !0); + if (!$result) return constant(null); + const $select = (() => { + if ($result instanceof PgDeleteSingleStep) return pgSelectFromRecord($result.resource, $result.record());else { + const spec = commentUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return pgResource_commentPgResource.find(spec); + } + })(), + $value = args.getRaw("orderBy"); + applyOrderToPlan($select, $value, info.schema.getType("CommentOrderBy")); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + }, + args: { + orderBy: undefined + } + } + }, + CreateCommentInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + }, + autoApplyAfterParentApplyPlan: true + }, + comment: { + applyPlan($object) { + return $object.getStepForKey("result").setPlan(); + }, + autoApplyAfterParentApplyPlan: true + } + }, + CommentInput: { + "__inputPlan": function CommentInput_inputPlan() { + return object(Object.create(null)); + }, + rowId: { + applyPlan($insert, val) { + $insert.set("id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + message: { + applyPlan($insert, val) { + $insert.set("message", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + postId: { + applyPlan($insert, val) { + $insert.set("post_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + userId: { + applyPlan($insert, val) { + $insert.set("user_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + createdAt: { + applyPlan($insert, val) { + $insert.set("created_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + updatedAt: { + applyPlan($insert, val) { + $insert.set("updated_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + } + }, CreatePostPayload: { __assertStep: assertExecutableStep, clientMutationId($mutation) { @@ -19132,23 +25456,163 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; autoApplyAfterParentInputPlan: true, autoApplyAfterParentApplyPlan: true }, - slug: { + slug: { + applyPlan($insert, val) { + $insert.set("slug", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + description: { + applyPlan($insert, val) { + $insert.set("description", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + organizationId: { + applyPlan($insert, val) { + $insert.set("organization_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + createdAt: { + applyPlan($insert, val) { + $insert.set("created_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + updatedAt: { + applyPlan($insert, val) { + $insert.set("updated_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + } + }, + UpdateUserOrganizationPayload: { + __assertStep: ObjectStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + }, + userOrganization($object) { + return $object.get("result"); + }, + query() { + return rootValue(); + } + }, + UpdateUserOrganizationByUserIdAndOrganizationIdInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + userId: undefined, + organizationId: undefined, + patch: { + applyPlan($object) { + return $object.getStepForKey("result").setPlan(); + } + } + }, + UserOrganizationPatch: { + "__inputPlan": function UserOrganizationPatch_inputPlan() { + return object(Object.create(null)); + }, + userId: { + applyPlan($insert, val) { + $insert.set("user_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + organizationId: { + applyPlan($insert, val) { + $insert.set("organization_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + createdAt: { + applyPlan($insert, val) { + $insert.set("created_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + } + }, + UpdateDownvotePayload: { + __assertStep: ObjectStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + }, + downvote($object) { + return $object.get("result"); + }, + query() { + return rootValue(); + }, + downvoteEdge: { + plan($mutation, args, info) { + const $result = $mutation.getStepForKey("result", !0); + if (!$result) return constant(null); + const $select = (() => { + if ($result instanceof PgDeleteSingleStep) return pgSelectFromRecord($result.resource, $result.record());else { + const spec = downvoteUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return pgResource_downvotePgResource.find(spec); + } + })(), + $value = args.getRaw("orderBy"); + applyOrderToPlan($select, $value, info.schema.getType("DownvoteOrderBy")); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + }, + args: { + orderBy: undefined + } + } + }, + UpdateDownvoteByIdInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + id: undefined, + patch: { + applyPlan($object) { + return $object.getStepForKey("result").setPlan(); + } + } + }, + DownvotePatch: { + "__inputPlan": function DownvotePatch_inputPlan() { + return object(Object.create(null)); + }, + rowId: { applyPlan($insert, val) { - $insert.set("slug", val.get()); + $insert.set("id", val.get()); }, autoApplyAfterParentInputPlan: true, autoApplyAfterParentApplyPlan: true }, - description: { + postId: { applyPlan($insert, val) { - $insert.set("description", val.get()); + $insert.set("post_id", val.get()); }, autoApplyAfterParentInputPlan: true, autoApplyAfterParentApplyPlan: true }, - organizationId: { + userId: { applyPlan($insert, val) { - $insert.set("organization_id", val.get()); + $insert.set("user_id", val.get()); }, autoApplyAfterParentInputPlan: true, autoApplyAfterParentApplyPlan: true @@ -19168,58 +25632,33 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; autoApplyAfterParentApplyPlan: true } }, - UpdateUserOrganizationPayload: { - __assertStep: ObjectStep, - clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); - }, - userOrganization($object) { - return $object.get("result"); + UpdateDownvoteInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } }, - query() { - return rootValue(); + rowId: undefined, + patch: { + applyPlan($object) { + return $object.getStepForKey("result").setPlan(); + } } }, - UpdateUserOrganizationByUserIdAndOrganizationIdInput: { + UpdateDownvoteByPostIdAndUserIdInput: { clientMutationId: { applyPlan($input, val) { $input.set("clientMutationId", val.get()); } }, + postId: undefined, userId: undefined, - organizationId: undefined, patch: { applyPlan($object) { return $object.getStepForKey("result").setPlan(); } } }, - UserOrganizationPatch: { - "__inputPlan": function UserOrganizationPatch_inputPlan() { - return object(Object.create(null)); - }, - userId: { - applyPlan($insert, val) { - $insert.set("user_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - organizationId: { - applyPlan($insert, val) { - $insert.set("organization_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - createdAt: { - applyPlan($insert, val) { - $insert.set("created_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - } - }, UpdateUpvotePayload: { __assertStep: ObjectStep, clientMutationId($mutation) { @@ -19462,6 +25901,114 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } } }, + UpdateCommentPayload: { + __assertStep: ObjectStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + }, + comment($object) { + return $object.get("result"); + }, + query() { + return rootValue(); + }, + commentEdge: { + plan($mutation, args, info) { + const $result = $mutation.getStepForKey("result", !0); + if (!$result) return constant(null); + const $select = (() => { + if ($result instanceof PgDeleteSingleStep) return pgSelectFromRecord($result.resource, $result.record());else { + const spec = commentUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return pgResource_commentPgResource.find(spec); + } + })(), + $value = args.getRaw("orderBy"); + applyOrderToPlan($select, $value, info.schema.getType("CommentOrderBy")); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + }, + args: { + orderBy: undefined + } + } + }, + UpdateCommentByIdInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + id: undefined, + patch: { + applyPlan($object) { + return $object.getStepForKey("result").setPlan(); + } + } + }, + CommentPatch: { + "__inputPlan": function CommentPatch_inputPlan() { + return object(Object.create(null)); + }, + rowId: { + applyPlan($insert, val) { + $insert.set("id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + message: { + applyPlan($insert, val) { + $insert.set("message", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + postId: { + applyPlan($insert, val) { + $insert.set("post_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + userId: { + applyPlan($insert, val) { + $insert.set("user_id", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + createdAt: { + applyPlan($insert, val) { + $insert.set("created_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + }, + updatedAt: { + applyPlan($insert, val) { + $insert.set("updated_at", val.get()); + }, + autoApplyAfterParentInputPlan: true, + autoApplyAfterParentApplyPlan: true + } + }, + UpdateCommentInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + rowId: undefined, + patch: { + applyPlan($object) { + return $object.getStepForKey("result").setPlan(); + } + } + }, UpdatePostPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { @@ -19888,6 +26435,71 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; userId: undefined, organizationId: undefined }, + DeleteDownvotePayload: { + __assertStep: ObjectStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + }, + downvote($object) { + return $object.get("result"); + }, + deletedDownvoteId($object) { + const $record = $object.getStepForKey("result"), + specifier = nodeIdHandlerByTypeName.Downvote.plan($record); + return lambda(specifier, nodeIdCodecs_base64JSON_base64JSON.encode); + }, + query() { + return rootValue(); + }, + downvoteEdge: { + plan($mutation, args, info) { + const $result = $mutation.getStepForKey("result", !0); + if (!$result) return constant(null); + const $select = (() => { + if ($result instanceof PgDeleteSingleStep) return pgSelectFromRecord($result.resource, $result.record());else { + const spec = downvoteUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return pgResource_downvotePgResource.find(spec); + } + })(), + $value = args.getRaw("orderBy"); + applyOrderToPlan($select, $value, info.schema.getType("DownvoteOrderBy")); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + }, + args: { + orderBy: undefined + } + } + }, + DeleteDownvoteByIdInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + id: undefined + }, + DeleteDownvoteInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + rowId: undefined + }, + DeleteDownvoteByPostIdAndUserIdInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + postId: undefined, + userId: undefined + }, DeleteUpvotePayload: { __assertStep: ObjectStep, clientMutationId($mutation) { @@ -20025,6 +26637,62 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; }, slug: undefined }, + DeleteCommentPayload: { + __assertStep: ObjectStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + }, + comment($object) { + return $object.get("result"); + }, + deletedCommentId($object) { + const $record = $object.getStepForKey("result"), + specifier = nodeIdHandlerByTypeName.Comment.plan($record); + return lambda(specifier, nodeIdCodecs_base64JSON_base64JSON.encode); + }, + query() { + return rootValue(); + }, + commentEdge: { + plan($mutation, args, info) { + const $result = $mutation.getStepForKey("result", !0); + if (!$result) return constant(null); + const $select = (() => { + if ($result instanceof PgDeleteSingleStep) return pgSelectFromRecord($result.resource, $result.record());else { + const spec = commentUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return pgResource_commentPgResource.find(spec); + } + })(), + $value = args.getRaw("orderBy"); + applyOrderToPlan($select, $value, info.schema.getType("CommentOrderBy")); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + }, + args: { + orderBy: undefined + } + } + }, + DeleteCommentByIdInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + id: undefined + }, + DeleteCommentInput: { + clientMutationId: { + applyPlan($input, val) { + $input.set("clientMutationId", val.get()); + } + }, + rowId: undefined + }, DeletePostPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { diff --git a/src/lib/drizzle/migrations/0002_high_ender_wiggin.sql b/src/lib/drizzle/migrations/0002_high_ender_wiggin.sql new file mode 100644 index 0000000..4de866e --- /dev/null +++ b/src/lib/drizzle/migrations/0002_high_ender_wiggin.sql @@ -0,0 +1,11 @@ +CREATE TABLE "comment" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "message" text, + "post_id" uuid NOT NULL, + "user_id" uuid NOT NULL, + "created_at" timestamp(6) with time zone DEFAULT now(), + "updated_at" timestamp(6) with time zone DEFAULT now() +); +--> statement-breakpoint +ALTER TABLE "comment" ADD CONSTRAINT "comment_post_id_post_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."post"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "comment" ADD CONSTRAINT "comment_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; \ No newline at end of file diff --git a/src/lib/drizzle/migrations/0003_medical_paper_doll.sql b/src/lib/drizzle/migrations/0003_medical_paper_doll.sql new file mode 100644 index 0000000..eb7394e --- /dev/null +++ b/src/lib/drizzle/migrations/0003_medical_paper_doll.sql @@ -0,0 +1,11 @@ +CREATE TABLE "downvote" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "post_id" uuid NOT NULL, + "user_id" uuid NOT NULL, + "created_at" timestamp(6) with time zone DEFAULT now(), + "updated_at" timestamp(6) with time zone DEFAULT now(), + CONSTRAINT "downvote_postId_userId_unique" UNIQUE("post_id","user_id") +); +--> statement-breakpoint +ALTER TABLE "downvote" ADD CONSTRAINT "downvote_post_id_post_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."post"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "downvote" ADD CONSTRAINT "downvote_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action; \ No newline at end of file diff --git a/src/lib/drizzle/migrations/meta/0002_snapshot.json b/src/lib/drizzle/migrations/meta/0002_snapshot.json new file mode 100644 index 0000000..5f07cbf --- /dev/null +++ b/src/lib/drizzle/migrations/meta/0002_snapshot.json @@ -0,0 +1,561 @@ +{ + "id": "a07ce84b-3633-4339-9d3f-3f1ea87fd405", + "prevId": "7fb3a1e8-4855-4cf2-a51f-829a6cb9943e", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.comment": { + "name": "comment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "post_id": { + "name": "post_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "comment_post_id_post_id_fk": { + "name": "comment_post_id_post_id_fk", + "tableFrom": "comment", + "tableTo": "post", + "columnsFrom": [ + "post_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "comment_user_id_user_id_fk": { + "name": "comment_user_id_user_id_fk", + "tableFrom": "comment", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_name_unique": { + "name": "organization_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + }, + "organization_slug_unique": { + "name": "organization_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.post": { + "name": "post", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "post_project_id_project_id_fk": { + "name": "post_project_id_project_id_fk", + "tableFrom": "post", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "post_user_id_user_id_fk": { + "name": "post_user_id_user_id_fk", + "tableFrom": "post", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project": { + "name": "project", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "project_organization_id_organization_id_fk": { + "name": "project_organization_id_organization_id_fk", + "tableFrom": "project", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "project_name_unique": { + "name": "project_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + }, + "project_slug_organizationId_unique": { + "name": "project_slug_organizationId_unique", + "nullsNotDistinct": false, + "columns": [ + "slug", + "organization_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.upvote": { + "name": "upvote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "post_id": { + "name": "post_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "upvote_post_id_post_id_fk": { + "name": "upvote_post_id_post_id_fk", + "tableFrom": "upvote", + "tableTo": "post", + "columnsFrom": [ + "post_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "upvote_user_id_user_id_fk": { + "name": "upvote_user_id_user_id_fk", + "tableFrom": "upvote", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "upvote_postId_userId_unique": { + "name": "upvote_postId_userId_unique", + "nullsNotDistinct": false, + "columns": [ + "post_id", + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "hidra_id": { + "name": "hidra_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_hidraId_unique": { + "name": "user_hidraId_unique", + "nullsNotDistinct": false, + "columns": [ + "hidra_id" + ] + }, + "user_username_unique": { + "name": "user_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_organization": { + "name": "user_organization", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_organization_user_id_user_id_fk": { + "name": "user_organization_user_id_user_id_fk", + "tableFrom": "user_organization", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_organization_organization_id_organization_id_fk": { + "name": "user_organization_organization_id_organization_id_fk", + "tableFrom": "user_organization", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_organization_userId_organizationId_unique": { + "name": "user_organization_userId_organizationId_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id", + "organization_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/src/lib/drizzle/migrations/meta/0003_snapshot.json b/src/lib/drizzle/migrations/meta/0003_snapshot.json new file mode 100644 index 0000000..63c8bc5 --- /dev/null +++ b/src/lib/drizzle/migrations/meta/0003_snapshot.json @@ -0,0 +1,643 @@ +{ + "id": "c3d6effb-2f62-41a2-b761-2021cf198532", + "prevId": "a07ce84b-3633-4339-9d3f-3f1ea87fd405", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.comment": { + "name": "comment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "post_id": { + "name": "post_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "comment_post_id_post_id_fk": { + "name": "comment_post_id_post_id_fk", + "tableFrom": "comment", + "tableTo": "post", + "columnsFrom": [ + "post_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "comment_user_id_user_id_fk": { + "name": "comment_user_id_user_id_fk", + "tableFrom": "comment", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.downvote": { + "name": "downvote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "post_id": { + "name": "post_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "downvote_post_id_post_id_fk": { + "name": "downvote_post_id_post_id_fk", + "tableFrom": "downvote", + "tableTo": "post", + "columnsFrom": [ + "post_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "downvote_user_id_user_id_fk": { + "name": "downvote_user_id_user_id_fk", + "tableFrom": "downvote", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "downvote_postId_userId_unique": { + "name": "downvote_postId_userId_unique", + "nullsNotDistinct": false, + "columns": [ + "post_id", + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organization": { + "name": "organization", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organization_name_unique": { + "name": "organization_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + }, + "organization_slug_unique": { + "name": "organization_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.post": { + "name": "post", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "post_project_id_project_id_fk": { + "name": "post_project_id_project_id_fk", + "tableFrom": "post", + "tableTo": "project", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "post_user_id_user_id_fk": { + "name": "post_user_id_user_id_fk", + "tableFrom": "post", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.project": { + "name": "project", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "project_organization_id_organization_id_fk": { + "name": "project_organization_id_organization_id_fk", + "tableFrom": "project", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "project_name_unique": { + "name": "project_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + }, + "project_slug_organizationId_unique": { + "name": "project_slug_organizationId_unique", + "nullsNotDistinct": false, + "columns": [ + "slug", + "organization_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.upvote": { + "name": "upvote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "post_id": { + "name": "post_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "upvote_post_id_post_id_fk": { + "name": "upvote_post_id_post_id_fk", + "tableFrom": "upvote", + "tableTo": "post", + "columnsFrom": [ + "post_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "upvote_user_id_user_id_fk": { + "name": "upvote_user_id_user_id_fk", + "tableFrom": "upvote", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "upvote_postId_userId_unique": { + "name": "upvote_postId_userId_unique", + "nullsNotDistinct": false, + "columns": [ + "post_id", + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "hidra_id": { + "name": "hidra_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_hidraId_unique": { + "name": "user_hidraId_unique", + "nullsNotDistinct": false, + "columns": [ + "hidra_id" + ] + }, + "user_username_unique": { + "name": "user_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_organization": { + "name": "user_organization", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "user_organization_user_id_user_id_fk": { + "name": "user_organization_user_id_user_id_fk", + "tableFrom": "user_organization", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "user_organization_organization_id_organization_id_fk": { + "name": "user_organization_organization_id_organization_id_fk", + "tableFrom": "user_organization", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_organization_userId_organizationId_unique": { + "name": "user_organization_userId_organizationId_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id", + "organization_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/src/lib/drizzle/migrations/meta/_journal.json b/src/lib/drizzle/migrations/meta/_journal.json index 9555aaf..9111197 100644 --- a/src/lib/drizzle/migrations/meta/_journal.json +++ b/src/lib/drizzle/migrations/meta/_journal.json @@ -15,6 +15,20 @@ "when": 1735577973197, "tag": "0001_thankful_shinko_yamashiro", "breakpoints": true + }, + { + "idx": 2, + "version": "7", + "when": 1735611260906, + "tag": "0002_high_ender_wiggin", + "breakpoints": true + }, + { + "idx": 3, + "version": "7", + "when": 1735658626719, + "tag": "0003_medical_paper_doll", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/lib/drizzle/schema/comment.table.ts b/src/lib/drizzle/schema/comment.table.ts new file mode 100644 index 0000000..d81aa58 --- /dev/null +++ b/src/lib/drizzle/schema/comment.table.ts @@ -0,0 +1,48 @@ +import { relations } from "drizzle-orm"; +import { pgTable, text, uuid } from "drizzle-orm/pg-core"; + +import { defaultDate, defaultId } from "./constants"; +import { posts } from "./post.table"; +import { users } from "./user.table"; + +import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; + +/** + * Comment table. Comments serve as units of feedback item discourse. + */ +export const comments = pgTable("comment", { + id: defaultId(), + message: text(), + postId: uuid() + .notNull() + .references(() => posts.id, { + onDelete: "cascade", + }), + userId: uuid() + .notNull() + .references(() => users.id, { + onDelete: "cascade", + }), + createdAt: defaultDate(), + updatedAt: defaultDate(), +}); + +/** + * Relations for the comment table. + */ +export const commentRelations = relations(comments, ({ one }) => ({ + post: one(posts, { + fields: [comments.postId], + references: [posts.id], + }), + user: one(users, { + fields: [comments.userId], + references: [users.id], + }), +})); + +/** + * Type helpers related to the comment table. + */ +export type InsertComment = InferInsertModel; +export type SelectComment = InferSelectModel; diff --git a/src/lib/drizzle/schema/downvote.table.ts b/src/lib/drizzle/schema/downvote.table.ts new file mode 100644 index 0000000..9aab720 --- /dev/null +++ b/src/lib/drizzle/schema/downvote.table.ts @@ -0,0 +1,51 @@ +import { relations } from "drizzle-orm"; +import { pgTable, unique, uuid } from "drizzle-orm/pg-core"; + +import { defaultDate, defaultId } from "./constants"; +import { posts } from "./post.table"; +import { users } from "./user.table"; + +import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; + +/** + * Downvote table. Downvotes are used to represent negative sentiment on posts. + */ +export const downvotes = pgTable( + "downvote", + { + id: defaultId(), + postId: uuid() + .notNull() + .references(() => posts.id, { + onDelete: "cascade", + }), + userId: uuid() + .notNull() + .references(() => users.id, { + onDelete: "cascade", + }), + createdAt: defaultDate(), + updatedAt: defaultDate(), + }, + (table) => [unique().on(table.postId, table.userId)] +); + +/** + * Relations for the downvote table. + */ +export const downvoteRelations = relations(downvotes, ({ one }) => ({ + post: one(posts, { + fields: [downvotes.postId], + references: [posts.id], + }), + user: one(users, { + fields: [downvotes.userId], + references: [users.id], + }), +})); + +/** + * Type helpers related to the downvote table. + */ +export type InsertDownvote = InferInsertModel; +export type SelectDownvote = InferSelectModel; diff --git a/src/lib/drizzle/schema/index.ts b/src/lib/drizzle/schema/index.ts index ca9592c..6aac608 100644 --- a/src/lib/drizzle/schema/index.ts +++ b/src/lib/drizzle/schema/index.ts @@ -1,3 +1,5 @@ +export * from "./comment.table"; +export * from "./downvote.table"; export * from "./organization.table"; export * from "./post.table"; export * from "./project.table"; diff --git a/src/lib/drizzle/schema/post.table.ts b/src/lib/drizzle/schema/post.table.ts index 03db956..61f3c9b 100644 --- a/src/lib/drizzle/schema/post.table.ts +++ b/src/lib/drizzle/schema/post.table.ts @@ -1,7 +1,9 @@ import { relations } from "drizzle-orm"; import { pgTable, text, uuid } from "drizzle-orm/pg-core"; +import { comments } from "./comment.table"; import { defaultDate, defaultId } from "./constants"; +import { downvotes } from "./downvote.table"; import { projects } from "./project.table"; import { upvotes } from "./upvote.table"; import { users } from "./user.table"; @@ -41,7 +43,9 @@ export const postRelations = relations(posts, ({ one, many }) => ({ fields: [posts.userId], references: [users.id], }), + comments: many(comments), upvotes: many(upvotes), + downvotes: many(downvotes), })); /** diff --git a/src/lib/drizzle/schema/user.table.ts b/src/lib/drizzle/schema/user.table.ts index db4a337..645e29e 100644 --- a/src/lib/drizzle/schema/user.table.ts +++ b/src/lib/drizzle/schema/user.table.ts @@ -1,7 +1,9 @@ import { relations } from "drizzle-orm"; import { pgTable, text, uuid } from "drizzle-orm/pg-core"; +import { comments } from "./comment.table"; import { defaultDate, defaultId } from "./constants"; +import { downvotes } from "./downvote.table"; import { posts } from "./post.table"; import { upvotes } from "./upvote.table"; import { usersToOrganizations } from "./userToOrganization.table"; @@ -28,7 +30,9 @@ export const users = pgTable("user", { export const userRelations = relations(users, ({ many }) => ({ organizations: many(usersToOrganizations), posts: many(posts), + comments: many(comments), upvotes: many(upvotes), + downvotes: many(downvotes), })); /** diff --git a/src/scripts/seedDatabase.ts b/src/scripts/seedDatabase.ts index 181507b..b9a2c5a 100644 --- a/src/scripts/seedDatabase.ts +++ b/src/scripts/seedDatabase.ts @@ -22,22 +22,26 @@ const seedDatabase = async () => { await seed(db, schema).refine((f) => ({ organizations: { - count: 400, + count: 200, columns: { name: f.companyName(), }, + with: { + projects: 50, + }, }, projects: { - count: 2000, columns: { description: f.loremIpsum(), slug: f.string({ isUnique: true, }), }, + with: { + posts: 20, + }, }, posts: { - count: 10000, columns: { title: f.companyName(), description: f.loremIpsum(), @@ -46,15 +50,24 @@ const seedDatabase = async () => { maxDate: dayjs(new Date()).format("YYYY-MM-DD"), }), }, + with: { + comments: 10, + }, }, users: { count: 500, + with: { + upvotes: 10, + downvotes: 10, + }, }, usersToOrganizations: { - count: 50, + count: 100, }, - upvotes: { - count: 1000, + comments: { + columns: { + message: f.loremIpsum(), + }, }, })); diff --git a/src/server.ts b/src/server.ts index d19758f..1362770 100644 --- a/src/server.ts +++ b/src/server.ts @@ -38,7 +38,7 @@ app.use( origin: isProdEnv ? appConfig.url : "http://localhost:3000", credentials: true, allowMethods: ["POST"], - }), + }) ); // mount GraphQL API @@ -47,7 +47,7 @@ app.use("/graphql", async (c) => yoga.handle(c.req.raw, {})); // GraphQL Yoga suppresses logging the startup message in production environments by default if (isProdEnv) console.log( - `🚀 ${appConfig.name} GraphQL API running at http://${HOST}:${PORT}`, + `🚀 ${appConfig.name} GraphQL API running at http://${HOST}:${PORT}` ); export default {