diff --git a/.env.development b/.env.development index 5a5e098..6f3a57f 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,4 @@ # TODO change once base path changes (https://linear.app/omnidev/issue/OMNI-254/move-apiauth-paths-to-base-path-or-subpath-eg-auth) AUTH_BASE_URL="https://localhost:8000/api/auth" + +CHECKOUT_SUCCESS_URL="https://localhost:3000/confirmation" diff --git a/.env.local.template b/.env.local.template index 418b8f4..e4bd1cf 100644 --- a/.env.local.template +++ b/.env.local.template @@ -1,4 +1,10 @@ DATABASE_URL="postgresql://postgres:postgres@localhost:5432/backfeed?schema=public" +# payment processing +# NB: for local development, make sure this token is generated for the Polar sandbox environment (https://docs.polar.sh/integrate/sandbox) in the Polar dashboard. If `NODE_ENV` is `development`, the sandbox will be used, otherwise Polar production will be used +POLAR_ACCESS_TOKEN="" +# a webhook secret can be generated at https://sandbox.polar.sh/dashboard/$ORGANIZATION_NAME/settings/webhooks +POLAR_WEBHOOK_SECRET="" + # skip auth check on API (set to SKIP_AUTH="true" to enable skip) SKIP_AUTH="" diff --git a/.env.production b/.env.production index c30c03a..c6462e4 100644 --- a/.env.production +++ b/.env.production @@ -1,2 +1,4 @@ # TODO change once base path changes (https://linear.app/omnidev/issue/OMNI-254/move-apiauth-paths-to-base-path-or-subpath-eg-auth) AUTH_BASE_URL="https://identity.omni.dev/api/auth" + +CHECKOUT_SUCCESS_URL="https://backfeed.omni.dev/confirmation" diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..cdba092 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Omni LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e968fda --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Backfeed API + +Backfeed is an open-source feedback reporting platform. + +## Local Development + +First, create a Postgres database called `backfeed`. Then, `cp .env.local.template .env.local` and fill in the values. + +### Building and Running (Native) + +Install dependencies: + +```sh +bun install +``` + +Run database migrations: + +```sh +bun db:migrate +``` + +Run the dev server: + +```sh +bun run dev +``` + +### Webhooks (Payments) + +Our Backfeed payment processor, [Polar](https://polar.sh), issues webhooks. Webhooks are used in this project for realtime updates. Webhooks can be managed at https://sandbox.polar.sh/dashboard/$ORGANIZATION_NAME/settings/webhooks. + +## License + +The code in this repository is licensed under MIT, © Omni LLC. See [LICENSE.md](LICENSE.md) for more information. diff --git a/bun.lock b/bun.lock index 008665f..cae5459 100644 --- a/bun.lock +++ b/bun.lock @@ -2,24 +2,27 @@ "lockfileVersion": 1, "workspaces": { "": { + "name": "backfeed-graphql-api", "dependencies": { "@envelop/generic-auth": "^9.1.3", "@envelop/parser-cache": "^8.1.3", "@envelop/validation-cache": "^8.1.3", "@escape.tech/graphql-armor": "^3.1.2", - "@graphile/pg-aggregates": "0.2.0-beta.7", - "@graphile/simplify-inflection": "8.0.0-beta.5", + "@graphile/pg-aggregates": "0.2.0-beta.8", + "@graphile/simplify-inflection": "8.0.0-beta.6", + "@polar-sh/hono": "^0.3.0", "dayjs": "^1.11.13", - "drizzle-orm": "^0.41.0", + "drizzle-orm": "^0.42.0", "drizzle-seed": "^0.3.1", - "graphile-export": "0.0.2-beta.24", + "graphile-export": "0.0.2-beta.26", "graphql": "^16.10.0", "graphql-yoga": "^5.13.2", - "hono": "^4.7.5", + "hono": "^4.7.7", "jose": "^6.0.10", "pg": "^8.14.1", - "postgraphile": "5.0.0-beta.37", - "postgraphile-plugin-connection-filter": "3.0.0-beta.7", + "postgraphile": "5.0.0-beta.40", + "postgraphile-plugin-connection-filter": "3.0.0-beta.8", + "zod": "^3.24.3", }, "devDependencies": { "@biomejs/biome": "^1.9.4", @@ -27,7 +30,7 @@ "@types/bun": "^1.2.8", "@types/node": "^22.13.14", "@types/pg": "^8.11.11", - "drizzle-kit": "^0.30.6", + "drizzle-kit": "^0.31.0", "husky": "^9.1.7", "replace-in-file": "^8.3.0", "typescript": "^5.8.2", @@ -41,19 +44,19 @@ "packages": { "@babel/code-frame": ["@babel/code-frame@7.26.2", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.25.9", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" } }, "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ=="], - "@babel/generator": ["@babel/generator@7.26.3", "", { "dependencies": { "@babel/parser": "^7.26.3", "@babel/types": "^7.26.3", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" } }, "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ=="], + "@babel/generator": ["@babel/generator@7.27.0", "", { "dependencies": { "@babel/parser": "^7.27.0", "@babel/types": "^7.27.0", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" } }, "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw=="], "@babel/helper-string-parser": ["@babel/helper-string-parser@7.25.9", "", {}, "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA=="], "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.25.9", "", {}, "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ=="], - "@babel/parser": ["@babel/parser@7.26.3", "", { "dependencies": { "@babel/types": "^7.26.3" }, "bin": "./bin/babel-parser.js" }, "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA=="], + "@babel/parser": ["@babel/parser@7.27.0", "", { "dependencies": { "@babel/types": "^7.27.0" }, "bin": "./bin/babel-parser.js" }, "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg=="], - "@babel/template": ["@babel/template@7.25.9", "", { "dependencies": { "@babel/code-frame": "^7.25.9", "@babel/parser": "^7.25.9", "@babel/types": "^7.25.9" } }, "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg=="], + "@babel/template": ["@babel/template@7.27.0", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/parser": "^7.27.0", "@babel/types": "^7.27.0" } }, "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA=="], - "@babel/traverse": ["@babel/traverse@7.26.4", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/generator": "^7.26.3", "@babel/parser": "^7.26.3", "@babel/template": "^7.25.9", "@babel/types": "^7.26.3", "debug": "^4.3.1", "globals": "^11.1.0" } }, "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w=="], + "@babel/traverse": ["@babel/traverse@7.27.0", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/generator": "^7.27.0", "@babel/parser": "^7.27.0", "@babel/template": "^7.27.0", "@babel/types": "^7.27.0", "debug": "^4.3.1", "globals": "^11.1.0" } }, "sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA=="], - "@babel/types": ["@babel/types@7.26.3", "", { "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" } }, "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA=="], + "@babel/types": ["@babel/types@7.27.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" } }, "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg=="], "@biomejs/biome": ["@biomejs/biome@1.9.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="], @@ -73,9 +76,9 @@ "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@1.9.4", "", { "os": "win32", "cpu": "x64" }, "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA=="], - "@dataplan/json": ["@dataplan/json@0.0.1-beta.28", "", { "dependencies": { "chalk": "^4.1.2", "tslib": "^2.6.2" }, "peerDependencies": { "grafast": "^0.1.1-beta.19" } }, "sha512-MtRzHpOolBWtW8xSLJVBLPfOC4NItOSY9XE6O3WHmL7+aEbUc2yFTOEaFdUnQbKea68m4CAUevkBHaq0ZwxY9Q=="], + "@dataplan/json": ["@dataplan/json@0.0.1-beta.30", "", { "dependencies": { "chalk": "^4.1.2", "tslib": "^2.6.2" }, "peerDependencies": { "grafast": "^0.1.1-beta.21" } }, "sha512-cy3mVqGgLh9YOptOnWlTCRvD+hI8k0dNbHNHugzEVWXw7G+zbo06ywJ8/WKGBNsAYG+7/avYNYcx8nlVSTFYFg=="], - "@dataplan/pg": ["@dataplan/pg@0.0.1-beta.30", "", { "dependencies": { "@graphile/lru": "^5.0.0-beta.3", "@types/node": "^20.5.7", "chalk": "^4.1.2", "debug": "^4.3.4", "eventemitter3": "^5.0.1", "pg-sql2": "^5.0.0-beta.7", "postgres-array": "~3.0.2", "postgres-range": "^1.1.3", "tslib": "^2.6.2" }, "peerDependencies": { "@dataplan/json": "^0.0.1-beta.28", "grafast": "^0.1.1-beta.19", "graphile-config": "^0.0.1-beta.14", "pg": "^8.7.1" }, "optionalPeers": ["graphile-config", "pg"] }, "sha512-6R2Kcq2A1vip8Vq9zma8YXVgreplT+T5If5uMkIlVDmkMMSW+EyHu4B8C/iO2DTj7/PjQqjsbljtWjJrTTT0SQ=="], + "@dataplan/pg": ["@dataplan/pg@0.0.1-beta.32", "", { "dependencies": { "@graphile/lru": "^5.0.0-beta.3", "@types/node": "^20.5.7", "chalk": "^4.1.2", "debug": "^4.3.4", "eventemitter3": "^5.0.1", "pg-sql2": "^5.0.0-beta.8", "postgres-array": "~3.0.2", "postgres-range": "^1.1.3", "tslib": "^2.6.2" }, "peerDependencies": { "@dataplan/json": "^0.0.1-beta.30", "grafast": "^0.1.1-beta.21", "graphile-config": "^0.0.1-beta.15", "pg": "^8.7.1" }, "optionalPeers": ["graphile-config", "pg"] }, "sha512-XQ5XK+P4CpeD7zi2IQI6MLL5RJwZowUw3acgcOw6fNrS833eHRn3fmY4HKGPUT/hMZwKX/Rah1mmhnFB/HQgmQ=="], "@drizzle-team/brocli": ["@drizzle-team/brocli@0.10.2", "", {}, "sha512-z33Il7l5dKjUgGULTqBsQBQwckHh5AbIuxhdsIxDDiZAzBOrZO6q9ogcWC65kU382AfynTfgNumVcNIjuIua6w=="], @@ -101,59 +104,63 @@ "@esbuild-kit/esm-loader": ["@esbuild-kit/esm-loader@2.6.5", "", { "dependencies": { "@esbuild-kit/core-utils": "^3.3.2", "get-tsconfig": "^4.7.0" } }, "sha512-FxEMIkJKnodyA1OaCUoEvbYRkoZlLZ4d/eXFu9Fh8CbBBgP5EmZxrfTRyN0qpXZ4vOvqnE5YdRdcrmUUXuU+dA=="], - "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.19.12", "", { "os": "aix", "cpu": "ppc64" }, "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA=="], + "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag=="], - "@esbuild/android-arm": ["@esbuild/android-arm@0.19.12", "", { "os": "android", "cpu": "arm" }, "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w=="], + "@esbuild/android-arm": ["@esbuild/android-arm@0.25.2", "", { "os": "android", "cpu": "arm" }, "sha512-NQhH7jFstVY5x8CKbcfa166GoV0EFkaPkCKBQkdPJFvo5u+nGXLEH/ooniLb3QI8Fk58YAx7nsPLozUWfCBOJA=="], - "@esbuild/android-arm64": ["@esbuild/android-arm64@0.19.12", "", { "os": "android", "cpu": "arm64" }, "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA=="], + "@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.2", "", { "os": "android", "cpu": "arm64" }, "sha512-5ZAX5xOmTligeBaeNEPnPaeEuah53Id2tX4c2CVP3JaROTH+j4fnfHCkr1PjXMd78hMst+TlkfKcW/DlTq0i4w=="], - "@esbuild/android-x64": ["@esbuild/android-x64@0.19.12", "", { "os": "android", "cpu": "x64" }, "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew=="], + "@esbuild/android-x64": ["@esbuild/android-x64@0.25.2", "", { "os": "android", "cpu": "x64" }, "sha512-Ffcx+nnma8Sge4jzddPHCZVRvIfQ0kMsUsCMcJRHkGJ1cDmhe4SsrYIjLUKn1xpHZybmOqCWwB0zQvsjdEHtkg=="], - "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.19.12", "", { "os": "darwin", "cpu": "arm64" }, "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g=="], + "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-MpM6LUVTXAzOvN4KbjzU/q5smzryuoNjlriAIx+06RpecwCkL9JpenNzpKd2YMzLJFOdPqBpuub6eVRP5IgiSA=="], - "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.19.12", "", { "os": "darwin", "cpu": "x64" }, "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A=="], + "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-5eRPrTX7wFyuWe8FqEFPG2cU0+butQQVNcT4sVipqjLYQjjh8a8+vUTfgBKM88ObB85ahsnTwF7PSIt6PG+QkA=="], - "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.19.12", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA=="], + "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.2", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-mLwm4vXKiQ2UTSX4+ImyiPdiHjiZhIaE9QvC7sw0tZ6HoNMjYAqQpGyui5VRIi5sGd+uWq940gdCbY3VLvsO1w=="], - "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.19.12", "", { "os": "freebsd", "cpu": "x64" }, "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg=="], + "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-6qyyn6TjayJSwGpm8J9QYYGQcRgc90nmfdUb0O7pp1s4lTY+9D0H9O02v5JqGApUyiHOtkz6+1hZNvNtEhbwRQ=="], - "@esbuild/linux-arm": ["@esbuild/linux-arm@0.19.12", "", { "os": "linux", "cpu": "arm" }, "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w=="], + "@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.2", "", { "os": "linux", "cpu": "arm" }, "sha512-UHBRgJcmjJv5oeQF8EpTRZs/1knq6loLxTsjc3nxO9eXAPDLcWW55flrMVc97qFPbmZP31ta1AZVUKQzKTzb0g=="], - "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.19.12", "", { "os": "linux", "cpu": "arm64" }, "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA=="], + "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-gq/sjLsOyMT19I8obBISvhoYiZIAaGF8JpeXu1u8yPv8BE5HlWYobmlsfijFIZ9hIVGYkbdFhEqC0NvM4kNO0g=="], - "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.19.12", "", { "os": "linux", "cpu": "ia32" }, "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA=="], + "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.2", "", { "os": "linux", "cpu": "ia32" }, "sha512-bBYCv9obgW2cBP+2ZWfjYTU+f5cxRoGGQ5SeDbYdFCAZpYWrfjjfYwvUpP8MlKbP0nwZ5gyOU/0aUzZ5HWPuvQ=="], - "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.19.12", "", { "os": "linux", "cpu": "none" }, "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA=="], + "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.2", "", { "os": "linux", "cpu": "none" }, "sha512-SHNGiKtvnU2dBlM5D8CXRFdd+6etgZ9dXfaPCeJtz+37PIUlixvlIhI23L5khKXs3DIzAn9V8v+qb1TRKrgT5w=="], - "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.19.12", "", { "os": "linux", "cpu": "none" }, "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w=="], + "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.2", "", { "os": "linux", "cpu": "none" }, "sha512-hDDRlzE6rPeoj+5fsADqdUZl1OzqDYow4TB4Y/3PlKBD0ph1e6uPHzIQcv2Z65u2K0kpeByIyAjCmjn1hJgG0Q=="], - "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.19.12", "", { "os": "linux", "cpu": "ppc64" }, "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg=="], + "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-tsHu2RRSWzipmUi9UBDEzc0nLc4HtpZEI5Ba+Omms5456x5WaNuiG3u7xh5AO6sipnJ9r4cRWQB2tUjPyIkc6g=="], - "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.19.12", "", { "os": "linux", "cpu": "none" }, "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg=="], + "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.2", "", { "os": "linux", "cpu": "none" }, "sha512-k4LtpgV7NJQOml/10uPU0s4SAXGnowi5qBSjaLWMojNCUICNu7TshqHLAEbkBdAszL5TabfvQ48kK84hyFzjnw=="], - "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.19.12", "", { "os": "linux", "cpu": "s390x" }, "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg=="], + "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-GRa4IshOdvKY7M/rDpRR3gkiTNp34M0eLTaC1a08gNrh4u488aPhuZOCpkF6+2wl3zAN7L7XIpOFBhnaE3/Q8Q=="], - "@esbuild/linux-x64": ["@esbuild/linux-x64@0.19.12", "", { "os": "linux", "cpu": "x64" }, "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg=="], + "@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.2", "", { "os": "linux", "cpu": "x64" }, "sha512-QInHERlqpTTZ4FRB0fROQWXcYRD64lAoiegezDunLpalZMjcUcld3YzZmVJ2H/Cp0wJRZ8Xtjtj0cEHhYc/uUg=="], - "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.19.12", "", { "os": "none", "cpu": "x64" }, "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA=="], + "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.2", "", { "os": "none", "cpu": "arm64" }, "sha512-talAIBoY5M8vHc6EeI2WW9d/CkiO9MQJ0IOWX8hrLhxGbro/vBXJvaQXefW2cP0z0nQVTdQ/eNyGFV1GSKrxfw=="], - "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.19.12", "", { "os": "openbsd", "cpu": "x64" }, "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw=="], + "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.2", "", { "os": "none", "cpu": "x64" }, "sha512-voZT9Z+tpOxrvfKFyfDYPc4DO4rk06qamv1a/fkuzHpiVBMOhpjK+vBmWM8J1eiB3OLSMFYNaOaBNLXGChf5tg=="], - "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.19.12", "", { "os": "sunos", "cpu": "x64" }, "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA=="], + "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.2", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-dcXYOC6NXOqcykeDlwId9kB6OkPUxOEqU+rkrYVqJbK2hagWOMrsTGsMr8+rW02M+d5Op5NNlgMmjzecaRf7Tg=="], - "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.19.12", "", { "os": "win32", "cpu": "arm64" }, "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A=="], + "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.2", "", { "os": "openbsd", "cpu": "x64" }, "sha512-t/TkWwahkH0Tsgoq1Ju7QfgGhArkGLkF1uYz8nQS/PPFlXbP5YgRpqQR3ARRiC2iXoLTWFxc6DJMSK10dVXluw=="], - "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.19.12", "", { "os": "win32", "cpu": "ia32" }, "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ=="], + "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.2", "", { "os": "sunos", "cpu": "x64" }, "sha512-cfZH1co2+imVdWCjd+D1gf9NjkchVhhdpgb1q5y6Hcv9TP6Zi9ZG/beI3ig8TvwT9lH9dlxLq5MQBBgwuj4xvA=="], - "@esbuild/win32-x64": ["@esbuild/win32-x64@0.19.12", "", { "os": "win32", "cpu": "x64" }, "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA=="], + "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-7Loyjh+D/Nx/sOTzV8vfbB3GJuHdOQyrOryFdZvPHLf42Tk9ivBU5Aedi7iyX+x6rbn2Mh68T4qq1SDqJBQO5Q=="], - "@escape.tech/graphql-armor": ["@escape.tech/graphql-armor@3.1.2", "", { "dependencies": { "@escape.tech/graphql-armor-block-field-suggestions": "3.0.0", "@escape.tech/graphql-armor-cost-limit": "2.4.0", "@escape.tech/graphql-armor-max-aliases": "2.6.0", "@escape.tech/graphql-armor-max-depth": "2.4.0", "@escape.tech/graphql-armor-max-directives": "2.3.0", "@escape.tech/graphql-armor-max-tokens": "2.5.0", "graphql": "^16.0.0" }, "peerDependencies": { "@apollo/server": "^4.0.0", "@envelop/core": "^5.0.0", "@escape.tech/graphql-armor-types": "0.7.0" }, "optionalPeers": ["@apollo/server", "@envelop/core", "@escape.tech/graphql-armor-types"] }, "sha512-nrCSdBTQU2f087xQXDqCI8dbyG+YG0Rj79vNonahea0qs12pKGTpKgOkbTnEeFqY/UIWxlkl9zipKWa5VoEPgg=="], + "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-WRJgsz9un0nqZJ4MfhabxaD9Ft8KioqU3JMinOTvobbX6MOSUigSBlogP8QB3uxpJDsFS6yN+3FDBdqE5lg9kg=="], + + "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.2", "", { "os": "win32", "cpu": "x64" }, "sha512-kM3HKb16VIXZyIeVrM1ygYmZBKybX8N4p754bw390wGO3Tf2j4L2/WYL+4suWujpgf6GBYs3jv7TyUivdd05JA=="], + + "@escape.tech/graphql-armor": ["@escape.tech/graphql-armor@3.1.3", "", { "dependencies": { "@escape.tech/graphql-armor-block-field-suggestions": "3.0.0", "@escape.tech/graphql-armor-cost-limit": "2.4.0", "@escape.tech/graphql-armor-max-aliases": "2.6.1", "@escape.tech/graphql-armor-max-depth": "2.4.0", "@escape.tech/graphql-armor-max-directives": "2.3.0", "@escape.tech/graphql-armor-max-tokens": "2.5.0", "graphql": "^16.0.0" }, "peerDependencies": { "@apollo/server": "^4.0.0", "@envelop/core": "^5.0.0", "@escape.tech/graphql-armor-types": "0.7.0" }, "optionalPeers": ["@apollo/server", "@envelop/core", "@escape.tech/graphql-armor-types"] }, "sha512-9A8ATmBHNp1yUjHqIXaVEoVkeIg+WFipVacq03LPjNVr36ScHWtU7og023Jd+HlJkTDYxIA/FVCXfFsEvMiwJQ=="], "@escape.tech/graphql-armor-block-field-suggestions": ["@escape.tech/graphql-armor-block-field-suggestions@3.0.0", "", { "dependencies": { "graphql": "^16.0.0" }, "optionalDependencies": { "@envelop/core": "^5.0.0" } }, "sha512-fx6o6uh9t9B96qFMdzp3TfBPW/wcGExa9F82PgHIekpKkg50K8848brv6y8Ue17VpVsleiYXHQeMtS4W4pY2AQ=="], "@escape.tech/graphql-armor-cost-limit": ["@escape.tech/graphql-armor-cost-limit@2.4.0", "", { "dependencies": { "graphql": "^16.0.0" }, "optionalDependencies": { "@envelop/core": "^5.0.0", "@escape.tech/graphql-armor-types": "0.7.0" } }, "sha512-B1s95ZFG1Xv4RtkQxpSe/tkFP2b0Cprvt8ZDnY7NddjRoI5kHy5aQt6n3g0erB9eMKXm17e0h+TcurMhVSTaPw=="], - "@escape.tech/graphql-armor-max-aliases": ["@escape.tech/graphql-armor-max-aliases@2.6.0", "", { "dependencies": { "graphql": "^16.0.0" }, "optionalDependencies": { "@envelop/core": "^5.0.0", "@escape.tech/graphql-armor-types": "0.7.0" } }, "sha512-9dwRC5+dl986byBD9QRYRUrLALa7awpUe4aIM1j7StZHGJgmYRj3LZaWQM3JyI8j2FXg4rqBC4FJAiVYpRyWqw=="], + "@escape.tech/graphql-armor-max-aliases": ["@escape.tech/graphql-armor-max-aliases@2.6.1", "", { "dependencies": { "graphql": "^16.0.0" }, "optionalDependencies": { "@envelop/core": "^5.0.0", "@escape.tech/graphql-armor-types": "0.7.0" } }, "sha512-R6DJqGXsWSv/rqM5loAZUTIY42XqCebaKG1irdK6uWxoQXywyrscqfJklh2u8/yLYz2gl2WPzzdYWMWEueMN5w=="], "@escape.tech/graphql-armor-max-depth": ["@escape.tech/graphql-armor-max-depth@2.4.0", "", { "dependencies": { "graphql": "^16.0.0" }, "optionalDependencies": { "@envelop/core": "^5.0.0", "@escape.tech/graphql-armor-types": "0.7.0" } }, "sha512-4sQkvPITjkSW4mReGyBT5A4qFkBTzyK9HGOLm8Rrte/JrulVAsokK8HWDr/2Yw0KqSFBMCAmy575YMaYoTHLvQ=="], @@ -163,27 +170,29 @@ "@escape.tech/graphql-armor-types": ["@escape.tech/graphql-armor-types@0.7.0", "", { "dependencies": { "graphql": "^16.0.0" } }, "sha512-RHxyyp6PDgS6NAPnnmB6JdmUJ6oqhpSHFbsglGWeCcnNzceA5AkQFpir7VIDbVyS8LNC1xhipOtk7f9ycrIemQ=="], - "@faker-js/faker": ["@faker-js/faker@9.6.0", "", {}, "sha512-3vm4by+B5lvsFPSyep3ELWmZfE3kicDtmemVpuwl1yH7tqtnHdsA6hG8fbXedMVdkzgtvzWoRgjSB4Q+FHnZiw=="], + "@faker-js/faker": ["@faker-js/faker@9.7.0", "", {}, "sha512-aozo5vqjCmDoXLNUJarFZx2IN/GgGaogY4TMJ6so/WLZOWpSV7fvj2dmrV6sEAnUm1O7aCrhTibjpzeDFgNqbg=="], + + "@fastify/busboy": ["@fastify/busboy@3.1.1", "", {}, "sha512-5DGmA8FTdB2XbDeEwc/5ZXBl6UbBAyBOOLlPuBnZ/N1SwdH9Ii+cOX3tBROlDgcTXxjOYnLMVoKk9+FXAw0CJw=="], "@graphile/lru": ["@graphile/lru@5.0.0-beta.3", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-atoHRmLuYMCoMeCjS1pIA442eqAHwFZ3+bnjm3Mn+kAvujyXzGs8uup39gfmMgxOFjRAPNmPEiPw2oJUbOk65Q=="], - "@graphile/pg-aggregates": ["@graphile/pg-aggregates@0.2.0-beta.7", "", { "peerDependencies": { "graphile-build": "^5.0.0-beta.27", "graphile-build-pg": "^5.0.0-beta.31", "graphql": "^16.1.0-experimental-stream-defer.6" }, "optionalPeers": ["graphile-build", "graphile-build-pg", "graphql"] }, "sha512-XaVAzlB1S1UzAmet7dZcoW3AnDGT2qrQqXCRIGJKeu7i76D/SIR5hZs+mytYOjfwuJsHsBBDtmlRORMaUKkJxw=="], + "@graphile/pg-aggregates": ["@graphile/pg-aggregates@0.2.0-beta.8", "", { "peerDependencies": { "graphile-build": "^5.0.0-beta.33", "graphile-build-pg": "^5.0.0-beta.38", "graphql": "^16.1.0-experimental-stream-defer.6" }, "optionalPeers": ["graphile-build", "graphile-build-pg", "graphql"] }, "sha512-nLpRkyVtoa44ygdR6blHnxjTOQPBYys6AVygh3WU5UlDirtoFqOBrhADUGHXw05awUiUtKjWcbMTBAnWLoM8jA=="], - "@graphile/simplify-inflection": ["@graphile/simplify-inflection@8.0.0-beta.5", "", {}, "sha512-1XaXGe5i5wRR/Uh2cvkt9KlFoXq/e7a3GYSdZtQnp68gIOdgcys2T24VNYsiekBhzcp5CCCcUJJdUvV2bvS21Q=="], + "@graphile/simplify-inflection": ["@graphile/simplify-inflection@8.0.0-beta.6", "", {}, "sha512-GFfQtUgX3yLj3XWY9vHrhOfkkCdoW2oqJgJdjQs3qYKqTHViKFch91NguUnw3z+4X1DgYb+qx10leTo+tZ+UeA=="], - "@graphql-tools/executor": ["@graphql-tools/executor@1.3.11", "", { "dependencies": { "@graphql-tools/utils": "^10.7.1", "@graphql-typed-document-node/core": "^3.2.0", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/disposablestack": "^0.0.5", "tslib": "^2.4.0", "value-or-promise": "^1.0.12" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-7Q1IwIuSgarDeaCOZ1VMZvGaWY7cD2jj+uTNn/PsenYYKqFWKH30UylEK67ZTpVMXqBJctFaxVnPP7KM0+LPWg=="], + "@graphql-tools/executor": ["@graphql-tools/executor@1.4.7", "", { "dependencies": { "@graphql-tools/utils": "^10.8.6", "@graphql-typed-document-node/core": "^3.2.0", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-U0nK9jzJRP9/9Izf1+0Gggd6K6RNRsheFo1gC/VWzfnsr0qjcOSS9qTjY0OTC5iTPt4tQ+W5Zpw/uc7mebI6aA=="], - "@graphql-tools/merge": ["@graphql-tools/merge@9.0.16", "", { "dependencies": { "@graphql-tools/utils": "^10.7.1", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Ek2ee3e4qMsMM2pBBZpDmL7j51b3F5qYsHtckO05e8zvOWuS28yBu+VhZYOtUPr/q+lBWhL+0rvFXaUwHZEuQQ=="], + "@graphql-tools/merge": ["@graphql-tools/merge@9.0.24", "", { "dependencies": { "@graphql-tools/utils": "^10.8.6", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-NzWx/Afl/1qHT3Nm1bghGG2l4jub28AdvtG11PoUlmjcIjnFBJMv4vqL0qnxWe8A82peWo4/TkVdjJRLXwgGEw=="], - "@graphql-tools/schema": ["@graphql-tools/schema@10.0.15", "", { "dependencies": { "@graphql-tools/merge": "^9.0.16", "@graphql-tools/utils": "^10.7.1", "tslib": "^2.4.0", "value-or-promise": "^1.0.12" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-QAD9XeC/iaVugMYWet73Vz/4wp1qmKHYPj1z/TyIW/fX41oNmNSBGNqdstMsvSG97PWLhFgbUqVCvY+1KesQKw=="], + "@graphql-tools/schema": ["@graphql-tools/schema@10.0.23", "", { "dependencies": { "@graphql-tools/merge": "^9.0.24", "@graphql-tools/utils": "^10.8.6", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-aEGVpd1PCuGEwqTXCStpEkmheTHNdMayiIKH1xDWqYp9i8yKv9FRDgkGrY4RD8TNxnf7iII+6KOBGaJ3ygH95A=="], - "@graphql-tools/utils": ["@graphql-tools/utils@10.7.1", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "cross-inspect": "1.0.1", "dset": "^3.1.2", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-mpHAA5EddtxvnkHIBEEon5++tvL5T+j3OeOP4CAXbguAK2RBRM9DVVsoc9U68vSPLJjBRGp+b5NjlRn04g9rMA=="], + "@graphql-tools/utils": ["@graphql-tools/utils@10.8.6", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "dset": "^3.1.4", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Alc9Vyg0oOsGhRapfL3xvqh1zV8nKoFUdtLhXX7Ki4nClaIJXckrA86j+uxEuG3ic6j4jlM1nvcWXRn/71AVLQ=="], "@graphql-typed-document-node/core": ["@graphql-typed-document-node/core@3.2.0", "", { "peerDependencies": { "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ=="], "@graphql-yoga/logger": ["@graphql-yoga/logger@2.0.1", "", { "dependencies": { "tslib": "^2.8.1" } }, "sha512-Nv0BoDGLMg9QBKy9cIswQ3/6aKaKjlTh87x3GiBg2Z4RrjyrM48DvOOK0pJh1C1At+b0mUIM67cwZcFTDLN4sA=="], - "@graphql-yoga/subscription": ["@graphql-yoga/subscription@5.0.3", "", { "dependencies": { "@graphql-yoga/typed-event-target": "^3.0.2", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/events": "^0.1.0", "tslib": "^2.8.1" } }, "sha512-xLGEataxCULjL9rlTCVFL1IW2E90TnDIL+mE4lZBi9X92jc6s+Q+jk6Ax3I98kryCJh0UMiwjit7CaIIczTiJg=="], + "@graphql-yoga/subscription": ["@graphql-yoga/subscription@5.0.5", "", { "dependencies": { "@graphql-yoga/typed-event-target": "^3.0.2", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/events": "^0.1.0", "tslib": "^2.8.1" } }, "sha512-oCMWOqFs6QV96/NZRt/ZhTQvzjkGB4YohBOpKM4jH/lDT4qb7Lex/aGCxpi/JD9njw3zBBtMqxbaC22+tFHVvw=="], "@graphql-yoga/typed-event-target": ["@graphql-yoga/typed-event-target@3.0.2", "", { "dependencies": { "@repeaterjs/repeater": "^3.0.4", "tslib": "^2.8.1" } }, "sha512-ZpJxMqB+Qfe3rp6uszCQoag4nSw42icURnBRfFYSOmTgEeOe4rD0vYlbA8spvCu2TlCesNTlEN9BLWtQqLxabA=="], @@ -199,39 +208,43 @@ "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="], - "@petamoriken/float16": ["@petamoriken/float16@3.9.2", "", {}, "sha512-VgffxawQde93xKxT3qap3OH+meZf7VaSB5Sqd4Rqc+FP5alWbpOyan/7tRbOAvynjpG3GpdtAuGU/NdhQpmrog=="], - "@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="], + "@polar-sh/adapter-utils": ["@polar-sh/adapter-utils@0.2.0", "", { "dependencies": { "@polar-sh/sdk": "^0.32.11" } }, "sha512-dSP4E8BgHyaGevYAaTRlNW8rJjR91GXP7InV2+WZ2je2+Oq8PJKo7sLWbpkkJp9zmRx1I88f76rk0XmCY8Aivg=="], + + "@polar-sh/hono": ["@polar-sh/hono@0.3.0", "", { "dependencies": { "@polar-sh/adapter-utils": "0.2.0", "@polar-sh/sdk": "^0.32.11" }, "peerDependencies": { "hono": "^4.6.16" } }, "sha512-oQ1MwoHxvzN9bzkbUumLuwVze+qOBOlxU+qQ80AQVCNEi2L52IpEnBypUVnQptf/7KvllwhlQRIlx0+x3u/ikg=="], + + "@polar-sh/sdk": ["@polar-sh/sdk@0.32.11", "", { "dependencies": { "standardwebhooks": "^1.0.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": ">=1.5.0 <1.10.0", "zod": ">= 3" }, "optionalPeers": ["@modelcontextprotocol/sdk"], "bin": { "mcp": "bin/mcp-server.js" } }, "sha512-GmMDrWyJJnM45rByMRkY8U8DYbL2ggJNohhTc/9naMlGHnP3+RRgIG9IG6yxuXfQ1wljKyoViHAWCAGCvS3DPA=="], + "@repeaterjs/repeater": ["@repeaterjs/repeater@3.0.6", "", {}, "sha512-Javneu5lsuhwNCryN+pXH93VPQ8g0dBX7wItHFgYiwQmzE1sVdg5tWHiOgHywzL2W21XQopa7IwIEnNbmeUJYA=="], - "@tsconfig/node20": ["@tsconfig/node20@20.1.4", "", {}, "sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg=="], + "@stablelib/base64": ["@stablelib/base64@1.0.1", "", {}, "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ=="], + + "@tsconfig/node20": ["@tsconfig/node20@20.1.5", "", {}, "sha512-Vm8e3WxDTqMGPU4GATF9keQAIy1Drd7bPwlgzKJnZtoOsTm1tduUTbDjg0W5qERvGuxPI2h9RbMufH0YdfBylA=="], - "@types/bun": ["@types/bun@1.2.8", "", { "dependencies": { "bun-types": "1.2.7" } }, "sha512-t8L1RvJVUghW5V+M/fL3Thbxcs0HwNsXsnTEBEfEVqGteiJToOlZ/fyOEaR1kZsNqnu+3XA4RI/qmnX4w6+S+w=="], + "@types/bun": ["@types/bun@1.2.10", "", { "dependencies": { "bun-types": "1.2.10" } }, "sha512-eilv6WFM3M0c9ztJt7/g80BDusK98z/FrFwseZgT4bXCq2vPhXD4z8R3oddmAn+R/Nmz9vBn4kweJKmGTZj+lg=="], "@types/interpret": ["@types/interpret@1.1.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-uBaBhj/BhilG58r64mtDb/BEdH51HIQLgP5bmWzc5qCtFMja8dCk/IOJmk36j0lbi9QHwI6sbtUNGuqXdKCAtQ=="], - "@types/node": ["@types/node@22.13.14", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-Zs/Ollc1SJ8nKUAgc7ivOEdIBM8JAKgrqqUYi2J997JuKO7/tpQC+WCetQ1sypiKCQWHdvdg9wBNpUPEWZae7w=="], + "@types/node": ["@types/node@22.14.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw=="], - "@types/pg": ["@types/pg@8.11.11", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^4.0.1" } }, "sha512-kGT1qKM8wJQ5qlawUrEkXgvMSXoV213KfMGXcwfDwUIfUHXqXYXOfS1nE1LINRJVVVx5wCm70XnFlMHaIcQAfw=="], + "@types/pg": ["@types/pg@8.11.13", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^4.0.1" } }, "sha512-6kXByGkvRvwXLuyaWzsebs2du6+XuAB2CuMsuzP7uaihQahshVgSmB22Pmh0vQMkQ1h5+PZU0d+Di1o+WpVWJg=="], "@types/pluralize": ["@types/pluralize@0.0.30", "", {}, "sha512-kVww6xZrW/db5BR9OqiT71J9huRdQ+z/r+LbDuT7/EK50mCmj5FoaIARnVv0rvjUS/YpDox0cDU9lpQT011VBA=="], - "@types/semver": ["@types/semver@7.5.8", "", {}, "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ=="], - - "@types/ws": ["@types/ws@8.5.13", "", { "dependencies": { "@types/node": "*" } }, "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA=="], + "@types/semver": ["@types/semver@7.7.0", "", {}, "sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA=="], - "@whatwg-node/disposablestack": ["@whatwg-node/disposablestack@0.0.5", "", { "dependencies": { "tslib": "^2.6.3" } }, "sha512-9lXugdknoIequO4OYvIjhygvfSEgnO8oASLqLelnDhkRjgBZhc39shC3QSlZuyDO9bgYSIVa2cHAiN+St3ty4w=="], + "@whatwg-node/disposablestack": ["@whatwg-node/disposablestack@0.0.6", "", { "dependencies": { "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.6.3" } }, "sha512-LOtTn+JgJvX8WfBVJtF08TGrdjuFzGJc4mkP8EdDI8ADbvO7kiexYep1o8dwnt0okb0jYclCDXF13xU7Ge4zSw=="], "@whatwg-node/events": ["@whatwg-node/events@0.1.2", "", { "dependencies": { "tslib": "^2.6.3" } }, "sha512-ApcWxkrs1WmEMS2CaLLFUEem/49erT3sxIVjpzU5f6zmVcnijtDSrhoK2zVobOIikZJdH63jdAXOrvjf6eOUNQ=="], - "@whatwg-node/fetch": ["@whatwg-node/fetch@0.10.5", "", { "dependencies": { "@whatwg-node/node-fetch": "^0.7.11", "urlpattern-polyfill": "^10.0.0" } }, "sha512-+yFJU3hmXPAHJULwx0VzCIsvr/H0lvbPvbOH3areOH3NAuCxCwaJsQ8w6/MwwMcvEWIynSsmAxoyaH04KeosPg=="], + "@whatwg-node/fetch": ["@whatwg-node/fetch@0.10.6", "", { "dependencies": { "@whatwg-node/node-fetch": "^0.7.18", "urlpattern-polyfill": "^10.0.0" } }, "sha512-6uzhO2aQ757p3bSHcemA8C4pqEXuyBqyGAM7cYpO0c6/igRMV9As9XL0W12h5EPYMclgr7FgjmbVQBoWEdJ/yA=="], - "@whatwg-node/node-fetch": ["@whatwg-node/node-fetch@0.7.17", "", { "dependencies": { "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/promise-helpers": "^1.2.5", "busboy": "^1.6.0", "tslib": "^2.6.3" } }, "sha512-Ni8A2H/r6brNf4u8Y7ATxmWUD0xltsQ6a4NnjWSbw4PgaT34CbY+u4QtVsFj9pTC3dBKJADKjac3AieAig+PZA=="], + "@whatwg-node/node-fetch": ["@whatwg-node/node-fetch@0.7.18", "", { "dependencies": { "@fastify/busboy": "^3.1.1", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/promise-helpers": "^1.3.1", "tslib": "^2.6.3" } }, "sha512-IxKdVWfZYasGiyxBcsROxq6FmDQu3MNNiOYJ/yqLKhe+Qq27IIWsK7ItbjS2M9L5aM5JxjWkIS7JDh7wnsn+CQ=="], - "@whatwg-node/promise-helpers": ["@whatwg-node/promise-helpers@1.3.0", "", { "dependencies": { "tslib": "^2.6.3" } }, "sha512-486CouizxHXucj8Ky153DDragfkMcHtVEToF5Pn/fInhUUSiCmt9Q4JVBa6UK5q4RammFBtGQ4C9qhGlXU9YbA=="], + "@whatwg-node/promise-helpers": ["@whatwg-node/promise-helpers@1.3.1", "", { "dependencies": { "tslib": "^2.6.3" } }, "sha512-D+OwTEunoQhVHVToD80dPhfz9xgPLqJyEA3F5jCRM14A2u8tBBQVdZekqfqx6ZAfZ+POT4Hb0dn601UKMsvADw=="], - "@whatwg-node/server": ["@whatwg-node/server@0.10.3", "", { "dependencies": { "@envelop/instrumentation": "^1.0.0", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/fetch": "^0.10.5", "@whatwg-node/promise-helpers": "^1.2.3", "tslib": "^2.6.3" } }, "sha512-2Dnfey57vWR+hDUMjPhNzJQc9z116BBzSQwR9eD0vhnzYmN2rJXuY0QuMaHDCCqEZRmFHg2bo8iJ+/1uHOlxpg=="], + "@whatwg-node/server": ["@whatwg-node/server@0.10.5", "", { "dependencies": { "@envelop/instrumentation": "^1.0.0", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/fetch": "^0.10.6", "@whatwg-node/promise-helpers": "^1.3.1", "tslib": "^2.6.3" } }, "sha512-ydxzH1iox9AzLe+uaX9jjyVFkQO+h15j+JClropw0P4Vz+ES4+xTZVu5leUsWW8AYTVZBFkiC0iHl/PwFZ+Q1Q=="], "ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="], @@ -245,9 +258,7 @@ "buffer-from": ["buffer-from@1.1.2", "", {}, "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="], - "bun-types": ["bun-types@1.2.7", "", { "dependencies": { "@types/node": "*", "@types/ws": "*" } }, "sha512-P4hHhk7kjF99acXqKvltyuMQ2kf/rzIw3ylEDpCxDS9Xa0X0Yp/gJu/vDCucmWpiur5qJ0lwB2bWzOXa2GlHqA=="], - - "busboy": ["busboy@1.6.0", "", { "dependencies": { "streamsearch": "^1.1.0" } }, "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA=="], + "bun-types": ["bun-types@1.2.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-b5ITZMnVdf3m1gMvJHG+gIfeJHiQPJak0f7925Hxu6ZN5VKA8AGy4GZ4lM+Xkn6jtWxg5S3ldWvfmXdvnkp3GQ=="], "chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="], @@ -265,9 +276,9 @@ "debug": ["debug@4.4.0", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="], - "drizzle-kit": ["drizzle-kit@0.30.6", "", { "dependencies": { "@drizzle-team/brocli": "^0.10.2", "@esbuild-kit/esm-loader": "^2.5.5", "esbuild": "^0.19.7", "esbuild-register": "^3.5.0", "gel": "^2.0.0" }, "bin": { "drizzle-kit": "bin.cjs" } }, "sha512-U4wWit0fyZuGuP7iNmRleQyK2V8wCuv57vf5l3MnG4z4fzNTjY/U13M8owyQ5RavqvqxBifWORaR3wIUzlN64g=="], + "drizzle-kit": ["drizzle-kit@0.31.0", "", { "dependencies": { "@drizzle-team/brocli": "^0.10.2", "@esbuild-kit/esm-loader": "^2.5.5", "esbuild": "^0.25.2", "esbuild-register": "^3.5.0" }, "bin": { "drizzle-kit": "bin.cjs" } }, "sha512-pcKVT+GbfPA+bUovPIilgVOoq+onNBo/YQBG86sf3/GFHkN6lRJPm1l7dKN0IMAk57RQoIm4GUllRrasLlcaSg=="], - "drizzle-orm": ["drizzle-orm@0.41.0", "", { "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=4", "@electric-sql/pglite": ">=0.2.0", "@libsql/client": ">=0.10.0", "@libsql/client-wasm": ">=0.10.0", "@neondatabase/serverless": ">=0.10.0", "@op-engineering/op-sqlite": ">=2", "@opentelemetry/api": "^1.4.1", "@planetscale/database": ">=1", "@prisma/client": "*", "@tidbcloud/serverless": "*", "@types/better-sqlite3": "*", "@types/pg": "*", "@types/sql.js": "*", "@vercel/postgres": ">=0.8.0", "@xata.io/client": "*", "better-sqlite3": ">=7", "bun-types": "*", "expo-sqlite": ">=14.0.0", "gel": ">=2", "knex": "*", "kysely": "*", "mysql2": ">=2", "pg": ">=8", "postgres": ">=3", "sql.js": ">=1", "sqlite3": ">=5" }, "optionalPeers": ["@aws-sdk/client-rds-data", "@cloudflare/workers-types", "@electric-sql/pglite", "@libsql/client", "@libsql/client-wasm", "@neondatabase/serverless", "@op-engineering/op-sqlite", "@opentelemetry/api", "@planetscale/database", "@prisma/client", "@tidbcloud/serverless", "@types/better-sqlite3", "@types/pg", "@types/sql.js", "@vercel/postgres", "@xata.io/client", "better-sqlite3", "bun-types", "expo-sqlite", "gel", "knex", "kysely", "mysql2", "pg", "postgres", "sql.js", "sqlite3"] }, "sha512-7A4ZxhHk9gdlXmTdPj/lREtP+3u8KvZ4yEN6MYVxBzZGex5Wtdc+CWSbu7btgF6TB0N+MNPrvW7RKBbxJchs/Q=="], + "drizzle-orm": ["drizzle-orm@0.42.0", "", { "peerDependencies": { "@aws-sdk/client-rds-data": ">=3", "@cloudflare/workers-types": ">=4", "@electric-sql/pglite": ">=0.2.0", "@libsql/client": ">=0.10.0", "@libsql/client-wasm": ">=0.10.0", "@neondatabase/serverless": ">=0.10.0", "@op-engineering/op-sqlite": ">=2", "@opentelemetry/api": "^1.4.1", "@planetscale/database": ">=1.13", "@prisma/client": "*", "@tidbcloud/serverless": "*", "@types/better-sqlite3": "*", "@types/pg": "*", "@types/sql.js": "*", "@vercel/postgres": ">=0.8.0", "@xata.io/client": "*", "better-sqlite3": ">=7", "bun-types": "*", "expo-sqlite": ">=14.0.0", "gel": ">=2", "knex": "*", "kysely": "*", "mysql2": ">=2", "pg": ">=8", "postgres": ">=3", "sql.js": ">=1", "sqlite3": ">=5" }, "optionalPeers": ["@aws-sdk/client-rds-data", "@cloudflare/workers-types", "@electric-sql/pglite", "@libsql/client", "@libsql/client-wasm", "@neondatabase/serverless", "@op-engineering/op-sqlite", "@opentelemetry/api", "@planetscale/database", "@prisma/client", "@tidbcloud/serverless", "@types/better-sqlite3", "@types/pg", "@types/sql.js", "@vercel/postgres", "@xata.io/client", "better-sqlite3", "bun-types", "expo-sqlite", "gel", "knex", "kysely", "mysql2", "pg", "postgres", "sql.js", "sqlite3"] }, "sha512-pS8nNJm2kBNZwrOjTHJfdKkaU+KuUQmV/vk5D57NojDq4FG+0uAYGMulXtYT///HfgsMF0hnFFvu1ezI3OwOkg=="], "drizzle-seed": ["drizzle-seed@0.3.1", "", { "dependencies": { "pure-rand": "^6.1.0" }, "peerDependencies": { "drizzle-orm": ">=0.36.4" }, "optionalPeers": ["drizzle-orm"] }, "sha512-F/0lgvfOAsqlYoHM/QAGut4xXIOXoE5VoAdv2FIl7DpGYVXlAzKuJO+IphkKUFK3Dz+rFlOsQLnMNrvoQ0cx7g=="], @@ -279,9 +290,7 @@ "emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="], - "env-paths": ["env-paths@3.0.0", "", {}, "sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A=="], - - "esbuild": ["esbuild@0.19.12", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.19.12", "@esbuild/android-arm": "0.19.12", "@esbuild/android-arm64": "0.19.12", "@esbuild/android-x64": "0.19.12", "@esbuild/darwin-arm64": "0.19.12", "@esbuild/darwin-x64": "0.19.12", "@esbuild/freebsd-arm64": "0.19.12", "@esbuild/freebsd-x64": "0.19.12", "@esbuild/linux-arm": "0.19.12", "@esbuild/linux-arm64": "0.19.12", "@esbuild/linux-ia32": "0.19.12", "@esbuild/linux-loong64": "0.19.12", "@esbuild/linux-mips64el": "0.19.12", "@esbuild/linux-ppc64": "0.19.12", "@esbuild/linux-riscv64": "0.19.12", "@esbuild/linux-s390x": "0.19.12", "@esbuild/linux-x64": "0.19.12", "@esbuild/netbsd-x64": "0.19.12", "@esbuild/openbsd-x64": "0.19.12", "@esbuild/sunos-x64": "0.19.12", "@esbuild/win32-arm64": "0.19.12", "@esbuild/win32-ia32": "0.19.12", "@esbuild/win32-x64": "0.19.12" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg=="], + "esbuild": ["esbuild@0.25.2", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.2", "@esbuild/android-arm": "0.25.2", "@esbuild/android-arm64": "0.25.2", "@esbuild/android-x64": "0.25.2", "@esbuild/darwin-arm64": "0.25.2", "@esbuild/darwin-x64": "0.25.2", "@esbuild/freebsd-arm64": "0.25.2", "@esbuild/freebsd-x64": "0.25.2", "@esbuild/linux-arm": "0.25.2", "@esbuild/linux-arm64": "0.25.2", "@esbuild/linux-ia32": "0.25.2", "@esbuild/linux-loong64": "0.25.2", "@esbuild/linux-mips64el": "0.25.2", "@esbuild/linux-ppc64": "0.25.2", "@esbuild/linux-riscv64": "0.25.2", "@esbuild/linux-s390x": "0.25.2", "@esbuild/linux-x64": "0.25.2", "@esbuild/netbsd-arm64": "0.25.2", "@esbuild/netbsd-x64": "0.25.2", "@esbuild/openbsd-arm64": "0.25.2", "@esbuild/openbsd-x64": "0.25.2", "@esbuild/sunos-x64": "0.25.2", "@esbuild/win32-arm64": "0.25.2", "@esbuild/win32-ia32": "0.25.2", "@esbuild/win32-x64": "0.25.2" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-16854zccKPnC+toMywC+uKNeYSv+/eXkevRAfwRD/G9Cleq66m8XFIrigkbvauLLlCfDL45Q2cWegSg53gGBnQ=="], "esbuild-register": ["esbuild-register@3.6.0", "", { "dependencies": { "debug": "^4.3.4" }, "peerDependencies": { "esbuild": ">=0.12 <1" } }, "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg=="], @@ -289,45 +298,45 @@ "eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="], - "follow-redirects": ["follow-redirects@1.15.9", "", {}, "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="], + "fast-sha256": ["fast-sha256@1.3.0", "", {}, "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ=="], - "foreground-child": ["foreground-child@3.3.0", "", { "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" } }, "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg=="], + "follow-redirects": ["follow-redirects@1.15.9", "", {}, "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ=="], - "gel": ["gel@2.0.1", "", { "dependencies": { "@petamoriken/float16": "^3.8.7", "debug": "^4.3.4", "env-paths": "^3.0.0", "semver": "^7.6.2", "shell-quote": "^1.8.1", "which": "^4.0.0" }, "bin": { "gel": "dist/cli.mjs" } }, "sha512-gfem3IGvqKqXwEq7XseBogyaRwGsQGuE7Cw/yQsjLGdgiyqX92G1xENPCE0ltunPGcsJIa6XBOTx/PK169mOqw=="], + "foreground-child": ["foreground-child@3.3.1", "", { "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" } }, "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw=="], "get-caller-file": ["get-caller-file@2.0.5", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="], - "get-tsconfig": ["get-tsconfig@4.8.1", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg=="], + "get-tsconfig": ["get-tsconfig@4.10.0", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A=="], "glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="], "globals": ["globals@11.12.0", "", {}, "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="], - "grafast": ["grafast@0.1.1-beta.19", "", { "dependencies": { "@graphile/lru": "^5.0.0-beta.3", "chalk": "^4.1.2", "debug": "^4.3.4", "eventemitter3": "^5.0.1", "graphile-config": "^0.0.1-beta.14", "graphql": "^16.1.0-experimental-stream-defer.6", "iterall": "^1.3.0", "tamedevil": "^0.0.0-beta.7", "tslib": "^2.6.2" }, "peerDependencies": { "@envelop/core": "^5.0.0" }, "optionalPeers": ["@envelop/core"] }, "sha512-EbttEa9DQEScYqSZaS5PIVFEwZ7tTgjV0vqxzAyRH90iCDKqrt3dZD8+8GNQLOznnKCCsAFnYTiRUeAi29eR/A=="], + "grafast": ["grafast@0.1.1-beta.21", "", { "dependencies": { "@graphile/lru": "^5.0.0-beta.3", "chalk": "^4.1.2", "debug": "^4.3.4", "eventemitter3": "^5.0.1", "graphile-config": "^0.0.1-beta.15", "graphql": "^16.1.0-experimental-stream-defer.6", "iterall": "^1.3.0", "tamedevil": "^0.0.0-beta.7", "tslib": "^2.6.2" }, "peerDependencies": { "@envelop/core": "^5.0.0" }, "optionalPeers": ["@envelop/core"] }, "sha512-uyq16JIpfzlTAKDwd1dsVPPGmMdnb4LTq6B7CS3cEzPwklV3rkqySbKEzQKD/JIAOG8BykXUgZUkRCdMFTLRpQ=="], - "grafserv": ["grafserv@0.1.1-beta.21", "", { "dependencies": { "@graphile/lru": "^5.0.0-beta.3", "debug": "^4.3.4", "eventemitter3": "^5.0.1", "graphile-config": "^0.0.1-beta.14", "graphql-ws": "^5.14.0", "ruru": "^2.0.0-beta.19", "tslib": "^2.6.2" }, "peerDependencies": { "@envelop/core": "^5.0.0", "grafast": "^0.1.1-beta.19", "graphql": "^16.1.0-experimental-stream-defer.6", "h3": "^1.13.0", "ws": "^8.12.1" }, "optionalPeers": ["@envelop/core", "h3", "ws"] }, "sha512-BmKZPf8Uxbih6KTVHhrccrb4ccfdkcbcHO6fqBPsQHCDUGDLeFUGejixiD1SbhqapvkUj+B/8Gx8y+v2n3xK4Q=="], + "grafserv": ["grafserv@0.1.1-beta.24", "", { "dependencies": { "@graphile/lru": "^5.0.0-beta.3", "debug": "^4.3.4", "eventemitter3": "^5.0.1", "graphile-config": "^0.0.1-beta.15", "graphql-ws": "^5.14.0", "ruru": "^2.0.0-beta.22", "tslib": "^2.6.2" }, "peerDependencies": { "@envelop/core": "^5.0.0", "grafast": "^0.1.1-beta.21", "graphql": "^16.1.0-experimental-stream-defer.6", "h3": "^1.13.0", "hono": "^4.6.15", "ws": "^8.12.1" }, "optionalPeers": ["@envelop/core", "h3", "hono", "ws"] }, "sha512-guUuFlqvSdw/F1nnU7zkxtAWBuYwyWPUmH5m+SV6/iDGRKoFI/ObqUKz5E7GmSPKIrk+69OSFzr+IWf6cCrrTw=="], - "graphile-build": ["graphile-build@5.0.0-beta.31", "", { "dependencies": { "@types/node": "^20.5.7", "@types/pluralize": "^0.0.30", "@types/semver": "^7.5.1", "chalk": "^4.1.2", "debug": "^4.3.4", "graphile-config": "^0.0.1-beta.14", "graphql": "^16.1.0-experimental-stream-defer.6", "lodash": "^4.17.21", "pluralize": "^7.0.0", "semver": "^7.5.4", "tamedevil": "^0.0.0-beta.7", "tslib": "^2.6.2" }, "peerDependencies": { "grafast": "^0.1.1-beta.19" } }, "sha512-yFnKgngSLwzx9HhZY0ysLCR9t1fn2WNAER/+Aczk9wj/lrVi9GcfTb4QIi7Y9yzNLmo+smkJ0+jx1+7kxWknOg=="], + "graphile-build": ["graphile-build@5.0.0-beta.33", "", { "dependencies": { "@types/node": "^20.5.7", "@types/pluralize": "^0.0.30", "@types/semver": "^7.5.1", "chalk": "^4.1.2", "debug": "^4.3.4", "graphile-config": "^0.0.1-beta.15", "graphql": "^16.1.0-experimental-stream-defer.6", "lodash": "^4.17.21", "pluralize": "^7.0.0", "semver": "^7.5.4", "tamedevil": "^0.0.0-beta.7", "tslib": "^2.6.2" }, "peerDependencies": { "grafast": "^0.1.1-beta.21" } }, "sha512-c3tNSXrfx6jJNYqqyJVDGo9oIuPCkBit3/AfmmA1fcc7WFKYGe1g2lEyzZuU1eztsa7XSPu158asr8M0CAX15Q=="], - "graphile-build-pg": ["graphile-build-pg@5.0.0-beta.36", "", { "dependencies": { "@types/node": "^20.5.7", "debug": "^4.3.4", "graphile-config": "^0.0.1-beta.14", "jsonwebtoken": "^9.0.2", "pg-introspection": "^0.0.1-beta.10", "tslib": "^2.6.2" }, "peerDependencies": { "@dataplan/pg": "^0.0.1-beta.30", "grafast": "^0.1.1-beta.19", "graphile-build": "5.0.0-beta.31", "graphql": "^16.1.0-experimental-stream-defer.6", "pg": "^8.7.1", "pg-sql2": "^5.0.0-beta.7", "tamedevil": "^0.0.0-beta.7" }, "optionalPeers": ["pg"] }, "sha512-V+73qQrEzAEK2eaVDRaS1P1hS8M7XU3KcPh+fM/rijTWKAXnDWpqV7yaRagkGF5dRl8RDjuqR0r2BOg99uwnEg=="], + "graphile-build-pg": ["graphile-build-pg@5.0.0-beta.38", "", { "dependencies": { "@types/node": "^20.5.7", "debug": "^4.3.4", "graphile-config": "^0.0.1-beta.15", "jsonwebtoken": "^9.0.2", "pg-introspection": "^0.0.1-beta.10", "tslib": "^2.6.2" }, "peerDependencies": { "@dataplan/pg": "^0.0.1-beta.32", "grafast": "^0.1.1-beta.21", "graphile-build": "5.0.0-beta.33", "graphql": "^16.1.0-experimental-stream-defer.6", "pg": "^8.7.1", "pg-sql2": "^5.0.0-beta.8", "tamedevil": "^0.0.0-beta.7" }, "optionalPeers": ["pg"] }, "sha512-fOFSonm5Sz/A1ZkVH9yLVmbrRZlAV+yWtb3xbkH4E3XwA7CqIF2Skd8gOe8E/npzN965thWMfi6YQOROlxCmZg=="], - "graphile-config": ["graphile-config@0.0.1-beta.14", "", { "dependencies": { "@types/interpret": "^1.1.1", "@types/node": "^20.5.7", "@types/semver": "^7.5.1", "chalk": "^4.1.2", "debug": "^4.3.4", "interpret": "^3.1.1", "semver": "^7.5.4", "tslib": "^2.6.2", "yargs": "^17.7.2" } }, "sha512-3FlhyRKz4LvIbY4AXn4EI8DSTdSYsg0WRfX6U9QeytGta9aiefF1QqSiC1ocXUlNJUMBfm28dy0eL669ljYRwg=="], + "graphile-config": ["graphile-config@0.0.1-beta.15", "", { "dependencies": { "@types/interpret": "^1.1.1", "@types/node": "^20.5.7", "@types/semver": "^7.5.1", "chalk": "^4.1.2", "debug": "^4.3.4", "interpret": "^3.1.1", "semver": "^7.5.4", "tslib": "^2.6.2", "yargs": "^17.7.2" } }, "sha512-J+hYqhZlx5yY7XdU7XjOAqNCAUZU33fEx3PdkNc1cfAAbo1TNMWiib4DFH5XkT8BagJtTyFrMnDCuKxnphCu+g=="], - "graphile-export": ["graphile-export@0.0.2-beta.24", "", { "dependencies": { "@babel/generator": "^7.25.6", "@babel/parser": "^7.25.6", "@babel/template": "^7.25.0", "@babel/traverse": "^7.25.6", "@babel/types": "^7.25.6", "@types/node": "^20.5.7", "prettier": "^3.0.3", "tslib": "^2.6.2" }, "peerDependencies": { "eslint": "^8.48.0", "grafast": "^0.1.1-beta.19", "pg-sql2": "^5.0.0-beta.7" }, "optionalPeers": ["eslint", "pg-sql2"] }, "sha512-nu24HgtCc2G5lfAK5EkzWcE6Vv9TTTJrzutTjnOVJ5Zbdp55XBPrk0y0TWJulGjcj3Do3y+gz0T9Ldzil89yxg=="], + "graphile-export": ["graphile-export@0.0.2-beta.26", "", { "dependencies": { "@babel/generator": "^7.25.6", "@babel/parser": "^7.25.6", "@babel/template": "^7.25.0", "@babel/traverse": "^7.25.6", "@babel/types": "^7.25.6", "@types/node": "^20.5.7", "prettier": "^3.0.3", "tslib": "^2.6.2" }, "peerDependencies": { "eslint": "^8.48.0", "grafast": "^0.1.1-beta.21", "pg-sql2": "^5.0.0-beta.8" }, "optionalPeers": ["eslint", "pg-sql2"] }, "sha512-F/VwojFj+UWKUcL5kiLeeYNLTKJzK19rC9rZO1Ga/4NVCAAx2azscocDKlpJE7W+LYcPwtZkYhESKwfLOts8zw=="], - "graphile-utils": ["graphile-utils@5.0.0-beta.36", "", { "dependencies": { "debug": "^4.3.4", "json5": "^2.2.3", "tslib": "^2.6.2" }, "peerDependencies": { "@dataplan/pg": "^0.0.1-beta.30", "grafast": "^0.1.1-beta.19", "graphile-build": "^5.0.0-beta.31", "graphile-build-pg": "^5.0.0-beta.36", "graphile-config": "^0.0.1-beta.14", "graphql": "^16.1.0-experimental-stream-defer.6", "tamedevil": "^0.0.0-beta.7" }, "optionalPeers": ["@dataplan/pg", "graphile-build-pg"] }, "sha512-Bo3PEOzLhlcs/NtaTXb2XSVazQxkQzMLkaxY7f0GWMImMfPZJekJW5zcOKVYLeljjXnfCMGkYsYddvtcwbha5w=="], + "graphile-utils": ["graphile-utils@5.0.0-beta.38", "", { "dependencies": { "debug": "^4.3.4", "json5": "^2.2.3", "tslib": "^2.6.2" }, "peerDependencies": { "@dataplan/pg": "^0.0.1-beta.32", "grafast": "^0.1.1-beta.21", "graphile-build": "^5.0.0-beta.33", "graphile-build-pg": "^5.0.0-beta.38", "graphile-config": "^0.0.1-beta.15", "graphql": "^16.1.0-experimental-stream-defer.6", "tamedevil": "^0.0.0-beta.7" }, "optionalPeers": ["@dataplan/pg", "graphile-build-pg"] }, "sha512-XKOq/mhMWwPTB/yenMvcozW+tX47ChCEc7BT9KKmFlh77PVx6XKi8UMnGZx2vEvy/RxExf/ii5jPomwUtQBIGg=="], "graphql": ["graphql@16.10.0", "", {}, "sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ=="], - "graphql-ws": ["graphql-ws@5.16.0", "", { "peerDependencies": { "graphql": ">=0.11 <=16" } }, "sha512-Ju2RCU2dQMgSKtArPbEtsK5gNLnsQyTNIo/T7cZNp96niC1x0KdJNZV0TIoilceBPQwfb5itrGl8pkFeOUMl4A=="], + "graphql-ws": ["graphql-ws@5.16.2", "", { "peerDependencies": { "graphql": ">=0.11 <=16" } }, "sha512-E1uccsZxt/96jH/OwmLPuXMACILs76pKF2i3W861LpKBCYtGIyPQGtWLuBLkND4ox1KHns70e83PS4te50nvPQ=="], - "graphql-yoga": ["graphql-yoga@5.13.2", "", { "dependencies": { "@envelop/core": "^5.2.3", "@envelop/instrumentation": "^1.0.0", "@graphql-tools/executor": "^1.4.0", "@graphql-tools/schema": "^10.0.11", "@graphql-tools/utils": "^10.6.2", "@graphql-yoga/logger": "^2.0.1", "@graphql-yoga/subscription": "^5.0.3", "@whatwg-node/fetch": "^0.10.5", "@whatwg-node/promise-helpers": "^1.2.4", "@whatwg-node/server": "^0.10.1", "dset": "^3.1.4", "lru-cache": "^10.0.0", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^15.2.0 || ^16.0.0" } }, "sha512-ZXhIoAPCV2K2ozwpxDL1ZXhhI2SvIp3hJMaSRaHcojLGE9w9iV8oYGPnZKcV5eisF3VE13RcIF4Ys6TTkU338Q=="], + "graphql-yoga": ["graphql-yoga@5.13.4", "", { "dependencies": { "@envelop/core": "^5.2.3", "@envelop/instrumentation": "^1.0.0", "@graphql-tools/executor": "^1.4.0", "@graphql-tools/schema": "^10.0.11", "@graphql-tools/utils": "^10.6.2", "@graphql-yoga/logger": "^2.0.1", "@graphql-yoga/subscription": "^5.0.5", "@whatwg-node/fetch": "^0.10.6", "@whatwg-node/promise-helpers": "^1.2.4", "@whatwg-node/server": "^0.10.5", "dset": "^3.1.4", "lru-cache": "^10.0.0", "tslib": "^2.8.1" }, "peerDependencies": { "graphql": "^15.2.0 || ^16.0.0" } }, "sha512-q5l3HEvgXnZCKG6K38fz3XNBX41GkHkIYspJbdVl9QVsm5Ah0EFUkY303tEOx8IucyB0h2hb8OfbYXEcoNCLMw=="], "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], "hash-it": ["hash-it@6.0.0", "", {}, "sha512-KHzmSFx1KwyMPw0kXeeUD752q/Kfbzhy6dAZrjXV9kAIXGqzGvv8vhkUqj+2MGZldTo0IBpw6v7iWE7uxsvH0w=="], - "hono": ["hono@4.7.5", "", {}, "sha512-fDOK5W2C1vZACsgLONigdZTRZxuBqFtcKh7bUQ5cVSbwI2RWjloJDcgFOVzbQrlI6pCmhlTsVYZ7zpLj4m4qMQ=="], + "hono": ["hono@4.7.7", "", {}, "sha512-2PCpQRbN87Crty8/L/7akZN3UyZIAopSoRxCwRbJgUuV1+MHNFHzYFxZTg4v/03cXUm+jce/qa2VSBZpKBm3Qw=="], "http-proxy": ["http-proxy@1.18.1", "", { "dependencies": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", "requires-port": "^1.0.0" } }, "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ=="], @@ -337,7 +346,7 @@ "is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="], - "isexe": ["isexe@3.1.1", "", {}, "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ=="], + "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], "iterall": ["iterall@1.3.0", "", {}, "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg=="], @@ -403,9 +412,9 @@ "pg-pool": ["pg-pool@3.8.0", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-VBw3jiVm6ZOdLBTIcXLNdSotb6Iy3uOCwDGFAksZCXmi10nyRvnP2v3jl4d+IsLYRyXf6o9hIm/ZtUzlByNUdw=="], - "pg-protocol": ["pg-protocol@1.7.0", "", {}, "sha512-hTK/mE36i8fDDhgDFjy6xNOG+LCorxLG3WO17tku+ij6sVHXh1jQUJ8hYAnRhNla4QVD2H8er/FOjc/+EgC6yQ=="], + "pg-protocol": ["pg-protocol@1.8.0", "", {}, "sha512-jvuYlEkL03NRvOoyoRktBK7+qU5kOvlAwvmrH8sr3wbLrOdVWsRxQfz8mMy9sZFsqJ1hEWNfdWKI4SAmoL+j7g=="], - "pg-sql2": ["pg-sql2@5.0.0-beta.7", "", { "dependencies": { "@graphile/lru": "^5.0.0-beta.3", "tslib": "^2.6.2" } }, "sha512-rXpjk2akonXBR6jkQUbZuYcOOmoMslPasqqSJW4Hwox+ooSJ0ybjsPnExyPkCPhVFxGPmE4XfBlj0SWeRL6IDw=="], + "pg-sql2": ["pg-sql2@5.0.0-beta.8", "", { "dependencies": { "@graphile/lru": "^5.0.0-beta.3", "tslib": "^2.6.2" } }, "sha512-qNhtl9iVRhAfRuMOKwWgh0t7EajyIhc0Gd25vNwaX2zbiXtpFanaX0TK7AD0+Aen9TejZ7IsGl7aYRZbr9aRfQ=="], "pg-types": ["pg-types@4.0.2", "", { "dependencies": { "pg-int8": "1.0.1", "pg-numeric": "1.0.2", "postgres-array": "~3.0.1", "postgres-bytea": "~3.0.0", "postgres-date": "~2.1.0", "postgres-interval": "^3.0.0", "postgres-range": "^1.1.1" } }, "sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng=="], @@ -415,11 +424,11 @@ "pluralize": ["pluralize@7.0.0", "", {}, "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow=="], - "postgraphile": ["postgraphile@5.0.0-beta.37", "", { "dependencies": { "@dataplan/json": "0.0.1-beta.28", "@dataplan/pg": "0.0.1-beta.30", "@graphile/lru": "^5.0.0-beta.3", "@types/node": "^20.5.7", "@types/pg": "^8.10.2", "debug": "^4.3.4", "grafast": "^0.1.1-beta.19", "grafserv": "^0.1.1-beta.21", "graphile-build": "5.0.0-beta.31", "graphile-build-pg": "5.0.0-beta.36", "graphile-config": "^0.0.1-beta.14", "graphile-utils": "^5.0.0-beta.36", "graphql": "^16.1.0-experimental-stream-defer.6", "iterall": "^1.3.0", "jsonwebtoken": "^9.0.2", "pg": "^8.11.3", "pg-sql2": "^5.0.0-beta.7", "tamedevil": "^0.0.0-beta.7", "tslib": "^2.6.2", "ws": "^8.17.1" }, "peerDependencies": { "@envelop/core": "^5.0.0" }, "optionalPeers": ["@envelop/core"], "bin": { "postgraphile": "dist/cli-run.js" } }, "sha512-+Qm6VTu1nFdNkB5ci81klwXSCHHQ+Xgiz/flqomSef6XRXGnE28R++Z+9+OTJinsPd4NCDaio05kgfSxbZMM5g=="], + "postgraphile": ["postgraphile@5.0.0-beta.40", "", { "dependencies": { "@dataplan/json": "0.0.1-beta.30", "@dataplan/pg": "0.0.1-beta.32", "@graphile/lru": "^5.0.0-beta.3", "@types/node": "^20.5.7", "@types/pg": "^8.10.2", "debug": "^4.3.4", "grafast": "^0.1.1-beta.21", "grafserv": "^0.1.1-beta.24", "graphile-build": "5.0.0-beta.33", "graphile-build-pg": "5.0.0-beta.38", "graphile-config": "^0.0.1-beta.15", "graphile-utils": "^5.0.0-beta.38", "graphql": "^16.1.0-experimental-stream-defer.6", "iterall": "^1.3.0", "jsonwebtoken": "^9.0.2", "pg": "^8.13.3", "pg-sql2": "^5.0.0-beta.8", "tamedevil": "^0.0.0-beta.7", "tslib": "^2.6.2", "ws": "^8.17.1" }, "peerDependencies": { "@envelop/core": "^5.0.0" }, "optionalPeers": ["@envelop/core"], "bin": { "postgraphile": "dist/cli-run.js" } }, "sha512-EpWF573uHtJs542Y9RCNBKoFFvutmyHlUJaotM5JsemKhN0iCK4LPIWJhsawUxxC+moEaHCTI2Ftd6jd2/wvZQ=="], - "postgraphile-plugin-connection-filter": ["postgraphile-plugin-connection-filter@3.0.0-beta.7", "", { "dependencies": { "@tsconfig/node20": "^20.1.4", "tslib": "^2.5.0" } }, "sha512-F18Q+8t9LRh4RMGkLEGOOKfb5dXzTg3QqD0/ViXNRN7MANR0PBL+pI6QMOLzPcxMCx5UsD62Rp8Lur2ShvG8GA=="], + "postgraphile-plugin-connection-filter": ["postgraphile-plugin-connection-filter@3.0.0-beta.8", "", { "dependencies": { "@tsconfig/node20": "^20.1.4", "tslib": "^2.5.0" } }, "sha512-DlIcamkgkwuUbV0X5R/baMC5phLYD35Hj+U+oxZKHTZlM4ILkIO4hBoDHVbbImn9QE1EHmSeb2CVwjZs3+Pwog=="], - "postgres-array": ["postgres-array@3.0.2", "", {}, "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog=="], + "postgres-array": ["postgres-array@3.0.4", "", {}, "sha512-nAUSGfSDGOaOAEGwqsRY27GPOea7CNipJPOA7lPbdEpx5Kg3qzdP0AaWC5MlhTWV9s4hFX39nomVZ+C4tnGOJQ=="], "postgres-bytea": ["postgres-bytea@3.0.0", "", { "dependencies": { "obuf": "~1.1.2" } }, "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw=="], @@ -429,7 +438,7 @@ "postgres-range": ["postgres-range@1.1.4", "", {}, "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w=="], - "prettier": ["prettier@3.4.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ=="], + "prettier": ["prettier@3.5.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw=="], "pure-rand": ["pure-rand@6.1.0", "", {}, "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA=="], @@ -441,18 +450,16 @@ "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="], - "ruru": ["ruru@2.0.0-beta.19", "", { "dependencies": { "@emotion/is-prop-valid": "^1.2.1", "graphile-config": "^0.0.1-beta.14", "graphql": "^16.1.0-experimental-stream-defer.6", "http-proxy": "^1.18.1", "tslib": "^2.6.2", "yargs": "^17.7.2" }, "bin": { "ruru": "dist/cli-run.js" } }, "sha512-79S/s07CqhxaHR1EVEpkOxPqkOaD98WwqB1RKe00WswFUTgSEhm1nOkXLeWc7A2xRFcCgO4lxPT5TmvJ17JwAg=="], + "ruru": ["ruru@2.0.0-beta.22", "", { "dependencies": { "@emotion/is-prop-valid": "^1.2.1", "graphile-config": "^0.0.1-beta.15", "graphql": "^16.1.0-experimental-stream-defer.6", "http-proxy": "^1.18.1", "tslib": "^2.6.2", "yargs": "^17.7.2" }, "bin": { "ruru": "dist/cli-run.js" } }, "sha512-TpjpNyJSOK8p2sPPzC8/XFv9o/R6PrzEX8MEVR8j5MHDyQA6D2804N5RgqtFp2Gr6MraDH+4E6SQ+OS52nfFXg=="], "safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], - "semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="], + "semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="], "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="], "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], - "shell-quote": ["shell-quote@1.8.2", "", {}, "sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA=="], - "signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="], "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], @@ -461,7 +468,7 @@ "split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="], - "streamsearch": ["streamsearch@1.1.0", "", {}, "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="], + "standardwebhooks": ["standardwebhooks@1.0.0", "", { "dependencies": { "@stablelib/base64": "^1.0.0", "fast-sha256": "^1.3.0" } }, "sha512-BbHGOQK9olHPMvQNHWul6MYlrRTAOKn03rOe4A8O3CLWhNf4YHBqq2HJKKC+sfqpxiBY52pNeesD6jIiLDz8jg=="], "string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="], @@ -477,21 +484,19 @@ "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - "typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="], + "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="], - "undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="], + "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], "urlpattern-polyfill": ["urlpattern-polyfill@10.0.0", "", {}, "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg=="], - "value-or-promise": ["value-or-promise@1.0.12", "", {}, "sha512-Z6Uz+TYwEqE7ZN50gwn+1LCVo9ZVrpxRPOhOLnncYkY1ZzOYtrX8Fwf/rFktZ8R5mJms6EZf5TqNOMeZmnPq9Q=="], - - "which": ["which@4.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="], + "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], "wrap-ansi": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], "wrap-ansi-cjs": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="], - "ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="], + "ws": ["ws@8.18.1", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w=="], "xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="], @@ -501,73 +506,43 @@ "yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="], + "zod": ["zod@3.24.3", "", {}, "sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg=="], + "@dataplan/json/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - "@dataplan/pg/@types/node": ["@types/node@20.12.14", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg=="], + "@dataplan/pg/@types/node": ["@types/node@20.17.30", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg=="], "@dataplan/pg/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - "@envelop/extended-validation/@graphql-tools/utils": ["@graphql-tools/utils@10.8.6", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "dset": "^3.1.4", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Alc9Vyg0oOsGhRapfL3xvqh1zV8nKoFUdtLhXX7Ki4nClaIJXckrA86j+uxEuG3ic6j4jlM1nvcWXRn/71AVLQ=="], - "@esbuild-kit/core-utils/esbuild": ["esbuild@0.18.20", "", { "optionalDependencies": { "@esbuild/android-arm": "0.18.20", "@esbuild/android-arm64": "0.18.20", "@esbuild/android-x64": "0.18.20", "@esbuild/darwin-arm64": "0.18.20", "@esbuild/darwin-x64": "0.18.20", "@esbuild/freebsd-arm64": "0.18.20", "@esbuild/freebsd-x64": "0.18.20", "@esbuild/linux-arm": "0.18.20", "@esbuild/linux-arm64": "0.18.20", "@esbuild/linux-ia32": "0.18.20", "@esbuild/linux-loong64": "0.18.20", "@esbuild/linux-mips64el": "0.18.20", "@esbuild/linux-ppc64": "0.18.20", "@esbuild/linux-riscv64": "0.18.20", "@esbuild/linux-s390x": "0.18.20", "@esbuild/linux-x64": "0.18.20", "@esbuild/netbsd-x64": "0.18.20", "@esbuild/openbsd-x64": "0.18.20", "@esbuild/sunos-x64": "0.18.20", "@esbuild/win32-arm64": "0.18.20", "@esbuild/win32-ia32": "0.18.20", "@esbuild/win32-x64": "0.18.20" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA=="], - "@escape.tech/graphql-armor-block-field-suggestions/@envelop/core": ["@envelop/core@5.0.2", "", { "dependencies": { "@envelop/types": "5.0.0", "tslib": "^2.5.0" } }, "sha512-tVL6OrMe6UjqLosiE+EH9uxh2TQC0469GwF4tE014ugRaDDKKVWwFwZe0TBMlcyHKh5MD4ZxktWo/1hqUxIuhw=="], - - "@escape.tech/graphql-armor-cost-limit/@envelop/core": ["@envelop/core@5.0.2", "", { "dependencies": { "@envelop/types": "5.0.0", "tslib": "^2.5.0" } }, "sha512-tVL6OrMe6UjqLosiE+EH9uxh2TQC0469GwF4tE014ugRaDDKKVWwFwZe0TBMlcyHKh5MD4ZxktWo/1hqUxIuhw=="], - - "@escape.tech/graphql-armor-max-aliases/@envelop/core": ["@envelop/core@5.0.2", "", { "dependencies": { "@envelop/types": "5.0.0", "tslib": "^2.5.0" } }, "sha512-tVL6OrMe6UjqLosiE+EH9uxh2TQC0469GwF4tE014ugRaDDKKVWwFwZe0TBMlcyHKh5MD4ZxktWo/1hqUxIuhw=="], - - "@escape.tech/graphql-armor-max-depth/@envelop/core": ["@envelop/core@5.0.2", "", { "dependencies": { "@envelop/types": "5.0.0", "tslib": "^2.5.0" } }, "sha512-tVL6OrMe6UjqLosiE+EH9uxh2TQC0469GwF4tE014ugRaDDKKVWwFwZe0TBMlcyHKh5MD4ZxktWo/1hqUxIuhw=="], - - "@escape.tech/graphql-armor-max-directives/@envelop/core": ["@envelop/core@5.0.2", "", { "dependencies": { "@envelop/types": "5.0.0", "tslib": "^2.5.0" } }, "sha512-tVL6OrMe6UjqLosiE+EH9uxh2TQC0469GwF4tE014ugRaDDKKVWwFwZe0TBMlcyHKh5MD4ZxktWo/1hqUxIuhw=="], - - "@escape.tech/graphql-armor-max-tokens/@envelop/core": ["@envelop/core@5.0.2", "", { "dependencies": { "@envelop/types": "5.0.0", "tslib": "^2.5.0" } }, "sha512-tVL6OrMe6UjqLosiE+EH9uxh2TQC0469GwF4tE014ugRaDDKKVWwFwZe0TBMlcyHKh5MD4ZxktWo/1hqUxIuhw=="], - "@isaacs/cliui/string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="], "@isaacs/cliui/strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="], "@isaacs/cliui/wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="], - "@types/interpret/@types/node": ["@types/node@22.10.4", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-99l6wv4HEzBQhvaU/UGoeBoCK61SCROQaCCGyQSgX2tEQ3rKkNZ2S7CEWnS/4s1LV+8ODdK21UeyR1fHP2mXug=="], - - "@types/ws/@types/node": ["@types/node@22.10.4", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-99l6wv4HEzBQhvaU/UGoeBoCK61SCROQaCCGyQSgX2tEQ3rKkNZ2S7CEWnS/4s1LV+8ODdK21UeyR1fHP2mXug=="], - - "@whatwg-node/node-fetch/@whatwg-node/disposablestack": ["@whatwg-node/disposablestack@0.0.6", "", { "dependencies": { "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.6.3" } }, "sha512-LOtTn+JgJvX8WfBVJtF08TGrdjuFzGJc4mkP8EdDI8ADbvO7kiexYep1o8dwnt0okb0jYclCDXF13xU7Ge4zSw=="], - - "@whatwg-node/server/@whatwg-node/disposablestack": ["@whatwg-node/disposablestack@0.0.6", "", { "dependencies": { "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.6.3" } }, "sha512-LOtTn+JgJvX8WfBVJtF08TGrdjuFzGJc4mkP8EdDI8ADbvO7kiexYep1o8dwnt0okb0jYclCDXF13xU7Ge4zSw=="], - - "cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], - "grafast/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - "graphile-build/@types/node": ["@types/node@20.12.14", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg=="], + "graphile-build/@types/node": ["@types/node@20.17.30", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg=="], "graphile-build/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - "graphile-build-pg/@types/node": ["@types/node@20.12.14", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg=="], + "graphile-build-pg/@types/node": ["@types/node@20.17.30", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg=="], - "graphile-config/@types/node": ["@types/node@20.12.14", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg=="], + "graphile-config/@types/node": ["@types/node@20.17.30", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg=="], "graphile-config/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], - "graphile-export/@types/node": ["@types/node@20.12.14", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg=="], - - "graphql-yoga/@graphql-tools/executor": ["@graphql-tools/executor@1.4.7", "", { "dependencies": { "@graphql-tools/utils": "^10.8.6", "@graphql-typed-document-node/core": "^3.2.0", "@repeaterjs/repeater": "^3.0.4", "@whatwg-node/disposablestack": "^0.0.6", "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-U0nK9jzJRP9/9Izf1+0Gggd6K6RNRsheFo1gC/VWzfnsr0qjcOSS9qTjY0OTC5iTPt4tQ+W5Zpw/uc7mebI6aA=="], + "graphile-export/@types/node": ["@types/node@20.17.30", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg=="], "http-proxy/eventemitter3": ["eventemitter3@4.0.7", "", {}, "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="], - "pg/pg-protocol": ["pg-protocol@1.8.0", "", {}, "sha512-jvuYlEkL03NRvOoyoRktBK7+qU5kOvlAwvmrH8sr3wbLrOdVWsRxQfz8mMy9sZFsqJ1hEWNfdWKI4SAmoL+j7g=="], - "pg/pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="], - "postgraphile/@types/node": ["@types/node@20.12.14", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg=="], + "postgraphile/@types/node": ["@types/node@20.17.30", "", { "dependencies": { "undici-types": "~6.19.2" } }, "sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg=="], - "postgraphile/@types/pg": ["@types/pg@8.11.10", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^4.0.1" } }, "sha512-LczQUW4dbOQzsH2RQ5qoeJ6qJPdrcM/DcMLoqWQkMLMsq83J5lAX3LXjdkWdpscFy67JSOWDnh7Ny/sPFykmkg=="], - - "postgraphile/pg": ["pg@8.13.1", "", { "dependencies": { "pg-connection-string": "^2.7.0", "pg-pool": "^3.7.0", "pg-protocol": "^1.7.0", "pg-types": "^2.1.0", "pgpass": "1.x" }, "optionalDependencies": { "pg-cloudflare": "^1.1.1" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-OUir1A0rPNZlX//c7ksiu7crsGZTKSOXJPgtNiHGIlC9H0lO+NC6ZDYksSgBYY/thSWhnSRBv8w1lieNNGATNQ=="], - - "@dataplan/pg/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], + "@dataplan/pg/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.18.20", "", { "os": "android", "cpu": "arm" }, "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw=="], @@ -613,37 +588,19 @@ "@esbuild-kit/core-utils/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.18.20", "", { "os": "win32", "cpu": "x64" }, "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ=="], - "@escape.tech/graphql-armor-block-field-suggestions/@envelop/core/@envelop/types": ["@envelop/types@5.0.0", "", { "dependencies": { "tslib": "^2.5.0" } }, "sha512-IPjmgSc4KpQRlO4qbEDnBEixvtb06WDmjKfi/7fkZaryh5HuOmTtixe1EupQI5XfXO8joc3d27uUZ0QdC++euA=="], - - "@escape.tech/graphql-armor-cost-limit/@envelop/core/@envelop/types": ["@envelop/types@5.0.0", "", { "dependencies": { "tslib": "^2.5.0" } }, "sha512-IPjmgSc4KpQRlO4qbEDnBEixvtb06WDmjKfi/7fkZaryh5HuOmTtixe1EupQI5XfXO8joc3d27uUZ0QdC++euA=="], - - "@escape.tech/graphql-armor-max-aliases/@envelop/core/@envelop/types": ["@envelop/types@5.0.0", "", { "dependencies": { "tslib": "^2.5.0" } }, "sha512-IPjmgSc4KpQRlO4qbEDnBEixvtb06WDmjKfi/7fkZaryh5HuOmTtixe1EupQI5XfXO8joc3d27uUZ0QdC++euA=="], - - "@escape.tech/graphql-armor-max-depth/@envelop/core/@envelop/types": ["@envelop/types@5.0.0", "", { "dependencies": { "tslib": "^2.5.0" } }, "sha512-IPjmgSc4KpQRlO4qbEDnBEixvtb06WDmjKfi/7fkZaryh5HuOmTtixe1EupQI5XfXO8joc3d27uUZ0QdC++euA=="], - - "@escape.tech/graphql-armor-max-directives/@envelop/core/@envelop/types": ["@envelop/types@5.0.0", "", { "dependencies": { "tslib": "^2.5.0" } }, "sha512-IPjmgSc4KpQRlO4qbEDnBEixvtb06WDmjKfi/7fkZaryh5HuOmTtixe1EupQI5XfXO8joc3d27uUZ0QdC++euA=="], - - "@escape.tech/graphql-armor-max-tokens/@envelop/core/@envelop/types": ["@envelop/types@5.0.0", "", { "dependencies": { "tslib": "^2.5.0" } }, "sha512-IPjmgSc4KpQRlO4qbEDnBEixvtb06WDmjKfi/7fkZaryh5HuOmTtixe1EupQI5XfXO8joc3d27uUZ0QdC++euA=="], - "@isaacs/cliui/string-width/emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="], "@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="], "@isaacs/cliui/wrap-ansi/ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="], - "cross-spawn/which/isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], - - "graphile-build-pg/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], + "graphile-build-pg/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], - "graphile-build/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], + "graphile-build/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], - "graphile-config/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], + "graphile-config/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], - "graphile-export/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], - - "graphql-yoga/@graphql-tools/executor/@graphql-tools/utils": ["@graphql-tools/utils@10.8.6", "", { "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@whatwg-node/promise-helpers": "^1.0.0", "cross-inspect": "1.0.1", "dset": "^3.1.4", "tslib": "^2.4.0" }, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } }, "sha512-Alc9Vyg0oOsGhRapfL3xvqh1zV8nKoFUdtLhXX7Ki4nClaIJXckrA86j+uxEuG3ic6j4jlM1nvcWXRn/71AVLQ=="], - - "graphql-yoga/@graphql-tools/executor/@whatwg-node/disposablestack": ["@whatwg-node/disposablestack@0.0.6", "", { "dependencies": { "@whatwg-node/promise-helpers": "^1.0.0", "tslib": "^2.6.3" } }, "sha512-LOtTn+JgJvX8WfBVJtF08TGrdjuFzGJc4mkP8EdDI8ADbvO7kiexYep1o8dwnt0okb0jYclCDXF13xU7Ge4zSw=="], + "graphile-export/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], "pg/pg-types/postgres-array": ["postgres-array@2.0.0", "", {}, "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="], @@ -653,20 +610,6 @@ "pg/pg-types/postgres-interval": ["postgres-interval@1.2.0", "", { "dependencies": { "xtend": "^4.0.0" } }, "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ=="], - "postgraphile/@types/node/undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="], - - "postgraphile/@types/pg/@types/node": ["@types/node@22.10.4", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-99l6wv4HEzBQhvaU/UGoeBoCK61SCROQaCCGyQSgX2tEQ3rKkNZ2S7CEWnS/4s1LV+8ODdK21UeyR1fHP2mXug=="], - - "postgraphile/pg/pg-pool": ["pg-pool@3.7.0", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-ZOBQForurqh4zZWjrgSwwAtzJ7QiRX0ovFkZr2klsen3Nm0aoh33Ls0fzfv3imeH/nw/O27cjdz5kzYJfeGp/g=="], - - "postgraphile/pg/pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="], - - "postgraphile/pg/pg-types/postgres-array": ["postgres-array@2.0.0", "", {}, "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="], - - "postgraphile/pg/pg-types/postgres-bytea": ["postgres-bytea@1.0.0", "", {}, "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w=="], - - "postgraphile/pg/pg-types/postgres-date": ["postgres-date@1.0.7", "", {}, "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q=="], - - "postgraphile/pg/pg-types/postgres-interval": ["postgres-interval@1.2.0", "", { "dependencies": { "xtend": "^4.0.0" } }, "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ=="], + "postgraphile/@types/node/undici-types": ["undici-types@6.19.8", "", {}, "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="], } } diff --git a/graphile.config.ts b/graphile.config.ts index 5b21dbf..c8ecc43 100644 --- a/graphile.config.ts +++ b/graphile.config.ts @@ -3,6 +3,7 @@ import { PgSimplifyInflectionPreset } from "@graphile/simplify-inflection"; import { PostGraphileConnectionFilterPreset } from "postgraphile-plugin-connection-filter"; import { makePgService } from "postgraphile/adaptors/pg"; import { PostGraphileAmberPreset } from "postgraphile/presets/amber"; +import { TagsFilePlugin } from "postgraphile/utils"; import { DATABASE_URL, isProdEnv } from "./src/lib/config/env.config"; import { @@ -33,6 +34,9 @@ const preset: GraphileConfig.Preset = { pgForbidSetofFunctionsToReturnNull: false, jsonScalarAsString: false, defaultBehavior: "-type:node -interface:node", + // See https://github.com/graphile-contrib/postgraphile-plugin-connection-filter?tab=readme-ov-file#handling-null-and-empty-objects + connectionFilterAllowNullInput: true, + connectionFilterAllowEmptyObjectInput: true, }, disablePlugins: ["PgIndexBehaviorsPlugin"], plugins: [ @@ -46,6 +50,7 @@ const preset: GraphileConfig.Preset = { DownvoteRBACPlugin, UpvoteRBACPlugin, CommentRBACPlugin, + TagsFilePlugin, ], grafserv: { graphiql: false, diff --git a/package.json b/package.json index 1837847..7511935 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@types/bun": "^1.2.8", "@types/node": "^22.13.14", "@types/pg": "^8.11.11", - "drizzle-kit": "^0.30.6", + "drizzle-kit": "^0.31.0", "husky": "^9.1.7", "replace-in-file": "^8.3.0", "typescript": "^5.8.2" @@ -36,19 +36,21 @@ "@envelop/parser-cache": "^8.1.3", "@envelop/validation-cache": "^8.1.3", "@escape.tech/graphql-armor": "^3.1.2", - "@graphile/pg-aggregates": "0.2.0-beta.7", - "@graphile/simplify-inflection": "8.0.0-beta.5", + "@graphile/pg-aggregates": "0.2.0-beta.8", + "@graphile/simplify-inflection": "8.0.0-beta.6", + "@polar-sh/hono": "^0.3.0", "dayjs": "^1.11.13", - "drizzle-orm": "^0.41.0", + "drizzle-orm": "^0.42.0", "drizzle-seed": "^0.3.1", - "graphile-export": "0.0.2-beta.24", + "graphile-export": "0.0.2-beta.26", "graphql": "^16.10.0", "graphql-yoga": "^5.13.2", - "hono": "^4.7.5", + "hono": "^4.7.7", "jose": "^6.0.10", "pg": "^8.14.1", - "postgraphile": "5.0.0-beta.37", - "postgraphile-plugin-connection-filter": "3.0.0-beta.7" + "postgraphile": "5.0.0-beta.40", + "postgraphile-plugin-connection-filter": "3.0.0-beta.8", + "zod": "^3.24.3" }, "trustedDependencies": ["@biomejs/biome", "esbuild"] } diff --git a/postgraphile.tags.json5 b/postgraphile.tags.json5 new file mode 100644 index 0000000..14df3b6 --- /dev/null +++ b/postgraphile.tags.json5 @@ -0,0 +1,16 @@ +{ + version: 1, + config: { + class: { + user: { + attribute: { + tier: { + tags: { + behavior: "-insert -update", + }, + }, + }, + }, + }, + }, +} diff --git a/src/generated/graphql/schema.executable.ts b/src/generated/graphql/schema.executable.ts index 3393921..21c064f 100644 --- a/src/generated/graphql/schema.executable.ts +++ b/src/generated/graphql/schema.executable.ts @@ -1,8 +1,8 @@ // @ts-nocheck -import { PgBooleanFilterStep, PgConditionStep, PgDeleteSingleStep, PgExecutor, PgOrFilterStep, PgSelectStep, PgUnionAllStep, TYPES, assertPgClassSingleStep, enumCodec, listOfCodec, makeRegistry, pgDeleteSingle, pgInsertSingle, pgSelectFromRecord, pgUpdateSingle, pgWhereConditionSpecListToSQL, recordCodec } from "@dataplan/pg"; +import { PgBooleanFilter, PgCondition, PgDeleteSingleStep, PgExecutor, PgOrFilter, TYPES, assertPgClassSingleStep, enumCodec, listOfCodec, makeRegistry, pgDeleteSingle, pgInsertSingle, pgSelectFromRecord, pgUpdateSingle, pgWhereConditionSpecListToSQL, recordCodec, sqlValueWithCodec } from "@dataplan/pg"; import { and, eq } from "drizzle-orm"; -import { ConnectionStep, EdgeStep, ExecutableStep, ModifierStep, ObjectStep, SafeError, __ValueStep, assertEdgeCapableStep, assertExecutableStep, assertPageInfoCapableStep, connection, constant, context, first, getEnumValueConfig, isExecutableStep, lambda, makeGrafastSchema, node, object, rootValue, sideEffect } from "grafast"; -import { GraphQLEnumType, GraphQLError, Kind } from "graphql"; +import { ConnectionStep, EdgeStep, ExecutableStep, Modifier, ObjectStep, __ValueStep, assertEdgeCapableStep, assertExecutableStep, assertPageInfoCapableStep, bakedInputRuntime, connection, constant, context, createObjectAndApplyChildren, first, isExecutableStep, lambda, makeGrafastSchema, node, object, rootValue, sideEffect } from "grafast"; +import { GraphQLError, Kind } from "graphql"; import * as lib_drizzle_schema from "lib/drizzle/schema"; import { sql } from "pg-sql2"; import { inspect } from "util"; @@ -24,6 +24,9 @@ const handler = { match(specifier) { return specifier === "query"; }, + getIdentifiers(_value) { + return []; + }, getSpec() { return "irrelevant"; }, @@ -34,7 +37,8 @@ const handler = { return constant`query`; } }; -const nodeIdCodecs = Object.assign(Object.create(null), { +const nodeIdCodecs = { + __proto__: null, raw: handler.codec, base64JSON: { name: "base64JSON", @@ -66,10 +70,11 @@ const nodeIdCodecs = Object.assign(Object.create(null), { isSyncAndSafe: true }) } -}); -const nodeIdHandlerByTypeName = Object.assign(Object.create(null), { +}; +const nodeIdHandlerByTypeName = { + __proto__: null, Query: handler -}); +}; const executor = new PgExecutor({ name: "main", context() { @@ -84,7 +89,8 @@ const downvoteIdentifier = sql.identifier("public", "downvote"); const spec_downvote = { name: "downvote", identifier: downvoteIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, id: { description: undefined, codec: TYPES.uuid, @@ -145,17 +151,19 @@ const spec_downvote = { canUpdate: true } } - }), + }, description: undefined, extensions: { - oid: "215477", + oid: "216526", isTableLike: true, pg: { serviceName: "main", schemaName: "public", name: "downvote" }, - tags: Object.create(null) + tags: { + __proto__: null + } }, executor: executor }; @@ -164,7 +172,8 @@ const upvoteIdentifier = sql.identifier("public", "upvote"); const spec_upvote = { name: "upvote", identifier: upvoteIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, id: { description: undefined, codec: TYPES.uuid, @@ -225,17 +234,19 @@ const spec_upvote = { canUpdate: true } } - }), + }, description: undefined, extensions: { - oid: "215390", + oid: "216439", isTableLike: true, pg: { serviceName: "main", schemaName: "public", name: "upvote" }, - tags: Object.create(null) + tags: { + __proto__: null + } }, executor: executor }; @@ -244,7 +255,8 @@ const invitationIdentifier = sql.identifier("public", "invitation"); const spec_invitation = { name: "invitation", identifier: invitationIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, id: { description: undefined, codec: TYPES.uuid, @@ -305,17 +317,19 @@ const spec_invitation = { canUpdate: true } } - }), + }, description: undefined, extensions: { - oid: "215577", + oid: "216625", isTableLike: true, pg: { serviceName: "main", schemaName: "public", name: "invitation" }, - tags: Object.create(null) + tags: { + __proto__: null + } }, executor: executor }; @@ -324,7 +338,8 @@ const organizationIdentifier = sql.identifier("public", "organization"); const spec_organization = { name: "organization", identifier: organizationIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, id: { description: undefined, codec: TYPES.uuid, @@ -385,17 +400,19 @@ const spec_organization = { canUpdate: true } } - }), + }, description: undefined, extensions: { - oid: "215352", + oid: "216401", isTableLike: true, pg: { serviceName: "main", schemaName: "public", name: "organization" }, - tags: Object.create(null) + tags: { + __proto__: null + } }, executor: executor }; @@ -404,7 +421,8 @@ const commentIdentifier = sql.identifier("public", "comment"); const spec_comment = { name: "comment", identifier: commentIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, id: { description: undefined, codec: TYPES.uuid, @@ -477,21 +495,142 @@ const spec_comment = { canUpdate: true } } - }), + }, description: undefined, extensions: { - oid: "215457", + oid: "216506", isTableLike: true, pg: { serviceName: "main", schemaName: "public", name: "comment" }, - tags: Object.create(null) + tags: { + __proto__: null + } }, executor: executor }; const commentCodec = recordCodec(spec_comment); +const projectIdentifier = sql.identifier("public", "project"); +const spec_project = { + name: "project", + identifier: projectIdentifier, + attributes: { + __proto__: null, + id: { + description: undefined, + codec: TYPES.uuid, + notNull: true, + hasDefault: true, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + name: { + description: undefined, + codec: TYPES.text, + notNull: true, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + image: { + description: undefined, + codec: TYPES.text, + notNull: false, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + slug: { + description: undefined, + codec: TYPES.text, + notNull: true, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + description: { + description: undefined, + codec: TYPES.text, + notNull: false, + hasDefault: false, + extensions: { + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true + } + }, + organization_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: "216425", + isTableLike: true, + pg: { + serviceName: "main", + schemaName: "public", + name: "project" + }, + tags: { + __proto__: null + } + }, + executor: executor +}; +const projectCodec = recordCodec(spec_project); const memberIdentifier = sql.identifier("public", "member"); const roleCodec = enumCodec({ name: "role", @@ -499,19 +638,22 @@ const roleCodec = enumCodec({ values: ["owner", "admin", "member"], description: undefined, extensions: { - oid: "215496", + oid: "216545", pg: { serviceName: "main", schemaName: "public", name: "role" }, - tags: Object.create(null) + tags: { + __proto__: null + } } }); const spec_member = { name: "member", identifier: memberIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, user_id: { description: undefined, codec: TYPES.uuid, @@ -572,17 +714,19 @@ const spec_member = { canUpdate: true } } - }), + }, description: undefined, extensions: { - oid: "215412", + oid: "216461", isTableLike: true, pg: { serviceName: "main", schemaName: "public", name: "member" }, - tags: Object.create(null) + tags: { + __proto__: null + } }, executor: executor }; @@ -591,7 +735,8 @@ const postIdentifier = sql.identifier("public", "post"); const spec_post = { name: "post", identifier: postIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, id: { description: undefined, codec: TYPES.uuid, @@ -700,17 +845,19 @@ const spec_post = { canUpdate: true } } - }), + }, description: undefined, extensions: { - oid: "215366", + oid: "216415", isTableLike: true, pg: { serviceName: "main", schemaName: "public", name: "post" }, - tags: Object.create(null) + tags: { + __proto__: null + } }, executor: executor }; @@ -719,7 +866,8 @@ const postStatusIdentifier = sql.identifier("public", "post_status"); const spec_postStatus = { name: "postStatus", identifier: postStatusIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, id: { description: undefined, codec: TYPES.uuid, @@ -816,142 +964,46 @@ const spec_postStatus = { canUpdate: true } } - }), + }, description: undefined, extensions: { - oid: "215551", + oid: "216599", isTableLike: true, pg: { serviceName: "main", schemaName: "public", name: "post_status" }, - tags: Object.create(null) + tags: { + __proto__: null + } }, executor: executor }; const postStatusCodec = recordCodec(spec_postStatus); -const projectIdentifier = sql.identifier("public", "project"); -const spec_project = { - name: "project", - identifier: projectIdentifier, - attributes: Object.assign(Object.create(null), { - id: { - description: undefined, - codec: TYPES.uuid, - notNull: true, - hasDefault: true, - extensions: { - tags: {}, - canSelect: true, - canInsert: true, - canUpdate: true - } - }, - name: { - description: undefined, - codec: TYPES.text, - notNull: true, - hasDefault: false, - extensions: { - tags: {}, - canSelect: true, - canInsert: true, - canUpdate: true - } - }, - image: { - description: undefined, - codec: TYPES.text, - notNull: false, - hasDefault: false, - extensions: { - tags: {}, - canSelect: true, - canInsert: true, - canUpdate: true - } - }, - slug: { - description: undefined, - codec: TYPES.text, - notNull: true, - hasDefault: false, - extensions: { - tags: {}, - canSelect: true, - canInsert: true, - canUpdate: true - } - }, - description: { - description: undefined, - codec: TYPES.text, - notNull: false, - hasDefault: false, - extensions: { - tags: {}, - canSelect: true, - canInsert: true, - canUpdate: true - } - }, - organization_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 - } - } - }), +const userIdentifier = sql.identifier("public", "user"); +const tierCodec = enumCodec({ + name: "tier", + identifier: sql.identifier("public", "tier"), + values: ["basic", "team", "enterprise"], description: undefined, extensions: { - oid: "215376", - isTableLike: true, + oid: "216648", pg: { serviceName: "main", schemaName: "public", - name: "project" + name: "tier" }, - tags: Object.create(null) - }, - executor: executor -}; -const projectCodec = recordCodec(spec_project); -const userIdentifier = sql.identifier("public", "user"); + tags: { + __proto__: null + } + } +}); const spec_user = { name: "user", identifier: userIdentifier, - attributes: Object.assign(Object.create(null), { + attributes: { + __proto__: null, id: { description: undefined, codec: TYPES.uuid, @@ -1047,19 +1099,35 @@ const spec_user = { canInsert: true, canUpdate: true } - } - }), - description: undefined, - extensions: { - oid: "215400", - isTableLike: true, - pg: { - serviceName: "main", - schemaName: "public", - name: "user" }, - tags: Object.create(null) - }, + tier: { + description: undefined, + codec: tierCodec, + notNull: false, + hasDefault: false, + extensions: { + tags: { + behavior: "-insert -update" + }, + canSelect: true, + canInsert: true, + canUpdate: true + } + } + }, + description: undefined, + extensions: { + oid: "216449", + isTableLike: true, + pg: { + serviceName: "main", + schemaName: "public", + name: "user" + }, + tags: { + __proto__: null + } + }, executor: executor }; const userCodec = recordCodec(spec_user); @@ -1068,16 +1136,19 @@ const downvoteUniques = [{ attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }, { isPrimary: false, attributes: ["post_id", "user_id"], description: undefined, extensions: { - tags: Object.assign(Object.create(null), { + tags: { + __proto__: null, behavior: ["-update", "-delete"] - }) + } } }]; const registryConfig_pgResources_downvote_downvote = { @@ -1111,16 +1182,19 @@ const upvoteUniques = [{ attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }, { isPrimary: false, attributes: ["post_id", "user_id"], description: undefined, extensions: { - tags: Object.assign(Object.create(null), { + tags: { + __proto__: null, behavior: ["-update", "-delete"] - }) + } } }]; const registryConfig_pgResources_upvote_upvote = { @@ -1154,16 +1228,19 @@ const invitationUniques = [{ attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }, { isPrimary: false, attributes: ["organization_id", "email"], description: undefined, extensions: { - tags: Object.assign(Object.create(null), { + tags: { + __proto__: null, behavior: ["-update", "-delete"] - }) + } } }]; const registryConfig_pgResources_invitation_invitation = { @@ -1197,25 +1274,29 @@ const organizationUniques = [{ attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }, { isPrimary: false, attributes: ["name"], description: undefined, extensions: { - tags: Object.assign(Object.create(null), { + tags: { + __proto__: null, behavior: ["-update", "-delete"] - }) + } } }, { isPrimary: false, attributes: ["slug"], description: undefined, extensions: { - tags: Object.assign(Object.create(null), { + tags: { + __proto__: null, behavior: ["-update", "-delete"] - }) + } } }]; const registryConfig_pgResources_organization_organization = { @@ -1249,7 +1330,9 @@ const commentUniques = [{ attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }]; const registryConfig_pgResources_comment_comment = { @@ -1283,16 +1366,19 @@ const projectUniques = [{ attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }, { isPrimary: false, attributes: ["slug", "organization_id"], description: undefined, extensions: { - tags: Object.assign(Object.create(null), { + tags: { + __proto__: null, behavior: ["-update", "-delete"] - }) + } } }]; const registryConfig_pgResources_project_project = { @@ -1321,82 +1407,24 @@ const registryConfig_pgResources_project_project = { canDelete: true } }; -const userUniques = [{ - isPrimary: true, - attributes: ["id"], - description: undefined, - extensions: { - tags: Object.create(null) - } -}, { - isPrimary: false, - attributes: ["email"], - description: undefined, - extensions: { - tags: Object.assign(Object.create(null), { - behavior: ["-update", "-delete"] - }) - } -}, { - isPrimary: false, - attributes: ["hidra_id"], - description: undefined, - extensions: { - tags: Object.assign(Object.create(null), { - behavior: ["-update", "-delete"] - }) - } -}, { - isPrimary: false, - attributes: ["username"], - description: undefined, - extensions: { - tags: Object.assign(Object.create(null), { - behavior: ["-update", "-delete"] - }) - } -}]; -const registryConfig_pgResources_user_user = { - executor: executor, - name: "user", - identifier: "main.public.user", - from: userIdentifier, - codec: userCodec, - uniques: userUniques, - isVirtual: false, - description: undefined, - extensions: { - description: undefined, - pg: { - serviceName: "main", - schemaName: "public", - name: "user" - }, - isInsertable: true, - isUpdatable: true, - isDeletable: true, - tags: {}, - canSelect: true, - canInsert: true, - canUpdate: true, - canDelete: true - } -}; const memberUniques = [{ isPrimary: true, attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }, { isPrimary: false, attributes: ["user_id", "organization_id"], description: undefined, extensions: { - tags: Object.assign(Object.create(null), { + tags: { + __proto__: null, behavior: ["-update", "-delete"] - }) + } } }]; const registryConfig_pgResources_member_member = { @@ -1430,7 +1458,9 @@ const postUniques = [{ attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }]; const registryConfig_pgResources_post_post = { @@ -1464,7 +1494,9 @@ const post_statusUniques = [{ attributes: ["id"], description: undefined, extensions: { - tags: Object.create(null) + tags: { + __proto__: null + } } }]; const registryConfig_pgResources_post_status_post_status = { @@ -1493,11 +1525,79 @@ const registryConfig_pgResources_post_status_post_status = { canDelete: true } }; +const userUniques = [{ + isPrimary: true, + attributes: ["id"], + description: undefined, + extensions: { + tags: { + __proto__: null + } + } +}, { + isPrimary: false, + attributes: ["email"], + description: undefined, + extensions: { + tags: { + __proto__: null, + behavior: ["-update", "-delete"] + } + } +}, { + isPrimary: false, + attributes: ["hidra_id"], + description: undefined, + extensions: { + tags: { + __proto__: null, + behavior: ["-update", "-delete"] + } + } +}, { + isPrimary: false, + attributes: ["username"], + description: undefined, + extensions: { + tags: { + __proto__: null, + behavior: ["-update", "-delete"] + } + } +}]; +const registryConfig_pgResources_user_user = { + executor: executor, + name: "user", + identifier: "main.public.user", + from: userIdentifier, + codec: userCodec, + uniques: userUniques, + isVirtual: false, + description: undefined, + extensions: { + description: undefined, + pg: { + serviceName: "main", + schemaName: "public", + name: "user" + }, + isInsertable: true, + isUpdatable: true, + isDeletable: true, + tags: {}, + canSelect: true, + canInsert: true, + canUpdate: true, + canDelete: true + } +}; const registryConfig = { - pgExecutors: Object.assign(Object.create(null), { + pgExecutors: { + __proto__: null, main: executor - }), - pgCodecs: Object.assign(Object.create(null), { + }, + pgCodecs: { + __proto__: null, downvote: downvoteCodec, uuid: TYPES.uuid, timestamptz: TYPES.timestamptz, @@ -1506,28 +1606,32 @@ const registryConfig = { text: TYPES.text, organization: organizationCodec, comment: commentCodec, + project: projectCodec, member: memberCodec, role: roleCodec, post: postCodec, postStatus: postStatusCodec, bool: TYPES.boolean, - project: projectCodec, - user: userCodec - }), - pgResources: Object.assign(Object.create(null), { + user: userCodec, + tier: tierCodec + }, + pgResources: { + __proto__: null, downvote: registryConfig_pgResources_downvote_downvote, upvote: registryConfig_pgResources_upvote_upvote, invitation: registryConfig_pgResources_invitation_invitation, organization: registryConfig_pgResources_organization_organization, comment: registryConfig_pgResources_comment_comment, project: registryConfig_pgResources_project_project, - user: registryConfig_pgResources_user_user, member: registryConfig_pgResources_member_member, post: registryConfig_pgResources_post_post, - post_status: registryConfig_pgResources_post_status_post_status - }), - pgRelations: Object.assign(Object.create(null), { - comment: Object.assign(Object.create(null), { + post_status: registryConfig_pgResources_post_status_post_status, + user: registryConfig_pgResources_user_user + }, + pgRelations: { + __proto__: null, + comment: { + __proto__: null, postByMyPostId: { localCodec: commentCodec, remoteResourceOptions: registryConfig_pgResources_post_post, @@ -1558,8 +1662,9 @@ const registryConfig = { } } } - }), - downvote: Object.assign(Object.create(null), { + }, + downvote: { + __proto__: null, postByMyPostId: { localCodec: downvoteCodec, remoteResourceOptions: registryConfig_pgResources_post_post, @@ -1590,8 +1695,9 @@ const registryConfig = { } } } - }), - invitation: Object.assign(Object.create(null), { + }, + invitation: { + __proto__: null, organizationByMyOrganizationId: { localCodec: invitationCodec, remoteResourceOptions: registryConfig_pgResources_organization_organization, @@ -1607,8 +1713,9 @@ const registryConfig = { } } } - }), - member: Object.assign(Object.create(null), { + }, + member: { + __proto__: null, organizationByMyOrganizationId: { localCodec: memberCodec, remoteResourceOptions: registryConfig_pgResources_organization_organization, @@ -1639,8 +1746,9 @@ const registryConfig = { } } } - }), - organization: Object.assign(Object.create(null), { + }, + organization: { + __proto__: null, projectsByTheirOrganizationId: { localCodec: organizationCodec, remoteResourceOptions: registryConfig_pgResources_project_project, @@ -1686,8 +1794,9 @@ const registryConfig = { } } } - }), - post: Object.assign(Object.create(null), { + }, + post: { + __proto__: null, projectByMyProjectId: { localCodec: postCodec, remoteResourceOptions: registryConfig_pgResources_project_project, @@ -1778,8 +1887,9 @@ const registryConfig = { } } } - }), - postStatus: Object.assign(Object.create(null), { + }, + postStatus: { + __proto__: null, projectByMyProjectId: { localCodec: postStatusCodec, remoteResourceOptions: registryConfig_pgResources_project_project, @@ -1810,8 +1920,9 @@ const registryConfig = { } } } - }), - project: Object.assign(Object.create(null), { + }, + project: { + __proto__: null, organizationByMyOrganizationId: { localCodec: projectCodec, remoteResourceOptions: registryConfig_pgResources_organization_organization, @@ -1857,8 +1968,9 @@ const registryConfig = { } } } - }), - upvote: Object.assign(Object.create(null), { + }, + upvote: { + __proto__: null, postByMyPostId: { localCodec: upvoteCodec, remoteResourceOptions: registryConfig_pgResources_post_post, @@ -1889,8 +2001,9 @@ const registryConfig = { } } } - }), - user: Object.assign(Object.create(null), { + }, + user: { + __proto__: null, postsByTheirUserId: { localCodec: userCodec, remoteResourceOptions: registryConfig_pgResources_post_post, @@ -1966,8 +2079,8 @@ const registryConfig = { } } } - }) - }) + } + } }; const registry = makeRegistry(registryConfig); const resource_downvotePgResource = registry.pgResources["downvote"]; @@ -1976,144 +2089,125 @@ const resource_invitationPgResource = registry.pgResources["invitation"]; const resource_organizationPgResource = registry.pgResources["organization"]; const resource_commentPgResource = registry.pgResources["comment"]; const resource_projectPgResource = registry.pgResources["project"]; -const resource_userPgResource = registry.pgResources["user"]; const resource_memberPgResource = registry.pgResources["member"]; const resource_postPgResource = registry.pgResources["post"]; const resource_post_statusPgResource = registry.pgResources["post_status"]; -const applyOrderToPlan = ($select, $value, TableOrderByType) => { - if (!("evalLength" in $value)) return; - const length = $value.evalLength(); - if (length == null) return; - for (let i = 0; i < length; i++) { - const order = $value.at(i).eval(); - if (order == null) continue; - const plan = getEnumValueConfig(TableOrderByType, order)?.extensions?.grafast?.applyPlan; - if (typeof plan !== "function") { - console.error(`Internal server error: invalid orderBy configuration: expected function, but received ${inspect(plan)}`); - throw new SafeError("Internal server error: invalid orderBy configuration"); - } - plan($select); - } -}; -function assertAllowed(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."), {}); +const resource_userPgResource = registry.pgResources["user"]; +function qbWhereBuilder(qb) { + return qb.whereBuilder(); +} +function isEmpty(o) { + return typeof o === "object" && o !== null && Object.keys(o).length === 0; +} +function assertAllowed(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed2(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."), {}); +function assertAllowed2(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed3(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."), {}); +function assertAllowed3(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed4(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."), {}); +function assertAllowed4(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed5(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."), {}); +function assertAllowed5(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed6(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."), {}); +function assertAllowed6(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === 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."), {}); +function assertAllowed7(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === 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."), {}); +function assertAllowed8(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed9(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed10(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } function UUIDSerialize(value) { return "" + value; @@ -2122,132 +2216,110 @@ 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 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) { - 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."), {}); +function assertAllowed11(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed12(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed13(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed14(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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."), {}); +function assertAllowed15(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === 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."), {}); +function assertAllowed16(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === 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."), {}); +function assertAllowed17(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === 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."), {}); +function assertAllowed18(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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 ProjectGroupBy_extensions_grafast_applyPlan($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("name")}` - }); -} -function ProjectGroupBy_extensions_grafast_applyPlan2($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("image")}` - }); -} -function ProjectGroupBy_extensions_grafast_applyPlan3($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("slug")}` - }); -} -function ProjectGroupBy_extensions_grafast_applyPlan4($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("description")}` - }); -} -function ProjectGroupBy_extensions_grafast_applyPlan5($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("organization_id")}` - }); -} -function ProjectGroupBy_extensions_grafast_applyPlan6($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` - }); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } +const dataTypeToAggregateTypeMap = {}; +const spec = { + id: "distinctCount", + humanLabel: "distinct count", + HumanLabel: "Distinct count", + isSuitableType() { + return !0; + }, + sqlAggregateWrap(sqlFrag) { + return sql`count(distinct ${sqlFrag})`; + }, + pgTypeCodecModifier(codec) { + const oid = codec.extensions?.oid; + return (oid ? dataTypeToAggregateTypeMap[oid] : null) ?? TYPES.bigint; + } +}; const aggregateGroupBySpec = { id: "truncated-to-hour", isSuitableType(codec) { @@ -2255,13 +2327,11 @@ const aggregateGroupBySpec = { }, sqlWrap(sqlFrag) { return sql`date_trunc('hour', ${sqlFrag})`; + }, + sqlWrapCodec(codec) { + return codec; } }; -function ProjectGroupBy_extensions_grafast_applyPlan7($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} const aggregateGroupBySpec2 = { id: "truncated-to-day", isSuitableType(codec) { @@ -2269,147 +2339,13 @@ const aggregateGroupBySpec2 = { }, sqlWrap(sqlFrag) { return sql`date_trunc('day', ${sqlFrag})`; + }, + sqlWrapCodec(codec) { + return codec; } }; -function ProjectGroupBy_extensions_grafast_applyPlan8($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function ProjectGroupBy_extensions_grafast_applyPlan9($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` - }); -} -function ProjectGroupBy_extensions_grafast_applyPlan10($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -function ProjectGroupBy_extensions_grafast_applyPlan11($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -export const ProjectGroupBy = new GraphQLEnumType({ - name: "ProjectGroupBy", - description: "Grouping methods for `Project` for usage during aggregation.", - values: Object.assign(Object.create(null), { - NAME: { - value: "NAME", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan - } - }) - }, - IMAGE: { - value: "IMAGE", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan2 - } - }) - }, - SLUG: { - value: "SLUG", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan3 - } - }) - }, - DESCRIPTION: { - value: "DESCRIPTION", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan4 - } - }) - }, - ORGANIZATION_ID: { - value: "ORGANIZATION_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan5 - } - }) - }, - CREATED_AT: { - value: "CREATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan6 - } - }) - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - value: "CREATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan7 - } - }) - }, - CREATED_AT_TRUNCATED_TO_DAY: { - value: "CREATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan8 - } - }) - }, - UPDATED_AT: { - value: "UPDATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan9 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - value: "UPDATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan10 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_DAY: { - value: "UPDATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan11 - } - }) - } - }) -}); -const dataTypeToAggregateTypeMap = {}; -const spec = { - id: "distinctCount", - humanLabel: "distinct count", - HumanLabel: "Distinct count", - isSuitableType() { - return !0; - }, - sqlAggregateWrap(sqlFrag) { - return sql`count(distinct ${sqlFrag})`; - }, - pgTypeCodecModifier(codec) { - var _a, _b; - const oid = (_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.oid; - return (_b = oid ? dataTypeToAggregateTypeMap[oid] : null) !== null && _b !== void 0 ? _b : TYPES.bigint; - } -}; -const isIntervalLike = codec => { - var _a; - return !!((_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.isIntervalLike); -}; -const isNumberLike = codec => { - var _a; - return !!((_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.isNumberLike); -}; +const isIntervalLike = codec => !!codec.extensions?.isIntervalLike; +const isNumberLike = codec => !!codec.extensions?.isNumberLike; const aggregateSpec_isSuitableType = codec => isIntervalLike(codec) || isNumberLike(codec); const dataTypeToAggregateTypeMap2 = { "20": TYPES.numeric, @@ -2430,9 +2366,8 @@ const aggregateSpec = { }, isNonNull: true, pgTypeCodecModifier(codec) { - var _a, _b; - const oid = (_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.oid; - return (_b = oid ? dataTypeToAggregateTypeMap2[oid] : null) !== null && _b !== void 0 ? _b : TYPES.numeric; + const oid = codec.extensions?.oid; + return (oid ? dataTypeToAggregateTypeMap2[oid] : null) ?? TYPES.numeric; } }; const infix = () => sql.fragment`=`; @@ -2477,9 +2412,8 @@ const aggregateSpec4 = { return sql`avg(${sqlFrag})`; }, pgTypeCodecModifier(codec) { - var _a, _b; - const oid = (_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.oid; - return (_b = oid ? dataTypeToAggregateTypeMap3[oid] : null) !== null && _b !== void 0 ? _b : TYPES.numeric; + const oid = codec.extensions?.oid; + return (oid ? dataTypeToAggregateTypeMap3[oid] : null) ?? TYPES.numeric; } }; const dataTypeToAggregateTypeMap4 = { @@ -2495,9 +2429,8 @@ const aggregateSpec5 = { return sql`stddev_samp(${sqlFrag})`; }, pgTypeCodecModifier(codec) { - var _a, _b; - const oid = (_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.oid; - return (_b = oid ? dataTypeToAggregateTypeMap4[oid] : null) !== null && _b !== void 0 ? _b : TYPES.numeric; + const oid = codec.extensions?.oid; + return (oid ? dataTypeToAggregateTypeMap4[oid] : null) ?? TYPES.numeric; } }; const dataTypeToAggregateTypeMap5 = { @@ -2513,9 +2446,8 @@ const aggregateSpec6 = { return sql`stddev_pop(${sqlFrag})`; }, pgTypeCodecModifier(codec) { - var _a, _b; - const oid = (_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.oid; - return (_b = oid ? dataTypeToAggregateTypeMap5[oid] : null) !== null && _b !== void 0 ? _b : TYPES.numeric; + const oid = codec.extensions?.oid; + return (oid ? dataTypeToAggregateTypeMap5[oid] : null) ?? TYPES.numeric; } }; const dataTypeToAggregateTypeMap6 = { @@ -2531,9 +2463,8 @@ const aggregateSpec7 = { return sql`var_samp(${sqlFrag})`; }, pgTypeCodecModifier(codec) { - var _a, _b; - const oid = (_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.oid; - return (_b = oid ? dataTypeToAggregateTypeMap6[oid] : null) !== null && _b !== void 0 ? _b : TYPES.numeric; + const oid = codec.extensions?.oid; + return (oid ? dataTypeToAggregateTypeMap6[oid] : null) ?? TYPES.numeric; } }; const dataTypeToAggregateTypeMap7 = { @@ -2549,13 +2480,10 @@ const aggregateSpec8 = { return sql`var_pop(${sqlFrag})`; }, pgTypeCodecModifier(codec) { - var _a, _b; - const oid = (_a = codec.extensions) === null || _a === void 0 ? void 0 : _a.oid; - return (_b = oid ? dataTypeToAggregateTypeMap7[oid] : null) !== null && _b !== void 0 ? _b : TYPES.numeric; + const oid = codec.extensions?.oid; + return (oid ? dataTypeToAggregateTypeMap7[oid] : null) ?? TYPES.numeric; } }; -const relation = registry.pgRelations["project"]["postsByTheirProjectId"]; -const relation2 = registry.pgRelations["project"]["postStatusesByTheirProjectId"]; const colSpec = { fieldName: "rowId", attributeName: "id", @@ -2596,43 +2524,40 @@ const colSpec8 = { attributeName: "updated_at", attribute: spec_project.attributes.updated_at }; -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) { - 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."), {}); +function assertAllowed19(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed20(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed21(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -const resolve = (i, _v, $input) => sql`${i} ${$input.eval() ? sql`IS NULL` : sql`IS NOT NULL`}`; +const resolve = (i, _v, input) => sql`${i} ${input ? sql`IS NULL` : sql`IS NOT NULL`}`; const resolveInputCodec = () => TYPES.boolean; const resolveSqlValue = () => sql.null; const resolve2 = (i, v) => sql`${i} = ${v}`; @@ -2682,7 +2607,7 @@ const resolve8 = (i, v) => sql`${i} < ${v}`; const resolve9 = (i, v) => sql`${i} <= ${v}`; const resolve10 = (i, v) => sql`${i} > ${v}`; const resolve11 = (i, v) => sql`${i} >= ${v}`; -const resolve12 = (i, _v, $input) => sql`${i} ${$input.eval() ? sql`IS NULL` : sql`IS NOT NULL`}`; +const resolve12 = (i, _v, input) => sql`${i} ${input ? sql`IS NULL` : sql`IS NOT NULL`}`; const resolveInputCodec4 = () => TYPES.boolean; const resolveSqlValue2 = () => sql.null; const resolve13 = (i, v) => sql`${i} = ${v}`; @@ -2797,12 +2722,12 @@ function resolveInputCodec8(inputCodec) { function resolveSqlIdentifier4(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue3($placeholderable, $input, inputCodec) { +function resolveSqlValue3(_unused, input, inputCodec) { if ("equalTo" === "in" || "equalTo" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2819,12 +2744,12 @@ function resolveInputCodec9(inputCodec) { function resolveSqlIdentifier5(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue4($placeholderable, $input, inputCodec) { +function resolveSqlValue4(_unused, input, inputCodec) { if ("notEqualTo" === "in" || "notEqualTo" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2841,12 +2766,12 @@ function resolveInputCodec10(inputCodec) { function resolveSqlIdentifier6(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue5($placeholderable, $input, inputCodec) { +function resolveSqlValue5(_unused, input, inputCodec) { if ("distinctFrom" === "in" || "distinctFrom" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2863,12 +2788,12 @@ function resolveInputCodec11(inputCodec) { function resolveSqlIdentifier7(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue6($placeholderable, $input, inputCodec) { +function resolveSqlValue6(_unused, input, inputCodec) { if ("notDistinctFrom" === "in" || "notDistinctFrom" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2885,12 +2810,12 @@ function resolveInputCodec12(inputCodec) { function resolveSqlIdentifier8(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue7($placeholderable, $input, inputCodec) { +function resolveSqlValue7(_unused, input, inputCodec) { if ("in" === "in" || "in" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2907,12 +2832,12 @@ function resolveInputCodec13(inputCodec) { function resolveSqlIdentifier9(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue8($placeholderable, $input, inputCodec) { +function resolveSqlValue8(_unused, input, inputCodec) { if ("notIn" === "in" || "notIn" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2929,12 +2854,12 @@ function resolveInputCodec14(inputCodec) { function resolveSqlIdentifier10(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue9($placeholderable, $input, inputCodec) { +function resolveSqlValue9(_unused, input, inputCodec) { if ("lessThan" === "in" || "lessThan" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2951,12 +2876,12 @@ function resolveInputCodec15(inputCodec) { function resolveSqlIdentifier11(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue10($placeholderable, $input, inputCodec) { +function resolveSqlValue10(_unused, input, inputCodec) { if ("lessThanOrEqualTo" === "in" || "lessThanOrEqualTo" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2973,12 +2898,12 @@ function resolveInputCodec16(inputCodec) { function resolveSqlIdentifier12(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue11($placeholderable, $input, inputCodec) { +function resolveSqlValue11(_unused, input, inputCodec) { if ("greaterThan" === "in" || "greaterThan" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } @@ -2995,16 +2920,16 @@ function resolveInputCodec17(inputCodec) { function resolveSqlIdentifier13(sourceAlias, codec) { return resolveDomains2(codec) === TYPES.citext ? [sourceAlias, codec] : [sql`lower(${sourceAlias}::text)`, TYPES.text]; } -function resolveSqlValue12($placeholderable, $input, inputCodec) { +function resolveSqlValue12(_unused, input, inputCodec) { if ("greaterThanOrEqualTo" === "in" || "greaterThanOrEqualTo" === "notIn") { - const sqlList = $placeholderable.placeholder($input, inputCodec); + const sqlList = sqlValueWithCodec(input, inputCodec); if (inputCodec.arrayOfCodec === TYPES.citext) return sqlList;else return sql`(select lower(t) from unnest(${sqlList}) t)`; } else { - const sqlValue = $placeholderable.placeholder($input, inputCodec); + const sqlValue = sqlValueWithCodec(input, inputCodec); if (inputCodec === TYPES.citext) return sqlValue;else return sql`lower(${sqlValue})`; } } -const resolve39 = (i, _v, $input) => sql`${i} ${$input.eval() ? sql`IS NULL` : sql`IS NOT NULL`}`; +const resolve39 = (i, _v, input) => sql`${i} ${input ? sql`IS NULL` : sql`IS NOT NULL`}`; const resolveInputCodec18 = () => TYPES.boolean; const resolveSqlValue13 = () => sql.null; const resolve40 = (i, v) => sql`${i} = ${v}`; @@ -3054,55 +2979,55 @@ 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 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) { - 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."), {}); +function assertAllowed22(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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 PgAggregateConditionExpressionStep = class PgAggregateConditionExpressionStep extends ModifierStep { - constructor($parent, spec, pgWhereConditionSpecListToSQL) { - super($parent); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +const PgAggregateConditionExpression = class PgAggregateConditionExpression extends Modifier { + spec; + pgWhereConditionSpecListToSQL; + alias; + conditions = []; + constructor(parent, spec, pgWhereConditionSpecListToSQL) { + super(parent); this.spec = spec; this.pgWhereConditionSpecListToSQL = pgWhereConditionSpecListToSQL; - this.conditions = []; - this.alias = $parent.alias; - } - placeholder($step, codec) { - return this.$parent.placeholder($step, codec); + this.alias = parent.alias; } where(condition) { this.conditions.push(condition); } apply() { const sqlCondition = this.pgWhereConditionSpecListToSQL(this.alias, this.conditions); - if (sqlCondition) this.$parent.expression(sqlCondition); + if (sqlCondition) this.parent.expression(sqlCondition); } }; -const PgAggregateConditionStep = class PgAggregateConditionStep extends ModifierStep { - constructor($parent, options, pgWhereConditionSpecListToSQL) { - super($parent); +const PgAggregateCondition = class PgAggregateCondition extends Modifier { + pgWhereConditionSpecListToSQL; + sql; + tableExpression; + alias; + conditions = []; + expressions = []; + constructor(parent, options, pgWhereConditionSpecListToSQL) { + super(parent); this.pgWhereConditionSpecListToSQL = pgWhereConditionSpecListToSQL; - this.conditions = []; - this.expressions = []; const { sql, tableExpression, alias } = options; this.sql = sql; - this.alias = sql.identifier(Symbol(alias !== null && alias !== void 0 ? alias : "aggregate")); + this.alias = sql.identifier(Symbol(alias ?? "aggregate")); this.tableExpression = tableExpression; } - placeholder($step, codec) { - return this.$parent.placeholder($step, codec); - } where(condition) { this.conditions.push(condition); } @@ -3110,7 +3035,7 @@ const PgAggregateConditionStep = class PgAggregateConditionStep extends Modifier this.expressions.push(expression); } forAggregate(spec) { - return new PgAggregateConditionExpressionStep(this, spec, this.pgWhereConditionSpecListToSQL); + return new PgAggregateConditionExpression(this, spec, this.pgWhereConditionSpecListToSQL); } apply() { const { @@ -3126,7 +3051,7 @@ select ${boolExpr} from ${this.tableExpression} as ${this.alias} ${where}`} group by ())`; - return this.$parent.where(subquery); + return this.parent.where(subquery); } }; const colSpec9 = { @@ -3174,53 +3099,49 @@ const colSpec17 = { attributeName: "status_updated_at", attribute: spec_post.attributes.status_updated_at }; -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) { - 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."), {}); +function assertAllowed23(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed24(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed25(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed26(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } const colSpec18 = { fieldName: "rowId", @@ -3247,29 +3168,27 @@ const colSpec22 = { attributeName: "updated_at", attribute: spec_upvote.attributes.updated_at }; -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) { - 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."), {}); +function assertAllowed27(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed28(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } const colSpec23 = { fieldName: "rowId", @@ -3311,43 +3230,34 @@ const colSpec30 = { attributeName: "email", attribute: spec_user.attributes.email }; -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) { - 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 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) { - 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."), {}); +const colSpec31 = { + fieldName: "tier", + attributeName: "tier", + attribute: spec_user.attributes.tier +}; +function assertAllowed29(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed30(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -const resolve50 = (i, _v, $input) => sql`${i} ${$input.eval() ? sql`IS NULL` : sql`IS NOT NULL`}`; +const resolve50 = (i, _v, input) => sql`${i} ${input ? sql`IS NULL` : sql`IS NOT NULL`}`; const resolveInputCodec21 = () => TYPES.boolean; const resolveSqlValue14 = () => sql.null; const resolve51 = (i, v) => sql`${i} = ${v}`; @@ -3397,115 +3307,172 @@ 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 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) { - 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."), {}); +function assertAllowed31(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +const resolve61 = (i, _v, input) => sql`${i} ${input ? sql`IS NULL` : sql`IS NOT NULL`}`; +const resolveInputCodec24 = () => TYPES.boolean; +const resolveSqlValue15 = () => sql.null; +const resolve62 = (i, v) => sql`${i} = ${v}`; +const forceTextTypesSensitive5 = [TYPES.citext, TYPES.char, TYPES.bpchar]; +function resolveDomains5(c) { + let current = c; + while (current.domainOfCodec) current = current.domainOfCodec; + return current; +} +function resolveInputCodec25(c) { + if (c.arrayOfCodec) { + if (forceTextTypesSensitive5.includes(resolveDomains5(c.arrayOfCodec))) return listOfCodec(TYPES.text, { + extensions: { + listItemNonNull: c.extensions?.listItemNonNull + } + }); + return c; + } else { + if (forceTextTypesSensitive5.includes(resolveDomains5(c))) return TYPES.text; + return c; + } +} +function resolveSqlIdentifier16(identifier, c) { + if (c.arrayOfCodec && forceTextTypesSensitive5.includes(resolveDomains5(c.arrayOfCodec))) return [sql`(${identifier})::text[]`, listOfCodec(TYPES.text, { + extensions: { + listItemNonNull: c.extensions?.listItemNonNull + } + })];else if (forceTextTypesSensitive5.includes(resolveDomains5(c))) return [sql`(${identifier})::text`, TYPES.text];else return [identifier, c]; +} +const resolve63 = (i, v) => sql`${i} <> ${v}`; +const resolve64 = (i, v) => sql`${i} IS DISTINCT FROM ${v}`; +const resolve65 = (i, v) => sql`${i} IS NOT DISTINCT FROM ${v}`; +const resolve66 = (i, v) => sql`${i} = ANY(${v})`; +function resolveInputCodec26(c) { + if (forceTextTypesSensitive5.includes(resolveDomains5(c))) return listOfCodec(TYPES.text, { + extensions: { + listItemNonNull: !0 + } + });else return listOfCodec(c, { + extensions: { + listItemNonNull: !0 + } + }); +} +const resolve67 = (i, v) => sql`${i} <> ALL(${v})`; +const resolve68 = (i, v) => sql`${i} < ${v}`; +const resolve69 = (i, v) => sql`${i} <= ${v}`; +const resolve70 = (i, v) => sql`${i} > ${v}`; +const resolve71 = (i, v) => sql`${i} >= ${v}`; +function assertAllowed32(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed33(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -const colSpec31 = { +const colSpec32 = { fieldName: "userId", attributeName: "user_id", attribute: spec_member.attributes.user_id }; -const colSpec32 = { +const colSpec33 = { fieldName: "organizationId", attributeName: "organization_id", attribute: spec_member.attributes.organization_id }; -const colSpec33 = { +const colSpec34 = { fieldName: "createdAt", attributeName: "created_at", attribute: spec_member.attributes.created_at }; -const colSpec34 = { +const colSpec35 = { fieldName: "role", attributeName: "role", attribute: spec_member.attributes.role }; -const colSpec35 = { +const colSpec36 = { fieldName: "rowId", attributeName: "id", attribute: spec_member.attributes.id }; -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) { - 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."), {}); +function assertAllowed34(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed35(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -const resolve61 = (i, _v, $input) => sql`${i} ${$input.eval() ? sql`IS NULL` : sql`IS NOT NULL`}`; -const resolveInputCodec24 = () => TYPES.boolean; -const resolveSqlValue15 = () => sql.null; -const resolve62 = (i, v) => sql`${i} = ${v}`; -const forceTextTypesSensitive5 = [TYPES.citext, TYPES.char, TYPES.bpchar]; -function resolveDomains5(c) { +const resolve72 = (i, _v, input) => sql`${i} ${input ? sql`IS NULL` : sql`IS NOT NULL`}`; +const resolveInputCodec27 = () => TYPES.boolean; +const resolveSqlValue16 = () => sql.null; +const resolve73 = (i, v) => sql`${i} = ${v}`; +const forceTextTypesSensitive6 = [TYPES.citext, TYPES.char, TYPES.bpchar]; +function resolveDomains6(c) { let current = c; while (current.domainOfCodec) current = current.domainOfCodec; return current; } -function resolveInputCodec25(c) { +function resolveInputCodec28(c) { if (c.arrayOfCodec) { - if (forceTextTypesSensitive5.includes(resolveDomains5(c.arrayOfCodec))) return listOfCodec(TYPES.text, { + if (forceTextTypesSensitive6.includes(resolveDomains6(c.arrayOfCodec))) return listOfCodec(TYPES.text, { extensions: { listItemNonNull: c.extensions?.listItemNonNull } }); return c; } else { - if (forceTextTypesSensitive5.includes(resolveDomains5(c))) return TYPES.text; + if (forceTextTypesSensitive6.includes(resolveDomains6(c))) return TYPES.text; return c; } } -function resolveSqlIdentifier16(identifier, c) { - if (c.arrayOfCodec && forceTextTypesSensitive5.includes(resolveDomains5(c.arrayOfCodec))) return [sql`(${identifier})::text[]`, listOfCodec(TYPES.text, { +function resolveSqlIdentifier17(identifier, c) { + if (c.arrayOfCodec && forceTextTypesSensitive6.includes(resolveDomains6(c.arrayOfCodec))) return [sql`(${identifier})::text[]`, listOfCodec(TYPES.text, { extensions: { listItemNonNull: c.extensions?.listItemNonNull } - })];else if (forceTextTypesSensitive5.includes(resolveDomains5(c))) return [sql`(${identifier})::text`, TYPES.text];else return [identifier, c]; + })];else if (forceTextTypesSensitive6.includes(resolveDomains6(c))) return [sql`(${identifier})::text`, TYPES.text];else return [identifier, c]; } -const resolve63 = (i, v) => sql`${i} <> ${v}`; -const resolve64 = (i, v) => sql`${i} IS DISTINCT FROM ${v}`; -const resolve65 = (i, v) => sql`${i} IS NOT DISTINCT FROM ${v}`; -const resolve66 = (i, v) => sql`${i} = ANY(${v})`; -function resolveInputCodec26(c) { - if (forceTextTypesSensitive5.includes(resolveDomains5(c))) return listOfCodec(TYPES.text, { +const resolve74 = (i, v) => sql`${i} <> ${v}`; +const resolve75 = (i, v) => sql`${i} IS DISTINCT FROM ${v}`; +const resolve76 = (i, v) => sql`${i} IS NOT DISTINCT FROM ${v}`; +const resolve77 = (i, v) => sql`${i} = ANY(${v})`; +function resolveInputCodec29(c) { + if (forceTextTypesSensitive6.includes(resolveDomains6(c))) return listOfCodec(TYPES.text, { extensions: { listItemNonNull: !0 } @@ -3515,408 +3482,390 @@ function resolveInputCodec26(c) { } }); } -const resolve67 = (i, v) => sql`${i} <> ALL(${v})`; -const resolve68 = (i, v) => sql`${i} < ${v}`; -const resolve69 = (i, v) => sql`${i} <= ${v}`; -const resolve70 = (i, v) => sql`${i} > ${v}`; -const resolve71 = (i, v) => sql`${i} >= ${v}`; -const colSpec36 = { +const resolve78 = (i, v) => sql`${i} <> ALL(${v})`; +const resolve79 = (i, v) => sql`${i} < ${v}`; +const resolve80 = (i, v) => sql`${i} <= ${v}`; +const resolve81 = (i, v) => sql`${i} > ${v}`; +const resolve82 = (i, v) => sql`${i} >= ${v}`; +const colSpec37 = { fieldName: "rowId", attributeName: "id", attribute: spec_organization.attributes.id }; -const colSpec37 = { +const colSpec38 = { fieldName: "name", attributeName: "name", attribute: spec_organization.attributes.name }; -const colSpec38 = { +const colSpec39 = { fieldName: "slug", attributeName: "slug", attribute: spec_organization.attributes.slug }; -const colSpec39 = { +const colSpec40 = { fieldName: "createdAt", attributeName: "created_at", attribute: spec_organization.attributes.created_at }; -const colSpec40 = { +const colSpec41 = { fieldName: "updatedAt", attributeName: "updated_at", attribute: spec_organization.attributes.updated_at }; -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) { - 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."), {}); +function assertAllowed36(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed37(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed38(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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) { - 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."), {}); +function assertAllowed39(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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."), {}); +function assertAllowed40(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -const colSpec41 = { +const colSpec42 = { fieldName: "rowId", attributeName: "id", attribute: spec_invitation.attributes.id }; -const colSpec42 = { +const colSpec43 = { fieldName: "organizationId", attributeName: "organization_id", attribute: spec_invitation.attributes.organization_id }; -const colSpec43 = { +const colSpec44 = { fieldName: "email", attributeName: "email", attribute: spec_invitation.attributes.email }; -const colSpec44 = { +const colSpec45 = { fieldName: "createdAt", attributeName: "created_at", attribute: spec_invitation.attributes.created_at }; -const colSpec45 = { +const colSpec46 = { fieldName: "updatedAt", attributeName: "updated_at", attribute: spec_invitation.attributes.updated_at }; -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."), {}); +function assertAllowed41(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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."), {}); +function assertAllowed42(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === 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."), {}); +function assertAllowed43(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -const colSpec46 = { +const colSpec47 = { fieldName: "rowId", attributeName: "id", attribute: spec_comment.attributes.id }; -const colSpec47 = { +const colSpec48 = { fieldName: "message", attributeName: "message", attribute: spec_comment.attributes.message }; -const colSpec48 = { +const colSpec49 = { fieldName: "postId", attributeName: "post_id", attribute: spec_comment.attributes.post_id }; -const colSpec49 = { +const colSpec50 = { fieldName: "userId", attributeName: "user_id", attribute: spec_comment.attributes.user_id }; -const colSpec50 = { +const colSpec51 = { fieldName: "createdAt", attributeName: "created_at", attribute: spec_comment.attributes.created_at }; -const colSpec51 = { +const colSpec52 = { fieldName: "updatedAt", attributeName: "updated_at", attribute: spec_comment.attributes.updated_at }; -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."), {}); +function assertAllowed44(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -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."), {}); +function assertAllowed45(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === 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."), {}); +function assertAllowed46(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -const colSpec52 = { +const colSpec53 = { fieldName: "rowId", attributeName: "id", attribute: spec_downvote.attributes.id }; -const colSpec53 = { +const colSpec54 = { fieldName: "postId", attributeName: "post_id", attribute: spec_downvote.attributes.post_id }; -const colSpec54 = { +const colSpec55 = { fieldName: "userId", attributeName: "user_id", attribute: spec_downvote.attributes.user_id }; -const colSpec55 = { +const colSpec56 = { fieldName: "createdAt", attributeName: "created_at", attribute: spec_downvote.attributes.created_at }; -const colSpec56 = { +const colSpec57 = { fieldName: "updatedAt", attributeName: "updated_at", attribute: spec_downvote.attributes.updated_at }; -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."), {}); +function assertAllowed47(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === 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) { - 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."), {}); +function assertAllowed48(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed49(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."), {}); +function assertAllowed49(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed50(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."), {}); +function assertAllowed50(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -const colSpec57 = { +const colSpec58 = { fieldName: "rowId", attributeName: "id", attribute: spec_postStatus.attributes.id }; -const colSpec58 = { +const colSpec59 = { fieldName: "status", attributeName: "status", attribute: spec_postStatus.attributes.status }; -const colSpec59 = { +const colSpec60 = { fieldName: "description", attributeName: "description", attribute: spec_postStatus.attributes.description }; -const colSpec60 = { +const colSpec61 = { fieldName: "color", attributeName: "color", attribute: spec_postStatus.attributes.color }; -const colSpec61 = { +const colSpec62 = { fieldName: "projectId", attributeName: "project_id", attribute: spec_postStatus.attributes.project_id }; -const colSpec62 = { +const colSpec63 = { fieldName: "isDefault", attributeName: "is_default", attribute: spec_postStatus.attributes.is_default }; -const colSpec63 = { +const colSpec64 = { fieldName: "createdAt", attributeName: "created_at", attribute: spec_postStatus.attributes.created_at }; -const colSpec64 = { +const colSpec65 = { fieldName: "updatedAt", attributeName: "updated_at", attribute: spec_postStatus.attributes.updated_at }; -function assertAllowed51(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."), {}); +function assertAllowed51(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed52(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."), {}); +function assertAllowed52(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed53(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."), {}); +function assertAllowed53(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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 resolve72 = (i, _v, $input) => sql`${i} ${$input.eval() ? sql`IS NULL` : sql`IS NOT NULL`}`; -const resolveInputCodec27 = () => TYPES.boolean; -const resolveSqlValue16 = () => sql.null; -const resolve73 = (i, v) => sql`${i} = ${v}`; -const forceTextTypesSensitive6 = [TYPES.citext, TYPES.char, TYPES.bpchar]; -function resolveDomains6(c) { + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); +} +const resolve83 = (i, _v, input) => sql`${i} ${input ? sql`IS NULL` : sql`IS NOT NULL`}`; +const resolveInputCodec30 = () => TYPES.boolean; +const resolveSqlValue17 = () => sql.null; +const resolve84 = (i, v) => sql`${i} = ${v}`; +const forceTextTypesSensitive7 = [TYPES.citext, TYPES.char, TYPES.bpchar]; +function resolveDomains7(c) { let current = c; while (current.domainOfCodec) current = current.domainOfCodec; return current; } -function resolveInputCodec28(c) { +function resolveInputCodec31(c) { if (c.arrayOfCodec) { - if (forceTextTypesSensitive6.includes(resolveDomains6(c.arrayOfCodec))) return listOfCodec(TYPES.text, { + if (forceTextTypesSensitive7.includes(resolveDomains7(c.arrayOfCodec))) return listOfCodec(TYPES.text, { extensions: { listItemNonNull: c.extensions?.listItemNonNull } }); return c; } else { - if (forceTextTypesSensitive6.includes(resolveDomains6(c))) return TYPES.text; + if (forceTextTypesSensitive7.includes(resolveDomains7(c))) return TYPES.text; return c; } } -function resolveSqlIdentifier17(identifier, c) { - if (c.arrayOfCodec && forceTextTypesSensitive6.includes(resolveDomains6(c.arrayOfCodec))) return [sql`(${identifier})::text[]`, listOfCodec(TYPES.text, { +function resolveSqlIdentifier18(identifier, c) { + if (c.arrayOfCodec && forceTextTypesSensitive7.includes(resolveDomains7(c.arrayOfCodec))) return [sql`(${identifier})::text[]`, listOfCodec(TYPES.text, { extensions: { listItemNonNull: c.extensions?.listItemNonNull } - })];else if (forceTextTypesSensitive6.includes(resolveDomains6(c))) return [sql`(${identifier})::text`, TYPES.text];else return [identifier, c]; + })];else if (forceTextTypesSensitive7.includes(resolveDomains7(c))) return [sql`(${identifier})::text`, TYPES.text];else return [identifier, c]; } -const resolve74 = (i, v) => sql`${i} <> ${v}`; -const resolve75 = (i, v) => sql`${i} IS DISTINCT FROM ${v}`; -const resolve76 = (i, v) => sql`${i} IS NOT DISTINCT FROM ${v}`; -const resolve77 = (i, v) => sql`${i} = ANY(${v})`; -function resolveInputCodec29(c) { - if (forceTextTypesSensitive6.includes(resolveDomains6(c))) return listOfCodec(TYPES.text, { +const resolve85 = (i, v) => sql`${i} <> ${v}`; +const resolve86 = (i, v) => sql`${i} IS DISTINCT FROM ${v}`; +const resolve87 = (i, v) => sql`${i} IS NOT DISTINCT FROM ${v}`; +const resolve88 = (i, v) => sql`${i} = ANY(${v})`; +function resolveInputCodec32(c) { + if (forceTextTypesSensitive7.includes(resolveDomains7(c))) return listOfCodec(TYPES.text, { extensions: { listItemNonNull: !0 } @@ -3926,1206 +3875,384 @@ function resolveInputCodec29(c) { } }); } -const resolve78 = (i, v) => sql`${i} <> ALL(${v})`; -const resolve79 = (i, v) => sql`${i} < ${v}`; -const resolve80 = (i, v) => sql`${i} <= ${v}`; -const resolve81 = (i, v) => sql`${i} > ${v}`; -const resolve82 = (i, v) => sql`${i} >= ${v}`; -function assertAllowed54(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."), {}); +const resolve89 = (i, v) => sql`${i} <> ALL(${v})`; +const resolve90 = (i, v) => sql`${i} < ${v}`; +const resolve91 = (i, v) => sql`${i} <= ${v}`; +const resolve92 = (i, v) => sql`${i} > ${v}`; +const resolve93 = (i, v) => sql`${i} >= ${v}`; +function assertAllowed54(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed55(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."), {}); +function assertAllowed55(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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 MemberGroupBy_extensions_grafast_applyPlan($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}` - }); -} -function MemberGroupBy_extensions_grafast_applyPlan2($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("organization_id")}` - }); -} -function MemberGroupBy_extensions_grafast_applyPlan3($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` - }); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function MemberGroupBy_extensions_grafast_applyPlan4($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function MemberGroupBy_extensions_grafast_applyPlan5($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function MemberGroupBy_extensions_grafast_applyPlan6($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("role")}` - }); -} -export const MemberGroupBy = new GraphQLEnumType({ - name: "MemberGroupBy", - description: "Grouping methods for `Member` for usage during aggregation.", - values: Object.assign(Object.create(null), { - USER_ID: { - value: "USER_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan - } - }) - }, - ORGANIZATION_ID: { - value: "ORGANIZATION_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan2 - } - }) - }, - CREATED_AT: { - value: "CREATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan3 - } - }) - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - value: "CREATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan4 - } - }) - }, - CREATED_AT_TRUNCATED_TO_DAY: { - value: "CREATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan5 - } - }) - }, - ROLE: { - value: "ROLE", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan6 - } - }) - } - }) -}); -function assertAllowed56(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."), {}); +const relation = registry.pgRelations["project"]["postsByTheirProjectId"]; +const relation2 = registry.pgRelations["project"]["postStatusesByTheirProjectId"]; +function assertAllowed56(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed57(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."), {}); +function assertAllowed57(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed58(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."), {}); +function assertAllowed58(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed59(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."), {}); +function assertAllowed59(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function assertAllowed60(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."), {}); +function assertAllowed60(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) 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 PostGroupBy_extensions_grafast_applyPlan($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("title")}` - }); -} -function PostGroupBy_extensions_grafast_applyPlan2($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("description")}` - }); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function PostGroupBy_extensions_grafast_applyPlan3($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("project_id")}` - }); +const relation3 = registry.pgRelations["post"]["upvotesByTheirPostId"]; +const relation4 = registry.pgRelations["post"]["commentsByTheirPostId"]; +const relation5 = registry.pgRelations["post"]["downvotesByTheirPostId"]; +function assertAllowed61(value, mode) { + if (mode === "object" && !true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (mode === "list" && !true) { + const arr = value; + if (arr) { + const l = arr.length; + for (let i = 0; i < l; i++) if (isEmpty(arr[i])) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + } + } + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); } -function PostGroupBy_extensions_grafast_applyPlan4($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}` - }); -} -function PostGroupBy_extensions_grafast_applyPlan5($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` - }); -} -function PostGroupBy_extensions_grafast_applyPlan6($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function PostGroupBy_extensions_grafast_applyPlan7($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function PostGroupBy_extensions_grafast_applyPlan8($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` - }); -} -function PostGroupBy_extensions_grafast_applyPlan9($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -function PostGroupBy_extensions_grafast_applyPlan10($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) +const relation6 = registry.pgRelations["postStatus"]["postsByTheirStatusId"]; +const relation7 = registry.pgRelations["organization"]["projectsByTheirOrganizationId"]; +const relation8 = registry.pgRelations["organization"]["membersByTheirOrganizationId"]; +const relation9 = registry.pgRelations["organization"]["invitationsByTheirOrganizationId"]; +const relation10 = registry.pgRelations["user"]["postsByTheirUserId"]; +const relation11 = registry.pgRelations["user"]["upvotesByTheirUserId"]; +const relation12 = registry.pgRelations["user"]["membersByTheirUserId"]; +const relation13 = registry.pgRelations["user"]["commentsByTheirUserId"]; +const relation14 = registry.pgRelations["user"]["downvotesByTheirUserId"]; +function oldPlan(_, args) { + const $insert = pgInsertSingle(resource_organizationPgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert }); } -function PostGroupBy_extensions_grafast_applyPlan11($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("status_id")}` +const planWrapper = (plan, _, fieldArgs) => { + const $organization = fieldArgs.getRaw(["input", "organization"]), + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$organization, $currentUser, $db], async ([organization, currentUser, db]) => { + if (!currentUser?.tier) throw new Error("Unauthorized"); + const { + members + } = lib_drizzle_schema; + if ("create" === "create") { + if (currentUser.tier === "basic") { + if ((await db.select().from(members).where(and(eq(members.userId, currentUser.id), eq(members.role, "owner")))).length > 0) throw new Error("Maximum number of organizations reached."); + } + } else { + const [userRole] = await db.select({ + role: members.role + }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organization))); + if ("create" === "delete" && userRole.role !== "owner") throw new Error("Insufficient permissions"); + if ("create" === "update" && (!userRole || userRole.role === "member")) throw new Error("Insufficient permissions"); + } }); -} -function PostGroupBy_extensions_grafast_applyPlan12($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("status_updated_at")}` + return plan(); +}; +function oldPlan2(_, args) { + const $insert = pgInsertSingle(resource_projectPgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert }); } -function PostGroupBy_extensions_grafast_applyPlan13($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("status_updated_at")}`) +const planWrapper2 = (plan, _, fieldArgs) => { + const $project = fieldArgs.getRaw(["input", "project"]), + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$project, $currentUser, $db], async ([project, currentUser, db]) => { + if (!currentUser?.tier) throw new Error("Unauthorized"); + let organizationId; + const { + members, + projects + } = lib_drizzle_schema; + if ("create" === "create") organizationId = project.organizationId;else { + const [currentProject] = await db.select().from(projects).where(eq(projects.id, project)); + organizationId = currentProject.organizationId; + } + const [userRole] = await db.select({ + role: members.role + }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organizationId))); + if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); + if ("create" === "create" && currentUser.tier === "basic") { + if ((await db.select().from(projects).where(eq(projects.organizationId, organizationId))).length >= 3) throw new Error("Maximum number of projects reached."); + } }); -} -function PostGroupBy_extensions_grafast_applyPlan14($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("status_updated_at")}`) + return plan(); +}; +function oldPlan3(_, args) { + const $insert = pgInsertSingle(resource_memberPgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert }); } -export const PostGroupBy = new GraphQLEnumType({ - name: "PostGroupBy", - description: "Grouping methods for `Post` for usage during aggregation.", - values: Object.assign(Object.create(null), { - TITLE: { - value: "TITLE", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan - } - }) - }, - DESCRIPTION: { - value: "DESCRIPTION", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan2 - } - }) - }, - PROJECT_ID: { - value: "PROJECT_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan3 - } - }) - }, - USER_ID: { - value: "USER_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan4 - } - }) - }, - CREATED_AT: { - value: "CREATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan5 - } - }) - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - value: "CREATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan6 - } - }) - }, - CREATED_AT_TRUNCATED_TO_DAY: { - value: "CREATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan7 - } - }) - }, - UPDATED_AT: { - value: "UPDATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan8 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - value: "UPDATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan9 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_DAY: { - value: "UPDATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan10 - } - }) - }, - STATUS_ID: { - value: "STATUS_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan11 - } - }) - }, - STATUS_UPDATED_AT: { - value: "STATUS_UPDATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan12 - } - }) - }, - STATUS_UPDATED_AT_TRUNCATED_TO_HOUR: { - value: "STATUS_UPDATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan13 - } - }) - }, - STATUS_UPDATED_AT_TRUNCATED_TO_DAY: { - value: "STATUS_UPDATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan14 - } - }) +const planWrapper3 = (plan, _, fieldArgs) => { + const $input = fieldArgs.getRaw(["input", "member"]), + $patch = "create" === "update" ? fieldArgs.getRaw(["input", "patch"]) : $input, + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$input, $patch, $currentUser, $db], async ([input, patch, currentUser, db]) => { + if (!currentUser) throw new Error("Unauthorized"); + const { + members + } = lib_drizzle_schema; + if ("create" === "create") { + const { + role, + userId, + organizationId + } = input, + organizationUsers = await db.select().from(members).where(eq(members.organizationId, organizationId)); + if (organizationUsers.length) { + const userRole = organizationUsers.find(user => user.userId === currentUser.id)?.role; + if (!userRole) { + if (userId !== currentUser.id || role !== "member") throw new Error("Insufficient permissions"); + } else if (userRole !== "owner") throw new Error("Insufficient permissions"); + } + } else { + const [member] = await db.select().from(members).where(eq(members.id, input)); + if (currentUser.id !== member.userId) { + const [userRole] = await db.select({ + role: members.role + }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, member.organizationId))); + if (userRole.role !== "owner") throw new Error("Insufficient permissions"); + if (patch.role === "owner") throw new Error("Organizations can only have one owner"); + } else throw new Error("Insufficient permissions"); } - }) -}); -const relation3 = registry.pgRelations["post"]["upvotesByTheirPostId"]; -const relation4 = registry.pgRelations["post"]["commentsByTheirPostId"]; -const relation5 = registry.pgRelations["post"]["downvotesByTheirPostId"]; -function UpvoteGroupBy_extensions_grafast_applyPlan($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("post_id")}` }); -} -function UpvoteGroupBy_extensions_grafast_applyPlan2($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}` + return plan(); +}; +function oldPlan4(_, args) { + const $insert = pgInsertSingle(resource_post_statusPgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert }); } -function UpvoteGroupBy_extensions_grafast_applyPlan3($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` +const planWrapper4 = (plan, _, fieldArgs) => { + const $postStatus = fieldArgs.getRaw(["input", "postStatus"]), + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$postStatus, $currentUser, $db], async ([postStatus, currentUser, db]) => { + if (!currentUser) throw new Error("Unauthorized"); + const { + members, + projects, + postStatuses + } = lib_drizzle_schema; + let projectId; + if ("create" === "create") projectId = postStatus.projectId;else { + const [currentPostStatus] = await db.select().from(postStatuses).where(eq(postStatuses.id, postStatus)); + projectId = currentPostStatus.projectId; + } + const [project] = await db.select({ + organizationId: projects.organizationId + }).from(projects).where(eq(projects.id, projectId)), + [userRole] = await db.select({ + role: members.role + }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, project.organizationId))); + if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); }); -} -function UpvoteGroupBy_extensions_grafast_applyPlan4($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + return plan(); +}; +const oldPlan5 = (_$root, args) => { + const $update = pgUpdateSingle(resource_downvotePgResource, { + id: args.getRaw(['input', "rowId"]) }); -} -function UpvoteGroupBy_extensions_grafast_applyPlan5($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + args.apply($update); + return object({ + result: $update }); -} -function UpvoteGroupBy_extensions_grafast_applyPlan6($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` +}; +const planWrapper5 = (plan, _, fieldArgs) => { + const $downvoteId = fieldArgs.getRaw(["input", "rowId"]), + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$downvoteId, $currentUser, $db], async ([downvoteId, currentUser, db]) => { + if (!currentUser) throw new Error("Unauthorized"); + const { + downvotes + } = lib_drizzle_schema, + [downvote] = await db.select().from(downvotes).where(eq(downvotes.id, downvoteId)); + if (currentUser.id !== downvote.userId) throw new Error("Insufficient permissions"); }); -} -function UpvoteGroupBy_extensions_grafast_applyPlan7($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + return plan(); +}; +const oldPlan6 = (_$root, args) => { + const $update = pgUpdateSingle(resource_upvotePgResource, { + id: args.getRaw(['input', "rowId"]) }); -} -function UpvoteGroupBy_extensions_grafast_applyPlan8($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + args.apply($update); + return object({ + result: $update }); -} -export const UpvoteGroupBy = new GraphQLEnumType({ - name: "UpvoteGroupBy", - description: "Grouping methods for `Upvote` for usage during aggregation.", - values: Object.assign(Object.create(null), { - POST_ID: { - value: "POST_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan - } - }) - }, - USER_ID: { - value: "USER_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan2 - } - }) - }, - CREATED_AT: { - value: "CREATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan3 - } - }) - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - value: "CREATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan4 - } - }) - }, - CREATED_AT_TRUNCATED_TO_DAY: { - value: "CREATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan5 - } - }) - }, - UPDATED_AT: { - value: "UPDATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan6 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - value: "UPDATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan7 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_DAY: { - value: "UPDATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan8 - } - }) - } - }) -}); -function CommentGroupBy_extensions_grafast_applyPlan($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("message")}` +}; +const planWrapper6 = (plan, _, fieldArgs) => { + const $upvoteId = fieldArgs.getRaw(["input", "rowId"]), + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$upvoteId, $currentUser, $db], async ([upvoteId, currentUser, db]) => { + if (!currentUser) throw new Error("Unauthorized"); + const { + upvotes + } = lib_drizzle_schema, + [upvote] = await db.select().from(upvotes).where(eq(upvotes.id, upvoteId)); + if (currentUser.id !== upvote.userId) throw new Error("Insufficient permissions"); }); -} -function CommentGroupBy_extensions_grafast_applyPlan2($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("post_id")}` + return plan(); +}; +const oldPlan7 = (_$root, args) => { + const $update = pgUpdateSingle(resource_organizationPgResource, { + id: args.getRaw(['input', "rowId"]) }); -} -function CommentGroupBy_extensions_grafast_applyPlan3($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}` + args.apply($update); + return object({ + result: $update }); -} -function CommentGroupBy_extensions_grafast_applyPlan4($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` +}; +const planWrapper7 = (plan, _, fieldArgs) => { + const $organization = fieldArgs.getRaw(["input", "rowId"]), + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$organization, $currentUser, $db], async ([organization, currentUser, db]) => { + if (!currentUser?.tier) throw new Error("Unauthorized"); + const { + members + } = lib_drizzle_schema; + if ("update" === "create") { + if (currentUser.tier === "basic") { + if ((await db.select().from(members).where(and(eq(members.userId, currentUser.id), eq(members.role, "owner")))).length > 0) throw new Error("Maximum number of organizations reached."); + } + } else { + const [userRole] = await db.select({ + role: members.role + }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organization))); + if ("update" === "delete" && userRole.role !== "owner") throw new Error("Insufficient permissions"); + if ("update" === "update" && (!userRole || userRole.role === "member")) throw new Error("Insufficient permissions"); + } }); -} -function CommentGroupBy_extensions_grafast_applyPlan5($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + return plan(); +}; +const oldPlan8 = (_$root, args) => { + const $update = pgUpdateSingle(resource_commentPgResource, { + id: args.getRaw(['input', "rowId"]) }); -} -function CommentGroupBy_extensions_grafast_applyPlan6($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) + args.apply($update); + return object({ + result: $update }); -} -function CommentGroupBy_extensions_grafast_applyPlan7($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` +}; +const planWrapper8 = (plan, _, fieldArgs) => { + const $commentId = fieldArgs.getRaw(["input", "rowId"]), + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$commentId, $currentUser, $db], async ([commentId, currentUser, db]) => { + if (!currentUser) throw new Error("Unauthorized"); + const { + members, + projects, + posts, + comments + } = lib_drizzle_schema, + [comment] = await db.select({ + organizationId: projects.organizationId, + userId: posts.userId + }).from(comments).innerJoin(posts, eq(comments.postId, posts.id)).innerJoin(projects, eq(posts.projectId, projects.id)).where(eq(comments.id, commentId)); + if (currentUser.id !== comment.userId) { + const [userRole] = await db.select({ + role: members.role + }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, comment.organizationId))); + if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); + } }); -} -function CommentGroupBy_extensions_grafast_applyPlan8($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + return plan(); +}; +const oldPlan9 = (_$root, args) => { + const $update = pgUpdateSingle(resource_projectPgResource, { + id: args.getRaw(['input', "rowId"]) }); -} -function CommentGroupBy_extensions_grafast_applyPlan9($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) + args.apply($update); + return object({ + result: $update }); -} -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: CommentGroupBy_extensions_grafast_applyPlan4 - } - }) - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - value: "CREATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan5 - } - }) - }, - CREATED_AT_TRUNCATED_TO_DAY: { - value: "CREATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan6 - } - }) - }, - UPDATED_AT: { - value: "UPDATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan7 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - value: "UPDATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan8 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_DAY: { - value: "UPDATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan9 - } - }) - } - }) -}); -function DownvoteGroupBy_extensions_grafast_applyPlan($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("post_id")}` - }); -} -function DownvoteGroupBy_extensions_grafast_applyPlan2($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}` - }); -} -function DownvoteGroupBy_extensions_grafast_applyPlan3($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` - }); -} -function DownvoteGroupBy_extensions_grafast_applyPlan4($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function DownvoteGroupBy_extensions_grafast_applyPlan5($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function DownvoteGroupBy_extensions_grafast_applyPlan6($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` - }); -} -function DownvoteGroupBy_extensions_grafast_applyPlan7($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -function DownvoteGroupBy_extensions_grafast_applyPlan8($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -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: DownvoteGroupBy_extensions_grafast_applyPlan3 - } - }) - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - value: "CREATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan4 - } - }) - }, - CREATED_AT_TRUNCATED_TO_DAY: { - value: "CREATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan5 - } - }) - }, - UPDATED_AT: { - value: "UPDATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan6 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - value: "UPDATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan7 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_DAY: { - value: "UPDATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan8 - } - }) - } - }) -}); -function InvitationGroupBy_extensions_grafast_applyPlan($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("organization_id")}` - }); -} -function InvitationGroupBy_extensions_grafast_applyPlan2($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("email")}` - }); -} -function InvitationGroupBy_extensions_grafast_applyPlan3($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` - }); -} -function InvitationGroupBy_extensions_grafast_applyPlan4($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function InvitationGroupBy_extensions_grafast_applyPlan5($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function InvitationGroupBy_extensions_grafast_applyPlan6($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` - }); -} -function InvitationGroupBy_extensions_grafast_applyPlan7($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -function InvitationGroupBy_extensions_grafast_applyPlan8($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -export const InvitationGroupBy = new GraphQLEnumType({ - name: "InvitationGroupBy", - description: "Grouping methods for `Invitation` for usage during aggregation.", - values: Object.assign(Object.create(null), { - ORGANIZATION_ID: { - value: "ORGANIZATION_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan - } - }) - }, - EMAIL: { - value: "EMAIL", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan2 - } - }) - }, - CREATED_AT: { - value: "CREATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan3 - } - }) - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - value: "CREATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan4 - } - }) - }, - CREATED_AT_TRUNCATED_TO_DAY: { - value: "CREATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan5 - } - }) - }, - UPDATED_AT: { - value: "UPDATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan6 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - value: "UPDATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan7 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_DAY: { - value: "UPDATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan8 - } - }) - } - }) -}); -function PostStatusGroupBy_extensions_grafast_applyPlan($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("status")}` - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan2($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("description")}` - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan3($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("color")}` - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan4($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("project_id")}` - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan5($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("is_default")}` - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan6($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}` - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan7($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan8($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`) - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan9($pgSelect) { - $pgSelect.groupBy({ - fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}` - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan10($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -function PostStatusGroupBy_extensions_grafast_applyPlan11($pgSelect) { - $pgSelect.groupBy({ - fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`) - }); -} -export const PostStatusGroupBy = new GraphQLEnumType({ - name: "PostStatusGroupBy", - description: "Grouping methods for `PostStatus` for usage during aggregation.", - values: Object.assign(Object.create(null), { - STATUS: { - value: "STATUS", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan - } - }) - }, - DESCRIPTION: { - value: "DESCRIPTION", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan2 - } - }) - }, - COLOR: { - value: "COLOR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan3 - } - }) - }, - PROJECT_ID: { - value: "PROJECT_ID", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan4 - } - }) - }, - IS_DEFAULT: { - value: "IS_DEFAULT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan5 - } - }) - }, - CREATED_AT: { - value: "CREATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan6 - } - }) - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - value: "CREATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan7 - } - }) - }, - CREATED_AT_TRUNCATED_TO_DAY: { - value: "CREATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan8 - } - }) - }, - UPDATED_AT: { - value: "UPDATED_AT", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan9 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - value: "UPDATED_AT_TRUNCATED_TO_HOUR", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan10 - } - }) - }, - UPDATED_AT_TRUNCATED_TO_DAY: { - value: "UPDATED_AT_TRUNCATED_TO_DAY", - extensions: Object.assign(Object.create(null), { - grafast: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan11 - } - }) - } - }) -}); -function assertAllowed61(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 relation6 = registry.pgRelations["postStatus"]["postsByTheirStatusId"]; -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 relation7 = registry.pgRelations["organization"]["projectsByTheirOrganizationId"]; -const relation8 = registry.pgRelations["organization"]["membersByTheirOrganizationId"]; -const relation9 = registry.pgRelations["organization"]["invitationsByTheirOrganizationId"]; -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 - } - }) - } - }) -}); -const relation10 = registry.pgRelations["user"]["postsByTheirUserId"]; -const relation11 = registry.pgRelations["user"]["upvotesByTheirUserId"]; -const relation12 = registry.pgRelations["user"]["membersByTheirUserId"]; -const relation13 = registry.pgRelations["user"]["commentsByTheirUserId"]; -const relation14 = registry.pgRelations["user"]["downvotesByTheirUserId"]; -function oldPlan(_, args) { - const plan = object({ - result: pgInsertSingle(resource_projectPgResource, Object.create(null)) - }); - args.apply(plan); - return plan; -} -const planWrapper = (plan, _, fieldArgs) => { - const $project = fieldArgs.getRaw(["input", "project"]), +}; +const planWrapper9 = (plan, _, fieldArgs) => { + const $project = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); sideEffect([$project, $currentUser, $db], async ([project, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); + if (!currentUser?.tier) throw new Error("Unauthorized"); let organizationId; const { members, projects } = lib_drizzle_schema; - if ("create" === "create") organizationId = project.organizationId;else { + if ("update" === "create") organizationId = project.organizationId;else { const [currentProject] = await db.select().from(projects).where(eq(projects.id, project)); organizationId = currentProject.organizationId; } @@ -5133,26 +4260,32 @@ const planWrapper = (plan, _, fieldArgs) => { role: members.role }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organizationId))); if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); + if ("update" === "create" && currentUser.tier === "basic") { + if ((await db.select().from(projects).where(eq(projects.organizationId, organizationId))).length >= 3) throw new Error("Maximum number of projects reached."); + } }); return plan(); }; -function oldPlan2(_, args) { - const plan = object({ - result: pgInsertSingle(resource_memberPgResource, Object.create(null)) +const oldPlan10 = (_$root, args) => { + const $update = pgUpdateSingle(resource_memberPgResource, { + id: args.getRaw(['input', "rowId"]) }); - args.apply(plan); - return plan; -} -const planWrapper2 = (plan, _, fieldArgs) => { - const $input = fieldArgs.getRaw(["input", "member"]), + args.apply($update); + return object({ + result: $update + }); +}; +const planWrapper10 = (plan, _, fieldArgs) => { + const $input = fieldArgs.getRaw(["input", "rowId"]), + $patch = "update" === "update" ? fieldArgs.getRaw(["input", "patch"]) : $input, $currentUser = context().get("currentUser"), $db = context().get("db"); - sideEffect([$input, $currentUser, $db], async ([input, currentUser, db]) => { + sideEffect([$input, $patch, $currentUser, $db], async ([input, patch, currentUser, db]) => { if (!currentUser) throw new Error("Unauthorized"); const { members } = lib_drizzle_schema; - if ("create" === "create") { + if ("update" === "create") { const { role, userId, @@ -5172,20 +4305,56 @@ const planWrapper2 = (plan, _, fieldArgs) => { role: members.role }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, member.organizationId))); if (userRole.role !== "owner") throw new Error("Insufficient permissions"); - } else if ("create" === "update" && member.role !== "owner") throw new Error("Insufficient permissions"); + if (patch.role === "owner") throw new Error("Organizations can only have one owner"); + } else throw new Error("Insufficient permissions"); } }); return plan(); }; -function oldPlan3(_, args) { - const plan = object({ - result: pgInsertSingle(resource_post_statusPgResource, Object.create(null)) +const oldPlan11 = (_$root, args) => { + const $update = pgUpdateSingle(resource_postPgResource, { + id: args.getRaw(['input', "rowId"]) }); - args.apply(plan); - return plan; -} -const planWrapper3 = (plan, _, fieldArgs) => { - const $postStatus = fieldArgs.getRaw(["input", "postStatus"]), + args.apply($update); + return object({ + result: $update + }); +}; +const planWrapper11 = (plan, _, fieldArgs) => { + const $postId = fieldArgs.getRaw(["input", "rowId"]), + $currentUser = context().get("currentUser"), + $db = context().get("db"); + sideEffect([$postId, $currentUser, $db], async ([postId, currentUser, db]) => { + if (!currentUser) throw new Error("Unauthorized"); + const { + members, + projects, + posts + } = lib_drizzle_schema, + [post] = await db.select({ + organizationId: projects.organizationId, + userId: posts.userId + }).from(posts).innerJoin(projects, eq(posts.projectId, projects.id)).where(eq(posts.id, postId)); + if (currentUser.id !== post.userId) { + const [userRole] = await db.select({ + role: members.role + }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, post.organizationId))); + if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); + } + }); + return plan(); +}; +const oldPlan12 = (_$root, args) => { + const $update = pgUpdateSingle(resource_post_statusPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($update); + return object({ + result: $update + }); +}; +const planWrapper12 = (plan, _, fieldArgs) => { + const $postStatus = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); sideEffect([$postStatus, $currentUser, $db], async ([postStatus, currentUser, db]) => { @@ -5196,7 +4365,7 @@ const planWrapper3 = (plan, _, fieldArgs) => { postStatuses } = lib_drizzle_schema; let projectId; - if ("create" === "create") projectId = postStatus.projectId;else { + if ("update" === "create") projectId = postStatus.projectId;else { const [currentPostStatus] = await db.select().from(postStatuses).where(eq(postStatuses.id, postStatus)); projectId = currentPostStatus.projectId; } @@ -5210,16 +4379,34 @@ const planWrapper3 = (plan, _, fieldArgs) => { }); return plan(); }; -const oldPlan4 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_downvotePgResource, { - id: args.get(['input', "rowId"]) - }) +const oldPlan13 = (_$root, args) => { + const $update = pgUpdateSingle(resource_userPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($update); + return object({ + result: $update }); - args.apply(plan); - return plan; }; -const planWrapper4 = (plan, _, fieldArgs) => { +const planWrapper13 = (plan, _, fieldArgs) => { + const $userId = fieldArgs.getRaw(["input", "rowId"]), + $currentUser = context().get("currentUser"); + sideEffect([$userId, $currentUser], async ([userId, currentUser]) => { + if (!currentUser) throw new Error("Unauthorized"); + if (userId !== currentUser.id) throw new Error("Insufficient permissions"); + }); + return plan(); +}; +const oldPlan14 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_downvotePgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($delete); + return object({ + result: $delete + }); +}; +const planWrapper14 = (plan, _, fieldArgs) => { const $downvoteId = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); @@ -5233,16 +4420,16 @@ const planWrapper4 = (plan, _, fieldArgs) => { }); return plan(); }; -const oldPlan5 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_upvotePgResource, { - id: args.get(['input', "rowId"]) - }) +const oldPlan15 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_upvotePgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($delete); + return object({ + result: $delete }); - args.apply(plan); - return plan; }; -const planWrapper5 = (plan, _, fieldArgs) => { +const planWrapper15 = (plan, _, fieldArgs) => { const $upvoteId = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); @@ -5256,42 +4443,48 @@ const planWrapper5 = (plan, _, fieldArgs) => { }); return plan(); }; -const oldPlan6 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_organizationPgResource, { - id: args.get(['input', "rowId"]) - }) +const oldPlan16 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_organizationPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($delete); + return object({ + result: $delete }); - args.apply(plan); - return plan; }; -const planWrapper6 = (plan, _, fieldArgs) => { - const $organizationId = fieldArgs.getRaw(["input", "rowId"]), +const planWrapper16 = (plan, _, fieldArgs) => { + const $organization = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); - sideEffect([$organizationId, $currentUser, $db], async ([organizationId, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); + sideEffect([$organization, $currentUser, $db], async ([organization, currentUser, db]) => { + if (!currentUser?.tier) throw new Error("Unauthorized"); const { - members - } = lib_drizzle_schema, - [userRole] = await db.select({ + members + } = lib_drizzle_schema; + if ("delete" === "create") { + if (currentUser.tier === "basic") { + if ((await db.select().from(members).where(and(eq(members.userId, currentUser.id), eq(members.role, "owner")))).length > 0) throw new Error("Maximum number of organizations reached."); + } + } else { + const [userRole] = await db.select({ role: members.role - }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organizationId))); - if ("update" === "delete" && userRole.role !== "owner") throw new Error("Insufficient permissions"); - if ("update" === "update" && (!userRole || userRole.role === "member")) throw new Error("Insufficient permissions"); + }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organization))); + if ("delete" === "delete" && userRole.role !== "owner") throw new Error("Insufficient permissions"); + if ("delete" === "update" && (!userRole || userRole.role === "member")) throw new Error("Insufficient permissions"); + } }); return plan(); }; -const oldPlan7 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_commentPgResource, { - id: args.get(['input', "rowId"]) - }) +const oldPlan17 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_commentPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($delete); + return object({ + result: $delete }); - args.apply(plan); - return plan; }; -const planWrapper7 = (plan, _, fieldArgs) => { +const planWrapper17 = (plan, _, fieldArgs) => { const $commentId = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); @@ -5316,27 +4509,27 @@ const planWrapper7 = (plan, _, fieldArgs) => { }); return plan(); }; -const oldPlan8 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_projectPgResource, { - id: args.get(['input', "rowId"]) - }) +const oldPlan18 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_projectPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($delete); + return object({ + result: $delete }); - args.apply(plan); - return plan; }; -const planWrapper8 = (plan, _, fieldArgs) => { +const planWrapper18 = (plan, _, fieldArgs) => { const $project = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); sideEffect([$project, $currentUser, $db], async ([project, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); + if (!currentUser?.tier) throw new Error("Unauthorized"); let organizationId; const { members, projects } = lib_drizzle_schema; - if ("update" === "create") organizationId = project.organizationId;else { + if ("delete" === "create") organizationId = project.organizationId;else { const [currentProject] = await db.select().from(projects).where(eq(projects.id, project)); organizationId = currentProject.organizationId; } @@ -5344,46 +4537,32 @@ const planWrapper8 = (plan, _, fieldArgs) => { role: members.role }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organizationId))); if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); + if ("delete" === "create" && currentUser.tier === "basic") { + if ((await db.select().from(projects).where(eq(projects.organizationId, organizationId))).length >= 3) throw new Error("Maximum number of projects reached."); + } }); return plan(); }; -const oldPlan9 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_userPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper9 = (plan, _, fieldArgs) => { - const $userId = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"); - sideEffect([$userId, $currentUser], async ([userId, currentUser]) => { - if (!currentUser) throw new Error("Unauthorized"); - if (userId !== currentUser.id) throw new Error("Insufficient permissions"); +const oldPlan19 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_memberPgResource, { + id: args.getRaw(['input', "rowId"]) }); - return plan(); -}; -const oldPlan10 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_memberPgResource, { - id: args.get(['input', "rowId"]) - }) + args.apply($delete); + return object({ + result: $delete }); - args.apply(plan); - return plan; }; -const planWrapper10 = (plan, _, fieldArgs) => { +const planWrapper19 = (plan, _, fieldArgs) => { const $input = fieldArgs.getRaw(["input", "rowId"]), + $patch = "delete" === "update" ? fieldArgs.getRaw(["input", "patch"]) : $input, $currentUser = context().get("currentUser"), $db = context().get("db"); - sideEffect([$input, $currentUser, $db], async ([input, currentUser, db]) => { + sideEffect([$input, $patch, $currentUser, $db], async ([input, patch, currentUser, db]) => { if (!currentUser) throw new Error("Unauthorized"); const { members } = lib_drizzle_schema; - if ("update" === "create") { + if ("delete" === "create") { const { role, userId, @@ -5403,21 +4582,22 @@ const planWrapper10 = (plan, _, fieldArgs) => { role: members.role }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, member.organizationId))); if (userRole.role !== "owner") throw new Error("Insufficient permissions"); - } else if ("update" === "update" && member.role !== "owner") throw new Error("Insufficient permissions"); + if (patch.role === "owner") throw new Error("Organizations can only have one owner"); + } else throw new Error("Insufficient permissions"); } }); return plan(); }; -const oldPlan11 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_postPgResource, { - id: args.get(['input', "rowId"]) - }) +const oldPlan20 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_postPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($delete); + return object({ + result: $delete }); - args.apply(plan); - return plan; }; -const planWrapper11 = (plan, _, fieldArgs) => { +const planWrapper20 = (plan, _, fieldArgs) => { const $postId = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); @@ -5441,16 +4621,16 @@ const planWrapper11 = (plan, _, fieldArgs) => { }); return plan(); }; -const oldPlan12 = (_$root, args) => { - const plan = object({ - result: pgUpdateSingle(resource_post_statusPgResource, { - id: args.get(['input', "rowId"]) - }) +const oldPlan21 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_post_statusPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($delete); + return object({ + result: $delete }); - args.apply(plan); - return plan; }; -const planWrapper12 = (plan, _, fieldArgs) => { +const planWrapper21 = (plan, _, fieldArgs) => { const $postStatus = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"), $db = context().get("db"); @@ -5462,7 +4642,7 @@ const planWrapper12 = (plan, _, fieldArgs) => { postStatuses } = lib_drizzle_schema; let projectId; - if ("update" === "create") projectId = postStatus.projectId;else { + if ("delete" === "create") projectId = postStatus.projectId;else { const [currentPostStatus] = await db.select().from(postStatuses).where(eq(postStatuses.id, postStatus)); projectId = currentPostStatus.projectId; } @@ -5476,153 +4656,16 @@ const planWrapper12 = (plan, _, fieldArgs) => { }); return plan(); }; -const oldPlan13 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_downvotePgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper13 = (plan, _, fieldArgs) => { - const $downvoteId = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"), - $db = context().get("db"); - sideEffect([$downvoteId, $currentUser, $db], async ([downvoteId, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); - const { - downvotes - } = lib_drizzle_schema, - [downvote] = await db.select().from(downvotes).where(eq(downvotes.id, downvoteId)); - if (currentUser.id !== downvote.userId) throw new Error("Insufficient permissions"); - }); - return plan(); -}; -const oldPlan14 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_upvotePgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper14 = (plan, _, fieldArgs) => { - const $upvoteId = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"), - $db = context().get("db"); - sideEffect([$upvoteId, $currentUser, $db], async ([upvoteId, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); - const { - upvotes - } = lib_drizzle_schema, - [upvote] = await db.select().from(upvotes).where(eq(upvotes.id, upvoteId)); - if (currentUser.id !== upvote.userId) throw new Error("Insufficient permissions"); - }); - return plan(); -}; -const oldPlan15 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_organizationPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper15 = (plan, _, fieldArgs) => { - const $organizationId = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"), - $db = context().get("db"); - sideEffect([$organizationId, $currentUser, $db], async ([organizationId, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); - const { - members - } = lib_drizzle_schema, - [userRole] = await db.select({ - role: members.role - }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organizationId))); - if ("delete" === "delete" && userRole.role !== "owner") throw new Error("Insufficient permissions"); - if ("delete" === "update" && (!userRole || userRole.role === "member")) throw new Error("Insufficient permissions"); - }); - return plan(); -}; -const oldPlan16 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_commentPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper16 = (plan, _, fieldArgs) => { - const $commentId = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"), - $db = context().get("db"); - sideEffect([$commentId, $currentUser, $db], async ([commentId, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); - const { - members, - projects, - posts, - comments - } = lib_drizzle_schema, - [comment] = await db.select({ - organizationId: projects.organizationId, - userId: posts.userId - }).from(comments).innerJoin(posts, eq(comments.postId, posts.id)).innerJoin(projects, eq(posts.projectId, projects.id)).where(eq(comments.id, commentId)); - if (currentUser.id !== comment.userId) { - const [userRole] = await db.select({ - role: members.role - }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, comment.organizationId))); - if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); - } - }); - return plan(); -}; -const oldPlan17 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_projectPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper17 = (plan, _, fieldArgs) => { - const $project = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"), - $db = context().get("db"); - sideEffect([$project, $currentUser, $db], async ([project, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); - let organizationId; - const { - members, - projects - } = lib_drizzle_schema; - if ("delete" === "create") organizationId = project.organizationId;else { - const [currentProject] = await db.select().from(projects).where(eq(projects.id, project)); - organizationId = currentProject.organizationId; - } - const [userRole] = await db.select({ - role: members.role - }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, organizationId))); - if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); +const oldPlan22 = (_$root, args) => { + const $delete = pgDeleteSingle(resource_userPgResource, { + id: args.getRaw(['input', "rowId"]) }); - return plan(); -}; -const oldPlan18 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_userPgResource, { - id: args.get(['input', "rowId"]) - }) + args.apply($delete); + return object({ + result: $delete }); - args.apply(plan); - return plan; }; -const planWrapper18 = (plan, _, fieldArgs) => { +const planWrapper22 = (plan, _, fieldArgs) => { const $userId = fieldArgs.getRaw(["input", "rowId"]), $currentUser = context().get("currentUser"); sideEffect([$userId, $currentUser], async ([userId, currentUser]) => { @@ -5631,117 +4674,6 @@ const planWrapper18 = (plan, _, fieldArgs) => { }); return plan(); }; -const oldPlan19 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_memberPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper19 = (plan, _, fieldArgs) => { - const $input = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"), - $db = context().get("db"); - sideEffect([$input, $currentUser, $db], async ([input, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); - const { - members - } = lib_drizzle_schema; - if ("delete" === "create") { - const { - role, - userId, - organizationId - } = input, - organizationUsers = await db.select().from(members).where(eq(members.organizationId, organizationId)); - if (organizationUsers.length) { - const userRole = organizationUsers.find(user => user.userId === currentUser.id)?.role; - if (!userRole) { - if (userId !== currentUser.id || role !== "member") throw new Error("Insufficient permissions"); - } else if (userRole !== "owner") throw new Error("Insufficient permissions"); - } - } else { - const [member] = await db.select().from(members).where(eq(members.id, input)); - if (currentUser.id !== member.userId) { - const [userRole] = await db.select({ - role: members.role - }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, member.organizationId))); - if (userRole.role !== "owner") throw new Error("Insufficient permissions"); - } else if ("delete" === "update" && member.role !== "owner") throw new Error("Insufficient permissions"); - } - }); - return plan(); -}; -const oldPlan20 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_postPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper20 = (plan, _, fieldArgs) => { - const $postId = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"), - $db = context().get("db"); - sideEffect([$postId, $currentUser, $db], async ([postId, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); - const { - members, - projects, - posts - } = lib_drizzle_schema, - [post] = await db.select({ - organizationId: projects.organizationId, - userId: posts.userId - }).from(posts).innerJoin(projects, eq(posts.projectId, projects.id)).where(eq(posts.id, postId)); - if (currentUser.id !== post.userId) { - const [userRole] = await db.select({ - role: members.role - }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, post.organizationId))); - if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); - } - }); - return plan(); -}; -const oldPlan21 = (_$root, args) => { - const plan = object({ - result: pgDeleteSingle(resource_post_statusPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; -}; -const planWrapper21 = (plan, _, fieldArgs) => { - const $postStatus = fieldArgs.getRaw(["input", "rowId"]), - $currentUser = context().get("currentUser"), - $db = context().get("db"); - sideEffect([$postStatus, $currentUser, $db], async ([postStatus, currentUser, db]) => { - if (!currentUser) throw new Error("Unauthorized"); - const { - members, - projects, - postStatuses - } = lib_drizzle_schema; - let projectId; - if ("delete" === "create") projectId = postStatus.projectId;else { - const [currentPostStatus] = await db.select().from(postStatuses).where(eq(postStatuses.id, postStatus)); - projectId = currentPostStatus.projectId; - } - const [project] = await db.select({ - organizationId: projects.organizationId - }).from(projects).where(eq(projects.id, projectId)), - [userRole] = await db.select({ - role: members.role - }).from(members).where(and(eq(members.userId, currentUser.id), eq(members.organizationId, project.organizationId))); - if (!userRole || userRole.role === "member") throw new Error("Insufficient permissions"); - }); - return plan(); -}; export const typeDefs = /* GraphQL */`"""The root query type which gives access points into the data universe.""" type Query implements Node { """ @@ -5797,18 +4729,6 @@ type Query implements Node { """Get a single \`Project\`.""" projectBySlugAndOrganizationId(slug: String!, organizationId: UUID!): Project - """Get a single \`User\`.""" - user(rowId: UUID!): User - - """Get a single \`User\`.""" - userByEmail(email: String!): User - - """Get a single \`User\`.""" - userByHidraId(hidraId: UUID!): User - - """Get a single \`User\`.""" - userByUsername(username: String!): User - """Get a single \`Member\`.""" member(rowId: UUID!): Member @@ -5821,6 +4741,18 @@ type Query implements Node { """Get a single \`PostStatus\`.""" postStatus(rowId: UUID!): PostStatus + """Get a single \`User\`.""" + user(rowId: UUID!): User + + """Get a single \`User\`.""" + userByEmail(email: String!): User + + """Get a single \`User\`.""" + userByHidraId(hidraId: UUID!): User + + """Get a single \`User\`.""" + userByUsername(username: String!): User + """Reads and enables pagination through a set of \`Downvote\`.""" downvotes( """Only read the first \`n\` values of the set.""" @@ -5841,9 +4773,6 @@ type Query implements Node { """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. """ @@ -5853,6 +4782,9 @@ type Query implements Node { A filter to be used in determining which values should be returned by the collection. """ filter: DownvoteFilter + + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!] = [PRIMARY_KEY_ASC] ): DownvoteConnection """Reads and enables pagination through a set of \`Upvote\`.""" @@ -5875,9 +4807,6 @@ type Query implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Upvote\`.""" - orderBy: [UpvoteOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -5887,6 +4816,9 @@ type Query implements Node { A filter to be used in determining which values should be returned by the collection. """ filter: UpvoteFilter + + """The method to use when ordering \`Upvote\`.""" + orderBy: [UpvoteOrderBy!] = [PRIMARY_KEY_ASC] ): UpvoteConnection """Reads and enables pagination through a set of \`Invitation\`.""" @@ -5909,9 +4841,6 @@ type Query implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Invitation\`.""" - orderBy: [InvitationOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -5921,6 +4850,9 @@ type Query implements Node { A filter to be used in determining which values should be returned by the collection. """ filter: InvitationFilter + + """The method to use when ordering \`Invitation\`.""" + orderBy: [InvitationOrderBy!] = [PRIMARY_KEY_ASC] ): InvitationConnection """Reads and enables pagination through a set of \`Organization\`.""" @@ -5943,9 +4875,6 @@ type Query implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Organization\`.""" - orderBy: [OrganizationOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -5955,6 +4884,9 @@ type Query implements Node { A filter to be used in determining which values should be returned by the collection. """ filter: OrganizationFilter + + """The method to use when ordering \`Organization\`.""" + orderBy: [OrganizationOrderBy!] = [PRIMARY_KEY_ASC] ): OrganizationConnection """Reads and enables pagination through a set of \`Comment\`.""" @@ -5977,9 +4909,6 @@ type Query implements Node { """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. """ @@ -5989,6 +4918,9 @@ type Query implements Node { A filter to be used in determining which values should be returned by the collection. """ filter: CommentFilter + + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!] = [PRIMARY_KEY_ASC] ): CommentConnection """Reads and enables pagination through a set of \`Project\`.""" @@ -6011,9 +4943,6 @@ type Query implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Project\`.""" - orderBy: [ProjectOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -6023,10 +4952,13 @@ type Query implements Node { A filter to be used in determining which values should be returned by the collection. """ filter: ProjectFilter + + """The method to use when ordering \`Project\`.""" + orderBy: [ProjectOrderBy!] = [PRIMARY_KEY_ASC] ): ProjectConnection - """Reads and enables pagination through a set of \`User\`.""" - users( + """Reads and enables pagination through a set of \`Member\`.""" + members( """Only read the first \`n\` values of the set.""" first: Int @@ -6045,22 +4977,22 @@ type Query implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`User\`.""" - orderBy: [UserOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ - condition: UserCondition + condition: MemberCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: UserFilter - ): UserConnection + filter: MemberFilter - """Reads and enables pagination through a set of \`Member\`.""" - members( + """The method to use when ordering \`Member\`.""" + orderBy: [MemberOrderBy!] = [PRIMARY_KEY_ASC] + ): MemberConnection + + """Reads and enables pagination through a set of \`Post\`.""" + posts( """Only read the first \`n\` values of the set.""" first: Int @@ -6079,22 +5011,22 @@ type Query implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Member\`.""" - orderBy: [MemberOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ - condition: MemberCondition + condition: PostCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: MemberFilter - ): MemberConnection + filter: PostFilter - """Reads and enables pagination through a set of \`Post\`.""" - posts( + """The method to use when ordering \`Post\`.""" + orderBy: [PostOrderBy!] = [PRIMARY_KEY_ASC] + ): PostConnection + + """Reads and enables pagination through a set of \`PostStatus\`.""" + postStatuses( """Only read the first \`n\` values of the set.""" first: Int @@ -6113,22 +5045,22 @@ 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] - """ A condition to be used in determining which values should be returned by the collection. """ - condition: PostCondition + condition: PostStatusCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: PostFilter - ): PostConnection + filter: PostStatusFilter - """Reads and enables pagination through a set of \`PostStatus\`.""" - postStatuses( + """The method to use when ordering \`PostStatus\`.""" + orderBy: [PostStatusOrderBy!] = [PRIMARY_KEY_ASC] + ): PostStatusConnection + + """Reads and enables pagination through a set of \`User\`.""" + users( """Only read the first \`n\` values of the set.""" first: Int @@ -6147,19 +5079,19 @@ type Query implements Node { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`PostStatus\`.""" - orderBy: [PostStatusOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ - condition: PostStatusCondition + condition: UserCondition """ A filter to be used in determining which values should be returned by the collection. """ - filter: PostStatusFilter - ): PostStatusConnection + filter: UserFilter + + """The method to use when ordering \`User\`.""" + orderBy: [UserOrderBy!] = [PRIMARY_KEY_ASC] + ): UserConnection } """An object with a globally unique \`ID\`.""" @@ -6238,9 +5170,6 @@ type Post { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Upvote\`.""" - orderBy: [UpvoteOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -6250,6 +5179,9 @@ type Post { A filter to be used in determining which values should be returned by the collection. """ filter: UpvoteFilter + + """The method to use when ordering \`Upvote\`.""" + orderBy: [UpvoteOrderBy!] = [PRIMARY_KEY_ASC] ): UpvoteConnection! """Reads and enables pagination through a set of \`Comment\`.""" @@ -6272,9 +5204,6 @@ type Post { """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. """ @@ -6284,6 +5213,9 @@ type Post { A filter to be used in determining which values should be returned by the collection. """ filter: CommentFilter + + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!] = [PRIMARY_KEY_ASC] ): CommentConnection! """Reads and enables pagination through a set of \`Downvote\`.""" @@ -6306,9 +5238,6 @@ type Post { """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. """ @@ -6318,6 +5247,9 @@ type Post { A filter to be used in determining which values should be returned by the collection. """ filter: DownvoteFilter + + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!] = [PRIMARY_KEY_ASC] ): DownvoteConnection! } @@ -6354,9 +5286,6 @@ type Project { """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. """ @@ -6366,6 +5295,9 @@ type Project { A filter to be used in determining which values should be returned by the collection. """ filter: PostFilter + + """The method to use when ordering \`Post\`.""" + orderBy: [PostOrderBy!] = [PRIMARY_KEY_ASC] ): PostConnection! """Reads and enables pagination through a set of \`PostStatus\`.""" @@ -6388,9 +5320,6 @@ type Project { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`PostStatus\`.""" - orderBy: [PostStatusOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -6400,6 +5329,9 @@ type Project { A filter to be used in determining which values should be returned by the collection. """ filter: PostStatusFilter + + """The method to use when ordering \`PostStatus\`.""" + orderBy: [PostStatusOrderBy!] = [PRIMARY_KEY_ASC] ): PostStatusConnection! } @@ -6430,9 +5362,6 @@ type Organization { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Project\`.""" - orderBy: [ProjectOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -6442,6 +5371,9 @@ type Organization { A filter to be used in determining which values should be returned by the collection. """ filter: ProjectFilter + + """The method to use when ordering \`Project\`.""" + orderBy: [ProjectOrderBy!] = [PRIMARY_KEY_ASC] ): ProjectConnection! """Reads and enables pagination through a set of \`Member\`.""" @@ -6464,9 +5396,6 @@ type Organization { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Member\`.""" - orderBy: [MemberOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -6476,6 +5405,9 @@ type Organization { A filter to be used in determining which values should be returned by the collection. """ filter: MemberFilter + + """The method to use when ordering \`Member\`.""" + orderBy: [MemberOrderBy!] = [PRIMARY_KEY_ASC] ): MemberConnection! """Reads and enables pagination through a set of \`Invitation\`.""" @@ -6498,9 +5430,6 @@ type Organization { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Invitation\`.""" - orderBy: [InvitationOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -6510,6 +5439,9 @@ type Organization { A filter to be used in determining which values should be returned by the collection. """ filter: InvitationFilter + + """The method to use when ordering \`Invitation\`.""" + orderBy: [InvitationOrderBy!] = [PRIMARY_KEY_ASC] ): InvitationConnection! } @@ -6699,67 +5631,6 @@ input ProjectHavingVariancePopulationInput { updatedAt: HavingDatetimeFilter } -"""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 - 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 - POSTS_DISTINCT_COUNT_STATUS_ID_ASC - POSTS_DISTINCT_COUNT_STATUS_ID_DESC - POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_ASC - POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC - POST_STATUSES_COUNT_ASC - POST_STATUSES_COUNT_DESC - POST_STATUSES_DISTINCT_COUNT_ROW_ID_ASC - POST_STATUSES_DISTINCT_COUNT_ROW_ID_DESC - POST_STATUSES_DISTINCT_COUNT_STATUS_ASC - POST_STATUSES_DISTINCT_COUNT_STATUS_DESC - POST_STATUSES_DISTINCT_COUNT_DESCRIPTION_ASC - POST_STATUSES_DISTINCT_COUNT_DESCRIPTION_DESC - POST_STATUSES_DISTINCT_COUNT_COLOR_ASC - POST_STATUSES_DISTINCT_COUNT_COLOR_DESC - POST_STATUSES_DISTINCT_COUNT_PROJECT_ID_ASC - POST_STATUSES_DISTINCT_COUNT_PROJECT_ID_DESC - POST_STATUSES_DISTINCT_COUNT_IS_DEFAULT_ASC - POST_STATUSES_DISTINCT_COUNT_IS_DEFAULT_DESC - POST_STATUSES_DISTINCT_COUNT_CREATED_AT_ASC - POST_STATUSES_DISTINCT_COUNT_CREATED_AT_DESC - POST_STATUSES_DISTINCT_COUNT_UPDATED_AT_ASC - POST_STATUSES_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.’ """ @@ -7238,6 +6109,9 @@ input UserFilter { """Filter by the object’s \`email\` field.""" email: StringFilter + """Filter by the object’s \`tier\` field.""" + tier: TierFilter + """Filter by the object’s \`posts\` relation.""" posts: UserToManyPostFilter @@ -7278,6 +6152,54 @@ input UserFilter { not: UserFilter } +""" +A filter to be used against Tier fields. All fields are combined with a logical ‘and.’ +""" +input TierFilter { + """ + Is null (if \`true\` is specified) or is not null (if \`false\` is specified). + """ + isNull: Boolean + + """Equal to the specified value.""" + equalTo: Tier + + """Not equal to the specified value.""" + notEqualTo: Tier + + """ + Not equal to the specified value, treating null like an ordinary value. + """ + distinctFrom: Tier + + """Equal to the specified value, treating null like an ordinary value.""" + notDistinctFrom: Tier + + """Included in the specified list.""" + in: [Tier!] + + """Not included in the specified list.""" + notIn: [Tier!] + + """Less than the specified value.""" + lessThan: Tier + + """Less than or equal to the specified value.""" + lessThanOrEqualTo: Tier + + """Greater than the specified value.""" + greaterThan: Tier + + """Greater than or equal to the specified value.""" + greaterThanOrEqualTo: Tier +} + +enum Tier { + basic + team + enterprise +} + """ A filter to be used against many \`Post\` object types. All fields are combined with a logical ‘and.’ """ @@ -8083,6 +7005,67 @@ input PostStatusDistinctCountAggregateFilter { updatedAt: BigIntFilter } +"""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 + 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 + POSTS_DISTINCT_COUNT_STATUS_ID_ASC + POSTS_DISTINCT_COUNT_STATUS_ID_DESC + POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_ASC + POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC + POST_STATUSES_COUNT_ASC + POST_STATUSES_COUNT_DESC + POST_STATUSES_DISTINCT_COUNT_ROW_ID_ASC + POST_STATUSES_DISTINCT_COUNT_ROW_ID_DESC + POST_STATUSES_DISTINCT_COUNT_STATUS_ASC + POST_STATUSES_DISTINCT_COUNT_STATUS_DESC + POST_STATUSES_DISTINCT_COUNT_DESCRIPTION_ASC + POST_STATUSES_DISTINCT_COUNT_DESCRIPTION_DESC + POST_STATUSES_DISTINCT_COUNT_COLOR_ASC + POST_STATUSES_DISTINCT_COUNT_COLOR_DESC + POST_STATUSES_DISTINCT_COUNT_PROJECT_ID_ASC + POST_STATUSES_DISTINCT_COUNT_PROJECT_ID_DESC + POST_STATUSES_DISTINCT_COUNT_IS_DEFAULT_ASC + POST_STATUSES_DISTINCT_COUNT_IS_DEFAULT_DESC + POST_STATUSES_DISTINCT_COUNT_CREATED_AT_ASC + POST_STATUSES_DISTINCT_COUNT_CREATED_AT_DESC + POST_STATUSES_DISTINCT_COUNT_UPDATED_AT_ASC + POST_STATUSES_DISTINCT_COUNT_UPDATED_AT_DESC +} + """A connection to a list of \`Member\` values.""" type MemberConnection { """A list of \`Member\` objects.""" @@ -8139,6 +7122,7 @@ type User { firstName: String lastName: String email: String! + tier: Tier """Reads and enables pagination through a set of \`Post\`.""" posts( @@ -8160,9 +7144,6 @@ type User { """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. """ @@ -8172,6 +7153,9 @@ type User { A filter to be used in determining which values should be returned by the collection. """ filter: PostFilter + + """The method to use when ordering \`Post\`.""" + orderBy: [PostOrderBy!] = [PRIMARY_KEY_ASC] ): PostConnection! """Reads and enables pagination through a set of \`Upvote\`.""" @@ -8194,9 +7178,6 @@ type User { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Upvote\`.""" - orderBy: [UpvoteOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -8206,6 +7187,9 @@ type User { A filter to be used in determining which values should be returned by the collection. """ filter: UpvoteFilter + + """The method to use when ordering \`Upvote\`.""" + orderBy: [UpvoteOrderBy!] = [PRIMARY_KEY_ASC] ): UpvoteConnection! """Reads and enables pagination through a set of \`Member\`.""" @@ -8228,9 +7212,6 @@ type User { """Read all values in the set after (below) this cursor.""" after: Cursor - """The method to use when ordering \`Member\`.""" - orderBy: [MemberOrderBy!] = [PRIMARY_KEY_ASC] - """ A condition to be used in determining which values should be returned by the collection. """ @@ -8240,6 +7221,9 @@ type User { A filter to be used in determining which values should be returned by the collection. """ filter: MemberFilter + + """The method to use when ordering \`Member\`.""" + orderBy: [MemberOrderBy!] = [PRIMARY_KEY_ASC] ): MemberConnection! """Reads and enables pagination through a set of \`Comment\`.""" @@ -8262,9 +7246,6 @@ type User { """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. """ @@ -8274,6 +7255,9 @@ type User { A filter to be used in determining which values should be returned by the collection. """ filter: CommentFilter + + """The method to use when ordering \`Comment\`.""" + orderBy: [CommentOrderBy!] = [PRIMARY_KEY_ASC] ): CommentConnection! """Reads and enables pagination through a set of \`Downvote\`.""" @@ -8296,9 +7280,6 @@ type User { """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. """ @@ -8308,6 +7289,9 @@ type User { A filter to be used in determining which values should be returned by the collection. """ filter: DownvoteFilter + + """The method to use when ordering \`Downvote\`.""" + orderBy: [DownvoteOrderBy!] = [PRIMARY_KEY_ASC] ): DownvoteConnection! } @@ -8478,6 +7462,38 @@ input PostHavingVariancePopulationInput { statusUpdatedAt: HavingDatetimeFilter } +""" +A condition to be used against \`Post\` object types. All fields are tested for equality and combined with a logical ‘and.’ +""" +input PostCondition { + """Checks for equality with the object’s \`rowId\` field.""" + rowId: UUID + + """Checks for equality with the object’s \`title\` field.""" + title: String + + """Checks for equality with the object’s \`description\` field.""" + description: String + + """Checks for equality with the object’s \`projectId\` field.""" + projectId: UUID + + """Checks for equality with the object’s \`userId\` field.""" + userId: UUID + + """Checks for equality with the object’s \`createdAt\` field.""" + createdAt: Datetime + + """Checks for equality with the object’s \`updatedAt\` field.""" + updatedAt: Datetime + + """Checks for equality with the object’s \`statusId\` field.""" + statusId: UUID + + """Checks for equality with the object’s \`statusUpdatedAt\` field.""" + statusUpdatedAt: Datetime +} + """Methods to use when ordering \`Post\`.""" enum PostOrderBy { NATURAL @@ -8541,38 +7557,6 @@ enum PostOrderBy { DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_DESC } -""" -A condition to be used against \`Post\` object types. All fields are tested for equality and combined with a logical ‘and.’ -""" -input PostCondition { - """Checks for equality with the object’s \`rowId\` field.""" - rowId: UUID - - """Checks for equality with the object’s \`title\` field.""" - title: String - - """Checks for equality with the object’s \`description\` field.""" - description: String - - """Checks for equality with the object’s \`projectId\` field.""" - projectId: UUID - - """Checks for equality with the object’s \`userId\` field.""" - userId: UUID - - """Checks for equality with the object’s \`createdAt\` field.""" - createdAt: Datetime - - """Checks for equality with the object’s \`updatedAt\` field.""" - updatedAt: Datetime - - """Checks for equality with the object’s \`statusId\` field.""" - statusId: UUID - - """Checks for equality with the object’s \`statusUpdatedAt\` field.""" - statusUpdatedAt: Datetime -} - """A connection to a list of \`Upvote\` values.""" type UpvoteConnection { """A list of \`Upvote\` objects.""" @@ -8727,23 +7711,6 @@ input UpvoteHavingVariancePopulationInput { updatedAt: HavingDatetimeFilter } -"""Methods to use when ordering \`Upvote\`.""" -enum UpvoteOrderBy { - NATURAL - PRIMARY_KEY_ASC - PRIMARY_KEY_DESC - ROW_ID_ASC - ROW_ID_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 -} - """ A condition to be used against \`Upvote\` object types. All fields are tested for equality and combined with a logical ‘and.’ """ @@ -8764,21 +7731,21 @@ input UpvoteCondition { updatedAt: Datetime } -"""Methods to use when ordering \`Member\`.""" -enum MemberOrderBy { +"""Methods to use when ordering \`Upvote\`.""" +enum UpvoteOrderBy { NATURAL PRIMARY_KEY_ASC PRIMARY_KEY_DESC + ROW_ID_ASC + ROW_ID_DESC + POST_ID_ASC + POST_ID_DESC USER_ID_ASC USER_ID_DESC - ORGANIZATION_ID_ASC - ORGANIZATION_ID_DESC CREATED_AT_ASC CREATED_AT_DESC - ROLE_ASC - ROLE_DESC - ROW_ID_ASC - ROW_ID_DESC + UPDATED_AT_ASC + UPDATED_AT_DESC } """ @@ -8801,6 +7768,23 @@ input MemberCondition { rowId: UUID } +"""Methods to use when ordering \`Member\`.""" +enum MemberOrderBy { + NATURAL + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC + USER_ID_ASC + USER_ID_DESC + ORGANIZATION_ID_ASC + ORGANIZATION_ID_DESC + CREATED_AT_ASC + CREATED_AT_DESC + ROLE_ASC + ROLE_DESC + ROW_ID_ASC + ROW_ID_DESC +} + """A connection to a list of \`Comment\` values.""" type CommentConnection { """A list of \`Comment\` objects.""" @@ -8960,25 +7944,6 @@ input CommentHavingVariancePopulationInput { updatedAt: HavingDatetimeFilter } -"""Methods to use when ordering \`Comment\`.""" -enum CommentOrderBy { - NATURAL - PRIMARY_KEY_ASC - PRIMARY_KEY_DESC - ROW_ID_ASC - ROW_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 -} - """ A condition to be used against \`Comment\` object types. All fields are tested for equality and combined with a logical ‘and.’ """ @@ -9002,6 +7967,25 @@ input CommentCondition { updatedAt: Datetime } +"""Methods to use when ordering \`Comment\`.""" +enum CommentOrderBy { + NATURAL + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC + ROW_ID_ASC + ROW_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 +} + """A connection to a list of \`Downvote\` values.""" type DownvoteConnection { """A list of \`Downvote\` objects.""" @@ -9142,23 +8126,6 @@ input DownvoteHavingVariancePopulationInput { updatedAt: HavingDatetimeFilter } -"""Methods to use when ordering \`Downvote\`.""" -enum DownvoteOrderBy { - NATURAL - PRIMARY_KEY_ASC - PRIMARY_KEY_DESC - ROW_ID_ASC - ROW_ID_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 -} - """ A condition to be used against \`Downvote\` object types. All fields are tested for equality and combined with a logical ‘and.’ @@ -9180,6 +8147,23 @@ input DownvoteCondition { updatedAt: Datetime } +"""Methods to use when ordering \`Downvote\`.""" +enum DownvoteOrderBy { + NATURAL + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC + ROW_ID_ASC + ROW_ID_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 +} + """A \`Member\` edge in the connection.""" type MemberEdge { """A cursor for use in pagination.""" @@ -9427,23 +8411,6 @@ input InvitationHavingVariancePopulationInput { updatedAt: HavingDatetimeFilter } -"""Methods to use when ordering \`Invitation\`.""" -enum InvitationOrderBy { - NATURAL - PRIMARY_KEY_ASC - PRIMARY_KEY_DESC - ROW_ID_ASC - ROW_ID_DESC - ORGANIZATION_ID_ASC - ORGANIZATION_ID_DESC - EMAIL_ASC - EMAIL_DESC - CREATED_AT_ASC - CREATED_AT_DESC - UPDATED_AT_ASC - UPDATED_AT_DESC -} - """ A condition to be used against \`Invitation\` object types. All fields are tested for equality and combined with a logical ‘and.’ @@ -9465,6 +8432,23 @@ input InvitationCondition { updatedAt: Datetime } +"""Methods to use when ordering \`Invitation\`.""" +enum InvitationOrderBy { + NATURAL + PRIMARY_KEY_ASC + PRIMARY_KEY_DESC + ROW_ID_ASC + ROW_ID_DESC + ORGANIZATION_ID_ASC + ORGANIZATION_ID_DESC + EMAIL_ASC + EMAIL_DESC + CREATED_AT_ASC + CREATED_AT_DESC + UPDATED_AT_ASC + UPDATED_AT_DESC +} + """A connection to a list of \`PostStatus\` values.""" type PostStatusConnection { """A list of \`PostStatus\` objects.""" @@ -9531,9 +8515,6 @@ type PostStatus { """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. """ @@ -9543,6 +8524,9 @@ type PostStatus { A filter to be used in determining which values should be returned by the collection. """ filter: PostFilter + + """The method to use when ordering \`Post\`.""" + orderBy: [PostOrderBy!] = [PRIMARY_KEY_ASC] ): PostConnection! } @@ -9665,6 +8649,36 @@ input PostStatusHavingVariancePopulationInput { updatedAt: HavingDatetimeFilter } +""" +A condition to be used against \`PostStatus\` object types. All fields are tested +for equality and combined with a logical ‘and.’ +""" +input PostStatusCondition { + """Checks for equality with the object’s \`rowId\` field.""" + rowId: UUID + + """Checks for equality with the object’s \`status\` field.""" + status: String + + """Checks for equality with the object’s \`description\` field.""" + description: String + + """Checks for equality with the object’s \`color\` field.""" + color: String + + """Checks for equality with the object’s \`projectId\` field.""" + projectId: UUID + + """Checks for equality with the object’s \`isDefault\` field.""" + isDefault: Boolean + + """Checks for equality with the object’s \`createdAt\` field.""" + createdAt: Datetime + + """Checks for equality with the object’s \`updatedAt\` field.""" + updatedAt: Datetime +} + """Methods to use when ordering \`PostStatus\`.""" enum PostStatusOrderBy { NATURAL @@ -9708,36 +8722,6 @@ enum PostStatusOrderBy { POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC } -""" -A condition to be used against \`PostStatus\` object types. All fields are tested -for equality and combined with a logical ‘and.’ -""" -input PostStatusCondition { - """Checks for equality with the object’s \`rowId\` field.""" - rowId: UUID - - """Checks for equality with the object’s \`status\` field.""" - status: String - - """Checks for equality with the object’s \`description\` field.""" - description: String - - """Checks for equality with the object’s \`color\` field.""" - color: String - - """Checks for equality with the object’s \`projectId\` field.""" - projectId: UUID - - """Checks for equality with the object’s \`isDefault\` field.""" - isDefault: Boolean - - """Checks for equality with the object’s \`createdAt\` field.""" - createdAt: Datetime - - """Checks for equality with the object’s \`updatedAt\` field.""" - updatedAt: Datetime -} - """A connection to a list of \`Organization\` values.""" type OrganizationConnection { """A list of \`Organization\` objects.""" @@ -9876,6 +8860,27 @@ input OrganizationHavingVariancePopulationInput { updatedAt: HavingDatetimeFilter } +""" +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 + + """Checks for equality with the object’s \`name\` field.""" + name: String + + """Checks for equality with the object’s \`slug\` field.""" + slug: String + + """Checks for equality with the object’s \`createdAt\` field.""" + createdAt: Datetime + + """Checks for equality with the object’s \`updatedAt\` field.""" + updatedAt: Datetime +} + """Methods to use when ordering \`Organization\`.""" enum OrganizationOrderBy { NATURAL @@ -9935,27 +8940,6 @@ enum OrganizationOrderBy { INVITATIONS_DISTINCT_COUNT_UPDATED_AT_DESC } -""" -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 - - """Checks for equality with the object’s \`name\` field.""" - name: String - - """Checks for equality with the object’s \`slug\` field.""" - slug: String - - """Checks for equality with the object’s \`createdAt\` field.""" - createdAt: Datetime - - """Checks for equality with the object’s \`updatedAt\` field.""" - updatedAt: Datetime -} - """A connection to a list of \`User\` values.""" type UserConnection { """A list of \`User\` objects.""" @@ -10031,6 +9015,9 @@ type UserDistinctCountAggregates { """Distinct count of email across the matching connection""" email: BigInt + + """Distinct count of tier across the matching connection""" + tier: BigInt } """Grouping methods for \`User\` for usage during aggregation.""" @@ -10043,6 +9030,7 @@ enum UserGroupBy { UPDATED_AT_TRUNCATED_TO_DAY FIRST_NAME LAST_NAME + TIER } """Conditions for \`User\` aggregates.""" @@ -10105,6 +9093,38 @@ input UserHavingVariancePopulationInput { updatedAt: HavingDatetimeFilter } +""" +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 + + """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 + + """Checks for equality with the object’s \`email\` field.""" + email: String + + """Checks for equality with the object’s \`tier\` field.""" + tier: Tier +} + """Methods to use when ordering \`User\`.""" enum UserOrderBy { NATURAL @@ -10126,6 +9146,8 @@ enum UserOrderBy { LAST_NAME_DESC EMAIL_ASC EMAIL_DESC + TIER_ASC + TIER_DESC POSTS_COUNT_ASC POSTS_COUNT_DESC POSTS_DISTINCT_COUNT_ROW_ID_ASC @@ -10199,45 +9221,16 @@ enum UserOrderBy { } """ -A condition to be used against \`User\` object types. All fields are tested for equality and combined with a logical ‘and.’ +The root mutation type which contains root level fields which mutate data. """ -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 - - """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 - - """Checks for equality with the object’s \`email\` field.""" - email: String -} - -""" -The root mutation type which contains root level fields which mutate data. -""" -type Mutation { - """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 +type Mutation { + """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 """Creates a single \`Upvote\`.""" createUpvote( @@ -10279,14 +9272,6 @@ type Mutation { input: CreateProjectInput! ): CreateProjectPayload - """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 - """Creates a single \`Member\`.""" createMember( """ @@ -10311,6 +9296,14 @@ type Mutation { input: CreatePostStatusInput! ): CreatePostStatusPayload + """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 + """Updates a single \`Downvote\` using a unique key and a patch.""" updateDownvote( """ @@ -10359,14 +9352,6 @@ type Mutation { input: UpdateProjectInput! ): UpdateProjectPayload - """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 - """Updates a single \`Member\` using a unique key and a patch.""" updateMember( """ @@ -10391,6 +9376,14 @@ type Mutation { input: UpdatePostStatusInput! ): UpdatePostStatusPayload + """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 + """Deletes a single \`Downvote\` using a unique key.""" deleteDownvote( """ @@ -10439,14 +9432,6 @@ type Mutation { input: DeleteProjectInput! ): DeleteProjectPayload - """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 \`Member\` using a unique key.""" deleteMember( """ @@ -10470,6 +9455,14 @@ type Mutation { """ input: DeletePostStatusInput! ): DeletePostStatusPayload + + """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 } """The output of our create \`Downvote\` mutation.""" @@ -10740,53 +9733,6 @@ input ProjectInput { updatedAt: Datetime } -"""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 - - """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 -} - -"""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! -} - -"""An input for mutations affecting \`User\`""" -input UserInput { - rowId: UUID - createdAt: Datetime - updatedAt: Datetime - hidraId: UUID! - username: String - firstName: String - lastName: String - email: String! -} - """The output of our create \`Member\` mutation.""" type CreateMemberPayload { """ @@ -10926,6 +9872,53 @@ input PostStatusInput { updatedAt: Datetime } +"""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 + + """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 +} + +"""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! +} + +"""An input for mutations affecting \`User\`""" +input UserInput { + rowId: UUID + createdAt: Datetime + updatedAt: Datetime + hidraId: UUID! + username: String + firstName: String + lastName: String + email: String! +} + """The output of our update \`Downvote\` mutation.""" type UpdateDownvotePayload { """ @@ -11224,56 +10217,6 @@ input ProjectPatch { updatedAt: Datetime } -"""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 \`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! -} - -"""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 - email: String -} - """The output of our update \`Member\` mutation.""" type UpdateMemberPayload { """ @@ -11426,48 +10369,98 @@ input PostStatusPatch { updatedAt: Datetime } -"""The output of our delete \`Downvote\` mutation.""" -type DeleteDownvotePayload { +"""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 \`Downvote\` that was deleted by this mutation.""" - downvote: Downvote + """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 \`Downvote\`. May be used by Relay 1.""" - downvoteEdge( - """The method to use when ordering \`Downvote\`.""" - orderBy: [DownvoteOrderBy!]! = [PRIMARY_KEY_ASC] - ): DownvoteEdge + """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 \`deleteDownvote\` mutation.""" -input DeleteDownvoteInput { +"""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! -} -"""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. + An object where the defined keys will be set on the \`User\` being updated. """ - clientMutationId: String + patch: UserPatch! +} - """The \`Upvote\` that was deleted by this mutation.""" +"""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 + email: String +} + +"""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 + + """ + 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 \`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! +} + +"""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 """ @@ -11624,39 +10617,6 @@ input DeleteProjectInput { 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 - - """ - 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 \`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! -} - """The output of our delete \`Member\` mutation.""" type DeleteMemberPayload { """ @@ -11754,9041 +10714,7738 @@ input DeletePostStatusInput { """ clientMutationId: String rowId: 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 - } - }, - downvote: { - plan(_$root, args) { - return resource_downvotePgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - downvoteByPostIdAndUserId: { - plan(_$root, args) { - return resource_downvotePgResource.get({ - post_id: args.get("postId"), - user_id: args.get("userId") - }); - }, - args: { - postId: undefined, - userId: undefined - } - }, - upvote: { - plan(_$root, args) { - return resource_upvotePgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - upvoteByPostIdAndUserId: { - plan(_$root, args) { - return resource_upvotePgResource.get({ - post_id: args.get("postId"), - user_id: args.get("userId") - }); - }, - args: { - postId: undefined, - userId: undefined - } - }, - invitation: { - plan(_$root, args) { - return resource_invitationPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - invitationByOrganizationIdAndEmail: { - plan(_$root, args) { - return resource_invitationPgResource.get({ - organization_id: args.get("organizationId"), - email: args.get("email") - }); - }, - args: { - organizationId: undefined, - email: undefined - } - }, - organization: { - plan(_$root, args) { - return resource_organizationPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - organizationByName: { - plan(_$root, args) { - return resource_organizationPgResource.get({ - name: args.get("name") - }); - }, - args: { - name: undefined - } - }, - organizationBySlug: { - plan(_$root, args) { - return resource_organizationPgResource.get({ - slug: args.get("slug") - }); - }, - args: { - slug: undefined - } - }, - comment: { - plan(_$root, args) { - return resource_commentPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - project: { - plan(_$root, args) { - return resource_projectPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - projectBySlugAndOrganizationId: { - plan(_$root, args) { - return resource_projectPgResource.get({ - slug: args.get("slug"), - organization_id: args.get("organizationId") - }); - }, - args: { - slug: undefined, - organizationId: undefined - } - }, - user: { - plan(_$root, args) { - return resource_userPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - userByEmail: { - plan(_$root, args) { - return resource_userPgResource.get({ - email: args.get("email") - }); - }, - args: { - email: undefined - } - }, - userByHidraId: { - plan(_$root, args) { - return resource_userPgResource.get({ - hidra_id: args.get("hidraId") - }); - }, - args: { - hidraId: undefined - } - }, - userByUsername: { - plan(_$root, args) { - return resource_userPgResource.get({ - username: args.get("username") - }); - }, - args: { - username: undefined - } - }, - member: { - plan(_$root, args) { - return resource_memberPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - memberByUserIdAndOrganizationId: { - plan(_$root, args) { - return resource_memberPgResource.get({ - user_id: args.get("userId"), - organization_id: args.get("organizationId") - }); - }, - args: { - userId: undefined, - organizationId: undefined - } - }, - post: { - plan(_$root, args) { - return resource_postPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - postStatus: { - plan(_$root, args) { - return resource_post_statusPgResource.get({ - id: args.get("rowId") - }); - }, - args: { - rowId: undefined - } - }, - downvotes: { - plan() { - return connection(resource_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) { - assertAllowed(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } - } - }, - upvotes: { - plan() { - return connection(resource_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); - } - } - } - }, - invitations: { - plan() { - return connection(resource_invitationPgResource.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("InvitationOrderBy")); - 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(resource_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(resource_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); - } - } - } - }, - projects: { - plan() { - return connection(resource_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); - } - } - } - }, - users: { - plan() { - return connection(resource_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); - } - } - } - }, - members: { - plan() { - return connection(resource_memberPgResource.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("MemberOrderBy")); - 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); - } - } - } - }, - posts: { - plan() { - return connection(resource_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) { - assertAllowed9(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } - } - }, - postStatuses: { - plan() { - return connection(resource_post_statusPgResource.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("PostStatusOrderBy")); - 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); - } - } - } - } - }, - Downvote: { - __assertStep: assertPgClassSingleStep, - 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 resource_postPgResource.get({ - id: $record.get("post_id") - }); - }, - user($record) { - return resource_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; - } - }, - Post: { - __assertStep: assertPgClassSingleStep, - 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"); - }, - statusId($record) { - return $record.get("status_id"); - }, - statusUpdatedAt($record) { - return $record.get("status_updated_at"); - }, - project($record) { - return resource_projectPgResource.get({ - id: $record.get("project_id") - }); - }, - status($record) { - return resource_post_statusPgResource.get({ - id: $record.get("status_id") - }); - }, - user($record) { - return resource_userPgResource.get({ - id: $record.get("user_id") - }); - }, - upvotes: { - plan($record) { - const $records = resource_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) { - assertAllowed11(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } - } - }, - comments: { - plan($record) { - const $records = resource_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) { - assertAllowed12(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } - } - }, - downvotes: { - plan($record) { - const $records = resource_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) { - assertAllowed13(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } - } - } - }, - Project: { - __assertStep: assertPgClassSingleStep, - 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 resource_organizationPgResource.get({ - id: $record.get("organization_id") - }); - }, - posts: { - plan($record) { - const $records = resource_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) { - assertAllowed14(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } - } - }, - postStatuses: { - plan($record) { - const $records = resource_post_statusPgResource.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("PostStatusOrderBy")); - 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); - } - } - } - } - }, - Organization: { - __assertStep: assertPgClassSingleStep, - 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 = resource_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) { - assertAllowed16(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } - } - } - }, - members: { - plan($record) { - const $records = resource_memberPgResource.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("MemberOrderBy")); - 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); - } - } - } - }, - invitations: { - plan($record) { - const $records = resource_invitationPgResource.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("InvitationOrderBy")); - 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); - } - } - } - } - }, - 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(); - } - } - } - } - }, - ProjectEdge: { - __assertStep: assertEdgeCapableStep, - cursor($edge) { - return $edge.cursor(); - }, - node($edge) { - return $edge.node(); - } - }, - 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; - } - }, - PageInfo: { - __assertStep: assertPageInfoCapableStep, - hasNextPage($pageInfo) { - return $pageInfo.hasNextPage(); - }, - hasPreviousPage($pageInfo) { - return $pageInfo.hasPreviousPage(); - }, - startCursor($pageInfo) { - return $pageInfo.startCursor(); - }, - endCursor($pageInfo) { - return $pageInfo.endCursor(); - } - }, - ProjectAggregates: { - __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; - } - }, - ProjectDistinctCountAggregates: { - rowId($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("id")}`, - sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - name($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("name")}`, - sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - image($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("image")}`, - sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - slug($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("slug")}`, - sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - description($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("description")}`, - sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - organizationId($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("organization_id")}`, - sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - createdAt($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("created_at")}`, - sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - }, - updatedAt($pgSelectSingle) { - const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("updated_at")}`, - sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); - return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); - } - }, - 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; - } - }, - ProjectGroupBy: { - NAME: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan - }, - IMAGE: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan2 - }, - SLUG: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan3 - }, - DESCRIPTION: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan4 - }, - ORGANIZATION_ID: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan5 - }, - CREATED_AT: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan6 - }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan7 - }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan8 - }, - UPDATED_AT: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan9 - }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan10 - }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: ProjectGroupBy_extensions_grafast_applyPlan11 - } - }, - ProjectHavingInput: { - 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; - } - } - }, - ProjectHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_project.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_project.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)})`); - } - } - }, - ProjectHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - ProjectHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_project.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_project.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - ProjectHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_project.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_project.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - ProjectHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_project.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_project.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - ProjectHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_project.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_project.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - ProjectHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_project.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_project.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - ProjectHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_project.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_project.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - ProjectHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_project.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_project.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } - } - }, - ProjectOrderBy: { - NATURAL: { - applyPlan() {} - }, - PRIMARY_KEY_ASC: { - applyPlan(step) { - projectUniques[0].attributes.forEach(attributeName => { - const attribute = projectCodec.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) { - projectUniques[0].attributes.forEach(attributeName => { - const attribute = projectCodec.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(); - } - }, - 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: "name", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } - }, - 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: "name", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } - }, - IMAGE_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: "image", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } - }, - IMAGE_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: "image", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } - }, - SLUG_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: "slug", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } - }, - SLUG_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: "slug", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) 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(); - } - }, - 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) - }); - if (false) plan.setOrderIsUnique(); - } - }, - 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) - }); - 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(); - } - }, - POSTS_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } - }, - POSTS_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_TITLE_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_TITLE_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_DESCRIPTION_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_DESCRIPTION_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_PROJECT_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_PROJECT_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_USER_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_USER_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_STATUS_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_id.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_STATUS_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_id.codec, - direction: "DESC" - }); - } - }, - POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_updated_at.codec, - direction: "ASC" - }); - } - }, - POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec)} -from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_updated_at.codec, - direction: "DESC" - }); - } - }, - POST_STATUSES_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } - }, - POST_STATUSES_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_postStatus.attributes.id.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.id.codec, - direction: "ASC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_postStatus.attributes.id.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.id.codec, - direction: "DESC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_STATUS_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status")}`, spec_postStatus.attributes.status.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.status.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.status.codec, - direction: "ASC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_STATUS_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status")}`, spec_postStatus.attributes.status.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.status.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.status.codec, - direction: "DESC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_DESCRIPTION_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_postStatus.attributes.description.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.description.codec, - direction: "ASC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_DESCRIPTION_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_postStatus.attributes.description.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.description.codec, - direction: "DESC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_COLOR_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("color")}`, spec_postStatus.attributes.color.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.color.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.color.codec, - direction: "ASC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_COLOR_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("color")}`, spec_postStatus.attributes.color.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.color.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.color.codec, - direction: "DESC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_PROJECT_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_postStatus.attributes.project_id.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.project_id.codec, - direction: "ASC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_PROJECT_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_postStatus.attributes.project_id.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.project_id.codec, - direction: "DESC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_IS_DEFAULT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("is_default")}`, spec_postStatus.attributes.is_default.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.is_default.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.is_default.codec, - direction: "ASC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_IS_DEFAULT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("is_default")}`, spec_postStatus.attributes.is_default.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.is_default.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.is_default.codec, - direction: "DESC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_postStatus.attributes.created_at.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.created_at.codec, - direction: "ASC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_postStatus.attributes.created_at.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.created_at.codec, - direction: "DESC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_postStatus.attributes.updated_at.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.updated_at.codec, - direction: "ASC" - }); - } - }, - POST_STATUSES_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_postStatus.attributes.updated_at.codec)} -from ${resource_post_statusPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_postStatus.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_postStatus.attributes.updated_at.codec, - direction: "DESC" - }); - } - } - }, - ProjectCondition: { - 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_project.attributes.id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - name: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "name", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "name", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_project.attributes.name.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - image: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "image", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "image", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_project.attributes.image.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true +} + +"""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 + + """ + 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 \`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! +}`; +export const plans = { + Query: { + __assertStep() { + return !0; }, - slug: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "slug", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "slug", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_project.attributes.slug.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + query() { + return rootValue(); }, - 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_project.attributes.description.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - organizationId: { - 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_project.attributes.organization_id.codec)}`; - } - }); - }, - 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`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_project.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_project.attributes.updated_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - } - }, - 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 = colSpec; - fieldArgs.apply($col); - } + id($parent) { + const specifier = handler.plan($parent); + return lambda(specifier, nodeIdCodecs[handler.codec.name].encode); }, - 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 = colSpec2; - fieldArgs.apply($col); - } + node(_$root, args) { + return node(nodeIdHandlerByTypeName, args.getRaw("id")); }, - 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 = colSpec3; - fieldArgs.apply($col); - } + downvote(_$root, { + $rowId + }) { + return resource_downvotePgResource.get({ + id: $rowId + }); }, - 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 = colSpec4; - fieldArgs.apply($col); - } + downvoteByPostIdAndUserId(_$root, { + $postId, + $userId + }) { + return resource_downvotePgResource.get({ + post_id: $postId, + user_id: $userId + }); }, - 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 = colSpec5; - fieldArgs.apply($col); - } + upvote(_$root, { + $rowId + }) { + return resource_upvotePgResource.get({ + id: $rowId + }); }, - 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 = colSpec6; - fieldArgs.apply($col); - } + upvoteByPostIdAndUserId(_$root, { + $postId, + $userId + }) { + return resource_upvotePgResource.get({ + post_id: $postId, + user_id: $userId + }); }, - 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 = colSpec7; - fieldArgs.apply($col); - } + invitation(_$root, { + $rowId + }) { + return resource_invitationPgResource.get({ + id: $rowId + }); }, - 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 = colSpec8; - fieldArgs.apply($col); - } + invitationByOrganizationIdAndEmail(_$root, { + $organizationId, + $email + }) { + return resource_invitationPgResource.get({ + organization_id: $organizationId, + email: $email + }); }, - posts: { - applyPlan($where, fieldArgs) { - assertAllowed19(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: postIdentifier, - alias: resource_postPgResource.name, - localAttributes: registryConfig.pgRelations.project.postsByTheirProjectId.localAttributes, - remoteAttributes: registryConfig.pgRelations.project.postsByTheirProjectId.remoteAttributes - }; - fieldArgs.apply($rel); - } + organization(_$root, { + $rowId + }) { + return resource_organizationPgResource.get({ + id: $rowId + }); }, - postsExist: { - applyPlan($where, fieldArgs) { - assertAllowed19(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: postIdentifier, - alias: resource_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)}`); - }); - } + organizationByName(_$root, { + $name + }) { + return resource_organizationPgResource.get({ + name: $name + }); }, - postStatuses: { - applyPlan($where, fieldArgs) { - assertAllowed19(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: postStatusIdentifier, - alias: resource_post_statusPgResource.name, - localAttributes: registryConfig.pgRelations.project.postStatusesByTheirProjectId.localAttributes, - remoteAttributes: registryConfig.pgRelations.project.postStatusesByTheirProjectId.remoteAttributes - }; - fieldArgs.apply($rel); - } + organizationBySlug(_$root, { + $slug + }) { + return resource_organizationPgResource.get({ + slug: $slug + }); }, - postStatusesExist: { - applyPlan($where, fieldArgs) { - assertAllowed19(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: postStatusIdentifier, - alias: resource_post_statusPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.project.postStatusesByTheirProjectId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.project.postStatusesByTheirProjectId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - } + comment(_$root, { + $rowId + }) { + return resource_commentPgResource.get({ + id: $rowId + }); }, - organization: { - applyPlan($where, fieldArgs) { - assertAllowed20(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: organizationIdentifier, - alias: resource_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); - } + project(_$root, { + $rowId + }) { + return resource_projectPgResource.get({ + id: $rowId + }); }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed21(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + projectBySlugAndOrganizationId(_$root, { + $slug, + $organizationId + }) { + return resource_projectPgResource.get({ + slug: $slug, + organization_id: $organizationId + }); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed21(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + member(_$root, { + $rowId + }) { + return resource_memberPgResource.get({ + id: $rowId + }); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed21(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } - } - }, - 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); - } + memberByUserIdAndOrganizationId(_$root, { + $userId, + $organizationId + }) { + return resource_memberPgResource.get({ + user_id: $userId, + organization_id: $organizationId + }); }, - 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); - } + post(_$root, { + $rowId + }) { + return resource_postPgResource.get({ + id: $rowId + }); }, - 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); - } + postStatus(_$root, { + $rowId + }) { + return resource_post_statusPgResource.get({ + id: $rowId + }); }, - 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); - } + user(_$root, { + $rowId + }) { + return resource_userPgResource.get({ + id: $rowId + }); }, - 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); - } + userByEmail(_$root, { + $email + }) { + return resource_userPgResource.get({ + email: $email + }); }, - 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); - } + userByHidraId(_$root, { + $hidraId + }) { + return resource_userPgResource.get({ + hidra_id: $hidraId + }); }, - 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); - } + userByUsername(_$root, { + $username + }) { + return resource_userPgResource.get({ + username: $username + }); }, - 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" + downvotes: { + plan() { + return connection(resource_downvotePgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + upvotes: { + plan() { + return connection(resource_upvotePgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed2(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + invitations: { + plan() { + return connection(resource_invitationPgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed3(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + organizations: { + plan() { + return connection(resource_organizationPgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed4(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + comments: { + plan() { + return connection(resource_commentPgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed5(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + projects: { + plan() { + return connection(resource_projectPgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed6(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + members: { + plan() { + return connection(resource_memberPgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed7(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + posts: { + plan() { + return connection(resource_postPgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed8(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + postStatuses: { + plan() { + return connection(resource_post_statusPgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed9(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + users: { + plan() { + return connection(resource_userPgResource.find()); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed10(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } + } + }, + Downvote: { + __assertStep: assertPgClassSingleStep, + rowId($record) { + return $record.get("id"); }, - 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); - } + postId($record) { + return $record.get("post_id"); }, - 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); - } + 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); - } + post($record) { + return resource_postPgResource.get({ + id: $record.get("post_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 resource_userPgResource.get({ + id: $record.get("user_id") + }); + } + }, + UUID: { + serialize: UUIDSerialize, + parseValue(value) { + return coerce("" + value); }, - 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); - } + 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; + } + }, + Post: { + __assertStep: assertPgClassSingleStep, + rowId($record) { + return $record.get("id"); }, - 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); - } + projectId($record) { + return $record.get("project_id"); }, - 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); - } + userId($record) { + return $record.get("user_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); - } + statusId($record) { + return $record.get("status_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); - } + statusUpdatedAt($record) { + return $record.get("status_updated_at"); }, - 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); - } + project($record) { + return resource_projectPgResource.get({ + id: $record.get("project_id") + }); }, - 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); - } + status($record) { + return resource_post_statusPgResource.get({ + id: $record.get("status_id") + }); }, - 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); - } + user($record) { + return resource_userPgResource.get({ + id: $record.get("user_id") + }); }, - 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" + upvotes: { + plan($record) { + const $records = resource_upvotePgResource.find({ + post_id: $record.get("id") + }); + return connection($records); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed11(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + comments: { + plan($record) { + const $records = resource_commentPgResource.find({ + post_id: $record.get("id") + }); + return connection($records); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed12(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + downvotes: { + plan($record) { + const $records = resource_downvotePgResource.find({ + post_id: $record.get("id") + }); + return connection($records); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed13(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } + } + }, + Project: { + __assertStep: assertPgClassSingleStep, + rowId($record) { + return $record.get("id"); }, - 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); - } + organizationId($record) { + return $record.get("organization_id"); }, - 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" - }); - $where.where(fragment); - } + createdAt($record) { + return $record.get("created_at"); }, - 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" - }); - $where.where(fragment); - } + updatedAt($record) { + return $record.get("updated_at"); }, - 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); - } + organization($record) { + return resource_organizationPgResource.get({ + id: $record.get("organization_id") + }); }, - 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" + posts: { + plan($record) { + const $records = resource_postPgResource.find({ + project_id: $record.get("id") + }); + return connection($records); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed14(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + postStatuses: { + plan($record) { + const $records = resource_post_statusPgResource.find({ + project_id: $record.get("id") + }); + return connection($records); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed15(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } + } + }, + Organization: { + __assertStep: assertPgClassSingleStep, + rowId($record) { + return $record.get("id"); }, - 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); - } + createdAt($record) { + return $record.get("created_at"); }, - 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); - } + updatedAt($record) { + return $record.get("updated_at"); }, - 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" + projects: { + plan($record) { + const $records = resource_projectPgResource.find({ + organization_id: $record.get("id") + }); + return connection($records); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed16(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + members: { + plan($record) { + const $records = resource_memberPgResource.find({ + organization_id: $record.get("id") + }); + return connection($records); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed17(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } }, - 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" + invitations: { + plan($record) { + const $records = resource_invitationPgResource.find({ + organization_id: $record.get("id") + }); + return connection($records); + }, + args: { + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); + }, + last(_, $connection, val) { + $connection.setLast(val.getRaw()); + }, + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); + }, + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); + }, + after(_, $connection, val) { + $connection.setAfter(val.getRaw()); + }, + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); + }, + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed18(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; }); - $where.where(fragment); + }, + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); + } } } }, - 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); - } + ProjectConnection: { + __assertStep: ConnectionStep, + totalCount($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").singleAsRecord().select(sql`count(*)`, TYPES.bigint, !1); }, - 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); - } + aggregates($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate").single(); }, - 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); + groupedAggregates: { + plan($connection) { + return $connection.cloneSubplanWithoutPagination("aggregate"); + }, + args: { + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); + }, + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); + } } + } + }, + ProjectEdge: { + __assertStep: assertEdgeCapableStep, + cursor($edge) { + return $edge.cursor(); }, - 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); - } + node($edge) { + return $edge.node(); + } + }, + 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; + } + }, + PageInfo: { + __assertStep: assertPageInfoCapableStep, + hasNextPage($pageInfo) { + return $pageInfo.hasNextPage(); }, - 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); - } + hasPreviousPage($pageInfo) { + return $pageInfo.hasPreviousPage(); }, - 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); - } + startCursor($pageInfo) { + return $pageInfo.startCursor(); }, - 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); - } + endCursor($pageInfo) { + return $pageInfo.endCursor(); + } + }, + ProjectAggregates: { + __assertStep: assertPgClassSingleStep, + keys($pgSelectSingle) { + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, - 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); - } + distinctCount($pgSelectSingle) { + return $pgSelectSingle; + } + }, + ProjectDistinctCountAggregates: { + rowId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("id")}`, + sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.uuid); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, - 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); - } + name($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("name")}`, + sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, - 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); - } + image($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("image")}`, + sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, - 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); - } - } - }, - ProjectToManyPostFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed22(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()); - } + slug($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("slug")}`, + sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed22(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); - } + description($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("description")}`, + sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed22(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); - } + organizationId($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("organization_id")}`, + sqlAggregate = spec.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); - } + createdAt($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("created_at")}`, + sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + updatedAt($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("updated_at")}`, + sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.timestamptz); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); } }, - 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 = colSpec9; - fieldArgs.apply($col); - } + 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; + } + }, + ProjectGroupBy: { + NAME($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("name")}`, + codec: TYPES.text + }); }, - 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 = colSpec10; - fieldArgs.apply($col); - } + IMAGE($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("image")}`, + codec: TYPES.text + }); }, - 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 = colSpec11; - fieldArgs.apply($col); - } + SLUG($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("slug")}`, + codec: TYPES.text + }); }, - 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 = colSpec12; - fieldArgs.apply($col); - } + DESCRIPTION($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("description")}`, + codec: TYPES.text + }); }, - 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 = colSpec13; - fieldArgs.apply($col); - } + ORGANIZATION_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("organization_id")}`, + codec: TYPES.uuid + }); }, - 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); - } + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - 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); - } + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - statusId: { - 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); - } + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - statusUpdatedAt: { - 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); - } + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - upvotes: { - applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: upvoteIdentifier, - alias: resource_upvotePgResource.name, - localAttributes: registryConfig.pgRelations.post.upvotesByTheirPostId.localAttributes, - remoteAttributes: registryConfig.pgRelations.post.upvotesByTheirPostId.remoteAttributes - }; - fieldArgs.apply($rel); - } + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - upvotesExist: { - applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: upvoteIdentifier, - alias: resource_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)}`); - }); - } + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); + } + }, + ProjectHavingInput: { + AND($where) { + return $where; }, - comments: { - applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: commentIdentifier, - alias: resource_commentPgResource.name, - localAttributes: registryConfig.pgRelations.post.commentsByTheirPostId.localAttributes, - remoteAttributes: registryConfig.pgRelations.post.commentsByTheirPostId.remoteAttributes - }; - fieldArgs.apply($rel); - } + OR($where) { + return new PgOrFilter($where); }, - commentsExist: { - applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: commentIdentifier, - alias: resource_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)}`); - }); - } + sum($having) { + return $having; }, - downvotes: { - applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: downvoteIdentifier, - alias: resource_downvotePgResource.name, - localAttributes: registryConfig.pgRelations.post.downvotesByTheirPostId.localAttributes, - remoteAttributes: registryConfig.pgRelations.post.downvotesByTheirPostId.remoteAttributes - }; - fieldArgs.apply($rel); - } + distinctCount($having) { + return $having; }, - downvotesExist: { - applyPlan($where, fieldArgs) { - assertAllowed23(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: downvoteIdentifier, - alias: resource_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)}`); - }); - } + min($having) { + return $having; }, - project: { - applyPlan($where, fieldArgs) { - assertAllowed24(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: projectIdentifier, - alias: resource_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); - } + max($having) { + return $having; }, - status: { - applyPlan($where, fieldArgs) { - assertAllowed24(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: postStatusIdentifier, - alias: resource_post_statusPgResource.name - }); - registryConfig.pgRelations.post.postStatusByMyStatusId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.post.postStatusByMyStatusId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); - } + average($having) { + return $having; }, - statusExists: { - applyPlan($where, fieldArgs) { - assertAllowed24(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: postStatusIdentifier, - alias: resource_post_statusPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.post.postStatusByMyStatusId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.post.postStatusByMyStatusId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - } + stddevSample($having) { + return $having; }, - user: { - applyPlan($where, fieldArgs) { - assertAllowed24(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: userIdentifier, - alias: resource_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); - } + stddevPopulation($having) { + return $having; }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed25(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + varianceSample($having) { + return $having; }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed25(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + variancePopulation($having) { + return $having; + } + }, + ProjectHavingSumInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed25(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, - PostToManyUpvoteFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed26(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()); - } + HavingDatetimeFilter: { + equalTo($booleanFilter, input) { + if (input == null) return; + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix()} ${sqlValueWithCodec(input, TYPES.timestamptz)})`); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed26(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); - } + notEqualTo($booleanFilter, input) { + if (input == null) return; + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix2()} ${sqlValueWithCodec(input, TYPES.timestamptz)})`); }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed26(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); - } + greaterThan($booleanFilter, input) { + if (input == null) return; + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix3()} ${sqlValueWithCodec(input, TYPES.timestamptz)})`); }, - 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); - } + greaterThanOrEqualTo($booleanFilter, input) { + if (input == null) return; + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix4()} ${sqlValueWithCodec(input, TYPES.timestamptz)})`); + }, + lessThan($booleanFilter, input) { + if (input == null) return; + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix5()} ${sqlValueWithCodec(input, TYPES.timestamptz)})`); + }, + lessThanOrEqualTo($booleanFilter, input) { + if (input == null) return; + $booleanFilter.having(sql`(${sql.parens($booleanFilter.expression)} ${infix6()} ${sqlValueWithCodec(input, TYPES.timestamptz)})`); } }, - 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 = colSpec18; - fieldArgs.apply($col); - } - }, - 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 = colSpec19; - fieldArgs.apply($col); - } + ProjectHavingDistinctCountInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - 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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + ProjectHavingMinInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - 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 = colSpec21; - fieldArgs.apply($col); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + ProjectHavingMaxInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($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 = colSpec22; - fieldArgs.apply($col); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + ProjectHavingAverageInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - post: { - applyPlan($where, fieldArgs) { - assertAllowed27(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: postIdentifier, - alias: resource_postPgResource.name - }); - 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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + ProjectHavingStddevSampleInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - user: { - applyPlan($where, fieldArgs) { - assertAllowed27(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: userIdentifier, - alias: resource_userPgResource.name - }); - 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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + ProjectHavingStddevPopulationInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed28(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + ProjectHavingVarianceSampleInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed28(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + ProjectHavingVariancePopulationInput: { + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_project.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed28(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_project.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, - 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 = colSpec23; - fieldArgs.apply($col); - } + ProjectCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); }, - 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 = colSpec24; - fieldArgs.apply($col); - } + name($condition, val) { + $condition.where({ + type: "attribute", + attribute: "name", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); }, - 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 = colSpec25; - fieldArgs.apply($col); - } + image($condition, val) { + $condition.where({ + type: "attribute", + attribute: "image", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); }, - 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 = colSpec26; - fieldArgs.apply($col); - } + slug($condition, val) { + $condition.where({ + type: "attribute", + attribute: "slug", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); }, - 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 = colSpec27; - fieldArgs.apply($col); - } + description($condition, val) { + $condition.where({ + type: "attribute", + attribute: "description", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); }, - 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 = colSpec28; - fieldArgs.apply($col); - } + organizationId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "organization_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); }, - 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 = colSpec29; - fieldArgs.apply($col); - } + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); }, - email: { - 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); - } + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + } + }, + ProjectFilter: { + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec; + return condition; + }, + name(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec2; + return condition; + }, + image(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec3; + return condition; + }, + slug(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec4; + return condition; + }, + description(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec5; + return condition; + }, + organizationId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec6; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec7; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec8; + return condition; + }, + posts($where, value) { + assertAllowed19(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: postIdentifier, + alias: resource_postPgResource.name, + localAttributes: registryConfig.pgRelations.project.postsByTheirProjectId.localAttributes, + remoteAttributes: registryConfig.pgRelations.project.postsByTheirProjectId.remoteAttributes + }; + return $rel; + }, + postsExist($where, value) { + assertAllowed19(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: resource_postPgResource.name, + equals: value + }); + 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)}`); + }); }, - posts: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: postIdentifier, - alias: resource_postPgResource.name, - localAttributes: registryConfig.pgRelations.user.postsByTheirUserId.localAttributes, - remoteAttributes: registryConfig.pgRelations.user.postsByTheirUserId.remoteAttributes - }; - fieldArgs.apply($rel); - } + postStatuses($where, value) { + assertAllowed19(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: postStatusIdentifier, + alias: resource_post_statusPgResource.name, + localAttributes: registryConfig.pgRelations.project.postStatusesByTheirProjectId.localAttributes, + remoteAttributes: registryConfig.pgRelations.project.postStatusesByTheirProjectId.remoteAttributes + }; + return $rel; + }, + postStatusesExist($where, value) { + assertAllowed19(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postStatusIdentifier, + alias: resource_post_statusPgResource.name, + equals: value + }); + registryConfig.pgRelations.project.postStatusesByTheirProjectId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.project.postStatusesByTheirProjectId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); }, - postsExist: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: postIdentifier, - alias: resource_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)}`); - }); - } + organization($where, value) { + assertAllowed20(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: organizationIdentifier, + alias: resource_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)}`); + }); + return $subQuery; }, - upvotes: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: upvoteIdentifier, - alias: resource_upvotePgResource.name, - localAttributes: registryConfig.pgRelations.user.upvotesByTheirUserId.localAttributes, - remoteAttributes: registryConfig.pgRelations.user.upvotesByTheirUserId.remoteAttributes - }; - fieldArgs.apply($rel); - } + and($where, value) { + assertAllowed21(value, "list"); + if (value == null) return; + return $where.andPlan(); }, - upvotesExist: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: upvoteIdentifier, - alias: resource_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)}`); - }); - } + or($where, value) { + assertAllowed21(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); }, - members: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: memberIdentifier, - alias: resource_memberPgResource.name, - localAttributes: registryConfig.pgRelations.user.membersByTheirUserId.localAttributes, - remoteAttributes: registryConfig.pgRelations.user.membersByTheirUserId.remoteAttributes - }; - fieldArgs.apply($rel); - } + not($where, value) { + assertAllowed21(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); + } + }, + UUIDFilter: { + isNull($where, value) { + 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."); + if (value === 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] = [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec ? resolveInputCodec(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue ? resolveSqlValue($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + }, + equalTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve2(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + }, + notEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve3(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + }, + distinctFrom($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve4(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); + }, + notDistinctFrom($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve5(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + }, + in($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec3 ? resolveInputCodec3(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve6(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); + }, + notIn($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec3 ? resolveInputCodec3(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve7(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); + }, + lessThan($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve8(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + }, + lessThanOrEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve9(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); + }, + greaterThan($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve10(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + }, + greaterThanOrEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec2 ? resolveInputCodec2(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve11(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); + } + }, + StringFilter: { + isNull($where, value) { + 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."); + if (value === 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] = [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec4 ? resolveInputCodec4(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue2 ? resolveSqlValue2($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve12(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + }, + equalTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve13(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + }, + notEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve14(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + }, + distinctFrom($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve15(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); + }, + notDistinctFrom($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve16(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + }, + in($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec6 ? resolveInputCodec6(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve17(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); + }, + notIn($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec6 ? resolveInputCodec6(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve18(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); + }, + lessThan($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve19(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + }, + lessThanOrEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve20(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); + }, + greaterThan($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve21(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + }, + greaterThanOrEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve22(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); + }, + includes($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput ? resolveInput(value) : value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve23(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "includes" + }); + $where.where(fragment); + }, + notIncludes($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput2 ? resolveInput2(value) : value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve24(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIncludes" + }); + $where.where(fragment); + }, + includesInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput3 ? resolveInput3(value) : value, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve25(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "includesInsensitive" + }); + $where.where(fragment); + }, + notIncludesInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput4 ? resolveInput4(value) : value, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve26(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIncludesInsensitive" + }); + $where.where(fragment); + }, + startsWith($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput5 ? resolveInput5(value) : value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve27(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "startsWith" + }); + $where.where(fragment); + }, + notStartsWith($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput6 ? resolveInput6(value) : value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve28(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notStartsWith" + }); + $where.where(fragment); + }, + startsWithInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput7 ? resolveInput7(value) : value, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve29(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "startsWithInsensitive" + }); + $where.where(fragment); + }, + notStartsWithInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput8 ? resolveInput8(value) : value, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve30(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notStartsWithInsensitive" + }); + $where.where(fragment); + }, + endsWith($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput9 ? resolveInput9(value) : value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve31(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "endsWith" + }); + $where.where(fragment); + }, + notEndsWith($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput10 ? resolveInput10(value) : value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve32(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEndsWith" + }); + $where.where(fragment); + }, + endsWithInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput11 ? resolveInput11(value) : value, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve33(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "endsWithInsensitive" + }); + $where.where(fragment); + }, + notEndsWithInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = resolveInput12 ? resolveInput12(value) : value, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve34(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEndsWithInsensitive" + }); + $where.where(fragment); + }, + like($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve35(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "like" + }); + $where.where(fragment); + }, + notLike($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec5 ? resolveInputCodec5(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve36(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notLike" + }); + $where.where(fragment); + }, + likeInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve37(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "likeInsensitive" + }); + $where.where(fragment); + }, + notLikeInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec7 ? resolveInputCodec7(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve38(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notLikeInsensitive" + }); + $where.where(fragment); + }, + equalToInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec8 ? resolveInputCodec8(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue3 ? resolveSqlValue3($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve13(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalToInsensitive" + }); + $where.where(fragment); + }, + notEqualToInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec9 ? resolveInputCodec9(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue4 ? resolveSqlValue4($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve14(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualToInsensitive" + }); + $where.where(fragment); + }, + distinctFromInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec10 ? resolveInputCodec10(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue5 ? resolveSqlValue5($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve15(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFromInsensitive" + }); + $where.where(fragment); + }, + notDistinctFromInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec11 ? resolveInputCodec11(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue6 ? resolveSqlValue6($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve16(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFromInsensitive" + }); + $where.where(fragment); + }, + inInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec12 ? resolveInputCodec12(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue7 ? resolveSqlValue7($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve17(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "inInsensitive" + }); + $where.where(fragment); + }, + notInInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec13 ? resolveInputCodec13(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue8 ? resolveSqlValue8($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve18(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notInInsensitive" + }); + $where.where(fragment); + }, + lessThanInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec14 ? resolveInputCodec14(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue9 ? resolveSqlValue9($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve19(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanInsensitive" + }); + $where.where(fragment); + }, + lessThanOrEqualToInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec15 ? resolveInputCodec15(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue10 ? resolveSqlValue10($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve20(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualToInsensitive" + }); + $where.where(fragment); + }, + greaterThanInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec16 ? resolveInputCodec16(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue11 ? resolveSqlValue11($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve21(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanInsensitive" + }); + $where.where(fragment); + }, + greaterThanOrEqualToInsensitive($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec17 ? resolveInputCodec17(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue12 ? resolveSqlValue12($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve22(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualToInsensitive" + }); + $where.where(fragment); + } + }, + DatetimeFilter: { + isNull($where, value) { + 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."); + if (value === 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] = [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec18 ? resolveInputCodec18(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue13 ? resolveSqlValue13($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve39(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + }, + equalTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve40(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + }, + notEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve41(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + }, + distinctFrom($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve42(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); + }, + notDistinctFrom($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve43(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + }, + in($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec20 ? resolveInputCodec20(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve44(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); + }, + notIn($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec20 ? resolveInputCodec20(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve45(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); + }, + lessThan($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve46(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + }, + lessThanOrEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve47(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); + }, + greaterThan($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve48(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + }, + greaterThanOrEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec19 ? resolveInputCodec19(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve49(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); + } + }, + ProjectToManyPostFilter: { + every($where, value) { + assertAllowed22(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - membersExist: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: memberIdentifier, - alias: resource_memberPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.user.membersByTheirUserId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.user.membersByTheirUserId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - } + some($where, value) { + assertAllowed22(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - comments: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: commentIdentifier, - alias: resource_commentPgResource.name, - localAttributes: registryConfig.pgRelations.user.commentsByTheirUserId.localAttributes, - remoteAttributes: registryConfig.pgRelations.user.commentsByTheirUserId.remoteAttributes - }; - fieldArgs.apply($rel); - } + none($where, value) { + assertAllowed22(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - commentsExist: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: commentIdentifier, - alias: resource_commentPgResource.name, - $equals: fieldArgs.get() - }); - 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)}`); - }); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; + } + }, + PostFilter: { + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec9; + return condition; + }, + title(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec10; + return condition; + }, + description(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec11; + return condition; + }, + projectId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec12; + return condition; + }, + userId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec13; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec14; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec15; + return condition; + }, + statusId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec16; + return condition; + }, + statusUpdatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec17; + return condition; + }, + upvotes($where, value) { + assertAllowed23(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: upvoteIdentifier, + alias: resource_upvotePgResource.name, + localAttributes: registryConfig.pgRelations.post.upvotesByTheirPostId.localAttributes, + remoteAttributes: registryConfig.pgRelations.post.upvotesByTheirPostId.remoteAttributes + }; + return $rel; + }, + upvotesExist($where, value) { + assertAllowed23(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: upvoteIdentifier, + alias: resource_upvotePgResource.name, + equals: value + }); + 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)}`); + }); }, - downvotes: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: downvoteIdentifier, - alias: resource_downvotePgResource.name, - localAttributes: registryConfig.pgRelations.user.downvotesByTheirUserId.localAttributes, - remoteAttributes: registryConfig.pgRelations.user.downvotesByTheirUserId.remoteAttributes - }; - fieldArgs.apply($rel); - } + comments($where, value) { + assertAllowed23(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: commentIdentifier, + alias: resource_commentPgResource.name, + localAttributes: registryConfig.pgRelations.post.commentsByTheirPostId.localAttributes, + remoteAttributes: registryConfig.pgRelations.post.commentsByTheirPostId.remoteAttributes + }; + return $rel; + }, + commentsExist($where, value) { + assertAllowed23(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: commentIdentifier, + alias: resource_commentPgResource.name, + equals: value + }); + 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)}`); + }); }, - downvotesExist: { - applyPlan($where, fieldArgs) { - assertAllowed29(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: downvoteIdentifier, - alias: resource_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)}`); - }); - } + downvotes($where, value) { + assertAllowed23(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: downvoteIdentifier, + alias: resource_downvotePgResource.name, + localAttributes: registryConfig.pgRelations.post.downvotesByTheirPostId.localAttributes, + remoteAttributes: registryConfig.pgRelations.post.downvotesByTheirPostId.remoteAttributes + }; + return $rel; + }, + downvotesExist($where, value) { + assertAllowed23(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: downvoteIdentifier, + alias: resource_downvotePgResource.name, + equals: value + }); + 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)}`); + }); }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed30(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + project($where, value) { + assertAllowed24(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: projectIdentifier, + alias: resource_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)}`); + }); + return $subQuery; + }, + status($where, value) { + assertAllowed24(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postStatusIdentifier, + alias: resource_post_statusPgResource.name + }); + registryConfig.pgRelations.post.postStatusByMyStatusId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.post.postStatusByMyStatusId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + return $subQuery; + }, + statusExists($where, value) { + assertAllowed24(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postStatusIdentifier, + alias: resource_post_statusPgResource.name, + equals: value + }); + registryConfig.pgRelations.post.postStatusByMyStatusId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.post.postStatusByMyStatusId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed30(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + user($where, value) { + assertAllowed24(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: resource_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)}`); + }); + return $subQuery; }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed30(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } + and($where, value) { + assertAllowed25(value, "list"); + if (value == null) return; + return $where.andPlan(); + }, + or($where, value) { + assertAllowed25(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); + }, + not($where, value) { + assertAllowed25(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); } }, - UserToManyPostFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed31(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()); - } + PostToManyUpvoteFilter: { + every($where, value) { + assertAllowed26(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed31(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); - } + some($where, value) { + assertAllowed26(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed31(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); - } + none($where, value) { + assertAllowed26(value, "object"); + if (value == null) return; + 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)}`); + }); + return $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); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; } }, - PostAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } + UpvoteFilter: { + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec18; + return condition; + }, + postId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec19; + return condition; + }, + userId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec20; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec21; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec22; + return condition; + }, + post($where, value) { + assertAllowed27(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: resource_postPgResource.name + }); + 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)}`); + }); + return $subQuery; + }, + user($where, value) { + assertAllowed27(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: resource_userPgResource.name + }); + 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)}`); + }); + return $subQuery; }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(spec)); - } + and($where, value) { + assertAllowed28(value, "list"); + if (value == null) return; + return $where.andPlan(); + }, + or($where, value) { + assertAllowed28(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); + }, + not($where, value) { + assertAllowed28(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); } }, - PostDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.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: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("title")}`, spec_post.attributes.title.codec) - }; - fieldArgs.apply($col); - } + UserFilter: { + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec23; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec24; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec25; + return condition; + }, + hidraId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec26; + return condition; + }, + username(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec27; + return condition; + }, + firstName(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec28; + return condition; + }, + lastName(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec29; + return condition; + }, + email(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec30; + return condition; + }, + tier(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec31; + return condition; + }, + posts($where, value) { + assertAllowed29(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: postIdentifier, + alias: resource_postPgResource.name, + localAttributes: registryConfig.pgRelations.user.postsByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.postsByTheirUserId.remoteAttributes + }; + return $rel; + }, + postsExist($where, value) { + assertAllowed29(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: resource_postPgResource.name, + equals: value + }); + 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)}`); + }); }, - description: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_post.attributes.description.codec) - }; - fieldArgs.apply($col); - } + upvotes($where, value) { + assertAllowed29(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: upvoteIdentifier, + alias: resource_upvotePgResource.name, + localAttributes: registryConfig.pgRelations.user.upvotesByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.upvotesByTheirUserId.remoteAttributes + }; + return $rel; + }, + upvotesExist($where, value) { + assertAllowed29(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: upvoteIdentifier, + alias: resource_upvotePgResource.name, + equals: value + }); + 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)}`); + }); }, - projectId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec) - }; - fieldArgs.apply($col); - } + members($where, value) { + assertAllowed29(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: memberIdentifier, + alias: resource_memberPgResource.name, + localAttributes: registryConfig.pgRelations.user.membersByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.membersByTheirUserId.remoteAttributes + }; + return $rel; + }, + membersExist($where, value) { + assertAllowed29(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: memberIdentifier, + alias: resource_memberPgResource.name, + equals: value + }); + registryConfig.pgRelations.user.membersByTheirUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.user.membersByTheirUserId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); }, - userId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec) - }; - fieldArgs.apply($col); - } + comments($where, value) { + assertAllowed29(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: commentIdentifier, + alias: resource_commentPgResource.name, + localAttributes: registryConfig.pgRelations.user.commentsByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.commentsByTheirUserId.remoteAttributes + }; + return $rel; + }, + commentsExist($where, value) { + assertAllowed29(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: commentIdentifier, + alias: resource_commentPgResource.name, + equals: value + }); + 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)}`); + }); }, - createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec) - }; - fieldArgs.apply($col); - } + downvotes($where, value) { + assertAllowed29(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: downvoteIdentifier, + alias: resource_downvotePgResource.name, + localAttributes: registryConfig.pgRelations.user.downvotesByTheirUserId.localAttributes, + remoteAttributes: registryConfig.pgRelations.user.downvotesByTheirUserId.remoteAttributes + }; + return $rel; + }, + downvotesExist($where, value) { + assertAllowed29(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: downvoteIdentifier, + alias: resource_downvotePgResource.name, + equals: value + }); + 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)}`); + }); }, - updatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec) - }; - fieldArgs.apply($col); - } + and($where, value) { + assertAllowed30(value, "list"); + if (value == null) return; + return $where.andPlan(); }, - statusId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec) - }; - fieldArgs.apply($col); - } + or($where, value) { + assertAllowed30(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); }, - statusUpdatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec) - }; - fieldArgs.apply($col); - } + not($where, value) { + assertAllowed30(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); } }, - 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); - } - }, - 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] = 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); - } - }, - 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] = 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); - } - }, - 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] = 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); - } - }, - 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] = 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); - } - }, - 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] = 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); - } - }, - 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); - } + TierFilter: { + isNull($where, value) { + 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."); + if (value === 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] = [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec21 ? resolveInputCodec21(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue14 ? resolveSqlValue14($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve50(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + }, + equalTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve51(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + }, + notEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve52(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + }, + distinctFrom($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve53(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); + }, + notDistinctFrom($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve54(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + }, + in($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec23 ? resolveInputCodec23(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve55(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); + }, + notIn($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec23 ? resolveInputCodec23(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve56(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); + }, + lessThan($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve57(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + }, + lessThanOrEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve58(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); + }, + greaterThan($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve59(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + }, + greaterThanOrEqualTo($where, value) { + 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."); + if (value === 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 (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec22 ? resolveInputCodec22(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve60(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); + } + }, + UserToManyPostFilter: { + every($where, value) { + assertAllowed31(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - 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); - } + some($where, value) { + assertAllowed31(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - 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] = 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" - }); - $where.where(fragment); - } + none($where, value) { + assertAllowed31(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - 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] = 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" - }); - $where.where(fragment); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; + } + }, + PostAggregatesFilter: { + filter($subquery, input) { + if (input == null) return; + return new PgCondition($subquery, !1, "AND"); }, - 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] = 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" - }); - $where.where(fragment); - } + distinctCount($subquery, input) { + if (input == null) return; + return $subquery.forAggregate(spec); + } + }, + PostDistinctCountAggregateFilter: { + rowId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_post.attributes.id.codec) + }; + return $col; + }, + title($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("title")}`, spec_post.attributes.title.codec) + }; + return $col; + }, + description($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_post.attributes.description.codec) + }; + return $col; + }, + projectId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec) + }; + return $col; + }, + userId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec) + }; + return $col; + }, + createdAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec) + }; + return $col; + }, + updatedAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec) + }; + return $col; + }, + statusId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec) + }; + return $col; + }, + statusUpdatedAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec) + }; + return $col; + } + }, + BigIntFilter: { + isNull($where, value) { + 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."); + if (value === 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] = [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec24 ? resolveInputCodec24(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue15 ? resolveSqlValue15($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve61(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + }, + equalTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve62(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + }, + notEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve63(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + }, + distinctFrom($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve64(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); + }, + notDistinctFrom($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve65(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + }, + in($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec26 ? resolveInputCodec26(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve66(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); + }, + notIn($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec26 ? resolveInputCodec26(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve67(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); + }, + lessThan($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve68(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + }, + lessThanOrEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve69(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); + }, + greaterThan($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve70(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + }, + greaterThanOrEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve71(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); } }, UserToManyUpvoteFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed32(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()); - } + every($where, value) { + assertAllowed32(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed32(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); - } + some($where, value) { + assertAllowed32(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed32(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); - } + none($where, value) { + assertAllowed32(value, "object"); + if (value == null) return; + 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)}`); + }); + return $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); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; } }, UpvoteAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } + filter($subquery, input) { + if (input == null) return; + return new PgCondition($subquery, !1, "AND"); }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(spec)); - } + distinctCount($subquery, input) { + if (input == null) return; + return $subquery.forAggregate(spec); } }, UpvoteDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.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: spec.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: spec.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: spec.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: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec) - }; - fieldArgs.apply($col); - } + rowId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec) + }; + return $col; + }, + postId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec) + }; + return $col; + }, + userId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec) + }; + return $col; + }, + createdAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec) + }; + return $col; + }, + updatedAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec) + }; + return $col; } }, UserToManyMemberFilter: { - 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()); - } + every($where, value) { + assertAllowed33(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - 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); - } + some($where, value) { + assertAllowed33(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - 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); - } + none($where, value) { + assertAllowed33(value, "object"); + if (value == null) return; + 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)}`); + }); + return $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); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; } }, MemberFilter: { - 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 = colSpec31; - fieldArgs.apply($col); - } - }, - 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 = colSpec32; - 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 = colSpec33; - fieldArgs.apply($col); - } - }, - role: { - 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); - } - }, - 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 = colSpec35; - fieldArgs.apply($col); - } - }, - organization: { - applyPlan($where, fieldArgs) { - assertAllowed34(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: organizationIdentifier, - alias: resource_organizationPgResource.name - }); - registryConfig.pgRelations.member.organizationByMyOrganizationId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.member.organizationByMyOrganizationId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); - } - }, - user: { - applyPlan($where, fieldArgs) { - assertAllowed34(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: userIdentifier, - alias: resource_userPgResource.name - }); - registryConfig.pgRelations.member.userByMyUserId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.member.userByMyUserId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); - } + userId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec32; + return condition; + }, + organizationId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec33; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec34; + return condition; + }, + role(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec35; + return condition; + }, + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec36; + return condition; + }, + organization($where, value) { + assertAllowed34(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: organizationIdentifier, + alias: resource_organizationPgResource.name + }); + registryConfig.pgRelations.member.organizationByMyOrganizationId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.member.organizationByMyOrganizationId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + return $subQuery; + }, + user($where, value) { + assertAllowed34(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: resource_userPgResource.name + }); + registryConfig.pgRelations.member.userByMyUserId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.member.userByMyUserId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + return $subQuery; }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed35(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + and($where, value) { + assertAllowed35(value, "list"); + if (value == null) return; + return $where.andPlan(); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed35(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + or($where, value) { + assertAllowed35(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed35(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } + not($where, value) { + assertAllowed35(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); } }, RoleFilter: { - 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 = resolveInputCodec24 ? resolveInputCodec24(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue15 ? resolveSqlValue15($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve61(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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve62(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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve63(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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve64(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "distinctFrom" - }); - $where.where(fragment); - } - }, - 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve65(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notDistinctFrom" - }); - $where.where(fragment); - } - }, - 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec26 ? resolveInputCodec26(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve66(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "in" - }); - $where.where(fragment); - } - }, - 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec26 ? resolveInputCodec26(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve67(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notIn" - }); - $where.where(fragment); - } - }, - 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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve68(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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve69(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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve70(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] = resolveSqlIdentifier16 ? resolveSqlIdentifier16(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 = resolveInputCodec25 ? resolveInputCodec25(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve71(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThanOrEqualTo" - }); - $where.where(fragment); - } + isNull($where, value) { + 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."); + if (value === 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] = [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec27 ? resolveInputCodec27(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue16 ? resolveSqlValue16($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve72(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + }, + equalTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve73(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + }, + notEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve74(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + }, + distinctFrom($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve75(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); + }, + notDistinctFrom($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve76(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + }, + in($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec29 ? resolveInputCodec29(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve77(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); + }, + notIn($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec29 ? resolveInputCodec29(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve78(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); + }, + lessThan($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve79(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + }, + lessThanOrEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve80(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); + }, + greaterThan($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve81(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + }, + greaterThanOrEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve82(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); } }, 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 = colSpec36; - 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 = colSpec37; - fieldArgs.apply($col); - } - }, - 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 = colSpec38; - 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 = colSpec39; - 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 = colSpec40; - fieldArgs.apply($col); - } - }, - projects: { - applyPlan($where, fieldArgs) { - assertAllowed36(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: projectIdentifier, - alias: resource_projectPgResource.name, - localAttributes: registryConfig.pgRelations.organization.projectsByTheirOrganizationId.localAttributes, - remoteAttributes: registryConfig.pgRelations.organization.projectsByTheirOrganizationId.remoteAttributes - }; - fieldArgs.apply($rel); - } - }, - projectsExist: { - applyPlan($where, fieldArgs) { - assertAllowed36(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: projectIdentifier, - alias: resource_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)}`); - }); - } - }, - members: { - applyPlan($where, fieldArgs) { - assertAllowed36(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: memberIdentifier, - alias: resource_memberPgResource.name, - localAttributes: registryConfig.pgRelations.organization.membersByTheirOrganizationId.localAttributes, - remoteAttributes: registryConfig.pgRelations.organization.membersByTheirOrganizationId.remoteAttributes - }; - fieldArgs.apply($rel); - } - }, - membersExist: { - applyPlan($where, fieldArgs) { - assertAllowed36(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: memberIdentifier, - alias: resource_memberPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.organization.membersByTheirOrganizationId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.organization.membersByTheirOrganizationId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - } + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec37; + return condition; + }, + name(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec38; + return condition; + }, + slug(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec39; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec40; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec41; + return condition; + }, + projects($where, value) { + assertAllowed36(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: projectIdentifier, + alias: resource_projectPgResource.name, + localAttributes: registryConfig.pgRelations.organization.projectsByTheirOrganizationId.localAttributes, + remoteAttributes: registryConfig.pgRelations.organization.projectsByTheirOrganizationId.remoteAttributes + }; + return $rel; + }, + projectsExist($where, value) { + assertAllowed36(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: projectIdentifier, + alias: resource_projectPgResource.name, + equals: value + }); + 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)}`); + }); }, - invitations: { - applyPlan($where, fieldArgs) { - assertAllowed36(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: invitationIdentifier, - alias: resource_invitationPgResource.name, - localAttributes: registryConfig.pgRelations.organization.invitationsByTheirOrganizationId.localAttributes, - remoteAttributes: registryConfig.pgRelations.organization.invitationsByTheirOrganizationId.remoteAttributes - }; - fieldArgs.apply($rel); - } + members($where, value) { + assertAllowed36(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: memberIdentifier, + alias: resource_memberPgResource.name, + localAttributes: registryConfig.pgRelations.organization.membersByTheirOrganizationId.localAttributes, + remoteAttributes: registryConfig.pgRelations.organization.membersByTheirOrganizationId.remoteAttributes + }; + return $rel; + }, + membersExist($where, value) { + assertAllowed36(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: memberIdentifier, + alias: resource_memberPgResource.name, + equals: value + }); + registryConfig.pgRelations.organization.membersByTheirOrganizationId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.organization.membersByTheirOrganizationId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); }, - invitationsExist: { - applyPlan($where, fieldArgs) { - assertAllowed36(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: invitationIdentifier, - alias: resource_invitationPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.organization.invitationsByTheirOrganizationId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.organization.invitationsByTheirOrganizationId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - } + invitations($where, value) { + assertAllowed36(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: invitationIdentifier, + alias: resource_invitationPgResource.name, + localAttributes: registryConfig.pgRelations.organization.invitationsByTheirOrganizationId.localAttributes, + remoteAttributes: registryConfig.pgRelations.organization.invitationsByTheirOrganizationId.remoteAttributes + }; + return $rel; + }, + invitationsExist($where, value) { + assertAllowed36(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: invitationIdentifier, + alias: resource_invitationPgResource.name, + equals: value + }); + registryConfig.pgRelations.organization.invitationsByTheirOrganizationId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.organization.invitationsByTheirOrganizationId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed37(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + and($where, value) { + assertAllowed37(value, "list"); + if (value == null) return; + return $where.andPlan(); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed37(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + or($where, value) { + assertAllowed37(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed37(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } + not($where, value) { + assertAllowed37(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); } }, OrganizationToManyProjectFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed38(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()); - } + every($where, value) { + assertAllowed38(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed38(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); - } + some($where, value) { + assertAllowed38(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed38(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); - } + none($where, value) { + assertAllowed38(value, "object"); + if (value == null) return; + 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)}`); + }); + return $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); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; } }, ProjectAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } + filter($subquery, input) { + if (input == null) return; + return new PgCondition($subquery, !1, "AND"); }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(spec)); - } + distinctCount($subquery, input) { + if (input == null) return; + return $subquery.forAggregate(spec); } }, ProjectDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.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: spec.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: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("image")}`, spec_project.attributes.image.codec) - }; - fieldArgs.apply($col); - } - }, - slug: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("slug")}`, spec_project.attributes.slug.codec) - }; - fieldArgs.apply($col); - } - }, - description: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_project.attributes.description.codec) - }; - fieldArgs.apply($col); - } - }, - organizationId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.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: spec.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: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_project.attributes.updated_at.codec) - }; - fieldArgs.apply($col); - } + rowId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_project.attributes.id.codec) + }; + return $col; + }, + name($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("name")}`, spec_project.attributes.name.codec) + }; + return $col; + }, + image($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("image")}`, spec_project.attributes.image.codec) + }; + return $col; + }, + slug($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("slug")}`, spec_project.attributes.slug.codec) + }; + return $col; + }, + description($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_project.attributes.description.codec) + }; + return $col; + }, + organizationId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_project.attributes.organization_id.codec) + }; + return $col; + }, + createdAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_project.attributes.created_at.codec) + }; + return $col; + }, + updatedAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_project.attributes.updated_at.codec) + }; + return $col; } }, OrganizationToManyMemberFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed39(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()); - } + every($where, value) { + assertAllowed39(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed39(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); - } + some($where, value) { + assertAllowed39(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed39(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); - } + none($where, value) { + assertAllowed39(value, "object"); + if (value == null) return; + 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)}`); + }); + return $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); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; } }, MemberAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } + filter($subquery, input) { + if (input == null) return; + return new PgCondition($subquery, !1, "AND"); }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(spec)); - } + distinctCount($subquery, input) { + if (input == null) return; + return $subquery.forAggregate(spec); } }, MemberDistinctCountAggregateFilter: { - userId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_member.attributes.user_id.codec) - }; - fieldArgs.apply($col); - } - }, - organizationId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_member.attributes.organization_id.codec) - }; - fieldArgs.apply($col); - } - }, - createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_member.attributes.created_at.codec) - }; - fieldArgs.apply($col); - } - }, - role: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("role")}`, spec_member.attributes.role.codec) - }; - fieldArgs.apply($col); - } - }, - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_member.attributes.id.codec) - }; - fieldArgs.apply($col); - } + userId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_member.attributes.user_id.codec) + }; + return $col; + }, + organizationId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_member.attributes.organization_id.codec) + }; + return $col; + }, + createdAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_member.attributes.created_at.codec) + }; + return $col; + }, + role($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("role")}`, spec_member.attributes.role.codec) + }; + return $col; + }, + rowId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_member.attributes.id.codec) + }; + return $col; } }, OrganizationToManyInvitationFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed40(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()); - } + every($where, value) { + assertAllowed40(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed40(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); - } + some($where, value) { + assertAllowed40(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed40(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); - } + none($where, value) { + assertAllowed40(value, "object"); + if (value == null) return; + 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)}`); + }); + return $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); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; } }, InvitationFilter: { - 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 = colSpec41; - fieldArgs.apply($col); - } - }, - 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 = colSpec42; - fieldArgs.apply($col); - } - }, - email: { - 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); - } - }, - 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 = colSpec44; - 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 = colSpec45; - fieldArgs.apply($col); - } - }, - organization: { - applyPlan($where, fieldArgs) { - assertAllowed41(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: organizationIdentifier, - alias: resource_organizationPgResource.name - }); - registryConfig.pgRelations.invitation.organizationByMyOrganizationId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.invitation.organizationByMyOrganizationId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); - } + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec42; + return condition; + }, + organizationId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec43; + return condition; + }, + email(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec44; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec45; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec46; + return condition; + }, + organization($where, value) { + assertAllowed41(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: organizationIdentifier, + alias: resource_organizationPgResource.name + }); + registryConfig.pgRelations.invitation.organizationByMyOrganizationId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.invitation.organizationByMyOrganizationId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + return $subQuery; }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed42(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + and($where, value) { + assertAllowed42(value, "list"); + if (value == null) return; + return $where.andPlan(); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed42(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + or($where, value) { + assertAllowed42(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed42(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } + not($where, value) { + assertAllowed42(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); } }, InvitationAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } + filter($subquery, input) { + if (input == null) return; + return new PgCondition($subquery, !1, "AND"); }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(spec)); - } + distinctCount($subquery, input) { + if (input == null) return; + return $subquery.forAggregate(spec); } }, InvitationDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_invitation.attributes.id.codec) - }; - fieldArgs.apply($col); - } - }, - organizationId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_invitation.attributes.organization_id.codec) - }; - fieldArgs.apply($col); - } - }, - email: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("email")}`, spec_invitation.attributes.email.codec) - }; - fieldArgs.apply($col); - } - }, - createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_invitation.attributes.created_at.codec) - }; - fieldArgs.apply($col); - } - }, - updatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_invitation.attributes.updated_at.codec) - }; - fieldArgs.apply($col); - } + rowId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_invitation.attributes.id.codec) + }; + return $col; + }, + organizationId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("organization_id")}`, spec_invitation.attributes.organization_id.codec) + }; + return $col; + }, + email($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("email")}`, spec_invitation.attributes.email.codec) + }; + return $col; + }, + createdAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_invitation.attributes.created_at.codec) + }; + return $col; + }, + updatedAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_invitation.attributes.updated_at.codec) + }; + return $col; } }, UserToManyCommentFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed43(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()); - } + every($where, value) { + assertAllowed43(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed43(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); - } + some($where, value) { + assertAllowed43(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed43(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); - } + none($where, value) { + assertAllowed43(value, "object"); + if (value == null) return; + 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)}`); + }); + return $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); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; } }, CommentFilter: { - 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 = colSpec46; - fieldArgs.apply($col); - } + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec47; + return condition; + }, + message(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec48; + return condition; + }, + postId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec49; + return condition; + }, + userId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec50; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec51; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec52; + return condition; + }, + post($where, value) { + assertAllowed44(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: resource_postPgResource.name + }); + 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)}`); + }); + return $subQuery; + }, + user($where, value) { + assertAllowed44(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: resource_userPgResource.name + }); + 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)}`); + }); + return $subQuery; }, - 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 = colSpec47; - fieldArgs.apply($col); - } + and($where, value) { + assertAllowed45(value, "list"); + if (value == null) return; + return $where.andPlan(); }, - 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 = colSpec48; - fieldArgs.apply($col); - } + or($where, value) { + assertAllowed45(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); }, - 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 = colSpec49; - fieldArgs.apply($col); - } + not($where, value) { + assertAllowed45(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); + } + }, + CommentAggregatesFilter: { + filter($subquery, input) { + if (input == null) return; + return new PgCondition($subquery, !1, "AND"); }, - 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 = colSpec50; - fieldArgs.apply($col); - } + distinctCount($subquery, input) { + if (input == null) return; + return $subquery.forAggregate(spec); + } + }, + CommentDistinctCountAggregateFilter: { + rowId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec) + }; + return $col; + }, + message($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec) + }; + return $col; + }, + postId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec) + }; + return $col; + }, + userId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec) + }; + return $col; + }, + createdAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec) + }; + return $col; + }, + updatedAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec) + }; + return $col; + } + }, + UserToManyDownvoteFilter: { + every($where, value) { + assertAllowed46(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - 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 = colSpec51; - fieldArgs.apply($col); - } + some($where, value) { + assertAllowed46(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - post: { - applyPlan($where, fieldArgs) { - assertAllowed44(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: postIdentifier, - alias: resource_postPgResource.name - }); - 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); - } + none($where, value) { + assertAllowed46(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - user: { - applyPlan($where, fieldArgs) { - assertAllowed44(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: userIdentifier, - alias: resource_userPgResource.name - }); - 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); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; + } + }, + DownvoteFilter: { + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec53; + return condition; + }, + postId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec54; + return condition; + }, + userId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec55; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec56; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec57; + return condition; + }, + post($where, value) { + assertAllowed47(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: resource_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)}`); + }); + return $subQuery; + }, + user($where, value) { + assertAllowed47(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: userIdentifier, + alias: resource_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)}`); + }); + return $subQuery; }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed45(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + and($where, value) { + assertAllowed48(value, "list"); + if (value == null) return; + return $where.andPlan(); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed45(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + or($where, value) { + assertAllowed48(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed45(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } + not($where, value) { + assertAllowed48(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); } }, - CommentAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } + DownvoteAggregatesFilter: { + filter($subquery, input) { + if (input == null) return; + return new PgCondition($subquery, !1, "AND"); }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(spec)); - } + distinctCount($subquery, input) { + if (input == null) return; + return $subquery.forAggregate(spec); } }, - CommentDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec) - }; - fieldArgs.apply($col); - } + DownvoteDistinctCountAggregateFilter: { + rowId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec) + }; + return $col; + }, + postId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec) + }; + return $col; + }, + userId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec) + }; + return $col; + }, + createdAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec) + }; + return $col; + }, + updatedAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec) + }; + return $col; + } + }, + PostToManyCommentFilter: { + every($where, value) { + assertAllowed49(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - message: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec) - }; - fieldArgs.apply($col); - } + some($where, value) { + assertAllowed49(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - postId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec) - }; - fieldArgs.apply($col); - } + none($where, value) { + assertAllowed49(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - userId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec) - }; - fieldArgs.apply($col); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; + } + }, + PostToManyDownvoteFilter: { + every($where, value) { + assertAllowed50(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec) - }; - fieldArgs.apply($col); - } + some($where, value) { + assertAllowed50(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - updatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec) - }; - fieldArgs.apply($col); - } + none($where, value) { + assertAllowed50(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; + }, + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; } }, - UserToManyDownvoteFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed46(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()); - } + PostStatusFilter: { + rowId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec58; + return condition; + }, + status(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec59; + return condition; + }, + description(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec60; + return condition; + }, + color(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec61; + return condition; + }, + projectId(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec62; + return condition; + }, + isDefault(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec63; + return condition; + }, + createdAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec64; + return condition; + }, + updatedAt(queryBuilder, value) { + if (value === void 0) return; + if (!true && isEmpty(value)) throw Object.assign(new Error("Empty objects are forbidden in filter argument input."), {}); + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const condition = new PgCondition(queryBuilder); + condition.extensions.pgFilterAttribute = colSpec65; + return condition; + }, + postsByStatusId($where, value) { + assertAllowed51(value, "object"); + const $rel = $where.andPlan(); + $rel.extensions.pgFilterRelation = { + tableExpression: postIdentifier, + alias: resource_postPgResource.name, + localAttributes: registryConfig.pgRelations.postStatus.postsByTheirStatusId.localAttributes, + remoteAttributes: registryConfig.pgRelations.postStatus.postsByTheirStatusId.remoteAttributes + }; + return $rel; + }, + postsByStatusIdExist($where, value) { + assertAllowed51(value, "scalar"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: postIdentifier, + alias: resource_postPgResource.name, + equals: value + }); + registryConfig.pgRelations.postStatus.postsByTheirStatusId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.postStatus.postsByTheirStatusId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed46(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); - } + project($where, value) { + assertAllowed52(value, "object"); + if (value == null) return; + const $subQuery = $where.existsPlan({ + tableExpression: projectIdentifier, + alias: resource_projectPgResource.name + }); + registryConfig.pgRelations.postStatus.projectByMyProjectId.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = registryConfig.pgRelations.postStatus.projectByMyProjectId.remoteAttributes[i]; + $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); + }); + return $subQuery; }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed46(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); - } + and($where, value) { + assertAllowed53(value, "list"); + if (value == null) return; + return $where.andPlan(); }, - 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); - } + or($where, value) { + assertAllowed53(value, "list"); + if (value == null) return; + const $or = $where.orPlan(); + return () => $or.andPlan(); + }, + not($where, value) { + assertAllowed53(value, "object"); + if (value == null) return; + return $where.notPlan().andPlan(); } }, - DownvoteFilter: { - 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 = colSpec52; - fieldArgs.apply($col); - } + BooleanFilter: { + isNull($where, value) { + 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."); + if (value === 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] = [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec30 ? resolveInputCodec30(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = resolveSqlValue17 ? resolveSqlValue17($where, value, inputCodec) : sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve83(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "isNull" + }); + $where.where(fragment); + }, + equalTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec31 ? resolveInputCodec31(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve84(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "equalTo" + }); + $where.where(fragment); + }, + notEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec31 ? resolveInputCodec31(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve85(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notEqualTo" + }); + $where.where(fragment); + }, + distinctFrom($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec31 ? resolveInputCodec31(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve86(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "distinctFrom" + }); + $where.where(fragment); + }, + notDistinctFrom($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec31 ? resolveInputCodec31(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve87(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notDistinctFrom" + }); + $where.where(fragment); + }, + in($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec32 ? resolveInputCodec32(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve88(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "in" + }); + $where.where(fragment); + }, + notIn($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec32 ? resolveInputCodec32(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve89(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "notIn" + }); + $where.where(fragment); + }, + lessThan($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec31 ? resolveInputCodec31(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve90(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThan" + }); + $where.where(fragment); + }, + lessThanOrEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec31 ? resolveInputCodec31(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve91(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "lessThanOrEqualTo" + }); + $where.where(fragment); + }, + greaterThan($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec31 ? resolveInputCodec31(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve92(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThan" + }); + $where.where(fragment); + }, + greaterThanOrEqualTo($where, value) { + 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."); + if (value === 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] = resolveSqlIdentifier18 ? resolveSqlIdentifier18(sourceAlias, sourceCodec) : [sourceAlias, sourceCodec]; + if (true && value === null) return; + if (!true && value === null) throw Object.assign(new Error("Null literals are forbidden in filter argument input."), {}); + const resolvedInput = value, + inputCodec = resolveInputCodec31 ? resolveInputCodec31(codec ?? attribute.codec) : codec ?? attribute.codec, + sqlValue = sqlValueWithCodec(resolvedInput, inputCodec), + fragment = resolve93(sqlIdentifier, sqlValue, value, $where, { + fieldName: parentFieldName ?? null, + operatorName: "greaterThanOrEqualTo" + }); + $where.where(fragment); + } + }, + PostStatusToManyPostFilter: { + every($where, value) { + assertAllowed54(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - 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 = colSpec53; - fieldArgs.apply($col); - } + some($where, value) { + assertAllowed54(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - 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 = colSpec54; - fieldArgs.apply($col); - } + none($where, value) { + assertAllowed54(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - 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 = colSpec55; - fieldArgs.apply($col); - } + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; + } + }, + ProjectToManyPostStatusFilter: { + every($where, value) { + assertAllowed55(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery.notPlan().andPlan(); }, - 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 = colSpec56; - fieldArgs.apply($col); - } + some($where, value) { + assertAllowed55(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - post: { - applyPlan($where, fieldArgs) { - assertAllowed47(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: postIdentifier, - alias: resource_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); - } + none($where, value) { + assertAllowed55(value, "object"); + if (value == null) return; + 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)}`); + }); + return $subQuery; }, - user: { - applyPlan($where, fieldArgs) { - assertAllowed47(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: userIdentifier, - alias: resource_userPgResource.name + aggregates($where, input) { + if (input == null) return; + if (!$where.extensions.pgFilterRelation) throw new Error("Invalid use of filter, 'pgFilterRelation' expected"); + const { + localAttributes, + remoteAttributes, + tableExpression, + alias + } = $where.extensions.pgFilterRelation, + $subQuery = new PgAggregateCondition($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)}`); + }); + return $subQuery; + } + }, + PostStatusAggregatesFilter: { + filter($subquery, input) { + if (input == null) return; + return new PgCondition($subquery, !1, "AND"); + }, + distinctCount($subquery, input) { + if (input == null) return; + return $subquery.forAggregate(spec); + } + }, + PostStatusDistinctCountAggregateFilter: { + rowId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_postStatus.attributes.id.codec) + }; + return $col; + }, + status($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("status")}`, spec_postStatus.attributes.status.codec) + }; + return $col; + }, + description($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_postStatus.attributes.description.codec) + }; + return $col; + }, + color($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("color")}`, spec_postStatus.attributes.color.codec) + }; + return $col; + }, + projectId($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("project_id")}`, spec_postStatus.attributes.project_id.codec) + }; + return $col; + }, + isDefault($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("is_default")}`, spec_postStatus.attributes.is_default.codec) + }; + return $col; + }, + createdAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_postStatus.attributes.created_at.codec) + }; + return $col; + }, + updatedAt($parent, input) { + if (input == null) return; + const $col = new PgCondition($parent); + $col.extensions.pgFilterAttribute = { + codec: TYPES.bigint, + expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_postStatus.attributes.updated_at.codec) + }; + return $col; + } + }, + ProjectOrderBy: { + PRIMARY_KEY_ASC(queryBuilder) { + projectUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - 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)}`); + }); + queryBuilder.setOrderIsUnique(); + }, + PRIMARY_KEY_DESC(queryBuilder) { + projectUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - fieldArgs.apply($subQuery); - } + }); + queryBuilder.setOrderIsUnique(); }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed48(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + ROW_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed48(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.setOrderIsUnique(); + }, + NAME_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "name", + direction: "ASC" + }); + }, + NAME_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "name", + direction: "DESC" + }); + }, + IMAGE_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "image", + direction: "ASC" + }); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed48(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); - } + IMAGE_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "image", + direction: "DESC" + }); }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(spec)); - } - } - }, - DownvoteDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec) - }; - fieldArgs.apply($col); - } + SLUG_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "slug", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - postId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec) - }; - fieldArgs.apply($col); - } + SLUG_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "slug", + direction: "DESC" + }); + queryBuilder.setOrderIsUnique(); }, - userId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec) - }; - fieldArgs.apply($col); - } + DESCRIPTION_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "description", + direction: "ASC" + }); }, - createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec) - }; - fieldArgs.apply($col); - } + DESCRIPTION_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "description", + direction: "DESC" + }); }, - updatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec) - }; - fieldArgs.apply($col); - } - } - }, - PostToManyCommentFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed49(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()); - } + ORGANIZATION_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "organization_id", + direction: "ASC" + }); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed49(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); - } + ORGANIZATION_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "organization_id", + direction: "DESC" + }); }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed49(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); - } + CREATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); }, - 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); - } - } - }, - PostToManyDownvoteFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed50(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()); - } + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed50(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); - } + UPDATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed50(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); - } + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + 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); - } - } - }, - PostStatusFilter: { - 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 = colSpec57; - fieldArgs.apply($col); - } + POSTS_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - status: { - 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 = colSpec58; - fieldArgs.apply($col); - } + POSTS_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - 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 = colSpec59; - fieldArgs.apply($col); - } + POSTS_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.id.codec) ?? spec_post.attributes.id.codec, + direction: "ASC" + }); }, - color: { - 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 = colSpec60; - fieldArgs.apply($col); - } + POSTS_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.id.codec) ?? spec_post.attributes.id.codec, + direction: "DESC" + }); }, - 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 = colSpec61; - fieldArgs.apply($col); - } + POSTS_DISTINCT_COUNT_TITLE_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.title.codec) ?? spec_post.attributes.title.codec, + direction: "ASC" + }); }, - isDefault: { - 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 = colSpec62; - fieldArgs.apply($col); - } + POSTS_DISTINCT_COUNT_TITLE_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.title.codec) ?? spec_post.attributes.title.codec, + direction: "DESC" + }); }, - 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 = colSpec63; - fieldArgs.apply($col); - } + POSTS_DISTINCT_COUNT_DESCRIPTION_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.description.codec) ?? spec_post.attributes.description.codec, + direction: "ASC" + }); }, - 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 = colSpec64; - fieldArgs.apply($col); - } + POSTS_DISTINCT_COUNT_DESCRIPTION_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.description.codec) ?? spec_post.attributes.description.codec, + direction: "DESC" + }); }, - postsByStatusId: { - applyPlan($where, fieldArgs) { - assertAllowed51(fieldArgs, "object"); - const $rel = $where.andPlan(); - $rel.extensions.pgFilterRelation = { - tableExpression: postIdentifier, - alias: resource_postPgResource.name, - localAttributes: registryConfig.pgRelations.postStatus.postsByTheirStatusId.localAttributes, - remoteAttributes: registryConfig.pgRelations.postStatus.postsByTheirStatusId.remoteAttributes - }; - fieldArgs.apply($rel); - } + POSTS_DISTINCT_COUNT_PROJECT_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.project_id.codec) ?? spec_post.attributes.project_id.codec, + direction: "ASC" + }); }, - postsByStatusIdExist: { - applyPlan($where, fieldArgs) { - assertAllowed51(fieldArgs, "scalar"); - const $subQuery = $where.existsPlan({ - tableExpression: postIdentifier, - alias: resource_postPgResource.name, - $equals: fieldArgs.get() - }); - registryConfig.pgRelations.postStatus.postsByTheirStatusId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.postStatus.postsByTheirStatusId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - } + POSTS_DISTINCT_COUNT_PROJECT_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.project_id.codec) ?? spec_post.attributes.project_id.codec, + direction: "DESC" + }); }, - project: { - applyPlan($where, fieldArgs) { - assertAllowed52(fieldArgs, "object"); - const $subQuery = $where.existsPlan({ - tableExpression: projectIdentifier, - alias: resource_projectPgResource.name - }); - registryConfig.pgRelations.postStatus.projectByMyProjectId.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = registryConfig.pgRelations.postStatus.projectByMyProjectId.remoteAttributes[i]; - $subQuery.where(sql`${$where.alias}.${sql.identifier(localAttribute)} = ${$subQuery.alias}.${sql.identifier(remoteAttribute)}`); - }); - fieldArgs.apply($subQuery); - } + POSTS_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.user_id.codec) ?? spec_post.attributes.user_id.codec, + direction: "ASC" + }); }, - and: { - applyPlan($where, fieldArgs) { - assertAllowed53(fieldArgs, "list"); - const $and = $where.andPlan(); - fieldArgs.apply($and); - } + POSTS_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.user_id.codec) ?? spec_post.attributes.user_id.codec, + direction: "DESC" + }); }, - or: { - applyPlan($where, fieldArgs) { - assertAllowed53(fieldArgs, "list"); - const $or = $where.orPlan(); - fieldArgs.apply(() => $or.andPlan()); - } + POSTS_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.created_at.codec) ?? spec_post.attributes.created_at.codec, + direction: "ASC" + }); }, - not: { - applyPlan($where, fieldArgs) { - assertAllowed53(fieldArgs, "object"); - const $and = $where.notPlan().andPlan(); - fieldArgs.apply($and); - } - } - }, - BooleanFilter: { - 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 = resolveInputCodec27 ? resolveInputCodec27(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = resolveSqlValue16 ? resolveSqlValue16($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve72(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "isNull" - }); - $where.where(fragment); - } + POSTS_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.created_at.codec) ?? spec_post.attributes.created_at.codec, + direction: "DESC" + }); }, - 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve73(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "equalTo" - }); - $where.where(fragment); - } + POSTS_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.updated_at.codec) ?? spec_post.attributes.updated_at.codec, + direction: "ASC" + }); }, - 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve74(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notEqualTo" - }); - $where.where(fragment); - } + POSTS_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.updated_at.codec) ?? spec_post.attributes.updated_at.codec, + direction: "DESC" + }); }, - 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve75(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "distinctFrom" - }); - $where.where(fragment); - } + POSTS_DISTINCT_COUNT_STATUS_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_id.codec) ?? spec_post.attributes.status_id.codec, + direction: "ASC" + }); }, - 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve76(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notDistinctFrom" - }); - $where.where(fragment); - } + POSTS_DISTINCT_COUNT_STATUS_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_id.codec) ?? spec_post.attributes.status_id.codec, + direction: "DESC" + }); }, - 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec29 ? resolveInputCodec29(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve77(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "in" - }); - $where.where(fragment); - } + POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_updated_at.codec) ?? spec_post.attributes.status_updated_at.codec, + direction: "ASC" + }); }, - 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec29 ? resolveInputCodec29(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve78(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "notIn" - }); - $where.where(fragment); - } + POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec)} +from ${resource_postPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_updated_at.codec) ?? spec_post.attributes.status_updated_at.codec, + direction: "DESC" + }); }, - 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve79(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThan" - }); - $where.where(fragment); - } + POST_STATUSES_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${resource_post_statusPgResource.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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve80(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "lessThanOrEqualTo" - }); - $where.where(fragment); - } + POST_STATUSES_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) +from ${resource_post_statusPgResource.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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve81(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThan" - }); - $where.where(fragment); - } + POST_STATUSES_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_postStatus.attributes.id.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.id.codec) ?? spec_postStatus.attributes.id.codec, + direction: "ASC" + }); }, - 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] = resolveSqlIdentifier17 ? resolveSqlIdentifier17(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 = resolveInputCodec28 ? resolveInputCodec28(codec ?? attribute.codec) : codec ?? attribute.codec, - sqlValue = undefined ? undefined($where, $input, inputCodec) : $where.placeholder($resolvedInput, inputCodec), - fragment = resolve82(sqlIdentifier, sqlValue, $input, $where, { - fieldName: parentFieldName ?? null, - operatorName: "greaterThanOrEqualTo" - }); - $where.where(fragment); - } - } - }, - PostStatusToManyPostFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed54(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()); - } + POST_STATUSES_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_postStatus.attributes.id.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.id.codec) ?? spec_postStatus.attributes.id.codec, + direction: "DESC" + }); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed54(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); - } + POST_STATUSES_DISTINCT_COUNT_STATUS_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status")}`, spec_postStatus.attributes.status.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.status.codec) ?? spec_postStatus.attributes.status.codec, + direction: "ASC" + }); }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed54(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); - } + POST_STATUSES_DISTINCT_COUNT_STATUS_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status")}`, spec_postStatus.attributes.status.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.status.codec) ?? spec_postStatus.attributes.status.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); - } - } - }, - ProjectToManyPostStatusFilter: { - every: { - applyPlan($where, fieldArgs) { - assertAllowed55(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()); - } + POST_STATUSES_DISTINCT_COUNT_DESCRIPTION_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_postStatus.attributes.description.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.description.codec) ?? spec_postStatus.attributes.description.codec, + direction: "ASC" + }); }, - some: { - applyPlan($where, fieldArgs) { - assertAllowed55(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); - } + POST_STATUSES_DISTINCT_COUNT_DESCRIPTION_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_postStatus.attributes.description.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.description.codec) ?? spec_postStatus.attributes.description.codec, + direction: "DESC" + }); }, - none: { - applyPlan($where, fieldArgs) { - assertAllowed55(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); - } + POST_STATUSES_DISTINCT_COUNT_COLOR_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("color")}`, spec_postStatus.attributes.color.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.color.codec) ?? spec_postStatus.attributes.color.codec, + direction: "ASC" + }); }, - 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); - } - } - }, - PostStatusAggregatesFilter: { - filter: { - applyPlan($subquery, fieldArgs) { - const $condition = new PgConditionStep($subquery, !1, "AND"); - fieldArgs.apply($condition); - } + POST_STATUSES_DISTINCT_COUNT_COLOR_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("color")}`, spec_postStatus.attributes.color.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.color.codec) ?? spec_postStatus.attributes.color.codec, + direction: "DESC" + }); }, - distinctCount: { - applyPlan($subquery, fieldArgs) { - fieldArgs.apply($subquery.forAggregate(spec)); - } - } - }, - PostStatusDistinctCountAggregateFilter: { - rowId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("id")}`, spec_postStatus.attributes.id.codec) - }; - fieldArgs.apply($col); - } + POST_STATUSES_DISTINCT_COUNT_PROJECT_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_postStatus.attributes.project_id.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.project_id.codec) ?? spec_postStatus.attributes.project_id.codec, + direction: "ASC" + }); }, - status: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("status")}`, spec_postStatus.attributes.status.codec) - }; - fieldArgs.apply($col); - } + POST_STATUSES_DISTINCT_COUNT_PROJECT_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_postStatus.attributes.project_id.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.project_id.codec) ?? spec_postStatus.attributes.project_id.codec, + direction: "DESC" + }); }, - description: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("description")}`, spec_postStatus.attributes.description.codec) - }; - fieldArgs.apply($col); - } + POST_STATUSES_DISTINCT_COUNT_IS_DEFAULT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("is_default")}`, spec_postStatus.attributes.is_default.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.is_default.codec) ?? spec_postStatus.attributes.is_default.codec, + direction: "ASC" + }); }, - color: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("color")}`, spec_postStatus.attributes.color.codec) - }; - fieldArgs.apply($col); - } + POST_STATUSES_DISTINCT_COUNT_IS_DEFAULT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("is_default")}`, spec_postStatus.attributes.is_default.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.is_default.codec) ?? spec_postStatus.attributes.is_default.codec, + direction: "DESC" + }); }, - projectId: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("project_id")}`, spec_postStatus.attributes.project_id.codec) - }; - fieldArgs.apply($col); - } + POST_STATUSES_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_postStatus.attributes.created_at.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.created_at.codec) ?? spec_postStatus.attributes.created_at.codec, + direction: "ASC" + }); }, - isDefault: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("is_default")}`, spec_postStatus.attributes.is_default.codec) - }; - fieldArgs.apply($col); - } + POST_STATUSES_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_postStatus.attributes.created_at.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.created_at.codec) ?? spec_postStatus.attributes.created_at.codec, + direction: "DESC" + }); }, - createdAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("created_at")}`, spec_postStatus.attributes.created_at.codec) - }; - fieldArgs.apply($col); - } + POST_STATUSES_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_postStatus.attributes.updated_at.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.updated_at.codec) ?? spec_postStatus.attributes.updated_at.codec, + direction: "ASC" + }); }, - updatedAt: { - applyPlan($parent, fieldArgs) { - const $col = new PgConditionStep($parent); - $col.extensions.pgFilterAttribute = { - codec: TYPES.bigint, - expression: spec.sqlAggregateWrap(sql`${$col.alias}.${sql.identifier("updated_at")}`, spec_postStatus.attributes.updated_at.codec) - }; - fieldArgs.apply($col); - } + POST_STATUSES_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_post_statusPgResource.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 resource_post_statusPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_postStatus.attributes.updated_at.codec)} +from ${resource_post_statusPgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_postStatus.attributes.updated_at.codec) ?? spec_postStatus.attributes.updated_at.codec, + direction: "DESC" + }); } }, MemberConnection: { __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); }, @@ -20800,25 +18457,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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(MemberGroupBy, 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; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -20834,9 +18477,6 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; createdAt($record) { return $record.get("created_at"); }, - role($record) { - return $record.get("role"); - }, rowId($record) { return $record.get("id"); }, @@ -20865,18 +18505,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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"); }, - email($record) { - return $record.get("email"); - }, posts: { plan($record) { const $records = resource_postPgResource.find({ @@ -20885,61 +18519,37 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return connection($records); }, args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } + last(_, $connection, val) { + $connection.setLast(val.getRaw()); }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } + after(_, $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(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed56(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; + }); }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed56(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); } } }, @@ -20951,61 +18561,37 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return connection($records); }, args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } + last(_, $connection, val) { + $connection.setLast(val.getRaw()); }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } + after(_, $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(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed57(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; + }); }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed57(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); } } }, @@ -21017,61 +18603,37 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return connection($records); }, args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } + last(_, $connection, val) { + $connection.setLast(val.getRaw()); }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } + after(_, $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("MemberOrderBy")); - return null; - } + condition(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed58(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; + }); }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed58(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); } } }, @@ -21083,61 +18645,37 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return connection($records); }, args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } + last(_, $connection, val) { + $connection.setLast(val.getRaw()); }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } + after(_, $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(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed59(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; + }); }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed59(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); } } }, @@ -21149,76 +18687,43 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return connection($records); }, args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } + last(_, $connection, val) { + $connection.setLast(val.getRaw()); }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } + after(_, $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(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed60(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; + }); }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed60(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); } } } }, 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); }, @@ -21230,25 +18735,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -21265,8 +18756,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; PostAggregates: { __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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -21320,1595 +18815,1210 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } }, PostGroupBy: { - TITLE: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan + TITLE($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("title")}`, + codec: TYPES.text + }); }, - DESCRIPTION: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan2 + DESCRIPTION($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("description")}`, + codec: TYPES.text + }); }, - PROJECT_ID: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan3 + PROJECT_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("project_id")}`, + codec: TYPES.uuid + }); }, - USER_ID: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan4 + USER_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}`, + codec: TYPES.uuid + }); }, - CREATED_AT: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan5 + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan6 + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan7 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan8 + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan9 + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan10 + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - STATUS_ID: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan11 + STATUS_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("status_id")}`, + codec: TYPES.uuid + }); }, - STATUS_UPDATED_AT: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan12 + STATUS_UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("status_updated_at")}`, + codec: TYPES.timestamptz + }); }, - STATUS_UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan13 + STATUS_UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("status_updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - STATUS_UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: PostGroupBy_extensions_grafast_applyPlan14 + STATUS_UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("status_updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); } }, PostHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, PostHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_post.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_post.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - statusUpdatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + statusUpdatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("status_updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_post.attributes.status_updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + PostCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + title($condition, val) { + $condition.where({ + type: "attribute", + attribute: "title", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + description($condition, val) { + $condition.where({ + type: "attribute", + attribute: "description", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + projectId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "project_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + userId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + statusId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "status_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + statusUpdatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "status_updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); } }, 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) - }); + PRIMARY_KEY_ASC(queryBuilder) { + postUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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) - }); + PRIMARY_KEY_DESC(queryBuilder) { + postUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.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(); - } + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "title", + direction: "ASC" + }); }, - 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(); - } + TITLE_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "title", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "description", + direction: "ASC" + }); }, - 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(); - } + DESCRIPTION_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "description", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "project_id", + direction: "ASC" + }); }, - 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(); - } + PROJECT_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "project_id", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "ASC" + }); }, - 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(); - } + USER_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); }, - 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(); - } + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); }, - 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(); - } + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "DESC" + }); }, - STATUS_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: "status_id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + STATUS_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "status_id", + direction: "ASC" + }); }, - STATUS_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: "status_id", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + STATUS_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "status_id", + direction: "DESC" + }); }, - STATUS_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: "status_updated_at", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + STATUS_UPDATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "status_updated_at", + direction: "ASC" + }); }, - STATUS_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: "status_updated_at", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + STATUS_UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "status_updated_at", + direction: "DESC" + }); }, - UPVOTES_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + UPVOTES_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - UPVOTES_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + UPVOTES_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $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(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.id.codec) ?? 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(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.id.codec) ?? 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(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_POST_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.post_id.codec) ?? 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(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_POST_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.post_id.codec) ?? 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(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.user_id.codec) ?? 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(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.user_id.codec) ?? 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(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.created_at.codec) ?? 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(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.created_at.codec) ?? spec_upvote.attributes.created_at.codec, + direction: "DESC" + }); }, - UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.updated_at.codec) ?? spec_upvote.attributes.updated_at.codec, + direction: "ASC" + }); }, - UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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 resource_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.updated_at.codec) ?? spec_upvote.attributes.updated_at.codec, + direction: "DESC" + }); }, - COMMENTS_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + COMMENTS_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_commentPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - COMMENTS_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + COMMENTS_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_commentPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.id.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.id.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_MESSAGE_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.message.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.message.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.message.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_MESSAGE_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.message.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.message.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.message.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_POST_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.post_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.post_id.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_POST_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.post_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.post_id.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.user_id.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.user_id.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.created_at.codec) ?? 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(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.created_at.codec) ?? spec_comment.attributes.created_at.codec, + direction: "DESC" + }); }, - COMMENTS_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.updated_at.codec) ?? spec_comment.attributes.updated_at.codec, + direction: "ASC" + }); }, - COMMENTS_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); - relation4.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation4.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation4.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation4.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.updated_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.updated_at.codec) ?? spec_comment.attributes.updated_at.codec, + direction: "DESC" + }); }, - DOWNVOTES_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + DOWNVOTES_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - DOWNVOTES_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + DOWNVOTES_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.id.codec) ?? spec_downvote.attributes.id.codec, + direction: "ASC" + }); }, - DOWNVOTES_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.id.codec) ?? spec_downvote.attributes.id.codec, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_POST_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_POST_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.post_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.post_id.codec) ?? spec_downvote.attributes.post_id.codec, + direction: "ASC" + }); }, - DOWNVOTES_DISTINCT_COUNT_POST_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_POST_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.post_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.post_id.codec) ?? spec_downvote.attributes.post_id.codec, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_USER_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.user_id.codec) ?? spec_downvote.attributes.user_id.codec, + direction: "ASC" + }); }, - DOWNVOTES_DISTINCT_COUNT_USER_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.user_id.codec) ?? spec_downvote.attributes.user_id.codec, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.created_at.codec) ?? spec_downvote.attributes.created_at.codec, + direction: "ASC" + }); }, - DOWNVOTES_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, 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(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` -select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} -from ${resource_downvotePgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.created_at.codec) ?? spec_downvote.attributes.created_at.codec, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, 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`; - } - });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 + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.updated_at.codec) ?? spec_downvote.attributes.updated_at.codec, + direction: "ASC" + }); }, - 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 - }, - 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 - }, - 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 - }, - statusId: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "status_id", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "status_id", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.status_id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - statusUpdatedAt: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "status_updated_at", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "status_updated_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_post.attributes.status_updated_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.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 resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` +select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} +from ${resource_downvotePgResource.from} ${tableAlias} +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.updated_at.codec) ?? spec_downvote.attributes.updated_at.codec, + direction: "DESC" + }); } }, UpvoteConnection: { __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); }, @@ -22920,25 +20030,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -22983,8 +20079,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -23018,774 +20118,462 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } }, UpvoteGroupBy: { - POST_ID: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan + POST_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("post_id")}`, + codec: TYPES.uuid + }); }, - USER_ID: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan2 + USER_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}`, + codec: TYPES.uuid + }); }, - CREATED_AT: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan3 + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan4 + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan5 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan6 + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan7 + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UpvoteGroupBy_extensions_grafast_applyPlan8 + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); } }, UpvoteHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, UpvoteHavingSumInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UpvoteHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UpvoteHavingMinInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UpvoteHavingMaxInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UpvoteHavingAverageInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UpvoteHavingStddevSampleInput: { - createdAt: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UpvoteHavingStddevPopulationInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UpvoteHavingVarianceSampleInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UpvoteHavingVariancePopulationInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_upvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + UpvoteCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + postId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "post_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + userId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); } }, UpvoteOrderBy: { - NATURAL: { - applyPlan() {} - }, - 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) - }); + PRIMARY_KEY_ASC(queryBuilder) { + upvoteUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.setOrderIsUnique(); }, - 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) - }); + PRIMARY_KEY_DESC(queryBuilder) { + upvoteUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.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(); - } + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.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"); - plan.orderBy({ - attribute: "post_id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } + POST_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "post_id", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - 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(); - } + POST_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "post_id", + direction: "DESC" + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "ASC" + }); }, - 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(); - } + USER_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); }, - 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(); - } + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); }, - 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(); - } + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "DESC" + }); } }, - 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 - }, - 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)}`; - } - }); - }, - 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 - }, - 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)}`; - } - }); - }, - 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)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + MemberCondition: { + userId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + organizationId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "organization_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + role($condition, val) { + $condition.where({ + type: "attribute", + attribute: "role", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, roleCodec)}`; + } + }); + }, + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); } }, MemberOrderBy: { - NATURAL: { - applyPlan() {} - }, - PRIMARY_KEY_ASC: { - applyPlan(step) { - memberUniques[0].attributes.forEach(attributeName => { - const attribute = memberCodec.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) { - memberUniques[0].attributes.forEach(attributeName => { - const attribute = memberCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); + PRIMARY_KEY_ASC(queryBuilder) { + memberUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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) + PRIMARY_KEY_DESC(queryBuilder) { + memberUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - if (true) plan.setOrderIsUnique(); - } + }); + queryBuilder.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 (true) plan.setOrderIsUnique(); - } + USER_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - 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) - }); - if (false) plan.setOrderIsUnique(); - } + USER_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "DESC" + }); + queryBuilder.setOrderIsUnique(); }, - 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) - }); - if (false) plan.setOrderIsUnique(); - } + ORGANIZATION_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "organization_id", + direction: "ASC" + }); }, - 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(); - } + ORGANIZATION_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "organization_id", + direction: "DESC" + }); }, - 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(); - } + CREATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); }, - ROLE_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: "role", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); }, - ROLE_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: "role", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + ROLE_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "role", + direction: "ASC" + }); }, - 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(); - } + ROLE_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "role", + direction: "DESC" + }); }, - 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(); - } - } - }, - MemberCondition: { - 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_member.attributes.user_id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - organizationId: { - 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_member.attributes.organization_id.codec)}`; - } - }); - }, - 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`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_member.attributes.created_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + ROW_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - role: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "role", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "role", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_member.attributes.role.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - 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_member.attributes.id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.setOrderIsUnique(); } }, CommentConnection: { __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); }, @@ -23797,25 +20585,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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(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); - } - return null; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -23825,9 +20599,6 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; rowId($record) { return $record.get("id"); }, - message($record) { - return $record.get("message"); - }, postId($record) { return $record.get("post_id"); }, @@ -23863,8 +20634,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; CommentAggregates: { __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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -23903,558 +20678,356 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } }, CommentGroupBy: { - MESSAGE: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan + MESSAGE($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("message")}`, + codec: TYPES.text + }); }, - POST_ID: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan2 + POST_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("post_id")}`, + codec: TYPES.uuid + }); }, - USER_ID: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan3 + USER_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}`, + codec: TYPES.uuid + }); }, - CREATED_AT: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan4 + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan5 + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan6 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan7 + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan8 + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: CommentGroupBy_extensions_grafast_applyPlan9 + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); } }, CommentHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, CommentHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, CommentHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, CommentHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, CommentHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, CommentHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, CommentHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, CommentHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, CommentHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, CommentHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_comment.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_comment.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, - CommentOrderBy: { - NATURAL: { - applyPlan() {} - }, - PRIMARY_KEY_ASC: { - applyPlan(step) { - commentUniques[0].attributes.forEach(attributeName => { - const attribute = commentCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - }); - step.setOrderIsUnique(); - } + CommentCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); }, - PRIMARY_KEY_DESC: { - applyPlan(step) { - commentUniques[0].attributes.forEach(attributeName => { - const attribute = commentCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - }); - step.setOrderIsUnique(); - } + message($condition, val) { + $condition.where({ + type: "attribute", + attribute: "message", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); }, - 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(); - } + postId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "post_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); }, - 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(); - } + userId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); }, - 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(); - } + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); }, - 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) + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + } + }, + CommentOrderBy: { + PRIMARY_KEY_ASC(queryBuilder) { + commentUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - if (false) plan.setOrderIsUnique(); - } + }); + queryBuilder.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"); - plan.orderBy({ - attribute: "post_id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + PRIMARY_KEY_DESC(queryBuilder) { + commentUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - if (false) plan.setOrderIsUnique(); - } + }); + queryBuilder.setOrderIsUnique(); }, - 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 (false) plan.setOrderIsUnique(); - } + ROW_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.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(); - } + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.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(); - } + MESSAGE_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "message", + direction: "ASC" + }); }, - 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(); - } + MESSAGE_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "message", + direction: "DESC" + }); }, - 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(); - } + POST_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "post_id", + direction: "ASC" + }); }, - 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(); - } + POST_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "post_id", + direction: "DESC" + }); }, - 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(); - } - } - }, - CommentCondition: { - 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_comment.attributes.id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + USER_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "ASC" + }); }, - 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)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - 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_comment.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_comment.attributes.user_id.codec)}`; - } - }); - }, - 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`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_comment.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_comment.attributes.updated_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + USER_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "DESC" + }); + }, + CREATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); + }, + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); + }, + UPDATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); + }, + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "DESC" + }); } }, DownvoteConnection: { __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); }, @@ -24466,25 +21039,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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(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); - } - return null; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -24501,8 +21060,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; DownvoteAggregates: { __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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -24536,497 +21099,327 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } }, DownvoteGroupBy: { - POST_ID: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan + POST_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("post_id")}`, + codec: TYPES.uuid + }); }, - USER_ID: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan2 + USER_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}`, + codec: TYPES.uuid + }); }, - CREATED_AT: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan3 + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan4 + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan5 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan6 + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan7 + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: DownvoteGroupBy_extensions_grafast_applyPlan8 + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); } }, DownvoteHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, DownvoteHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, DownvoteHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, DownvoteHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, DownvoteHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, DownvoteHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, DownvoteHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, DownvoteHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, DownvoteHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, DownvoteHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_downvote.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + DownvoteCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + postId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "post_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + userId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "user_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); } }, 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) - }); + PRIMARY_KEY_ASC(queryBuilder) { + downvoteUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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) - }); + PRIMARY_KEY_DESC(queryBuilder) { + downvoteUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.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(); - } + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.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"); - plan.orderBy({ - attribute: "post_id", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } + POST_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "post_id", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - 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(); - } + POST_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "post_id", + direction: "DESC" + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "ASC" + }); }, - 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(); - } + USER_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "user_id", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); }, - 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(); - } + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); }, - 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(); - } - } - }, - DownvoteCondition: { - 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_downvote.attributes.id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - 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_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)}`; - } - }); - }, - 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`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - 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)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "DESC" + }); } }, MemberEdge: { @@ -25041,8 +21434,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; MemberAggregates: { __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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -25076,177 +21473,143 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } }, MemberGroupBy: { - USER_ID: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan + USER_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("user_id")}`, + codec: TYPES.uuid + }); }, - ORGANIZATION_ID: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan2 + ORGANIZATION_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("organization_id")}`, + codec: TYPES.uuid + }); }, - CREATED_AT: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan3 + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan4 + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan5 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - ROLE: { - applyPlan: MemberGroupBy_extensions_grafast_applyPlan6 + ROLE($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("role")}`, + codec: roleCodec + }); } }, MemberHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, MemberHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, MemberHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, MemberHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, MemberHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, MemberHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, MemberHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, MemberHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, MemberHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, MemberHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_member.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationConnection: { __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); }, @@ -25258,25 +21621,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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(InvitationGroupBy, 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; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -25289,9 +21638,6 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; organizationId($record) { return $record.get("organization_id"); }, - email($record) { - return $record.get("email"); - }, createdAt($record) { return $record.get("created_at"); }, @@ -25316,8 +21662,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; InvitationAggregates: { __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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -25351,510 +21701,331 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } }, InvitationGroupBy: { - ORGANIZATION_ID: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan + ORGANIZATION_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("organization_id")}`, + codec: TYPES.uuid + }); }, - EMAIL: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan2 + EMAIL($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("email")}`, + codec: TYPES.text + }); }, - CREATED_AT: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan3 + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan4 + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan5 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan6 + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan7 + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: InvitationGroupBy_extensions_grafast_applyPlan8 + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); } }, InvitationHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, InvitationHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, InvitationHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_invitation.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, - InvitationOrderBy: { - NATURAL: { - applyPlan() {} - }, - PRIMARY_KEY_ASC: { - applyPlan(step) { - invitationUniques[0].attributes.forEach(attributeName => { - const attribute = invitationCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - }); - step.setOrderIsUnique(); - } + InvitationCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); }, - PRIMARY_KEY_DESC: { - applyPlan(step) { - invitationUniques[0].attributes.forEach(attributeName => { - const attribute = invitationCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - }); - step.setOrderIsUnique(); - } + organizationId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "organization_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); }, - 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(); - } + email($condition, val) { + $condition.where({ + type: "attribute", + attribute: "email", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); }, - 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(); - } + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); }, - 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) + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + } + }, + InvitationOrderBy: { + PRIMARY_KEY_ASC(queryBuilder) { + invitationUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - if (true) plan.setOrderIsUnique(); - } + }); + queryBuilder.setOrderIsUnique(); }, - 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) + PRIMARY_KEY_DESC(queryBuilder) { + invitationUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - if (true) plan.setOrderIsUnique(); - } + }); + queryBuilder.setOrderIsUnique(); }, - EMAIL_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: "email", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + ROW_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - EMAIL_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: "email", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.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(); - } + ORGANIZATION_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "organization_id", + direction: "ASC" + }); + queryBuilder.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(); - } + ORGANIZATION_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "organization_id", + direction: "DESC" + }); + queryBuilder.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(); - } + EMAIL_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "email", + direction: "ASC" + }); }, - 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(); - } - } - }, - InvitationCondition: { - 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_invitation.attributes.id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - organizationId: { - 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_invitation.attributes.organization_id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + EMAIL_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "email", + direction: "DESC" + }); }, - email: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "email", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "email", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_invitation.attributes.email.codec)}`; - } - }); - }, - 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`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_invitation.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_invitation.attributes.updated_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + CREATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); + }, + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); + }, + UPDATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); + }, + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "DESC" + }); } }, PostStatusConnection: { __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); }, @@ -25866,25 +22037,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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(PostStatusGroupBy, 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; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -25894,15 +22051,6 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; rowId($record) { return $record.get("id"); }, - status($record) { - return $record.get("status"); - }, - description($record) { - return $record.get("description"); - }, - color($record) { - return $record.get("color"); - }, projectId($record) { return $record.get("project_id"); }, @@ -25928,61 +22076,37 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; return connection($records); }, args: { - first: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, arg) { - $connection.setFirst(arg.getRaw()); - } + first(_, $connection, arg) { + $connection.setFirst(arg.getRaw()); }, - last: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setLast(val.getRaw()); - } + last(_, $connection, val) { + $connection.setLast(val.getRaw()); }, - offset: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setOffset(val.getRaw()); - } + offset(_, $connection, val) { + $connection.setOffset(val.getRaw()); }, - before: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setBefore(val.getRaw()); - } + before(_, $connection, val) { + $connection.setBefore(val.getRaw()); }, - after: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, val) { - $connection.setAfter(val.getRaw()); - } + after(_, $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(_condition, $connection, arg) { + const $select = $connection.getSubplan(); + arg.apply($select, qbWhereBuilder); }, - condition: { - autoApplyAfterParentPlan: true, - applyPlan(_condition, $connection) { - return $connection.getSubplan().wherePlan(); - } + filter(_, $connection, fieldArg) { + const $pgSelect = $connection.getSubplan(); + fieldArg.apply($pgSelect, (queryBuilder, value) => { + assertAllowed61(value, "object"); + if (value == null) return; + const condition = new PgCondition(queryBuilder); + return condition; + }); }, - filter: { - autoApplyAfterParentPlan: true, - applyPlan(_, $connection, fieldArgs) { - assertAllowed61(fieldArgs, "object"); - const $where = $connection.getSubplan().wherePlan(); - if (null) $where.extensions.pgFilterAttribute = { - codec: null - }; - fieldArgs.apply($where); - } + orderBy(parent, $connection, value) { + const $select = $connection.getSubplan(); + value.apply($select); } } } @@ -25999,8 +22123,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; PostStatusAggregates: { __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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -26049,1090 +22177,788 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } }, PostStatusGroupBy: { - STATUS: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan + STATUS($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("status")}`, + codec: TYPES.text + }); }, - DESCRIPTION: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan2 + DESCRIPTION($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("description")}`, + codec: TYPES.text + }); }, - COLOR: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan3 + COLOR($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("color")}`, + codec: TYPES.text + }); }, - PROJECT_ID: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan4 + PROJECT_ID($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("project_id")}`, + codec: TYPES.uuid + }); }, - IS_DEFAULT: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan5 + IS_DEFAULT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("is_default")}`, + codec: TYPES.boolean + }); }, - CREATED_AT: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan6 + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan7 + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan8 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan9 + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan10 + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: PostStatusGroupBy_extensions_grafast_applyPlan11 + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); } }, PostStatusHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, PostStatusHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostStatusHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostStatusHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostStatusHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostStatusHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostStatusHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostStatusHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostStatusHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, PostStatusHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_postStatus.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, - PostStatusOrderBy: { - NATURAL: { - applyPlan() {} - }, - PRIMARY_KEY_ASC: { - applyPlan(step) { - post_statusUniques[0].attributes.forEach(attributeName => { - const attribute = postStatusCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - }); - step.setOrderIsUnique(); - } + PostStatusCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); }, - PRIMARY_KEY_DESC: { - applyPlan(step) { - post_statusUniques[0].attributes.forEach(attributeName => { - const attribute = postStatusCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - }); - step.setOrderIsUnique(); - } + status($condition, val) { + $condition.where({ + type: "attribute", + attribute: "status", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); }, - 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(); - } + description($condition, val) { + $condition.where({ + type: "attribute", + attribute: "description", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); }, - 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(); - } + color($condition, val) { + $condition.where({ + type: "attribute", + attribute: "color", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + projectId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "project_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + isDefault($condition, val) { + $condition.where({ + type: "attribute", + attribute: "is_default", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.boolean)}`; + } + }); }, - STATUS_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: "status", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + } + }, + PostStatusOrderBy: { + PRIMARY_KEY_ASC(queryBuilder) { + post_statusUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - if (false) plan.setOrderIsUnique(); - } + }); + queryBuilder.setOrderIsUnique(); }, - STATUS_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: "status", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) + PRIMARY_KEY_DESC(queryBuilder) { + post_statusUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - if (false) plan.setOrderIsUnique(); - } + }); + queryBuilder.setOrderIsUnique(); + }, + ROW_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); + }, + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.setOrderIsUnique(); + }, + STATUS_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "status", + direction: "ASC" + }); }, - 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(); - } + STATUS_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "status", + direction: "DESC" + }); }, - 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(); - } + DESCRIPTION_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "description", + direction: "ASC" + }); }, - COLOR_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: "color", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + DESCRIPTION_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "description", + direction: "DESC" + }); }, - COLOR_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: "color", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + COLOR_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "color", + direction: "ASC" + }); }, - 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(); - } + COLOR_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "color", + direction: "DESC" + }); }, - 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(); - } + PROJECT_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "project_id", + direction: "ASC" + }); }, - IS_DEFAULT_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: "is_default", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + PROJECT_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "project_id", + direction: "DESC" + }); }, - IS_DEFAULT_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: "is_default", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (false) plan.setOrderIsUnique(); - } + IS_DEFAULT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "is_default", + direction: "ASC" + }); }, - 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(); - } + IS_DEFAULT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "is_default", + direction: "DESC" + }); }, - 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(); - } + CREATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); }, - 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(); - } + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); }, - 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(); - } + UPDATED_AT_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "DESC" + }); + }, + POSTS_BY_STATUS_ID_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_postPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + POSTS_BY_STATUS_ID_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_postPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.id.codec) ?? spec_post.attributes.id.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.id.codec) ?? spec_post.attributes.id.codec, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_TITLE_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_TITLE_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.title.codec) ?? spec_post.attributes.title.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_TITLE_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_TITLE_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.title.codec) ?? spec_post.attributes.title.codec, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_DESCRIPTION_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_DESCRIPTION_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.description.codec) ?? spec_post.attributes.description.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_DESCRIPTION_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_DESCRIPTION_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.description.codec) ?? spec_post.attributes.description.codec, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_PROJECT_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_PROJECT_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.project_id.codec) ?? spec_post.attributes.project_id.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_PROJECT_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_PROJECT_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.project_id.codec) ?? spec_post.attributes.project_id.codec, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_USER_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.user_id.codec) ?? spec_post.attributes.user_id.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_USER_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.user_id.codec) ?? spec_post.attributes.user_id.codec, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.created_at.codec) ?? spec_post.attributes.created_at.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.created_at.codec) ?? spec_post.attributes.created_at.codec, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.updated_at.codec) ?? spec_post.attributes.updated_at.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.updated_at.codec) ?? spec_post.attributes.updated_at.codec, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_id.codec) ?? spec_post.attributes.status_id.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_id.codec) ?? spec_post.attributes.status_id.codec, + direction: "DESC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_updated_at.codec) ?? spec_post.attributes.status_updated_at.codec, + direction: "ASC" + }); }, - POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); - 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_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_BY_STATUS_ID_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.name)); + 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_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_updated_at.codec, - direction: "DESC" - }); - } - } - }, - PostStatusCondition: { - 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_postStatus.attributes.id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - status: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "status", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "status", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_postStatus.attributes.status.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_postStatus.attributes.description.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - color: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "color", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "color", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_postStatus.attributes.color.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_postStatus.attributes.project_id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - isDefault: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "is_default", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "is_default", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_postStatus.attributes.is_default.codec)}`; - } - }); - }, - 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`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_postStatus.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_postStatus.attributes.updated_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_updated_at.codec) ?? spec_post.attributes.status_updated_at.codec, + direction: "DESC" + }); } }, OrganizationConnection: { __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); }, @@ -27144,25 +22970,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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(OrganizationGroupBy, 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; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -27179,8 +22991,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; OrganizationAggregates: { __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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -27214,1416 +23030,1113 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; } }, OrganizationGroupBy: { - CREATED_AT: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan2 + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan3 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan4 + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan5 + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: OrganizationGroupBy_extensions_grafast_applyPlan6 + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); } }, OrganizationHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, OrganizationHavingSumInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, OrganizationHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, OrganizationHavingMinInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, OrganizationHavingMaxInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, OrganizationHavingAverageInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, OrganizationHavingStddevSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, OrganizationHavingStddevPopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, OrganizationHavingVarianceSampleInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, OrganizationHavingVariancePopulationInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_organization.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_organization.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + OrganizationCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + name($condition, val) { + $condition.where({ + type: "attribute", + attribute: "name", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + slug($condition, val) { + $condition.where({ + type: "attribute", + attribute: "slug", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); } }, OrganizationOrderBy: { - NATURAL: { - applyPlan() {} - }, - PRIMARY_KEY_ASC: { - applyPlan(step) { - organizationUniques[0].attributes.forEach(attributeName => { - const attribute = organizationCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); + PRIMARY_KEY_ASC(queryBuilder) { + organizationUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.setOrderIsUnique(); }, - PRIMARY_KEY_DESC: { - applyPlan(step) { - organizationUniques[0].attributes.forEach(attributeName => { - const attribute = organizationCodec.attributes[attributeName]; - step.orderBy({ - codec: attribute.codec, - fragment: sql`${step}.${sql.identifier(attributeName)}`, - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); + PRIMARY_KEY_DESC(queryBuilder) { + organizationUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.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(); - } + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.setOrderIsUnique(); }, - 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: "name", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } + NAME_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "name", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - 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: "name", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } + NAME_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "name", + direction: "DESC" + }); + queryBuilder.setOrderIsUnique(); }, - SLUG_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: "slug", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } + SLUG_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "slug", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - SLUG_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: "slug", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } + SLUG_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "slug", + direction: "DESC" + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); }, - 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(); - } + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); }, - 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(); - } + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "DESC" + }); }, - PROJECTS_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + PROJECTS_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_projectPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - PROJECTS_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + PROJECTS_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_projectPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - PROJECTS_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_project.attributes.id.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.id.codec) ?? spec_project.attributes.id.codec, + direction: "ASC" + }); }, - PROJECTS_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_project.attributes.id.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.id.codec) ?? spec_project.attributes.id.codec, + direction: "DESC" + }); }, - PROJECTS_DISTINCT_COUNT_NAME_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_NAME_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("name")}`, spec_project.attributes.name.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.name.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.name.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.name.codec) ?? spec_project.attributes.name.codec, + direction: "ASC" + }); }, - PROJECTS_DISTINCT_COUNT_NAME_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_NAME_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("name")}`, spec_project.attributes.name.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.name.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.name.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.name.codec) ?? spec_project.attributes.name.codec, + direction: "DESC" + }); }, - PROJECTS_DISTINCT_COUNT_IMAGE_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_IMAGE_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("image")}`, spec_project.attributes.image.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.image.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.image.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.image.codec) ?? spec_project.attributes.image.codec, + direction: "ASC" + }); }, - PROJECTS_DISTINCT_COUNT_IMAGE_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_IMAGE_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("image")}`, spec_project.attributes.image.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.image.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.image.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.image.codec) ?? spec_project.attributes.image.codec, + direction: "DESC" + }); }, - PROJECTS_DISTINCT_COUNT_SLUG_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_SLUG_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("slug")}`, spec_project.attributes.slug.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.slug.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.slug.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.slug.codec) ?? spec_project.attributes.slug.codec, + direction: "ASC" + }); }, - PROJECTS_DISTINCT_COUNT_SLUG_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_SLUG_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("slug")}`, spec_project.attributes.slug.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.slug.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.slug.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.slug.codec) ?? spec_project.attributes.slug.codec, + direction: "DESC" + }); }, - PROJECTS_DISTINCT_COUNT_DESCRIPTION_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_DESCRIPTION_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_project.attributes.description.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.description.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.description.codec) ?? spec_project.attributes.description.codec, + direction: "ASC" + }); }, - PROJECTS_DISTINCT_COUNT_DESCRIPTION_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_DESCRIPTION_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_project.attributes.description.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.description.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.description.codec) ?? spec_project.attributes.description.codec, + direction: "DESC" + }); }, - PROJECTS_DISTINCT_COUNT_ORGANIZATION_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_ORGANIZATION_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_project.attributes.organization_id.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.organization_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.organization_id.codec) ?? spec_project.attributes.organization_id.codec, + direction: "ASC" + }); }, - PROJECTS_DISTINCT_COUNT_ORGANIZATION_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_ORGANIZATION_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_project.attributes.organization_id.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.organization_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.organization_id.codec) ?? spec_project.attributes.organization_id.codec, + direction: "DESC" + }); }, - PROJECTS_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_project.attributes.created_at.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.created_at.codec) ?? spec_project.attributes.created_at.codec, + direction: "ASC" + }); }, - PROJECTS_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_project.attributes.created_at.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.created_at.codec) ?? spec_project.attributes.created_at.codec, + direction: "DESC" + }); }, - PROJECTS_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_project.attributes.updated_at.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.updated_at.codec) ?? spec_project.attributes.updated_at.codec, + direction: "ASC" + }); }, - PROJECTS_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + PROJECTS_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_projectPgResource.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 resource_projectPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_project.attributes.updated_at.codec)} from ${resource_projectPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_project.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_project.attributes.updated_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_project.attributes.updated_at.codec) ?? spec_project.attributes.updated_at.codec, + direction: "DESC" + }); }, - MEMBERS_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + MEMBERS_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_memberPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - MEMBERS_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + MEMBERS_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_memberPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_USER_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_member.attributes.user_id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.user_id.codec) ?? spec_member.attributes.user_id.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_USER_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_member.attributes.user_id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.user_id.codec) ?? spec_member.attributes.user_id.codec, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_ORGANIZATION_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ORGANIZATION_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_member.attributes.organization_id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.organization_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.organization_id.codec) ?? spec_member.attributes.organization_id.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_ORGANIZATION_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ORGANIZATION_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_member.attributes.organization_id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.organization_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.organization_id.codec) ?? spec_member.attributes.organization_id.codec, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_member.attributes.created_at.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.created_at.codec) ?? spec_member.attributes.created_at.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_member.attributes.created_at.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.created_at.codec) ?? spec_member.attributes.created_at.codec, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_ROLE_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ROLE_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("role")}`, spec_member.attributes.role.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.role.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.role.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.role.codec) ?? spec_member.attributes.role.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_ROLE_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ROLE_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("role")}`, spec_member.attributes.role.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.role.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.role.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.role.codec) ?? spec_member.attributes.role.codec, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_member.attributes.id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.id.codec) ?? spec_member.attributes.id.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.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 resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_member.attributes.id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.id.codec) ?? spec_member.attributes.id.codec, + direction: "DESC" + }); }, - INVITATIONS_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + INVITATIONS_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - INVITATIONS_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + INVITATIONS_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - INVITATIONS_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_invitation.attributes.id.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.id.codec) ?? spec_invitation.attributes.id.codec, + direction: "ASC" + }); }, - INVITATIONS_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_invitation.attributes.id.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.id.codec) ?? spec_invitation.attributes.id.codec, + direction: "DESC" + }); }, - INVITATIONS_DISTINCT_COUNT_ORGANIZATION_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_ORGANIZATION_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_invitation.attributes.organization_id.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.organization_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.organization_id.codec) ?? spec_invitation.attributes.organization_id.codec, + direction: "ASC" + }); }, - INVITATIONS_DISTINCT_COUNT_ORGANIZATION_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_ORGANIZATION_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_invitation.attributes.organization_id.codec)} from ${resource_invitationPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.organization_id.codec, - direction: "DESC" - }); - } +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.organization_id.codec) ?? spec_invitation.attributes.organization_id.codec, + direction: "DESC" + }); }, - INVITATIONS_DISTINCT_COUNT_EMAIL_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_EMAIL_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("email")}`, spec_invitation.attributes.email.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.email.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.email.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.email.codec) ?? spec_invitation.attributes.email.codec, + direction: "ASC" + }); }, - INVITATIONS_DISTINCT_COUNT_EMAIL_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_EMAIL_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("email")}`, spec_invitation.attributes.email.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.email.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.email.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.email.codec) ?? spec_invitation.attributes.email.codec, + direction: "DESC" + }); }, - INVITATIONS_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_invitation.attributes.created_at.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.created_at.codec) ?? spec_invitation.attributes.created_at.codec, + direction: "ASC" + }); }, - INVITATIONS_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_invitation.attributes.created_at.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.created_at.codec) ?? spec_invitation.attributes.created_at.codec, + direction: "DESC" + }); }, - INVITATIONS_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_invitation.attributes.updated_at.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.updated_at.codec) ?? spec_invitation.attributes.updated_at.codec, + direction: "ASC" + }); }, - INVITATIONS_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + INVITATIONS_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_invitationPgResource.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_invitationPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_invitation.attributes.updated_at.codec)} from ${resource_invitationPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_invitation.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_invitation.attributes.updated_at.codec, - direction: "DESC" - }); - } - } - }, - OrganizationCondition: { - 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_organization.attributes.id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - name: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "name", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "name", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_organization.attributes.name.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - slug: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "slug", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "slug", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_organization.attributes.slug.codec)}`; - } - }); - }, - 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`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_organization.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_organization.attributes.updated_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_invitation.attributes.updated_at.codec) ?? spec_invitation.attributes.updated_at.codec, + direction: "DESC" + }); } }, UserConnection: { __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); }, @@ -28635,25 +24148,11 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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(UserGroupBy, 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; - } + groupBy(_$parent, $pgSelect, input) { + return input.apply($pgSelect); }, - having: { - autoApplyAfterParentPlan: true, - applyPlan(_$parent, $pgSelect) { - return $pgSelect.havingPlan(); - } + having(_$parent, $pgSelect, input) { + return input.apply($pgSelect, queryBuilder => queryBuilder.havingBuilder()); } } } @@ -28670,8 +24169,12 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; 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); + const $groupDetails = $pgSelectSingle.getClassStep().getGroupDetails(); + return lambda([$groupDetails, $pgSelectSingle], ([groupDetails, item]) => { + if (groupDetails.indicies.length === 0 || item == null) return null;else return groupDetails.indicies.map(({ + index + }) => item[index]); + }); }, distinctCount($pgSelectSingle) { return $pgSelectSingle; @@ -28717,2250 +24220,1801 @@ where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("email")}`, sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, TYPES.text); return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); + }, + tier($pgSelectSingle) { + const sqlAttribute = sql.fragment`${$pgSelectSingle.getClassStep().alias}.${sql.identifier("tier")}`, + sqlAggregate = spec.sqlAggregateWrap(sqlAttribute, tierCodec); + return $pgSelectSingle.select(sqlAggregate, TYPES.bigint); } }, UserGroupBy: { - CREATED_AT: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan + CREATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("created_at")}`, + codec: TYPES.timestamptz + }); + }, + CREATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan2 + CREATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("created_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - CREATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan3 + UPDATED_AT($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("updated_at")}`, + codec: TYPES.timestamptz + }); }, - UPDATED_AT: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan4 + UPDATED_AT_TRUNCATED_TO_HOUR($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_HOUR: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan5 + UPDATED_AT_TRUNCATED_TO_DAY($pgSelect) { + $pgSelect.groupBy({ + fragment: aggregateGroupBySpec2.sqlWrap(sql`${$pgSelect.alias}.${sql.identifier("updated_at")}`), + codec: aggregateGroupBySpec2.sqlWrapCodec(TYPES.timestamptz) + }); }, - UPDATED_AT_TRUNCATED_TO_DAY: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan6 + FIRST_NAME($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("first_name")}`, + codec: TYPES.text + }); }, - FIRST_NAME: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan7 + LAST_NAME($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("last_name")}`, + codec: TYPES.text + }); }, - LAST_NAME: { - applyPlan: UserGroupBy_extensions_grafast_applyPlan8 + TIER($pgSelect) { + $pgSelect.groupBy({ + fragment: sql.fragment`${$pgSelect.alias}.${sql.identifier("tier")}`, + codec: tierCodec + }); } }, UserHavingInput: { - AND: { - applyPlan($where, input) { - input.apply($where); - return null; - } + AND($where) { + return $where; }, - OR: { - applyPlan($where, input) { - const $or = new PgOrFilterStep($where); - input.apply($or); - return null; - } + OR($where) { + return new PgOrFilter($where); }, - sum: { - applyPlan($having) { - return $having; - } + sum($having) { + return $having; }, - distinctCount: { - applyPlan($having) { - return $having; - } + distinctCount($having) { + return $having; }, - min: { - applyPlan($having) { - return $having; - } + min($having) { + return $having; }, - max: { - applyPlan($having) { - return $having; - } + max($having) { + return $having; }, - average: { - applyPlan($having) { - return $having; - } + average($having) { + return $having; }, - stddevSample: { - applyPlan($having) { - return $having; - } + stddevSample($having) { + return $having; }, - stddevPopulation: { - applyPlan($having) { - return $having; - } + stddevPopulation($having) { + return $having; }, - varianceSample: { - applyPlan($having) { - return $having; - } + varianceSample($having) { + return $having; }, - variancePopulation: { - applyPlan($having) { - return $having; - } + variancePopulation($having) { + return $having; } }, UserHavingSumInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UserHavingDistinctCountInput: { - createdAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - updatedAt: { - applyPlan($having) { - const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, - aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); - return new PgBooleanFilterStep($having, aggregateExpression); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = spec.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UserHavingMinInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec2.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UserHavingMaxInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec3.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UserHavingAverageInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec4.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UserHavingStddevSampleInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec5.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UserHavingStddevPopulationInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - 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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec6.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UserHavingVarianceSampleInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - 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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec7.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); } }, UserHavingVariancePopulationInput: { - 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); - } + createdAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("created_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_user.attributes.created_at.codec); + return new PgBooleanFilter($having, aggregateExpression); }, - 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); - } + updatedAt($having) { + const attributeExpression = sql.fragment`${$having.alias}.${sql.identifier("updated_at")}`, + aggregateExpression = aggregateSpec8.sqlAggregateWrap(attributeExpression, spec_user.attributes.updated_at.codec); + return new PgBooleanFilter($having, aggregateExpression); + } + }, + UserCondition: { + rowId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + createdAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "created_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + updatedAt($condition, val) { + $condition.where({ + type: "attribute", + attribute: "updated_at", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.timestamptz)}`; + } + }); + }, + hidraId($condition, val) { + $condition.where({ + type: "attribute", + attribute: "hidra_id", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.uuid)}`; + } + }); + }, + username($condition, val) { + $condition.where({ + type: "attribute", + attribute: "username", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + firstName($condition, val) { + $condition.where({ + type: "attribute", + attribute: "first_name", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + lastName($condition, val) { + $condition.where({ + type: "attribute", + attribute: "last_name", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + email($condition, val) { + $condition.where({ + type: "attribute", + attribute: "email", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, TYPES.text)}`; + } + }); + }, + tier($condition, val) { + $condition.where({ + type: "attribute", + attribute: "tier", + callback(expression) { + return val === null ? sql`${expression} is null` : sql`${expression} = ${sqlValueWithCodec(val, tierCodec)}`; + } + }); } }, 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) - }); + PRIMARY_KEY_ASC(queryBuilder) { + userUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "ASC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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) - }); + PRIMARY_KEY_DESC(queryBuilder) { + userUniques[0].attributes.forEach(attributeName => { + queryBuilder.orderBy({ + attribute: attributeName, + direction: "DESC" }); - step.setOrderIsUnique(); - } + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "ASC" + }); + queryBuilder.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(); - } + ROW_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "id", + direction: "DESC" + }); + queryBuilder.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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "ASC" + }); }, - 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(); - } + CREATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "created_at", + direction: "DESC" + }); }, - 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_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "ASC" + }); }, - 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(); - } + UPDATED_AT_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "updated_at", + direction: "DESC" + }); }, - 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(); - } + HIDRA_ID_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "hidra_id", + direction: "ASC" + }); + queryBuilder.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) - }); - if (true) plan.setOrderIsUnique(); - } + HIDRA_ID_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "hidra_id", + direction: "DESC" + }); + queryBuilder.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) - }); - if (true) plan.setOrderIsUnique(); - } + USERNAME_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "username", + direction: "ASC" + }); + queryBuilder.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) - }); - if (true) plan.setOrderIsUnique(); - } + USERNAME_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "username", + direction: "DESC" + }); + queryBuilder.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) - }); - if (false) plan.setOrderIsUnique(); - } + FIRST_NAME_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "first_name", + direction: "ASC" + }); }, - 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(); - } + FIRST_NAME_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "first_name", + direction: "DESC" + }); }, - 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(); - } + LAST_NAME_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "last_name", + direction: "ASC" + }); }, - 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(); - } + LAST_NAME_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "last_name", + direction: "DESC" + }); }, - EMAIL_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: "email", - direction: "ASC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } + EMAIL_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "email", + direction: "ASC" + }); + queryBuilder.setOrderIsUnique(); }, - EMAIL_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: "email", - direction: "DESC", - ...(undefined != null ? { - nulls: undefined ? "LAST" : "FIRST" - } : null) - }); - if (true) plan.setOrderIsUnique(); - } + EMAIL_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "email", + direction: "DESC" + }); + queryBuilder.setOrderIsUnique(); }, - POSTS_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + TIER_ASC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "tier", + direction: "ASC" + }); + }, + TIER_DESC(queryBuilder) { + queryBuilder.orderBy({ + attribute: "tier", + direction: "DESC" + }); + }, + POSTS_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_postPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - POSTS_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + POSTS_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_postPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.id.codec) ?? spec_post.attributes.id.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_post.attributes.id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.id.codec) ?? spec_post.attributes.id.codec, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_TITLE_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_TITLE_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.title.codec) ?? spec_post.attributes.title.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_TITLE_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_TITLE_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("title")}`, spec_post.attributes.title.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.title.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.title.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.title.codec) ?? spec_post.attributes.title.codec, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_DESCRIPTION_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_DESCRIPTION_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.description.codec) ?? spec_post.attributes.description.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_DESCRIPTION_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_DESCRIPTION_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("description")}`, spec_post.attributes.description.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.description.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.description.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.description.codec) ?? spec_post.attributes.description.codec, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_PROJECT_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_PROJECT_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} from ${resource_postPgResource.from} ${tableAlias} -where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, - direction: "ASC" - }); - } +where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.project_id.codec) ?? spec_post.attributes.project_id.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_PROJECT_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_PROJECT_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("project_id")}`, spec_post.attributes.project_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.project_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.project_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.project_id.codec) ?? spec_post.attributes.project_id.codec, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_USER_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.user_id.codec) ?? spec_post.attributes.user_id.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_USER_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_post.attributes.user_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.user_id.codec) ?? spec_post.attributes.user_id.codec, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.created_at.codec) ?? spec_post.attributes.created_at.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_post.attributes.created_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.created_at.codec) ?? spec_post.attributes.created_at.codec, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.updated_at.codec) ?? spec_post.attributes.updated_at.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_post.attributes.updated_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.updated_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.updated_at.codec) ?? spec_post.attributes.updated_at.codec, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_STATUS_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_STATUS_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_id.codec) ?? spec_post.attributes.status_id.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_STATUS_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_STATUS_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_id")}`, spec_post.attributes.status_id.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_id.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_id.codec) ?? spec_post.attributes.status_id.codec, + direction: "DESC" + }); }, - POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_updated_at.codec) ?? spec_post.attributes.status_updated_at.codec, + direction: "ASC" + }); }, - POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + POSTS_DISTINCT_COUNT_STATUS_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_postPgResource.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 resource_postPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("status_updated_at")}`, spec_post.attributes.status_updated_at.codec)} from ${resource_postPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_post.attributes.status_updated_at.codec)) !== null && _b !== void 0 ? _b : spec_post.attributes.status_updated_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_post.attributes.status_updated_at.codec) ?? spec_post.attributes.status_updated_at.codec, + direction: "DESC" + }); }, - UPVOTES_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + UPVOTES_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - UPVOTES_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + UPVOTES_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $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(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.id.codec) ?? 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(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_upvote.attributes.id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.id.codec) ?? 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(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_POST_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.post_id.codec) ?? 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(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_POST_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_upvote.attributes.post_id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.post_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.post_id.codec) ?? 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(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.user_id.codec) ?? 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(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_upvote.attributes.user_id.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.user_id.codec) ?? 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(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.created_at.codec) ?? 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(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_upvote.attributes.created_at.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.created_at.codec) ?? spec_upvote.attributes.created_at.codec, + direction: "DESC" + }); }, - UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.updated_at.codec) ?? spec_upvote.attributes.updated_at.codec, + direction: "ASC" + }); }, - UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + UPVOTES_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_upvotePgResource.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_upvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_upvote.attributes.updated_at.codec)} from ${resource_upvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_upvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_upvote.attributes.updated_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_upvote.attributes.updated_at.codec) ?? spec_upvote.attributes.updated_at.codec, + direction: "DESC" + }); }, - MEMBERS_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + MEMBERS_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_memberPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - MEMBERS_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + MEMBERS_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_memberPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_USER_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_member.attributes.user_id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.user_id.codec) ?? spec_member.attributes.user_id.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_USER_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_member.attributes.user_id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.user_id.codec) ?? spec_member.attributes.user_id.codec, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_ORGANIZATION_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ORGANIZATION_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_member.attributes.organization_id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.organization_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.organization_id.codec) ?? spec_member.attributes.organization_id.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_ORGANIZATION_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ORGANIZATION_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("organization_id")}`, spec_member.attributes.organization_id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.organization_id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.organization_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.organization_id.codec) ?? spec_member.attributes.organization_id.codec, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_member.attributes.created_at.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.created_at.codec) ?? spec_member.attributes.created_at.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_member.attributes.created_at.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.created_at.codec) ?? spec_member.attributes.created_at.codec, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_ROLE_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ROLE_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("role")}`, spec_member.attributes.role.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.role.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.role.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.role.codec) ?? spec_member.attributes.role.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_ROLE_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ROLE_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("role")}`, spec_member.attributes.role.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.role.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.role.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.role.codec) ?? spec_member.attributes.role.codec, + direction: "DESC" + }); }, - MEMBERS_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_member.attributes.id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.id.codec) ?? spec_member.attributes.id.codec, + direction: "ASC" + }); }, - MEMBERS_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); - relation12.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation12.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + MEMBERS_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_memberPgResource.name)); + relation12.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation12.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_memberPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_member.attributes.id.codec)} from ${resource_memberPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_member.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_member.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_member.attributes.id.codec) ?? spec_member.attributes.id.codec, + direction: "DESC" + }); }, - COMMENTS_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + COMMENTS_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_commentPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - COMMENTS_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + COMMENTS_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_commentPgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.id.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_comment.attributes.id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.id.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_MESSAGE_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.message.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.message.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.message.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_MESSAGE_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("message")}`, spec_comment.attributes.message.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.message.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.message.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.message.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_POST_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.post_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.post_id.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_POST_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_comment.attributes.post_id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.post_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.post_id.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.user_id.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_comment.attributes.user_id.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.user_id.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.created_at.codec) ?? 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(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_comment.attributes.created_at.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.created_at.codec) ?? spec_comment.attributes.created_at.codec, + direction: "DESC" + }); }, - COMMENTS_DISTINCT_COUNT_UPDATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.updated_at.codec) ?? spec_comment.attributes.updated_at.codec, + direction: "ASC" + }); }, - COMMENTS_DISTINCT_COUNT_UPDATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); - relation13.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation13.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + COMMENTS_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_commentPgResource.name)); + relation13.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation13.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_commentPgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_comment.attributes.updated_at.codec)} from ${resource_commentPgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_comment.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_comment.attributes.updated_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_comment.attributes.updated_at.codec) ?? spec_comment.attributes.updated_at.codec, + direction: "DESC" + }); }, - DOWNVOTES_COUNT_ASC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + DOWNVOTES_COUNT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "ASC" + }); }, - DOWNVOTES_COUNT_DESC: { - applyPlan($select) { - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent`select count(*) + DOWNVOTES_COUNT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent`select count(*) from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.parens(sql.join(conditions.map(c => sql.parens(c)), " AND "))}`})`; - $select.orderBy({ - fragment, - codec: TYPES.bigint, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: TYPES.bigint, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_ROW_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_ROW_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.id.codec) ?? spec_downvote.attributes.id.codec, + direction: "ASC" + }); }, - DOWNVOTES_DISTINCT_COUNT_ROW_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_ROW_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("id")}`, spec_downvote.attributes.id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.id.codec) ?? spec_downvote.attributes.id.codec, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_POST_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_POST_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.post_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.post_id.codec) ?? spec_downvote.attributes.post_id.codec, + direction: "ASC" + }); }, - DOWNVOTES_DISTINCT_COUNT_POST_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_POST_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("post_id")}`, spec_downvote.attributes.post_id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.post_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.post_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.post_id.codec) ?? spec_downvote.attributes.post_id.codec, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_USER_ID_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_USER_ID_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.user_id.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.user_id.codec) ?? spec_downvote.attributes.user_id.codec, + direction: "ASC" + }); }, - DOWNVOTES_DISTINCT_COUNT_USER_ID_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_USER_ID_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("user_id")}`, spec_downvote.attributes.user_id.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.user_id.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.user_id.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.user_id.codec) ?? spec_downvote.attributes.user_id.codec, + direction: "DESC" + }); }, - DOWNVOTES_DISTINCT_COUNT_CREATED_AT_ASC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.created_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.created_at.codec) ?? spec_downvote.attributes.created_at.codec, + direction: "ASC" + }); }, - DOWNVOTES_DISTINCT_COUNT_CREATED_AT_DESC: { - applyPlan($select) { - var _a, _b; - const foreignTableAlias = $select.alias, - conditions = [], - tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_CREATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("created_at")}`, spec_downvote.attributes.created_at.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.created_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.created_at.codec, - direction: "DESC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.created_at.codec) ?? 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(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_ASC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.updated_at.codec, - direction: "ASC" - }); - } + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.updated_at.codec) ?? 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(resource_downvotePgResource.name)); - relation14.localAttributes.forEach((localAttribute, i) => { - const remoteAttribute = relation14.remoteAttributes[i]; - conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); - }); - if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); - const fragment = sql`(${sql.indent` + DOWNVOTES_DISTINCT_COUNT_UPDATED_AT_DESC($select) { + const foreignTableAlias = $select.alias, + conditions = [], + tableAlias = sql.identifier(Symbol(resource_downvotePgResource.name)); + relation14.localAttributes.forEach((localAttribute, i) => { + const remoteAttribute = relation14.remoteAttributes[i]; + conditions.push(sql.fragment`${tableAlias}.${sql.identifier(remoteAttribute)} = ${foreignTableAlias}.${sql.identifier(localAttribute)}`); + }); + if (typeof resource_downvotePgResource.from === "function") throw new Error("Function source unsupported"); + const fragment = sql`(${sql.indent` select ${spec.sqlAggregateWrap(sql.fragment`${tableAlias}.${sql.identifier("updated_at")}`, spec_downvote.attributes.updated_at.codec)} from ${resource_downvotePgResource.from} ${tableAlias} where ${sql.join(conditions.map(c => sql.parens(c)), " AND ")}`})`; - $select.orderBy({ - fragment, - codec: (_b = (_a = spec.pgTypeCodecModifier) === null || _a === void 0 ? void 0 : _a.call(spec, spec_downvote.attributes.updated_at.codec)) !== null && _b !== void 0 ? _b : spec_downvote.attributes.updated_at.codec, - direction: "DESC" - }); - } - } - }, - UserCondition: { - 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_user.attributes.id.codec)}`; - } - }); - }, - 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`; - } - });else $condition.where({ - type: "attribute", - attribute: "created_at", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_user.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_user.attributes.updated_at.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - hidraId: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "hidra_id", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "hidra_id", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_user.attributes.hidra_id.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - username: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "username", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "username", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_user.attributes.username.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - firstName: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "first_name", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "first_name", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_user.attributes.first_name.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - lastName: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "last_name", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "last_name", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_user.attributes.last_name.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - email: { - applyPlan($condition, val) { - if (val.getRaw().evalIs(null)) $condition.where({ - type: "attribute", - attribute: "email", - callback(expression) { - return sql`${expression} is null`; - } - });else $condition.where({ - type: "attribute", - attribute: "email", - callback(expression) { - return sql`${expression} = ${$condition.placeholder(val.get(), spec_user.attributes.email.codec)}`; - } - }); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + $select.orderBy({ + fragment, + codec: spec.pgTypeCodecModifier?.(spec_downvote.attributes.updated_at.codec) ?? spec_downvote.attributes.updated_at.codec, + direction: "DESC" + }); } }, Mutation: { __assertStep: __ValueStep, createDownvote: { plan(_, args) { - const plan = object({ - result: pgInsertSingle(resource_downvotePgResource, Object.create(null)) + const $insert = pgInsertSingle(resource_downvotePgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert }); - args.apply(plan); - return plan; }, args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, createUpvote: { plan(_, args) { - const plan = object({ - result: pgInsertSingle(resource_upvotePgResource, Object.create(null)) + const $insert = pgInsertSingle(resource_upvotePgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert }); - args.apply(plan); - return plan; }, args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, createInvitation: { plan(_, args) { - const plan = object({ - result: pgInsertSingle(resource_invitationPgResource, Object.create(null)) + const $insert = pgInsertSingle(resource_invitationPgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert }); - args.apply(plan); - return plan; }, args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, createOrganization: { - plan(_, args) { - const plan = object({ - result: pgInsertSingle(resource_organizationPgResource, Object.create(null)) - }); - args.apply(plan); - return plan; - }, - args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } - } - } - }, - createComment: { - plan(_, args) { - const plan = object({ - result: pgInsertSingle(resource_commentPgResource, Object.create(null)) - }); - args.apply(plan); - return plan; - }, - args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } - } - } - }, - createProject: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"createProject"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"createOrganization"}, but that function did not return a step! ${String(oldPlan)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -30973,37 +26027,31 @@ ${String(oldPlan)}`); return $newPlan; }, args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - createUser: { + createComment: { plan(_, args) { - const plan = object({ - result: pgInsertSingle(resource_userPgResource, Object.create(null)) + const $insert = pgInsertSingle(resource_commentPgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert }); - args.apply(plan); - return plan; }, args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - createMember: { + createProject: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan2(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"createMember"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"createProject"}, but that function did not return a step! ${String(oldPlan2)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31016,37 +26064,17 @@ ${String(oldPlan2)}`); return $newPlan; }, args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } - } - } - }, - createPost: { - plan(_, args) { - const plan = object({ - result: pgInsertSingle(resource_postPgResource, Object.create(null)) - }); - args.apply(plan); - return plan; - }, - args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - createPostStatus: { + createMember: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan3(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"createPostStatus"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"createMember"}, but that function did not return a step! ${String(oldPlan3)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31059,20 +26087,31 @@ ${String(oldPlan3)}`); return $newPlan; }, args: { - input: { - autoApplyAfterParentPlan: true, - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - updateDownvote: { + createPost: { + plan(_, args) { + const $insert = pgInsertSingle(resource_postPgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert + }); + }, + args: { + input(_, $object) { + return $object; + } + } + }, + createPostStatus: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan4(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"updateDownvote"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"createPostStatus"}, but that function did not return a step! ${String(oldPlan4)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31085,19 +26124,31 @@ ${String(oldPlan4)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - updateUpvote: { + createUser: { + plan(_, args) { + const $insert = pgInsertSingle(resource_userPgResource, Object.create(null)); + args.apply($insert); + return object({ + result: $insert + }); + }, + args: { + input(_, $object) { + return $object; + } + } + }, + updateDownvote: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan5(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"updateUpvote"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"updateDownvote"}, but that function did not return a step! ${String(oldPlan5)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31110,37 +26161,17 @@ ${String(oldPlan5)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } - } - } - }, - updateInvitation: { - plan(_$root, args) { - const plan = object({ - result: pgUpdateSingle(resource_invitationPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; - }, - args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - updateOrganization: { + updateUpvote: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan6(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"updateOrganization"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"updateUpvote"}, but that function did not return a step! ${String(oldPlan6)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31153,19 +26184,33 @@ ${String(oldPlan6)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - updateComment: { + updateInvitation: { + plan(_$root, args) { + const $update = pgUpdateSingle(resource_invitationPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($update); + return object({ + result: $update + }); + }, + args: { + input(_, $object) { + return $object; + } + } + }, + updateOrganization: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan7(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"updateComment"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"updateOrganization"}, but that function did not return a step! ${String(oldPlan7)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31178,19 +26223,17 @@ ${String(oldPlan7)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - updateProject: { + updateComment: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan8(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"updateProject"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"updateComment"}, but that function did not return a step! ${String(oldPlan8)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31203,19 +26246,17 @@ ${String(oldPlan8)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - updateUser: { + updateProject: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan9(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"updateUser"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"updateProject"}, but that function did not return a step! ${String(oldPlan9)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31228,10 +26269,8 @@ ${String(oldPlan9)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, @@ -31253,10 +26292,8 @@ ${String(oldPlan10)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, @@ -31278,10 +26315,8 @@ ${String(oldPlan11)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, @@ -31303,19 +26338,17 @@ ${String(oldPlan12)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - deleteDownvote: { + updateUser: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan13(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteDownvote"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"updateUser"}, but that function did not return a step! ${String(oldPlan13)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31328,19 +26361,17 @@ ${String(oldPlan13)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - deleteUpvote: { + deleteDownvote: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan14(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteUpvote"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteDownvote"}, but that function did not return a step! ${String(oldPlan14)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31353,37 +26384,17 @@ ${String(oldPlan14)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } - } - } - }, - deleteInvitation: { - plan(_$root, args) { - const plan = object({ - result: pgDeleteSingle(resource_invitationPgResource, { - id: args.get(['input', "rowId"]) - }) - }); - args.apply(plan); - return plan; - }, - args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - deleteOrganization: { + deleteUpvote: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan15(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteOrganization"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteUpvote"}, but that function did not return a step! ${String(oldPlan15)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31396,19 +26407,33 @@ ${String(oldPlan15)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - deleteComment: { + deleteInvitation: { + plan(_$root, args) { + const $delete = pgDeleteSingle(resource_invitationPgResource, { + id: args.getRaw(['input', "rowId"]) + }); + args.apply($delete); + return object({ + result: $delete + }); + }, + args: { + input(_, $object) { + return $object; + } + } + }, + deleteOrganization: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan16(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteComment"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteOrganization"}, but that function did not return a step! ${String(oldPlan16)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31421,19 +26446,17 @@ ${String(oldPlan16)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - deleteProject: { + deleteComment: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan17(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteProject"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteComment"}, but that function did not return a step! ${String(oldPlan17)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31446,19 +26469,17 @@ ${String(oldPlan17)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, - deleteUser: { + deleteProject: { plan(...planParams) { const smartPlan = (...overrideParams) => { const $prev = oldPlan18(...overrideParams.concat(planParams.slice(overrideParams.length))); if (!($prev instanceof ExecutableStep)) { - console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteUser"}, but that function did not return a step! + console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteProject"}, but that function did not return a step! ${String(oldPlan18)}`); throw new Error("Wrapped a plan function, but that function did not return a step!"); } @@ -31471,10 +26492,8 @@ ${String(oldPlan18)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, @@ -31496,10 +26515,8 @@ ${String(oldPlan19)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, @@ -31521,10 +26538,8 @@ ${String(oldPlan20)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; } } }, @@ -31546,10 +26561,31 @@ ${String(oldPlan21)}`); return $newPlan; }, args: { - input: { - applyPlan(_, $object) { - return $object; - } + input(_, $object) { + return $object; + } + } + }, + deleteUser: { + plan(...planParams) { + const smartPlan = (...overrideParams) => { + const $prev = oldPlan22(...overrideParams.concat(planParams.slice(overrideParams.length))); + if (!($prev instanceof ExecutableStep)) { + console.error(`Wrapped a plan function at ${"Mutation"}.${"deleteUser"}, but that function did not return a step! +${String(oldPlan22)}`); + throw new Error("Wrapped a plan function, but that function did not return a step!"); + } + return $prev; + }, + [$source, fieldArgs, info] = planParams, + $newPlan = planWrapper22(smartPlan, $source, fieldArgs, info); + if ($newPlan === void 0) throw new Error("Your plan wrapper didn't return anything; it must return a step or null!"); + if ($newPlan !== null && !isExecutableStep($newPlan)) throw new Error(`Your plan wrapper returned something other than a step... It must return a step (or null). (Returned: ${inspect($newPlan)})`); + return $newPlan; + }, + args: { + input(_, $object) { + return $object; } } } @@ -31557,7 +26593,7 @@ ${String(oldPlan21)}`); CreateDownvotePayload: { __assertStep: assertExecutableStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, downvote($object) { return $object.get("result"); @@ -31565,88 +26601,69 @@ ${String(oldPlan21)}`); 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 resource_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 - } + downvoteEdge($mutation, fieldArgs) { + 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 resource_downvotePgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, CreateDownvoteInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - downvote: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true + downvote(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, DownvoteInput: { - "__inputPlan": function DownvoteInput_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", 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 + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + postId(obj, val, { + field, + schema + }) { + obj.set("post_id", bakedInputRuntime(schema, field.type, val)); + }, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, CreateUpvotePayload: { __assertStep: assertExecutableStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, upvote($object) { return $object.get("result"); @@ -31654,88 +26671,69 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - upvoteEdge: { - 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 = upvoteUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_upvotePgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + upvoteEdge($mutation, fieldArgs) { + 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 = upvoteUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_upvotePgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, CreateUpvoteInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - upvote: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true + upvote(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, UpvoteInput: { - "__inputPlan": function UpvoteInput_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", 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 + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + postId(obj, val, { + field, + schema + }) { + obj.set("post_id", bakedInputRuntime(schema, field.type, val)); + }, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, CreateInvitationPayload: { __assertStep: assertExecutableStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, invitation($object) { return $object.get("result"); @@ -31743,493 +26741,303 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - invitationEdge: { - 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 = invitationUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_invitationPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("InvitationOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + invitationEdge($mutation, fieldArgs) { + 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 = invitationUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_invitationPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, CreateInvitationInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true - }, - invitation: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true - } - }, - InvitationInput: { - "__inputPlan": function InvitationInput_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - organizationId: { - applyPlan($insert, val) { - $insert.set("organization_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - email: { - applyPlan($insert, val) { - $insert.set("email", 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 - } - }, - CreateOrganizationPayload: { - __assertStep: assertExecutableStep, - clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); - }, - organization($object) { - return $object.get("result"); - }, - query() { - return rootValue(); - }, - organizationEdge: { - 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 = organizationUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_organizationPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("OrganizationOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } - } - }, - CreateOrganizationInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true - }, - organization: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true - } - }, - OrganizationInput: { - "__inputPlan": function OrganizationInput_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - name: { - applyPlan($insert, val) { - $insert.set("name", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - slug: { - applyPlan($insert, val) { - $insert.set("slug", 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 - } - }, - 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 resource_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 - } - }, - CreateProjectPayload: { - __assertStep: assertExecutableStep, - clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); - }, - project($object) { - return $object.get("result"); - }, - query() { - return rootValue(); - }, - projectEdge: { - 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 = projectUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_projectPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("ProjectOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } - } - }, - CreateProjectInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true - }, - project: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true + invitation(qb, arg) { + if (arg != null) return qb.setBuilder(); } - }, - ProjectInput: { - "__inputPlan": function ProjectInput_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - name: { - applyPlan($insert, val) { - $insert.set("name", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - image: { - applyPlan($insert, val) { - $insert.set("image", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - 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 + }, + InvitationInput: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + organizationId(obj, val, { + field, + schema + }) { + obj.set("organization_id", bakedInputRuntime(schema, field.type, val)); + }, + email(obj, val, { + field, + schema + }) { + obj.set("email", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, - CreateUserPayload: { + CreateOrganizationPayload: { __assertStep: assertExecutableStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, - user($object) { + organization($object) { return $object.get("result"); }, query() { return rootValue(); }, - userEdge: { - 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 = userUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_userPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("UserOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + organizationEdge($mutation, fieldArgs) { + 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 = organizationUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_organizationPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, - CreateUserInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true + CreateOrganizationInput: { + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - user: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true + organization(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, - UserInput: { - "__inputPlan": function UserInput_inputPlan() { - return object(Object.create(null)); + OrganizationInput: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + name(obj, val, { + field, + schema + }) { + obj.set("name", bakedInputRuntime(schema, field.type, val)); + }, + slug(obj, val, { + field, + schema + }) { + obj.set("slug", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); + } + }, + CreateCommentPayload: { + __assertStep: assertExecutableStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + comment($object) { + return $object.get("result"); }, - createdAt: { - applyPlan($insert, val) { - $insert.set("created_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + query() { + return rootValue(); }, - updatedAt: { - applyPlan($insert, val) { - $insert.set("updated_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + commentEdge($mutation, fieldArgs) { + 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 resource_commentPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + } + }, + CreateCommentInput: { + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - hidraId: { - applyPlan($insert, val) { - $insert.set("hidra_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + comment(qb, arg) { + if (arg != null) return qb.setBuilder(); + } + }, + CommentInput: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + message(obj, val, { + field, + schema + }) { + obj.set("message", bakedInputRuntime(schema, field.type, val)); + }, + postId(obj, val, { + field, + schema + }) { + obj.set("post_id", bakedInputRuntime(schema, field.type, val)); + }, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); + } + }, + CreateProjectPayload: { + __assertStep: assertExecutableStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, - username: { - applyPlan($insert, val) { - $insert.set("username", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + project($object) { + return $object.get("result"); }, - firstName: { - applyPlan($insert, val) { - $insert.set("first_name", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + query() { + return rootValue(); }, - lastName: { - applyPlan($insert, val) { - $insert.set("last_name", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + projectEdge($mutation, fieldArgs) { + 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 = projectUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_projectPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + } + }, + CreateProjectInput: { + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - email: { - applyPlan($insert, val) { - $insert.set("email", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + project(qb, arg) { + if (arg != null) return qb.setBuilder(); + } + }, + ProjectInput: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + name(obj, val, { + field, + schema + }) { + obj.set("name", bakedInputRuntime(schema, field.type, val)); + }, + image(obj, val, { + field, + schema + }) { + obj.set("image", bakedInputRuntime(schema, field.type, val)); + }, + slug(obj, val, { + field, + schema + }) { + obj.set("slug", bakedInputRuntime(schema, field.type, val)); + }, + description(obj, val, { + field, + schema + }) { + obj.set("description", bakedInputRuntime(schema, field.type, val)); + }, + organizationId(obj, val, { + field, + schema + }) { + obj.set("organization_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, CreateMemberPayload: { __assertStep: assertExecutableStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, member($object) { return $object.get("result"); @@ -32237,88 +27045,69 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - memberEdge: { - 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 = memberUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_memberPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("MemberOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + memberEdge($mutation, fieldArgs) { + 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 = memberUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_memberPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, CreateMemberInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - member: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true + member(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, MemberInput: { - "__inputPlan": function MemberInput_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 - }, - role: { - applyPlan($insert, val) { - $insert.set("role", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + __baked: createObjectAndApplyChildren, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + organizationId(obj, val, { + field, + schema + }) { + obj.set("organization_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + role(obj, val, { + field, + schema + }) { + obj.set("role", bakedInputRuntime(schema, field.type, val)); + }, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); } }, CreatePostPayload: { __assertStep: assertExecutableStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, post($object) { return $object.get("result"); @@ -32326,116 +27115,93 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - postEdge: { - 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 = postUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_postPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + postEdge($mutation, fieldArgs) { + 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 = postUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_postPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, CreatePostInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - post: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true + post(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, PostInput: { - "__inputPlan": function PostInput_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - title: { - applyPlan($insert, val) { - $insert.set("title", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - description: { - applyPlan($insert, val) { - $insert.set("description", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - projectId: { - applyPlan($insert, val) { - $insert.set("project_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 - }, - statusId: { - applyPlan($insert, val) { - $insert.set("status_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - statusUpdatedAt: { - applyPlan($insert, val) { - $insert.set("status_updated_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + title(obj, val, { + field, + schema + }) { + obj.set("title", bakedInputRuntime(schema, field.type, val)); + }, + description(obj, val, { + field, + schema + }) { + obj.set("description", bakedInputRuntime(schema, field.type, val)); + }, + projectId(obj, val, { + field, + schema + }) { + obj.set("project_id", bakedInputRuntime(schema, field.type, val)); + }, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); + }, + statusId(obj, val, { + field, + schema + }) { + obj.set("status_id", bakedInputRuntime(schema, field.type, val)); + }, + statusUpdatedAt(obj, val, { + field, + schema + }) { + obj.set("status_updated_at", bakedInputRuntime(schema, field.type, val)); } }, CreatePostStatusPayload: { __assertStep: assertExecutableStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, postStatus($object) { return $object.get("result"); @@ -32443,109 +27209,175 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - postStatusEdge: { - 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 = post_statusUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_post_statusPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("PostStatusOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + postStatusEdge($mutation, fieldArgs) { + 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 = post_statusUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_post_statusPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, CreatePostStatusInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - }, - autoApplyAfterParentApplyPlan: true + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - postStatus: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - }, - autoApplyAfterParentApplyPlan: true + postStatus(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, PostStatusInput: { - "__inputPlan": function PostStatusInput_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - status: { - applyPlan($insert, val) { - $insert.set("status", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - description: { - applyPlan($insert, val) { - $insert.set("description", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - color: { - applyPlan($insert, val) { - $insert.set("color", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + status(obj, val, { + field, + schema + }) { + obj.set("status", bakedInputRuntime(schema, field.type, val)); + }, + description(obj, val, { + field, + schema + }) { + obj.set("description", bakedInputRuntime(schema, field.type, val)); + }, + color(obj, val, { + field, + schema + }) { + obj.set("color", bakedInputRuntime(schema, field.type, val)); + }, + projectId(obj, val, { + field, + schema + }) { + obj.set("project_id", bakedInputRuntime(schema, field.type, val)); + }, + isDefault(obj, val, { + field, + schema + }) { + obj.set("is_default", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); + } + }, + CreateUserPayload: { + __assertStep: assertExecutableStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, - projectId: { - applyPlan($insert, val) { - $insert.set("project_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + user($object) { + return $object.get("result"); }, - isDefault: { - applyPlan($insert, val) { - $insert.set("is_default", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + query() { + return rootValue(); }, - createdAt: { - applyPlan($insert, val) { - $insert.set("created_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + userEdge($mutation, fieldArgs) { + 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 = userUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_userPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + } + }, + CreateUserInput: { + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - updatedAt: { - applyPlan($insert, val) { - $insert.set("updated_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + user(qb, arg) { + if (arg != null) return qb.setBuilder(); + } + }, + UserInput: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); + }, + hidraId(obj, val, { + field, + schema + }) { + obj.set("hidra_id", bakedInputRuntime(schema, field.type, val)); + }, + username(obj, val, { + field, + schema + }) { + obj.set("username", bakedInputRuntime(schema, field.type, val)); + }, + firstName(obj, val, { + field, + schema + }) { + obj.set("first_name", bakedInputRuntime(schema, field.type, val)); + }, + lastName(obj, val, { + field, + schema + }) { + obj.set("last_name", bakedInputRuntime(schema, field.type, val)); + }, + email(obj, val, { + field, + schema + }) { + obj.set("email", bakedInputRuntime(schema, field.type, val)); } }, UpdateDownvotePayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, downvote($object) { return $object.get("result"); @@ -32553,87 +27385,69 @@ ${String(oldPlan21)}`); 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 resource_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 - } + downvoteEdge($mutation, fieldArgs) { + 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 resource_downvotePgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, UpdateDownvoteInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, DownvotePatch: { - "__inputPlan": function DownvotePatch_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", 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 + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + postId(obj, val, { + field, + schema + }) { + obj.set("post_id", bakedInputRuntime(schema, field.type, val)); + }, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, UpdateUpvotePayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, upvote($object) { return $object.get("result"); @@ -32641,87 +27455,69 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - upvoteEdge: { - 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 = upvoteUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_upvotePgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + upvoteEdge($mutation, fieldArgs) { + 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 = upvoteUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_upvotePgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, UpdateUpvoteInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, UpvotePatch: { - "__inputPlan": function UpvotePatch_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", 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 + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + postId(obj, val, { + field, + schema + }) { + obj.set("post_id", bakedInputRuntime(schema, field.type, val)); + }, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, UpdateInvitationPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, invitation($object) { return $object.get("result"); @@ -32729,87 +27525,69 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - invitationEdge: { - 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 = invitationUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_invitationPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("InvitationOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + invitationEdge($mutation, fieldArgs) { + 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 = invitationUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_invitationPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, UpdateInvitationInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, InvitationPatch: { - "__inputPlan": function InvitationPatch_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - organizationId: { - applyPlan($insert, val) { - $insert.set("organization_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - email: { - applyPlan($insert, val) { - $insert.set("email", 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 + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + organizationId(obj, val, { + field, + schema + }) { + obj.set("organization_id", bakedInputRuntime(schema, field.type, val)); + }, + email(obj, val, { + field, + schema + }) { + obj.set("email", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, UpdateOrganizationPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, organization($object) { return $object.get("result"); @@ -32817,400 +27595,233 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - organizationEdge: { - 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 = organizationUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_organizationPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("OrganizationOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + organizationEdge($mutation, fieldArgs) { + 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 = organizationUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_organizationPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, UpdateOrganizationInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } - } - }, - OrganizationPatch: { - "__inputPlan": function OrganizationPatch_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - name: { - applyPlan($insert, val) { - $insert.set("name", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - slug: { - applyPlan($insert, val) { - $insert.set("slug", 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 - } - }, - 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 resource_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 - } - } - }, - UpdateCommentInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, - 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 + OrganizationPatch: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + name(obj, val, { + field, + schema + }) { + obj.set("name", bakedInputRuntime(schema, field.type, val)); + }, + slug(obj, val, { + field, + schema + }) { + obj.set("slug", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, - UpdateProjectPayload: { + UpdateCommentPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, - project($object) { + comment($object) { return $object.get("result"); }, query() { return rootValue(); }, - projectEdge: { - 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 = projectUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_projectPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("ProjectOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + commentEdge($mutation, fieldArgs) { + 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 resource_commentPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, - UpdateProjectInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + UpdateCommentInput: { + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, - ProjectPatch: { - "__inputPlan": function ProjectPatch_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - name: { - applyPlan($insert, val) { - $insert.set("name", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - image: { - applyPlan($insert, val) { - $insert.set("image", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - 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 + CommentPatch: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + message(obj, val, { + field, + schema + }) { + obj.set("message", bakedInputRuntime(schema, field.type, val)); + }, + postId(obj, val, { + field, + schema + }) { + obj.set("post_id", bakedInputRuntime(schema, field.type, val)); + }, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, - UpdateUserPayload: { + UpdateProjectPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, - user($object) { + project($object) { return $object.get("result"); }, query() { return rootValue(); }, - userEdge: { - 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 = userUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_userPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("UserOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + projectEdge($mutation, fieldArgs) { + 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 = projectUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_projectPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, - UpdateUserInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + UpdateProjectInput: { + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, - UserPatch: { - "__inputPlan": function UserPatch_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("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 - }, - hidraId: { - applyPlan($insert, val) { - $insert.set("hidra_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - username: { - applyPlan($insert, val) { - $insert.set("username", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - firstName: { - applyPlan($insert, val) { - $insert.set("first_name", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - lastName: { - applyPlan($insert, val) { - $insert.set("last_name", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - email: { - applyPlan($insert, val) { - $insert.set("email", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + ProjectPatch: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + name(obj, val, { + field, + schema + }) { + obj.set("name", bakedInputRuntime(schema, field.type, val)); + }, + image(obj, val, { + field, + schema + }) { + obj.set("image", bakedInputRuntime(schema, field.type, val)); + }, + slug(obj, val, { + field, + schema + }) { + obj.set("slug", bakedInputRuntime(schema, field.type, val)); + }, + description(obj, val, { + field, + schema + }) { + obj.set("description", bakedInputRuntime(schema, field.type, val)); + }, + organizationId(obj, val, { + field, + schema + }) { + obj.set("organization_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); } }, UpdateMemberPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, member($object) { return $object.get("result"); @@ -33218,87 +27829,69 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - memberEdge: { - 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 = memberUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_memberPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("MemberOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + memberEdge($mutation, fieldArgs) { + 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 = memberUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_memberPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, UpdateMemberInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, MemberPatch: { - "__inputPlan": function MemberPatch_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 - }, - role: { - applyPlan($insert, val) { - $insert.set("role", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + __baked: createObjectAndApplyChildren, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + organizationId(obj, val, { + field, + schema + }) { + obj.set("organization_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + role(obj, val, { + field, + schema + }) { + obj.set("role", bakedInputRuntime(schema, field.type, val)); + }, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); } }, UpdatePostPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, post($object) { return $object.get("result"); @@ -33306,115 +27899,93 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - postEdge: { - 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 = postUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_postPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + postEdge($mutation, fieldArgs) { + 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 = postUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_postPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, UpdatePostInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, PostPatch: { - "__inputPlan": function PostPatch_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - title: { - applyPlan($insert, val) { - $insert.set("title", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - description: { - applyPlan($insert, val) { - $insert.set("description", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - projectId: { - applyPlan($insert, val) { - $insert.set("project_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 - }, - statusId: { - applyPlan($insert, val) { - $insert.set("status_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - statusUpdatedAt: { - applyPlan($insert, val) { - $insert.set("status_updated_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + title(obj, val, { + field, + schema + }) { + obj.set("title", bakedInputRuntime(schema, field.type, val)); + }, + description(obj, val, { + field, + schema + }) { + obj.set("description", bakedInputRuntime(schema, field.type, val)); + }, + projectId(obj, val, { + field, + schema + }) { + obj.set("project_id", bakedInputRuntime(schema, field.type, val)); + }, + userId(obj, val, { + field, + schema + }) { + obj.set("user_id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); + }, + statusId(obj, val, { + field, + schema + }) { + obj.set("status_id", bakedInputRuntime(schema, field.type, val)); + }, + statusUpdatedAt(obj, val, { + field, + schema + }) { + obj.set("status_updated_at", bakedInputRuntime(schema, field.type, val)); } }, UpdatePostStatusPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, postStatus($object) { return $object.get("result"); @@ -33422,108 +27993,175 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - postStatusEdge: { - 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 = post_statusUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_post_statusPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("PostStatusOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + postStatusEdge($mutation, fieldArgs) { + 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 = post_statusUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_post_statusPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, UpdatePostStatusInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - rowId: undefined, - patch: { - applyPlan($object) { - return $object.getStepForKey("result").setPlan(); - } + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); } }, PostStatusPatch: { - "__inputPlan": function PostStatusPatch_inputPlan() { - return object(Object.create(null)); - }, - rowId: { - applyPlan($insert, val) { - $insert.set("id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - status: { - applyPlan($insert, val) { - $insert.set("status", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - description: { - applyPlan($insert, val) { - $insert.set("description", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true - }, - color: { - applyPlan($insert, val) { - $insert.set("color", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + status(obj, val, { + field, + schema + }) { + obj.set("status", bakedInputRuntime(schema, field.type, val)); + }, + description(obj, val, { + field, + schema + }) { + obj.set("description", bakedInputRuntime(schema, field.type, val)); + }, + color(obj, val, { + field, + schema + }) { + obj.set("color", bakedInputRuntime(schema, field.type, val)); + }, + projectId(obj, val, { + field, + schema + }) { + obj.set("project_id", bakedInputRuntime(schema, field.type, val)); + }, + isDefault(obj, val, { + field, + schema + }) { + obj.set("is_default", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); + } + }, + UpdateUserPayload: { + __assertStep: ObjectStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, - projectId: { - applyPlan($insert, val) { - $insert.set("project_id", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + user($object) { + return $object.get("result"); }, - isDefault: { - applyPlan($insert, val) { - $insert.set("is_default", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + query() { + return rootValue(); }, - createdAt: { - applyPlan($insert, val) { - $insert.set("created_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + userEdge($mutation, fieldArgs) { + 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 = userUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_userPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + } + }, + UpdateUserInput: { + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); }, - updatedAt: { - applyPlan($insert, val) { - $insert.set("updated_at", val.get()); - }, - autoApplyAfterParentInputPlan: true, - autoApplyAfterParentApplyPlan: true + patch(qb, arg) { + if (arg != null) return qb.setBuilder(); + } + }, + UserPatch: { + __baked: createObjectAndApplyChildren, + rowId(obj, val, { + field, + schema + }) { + obj.set("id", bakedInputRuntime(schema, field.type, val)); + }, + createdAt(obj, val, { + field, + schema + }) { + obj.set("created_at", bakedInputRuntime(schema, field.type, val)); + }, + updatedAt(obj, val, { + field, + schema + }) { + obj.set("updated_at", bakedInputRuntime(schema, field.type, val)); + }, + hidraId(obj, val, { + field, + schema + }) { + obj.set("hidra_id", bakedInputRuntime(schema, field.type, val)); + }, + username(obj, val, { + field, + schema + }) { + obj.set("username", bakedInputRuntime(schema, field.type, val)); + }, + firstName(obj, val, { + field, + schema + }) { + obj.set("first_name", bakedInputRuntime(schema, field.type, val)); + }, + lastName(obj, val, { + field, + schema + }) { + obj.set("last_name", bakedInputRuntime(schema, field.type, val)); + }, + email(obj, val, { + field, + schema + }) { + obj.set("email", bakedInputRuntime(schema, field.type, val)); } }, DeleteDownvotePayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, downvote($object) { return $object.get("result"); @@ -33531,42 +28169,33 @@ ${String(oldPlan21)}`); 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 resource_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 - } + downvoteEdge($mutation, fieldArgs) { + 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 resource_downvotePgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeleteDownvoteInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } }, DeleteUpvotePayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, upvote($object) { return $object.get("result"); @@ -33574,42 +28203,33 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - upvoteEdge: { - 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 = upvoteUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_upvotePgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("UpvoteOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + upvoteEdge($mutation, fieldArgs) { + 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 = upvoteUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_upvotePgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeleteUpvoteInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } }, DeleteInvitationPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, invitation($object) { return $object.get("result"); @@ -33617,42 +28237,33 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - invitationEdge: { - 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 = invitationUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_invitationPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("InvitationOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + invitationEdge($mutation, fieldArgs) { + 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 = invitationUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_invitationPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeleteInvitationInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } }, DeleteOrganizationPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, organization($object) { return $object.get("result"); @@ -33660,42 +28271,33 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - organizationEdge: { - 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 = organizationUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_organizationPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("OrganizationOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + organizationEdge($mutation, fieldArgs) { + 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 = organizationUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_organizationPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeleteOrganizationInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } }, DeleteCommentPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, comment($object) { return $object.get("result"); @@ -33703,42 +28305,33 @@ ${String(oldPlan21)}`); 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 resource_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 - } + commentEdge($mutation, fieldArgs) { + 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 resource_commentPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeleteCommentInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } }, DeleteProjectPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, project($object) { return $object.get("result"); @@ -33746,85 +28339,33 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - projectEdge: { - 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 = projectUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_projectPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("ProjectOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + projectEdge($mutation, fieldArgs) { + 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 = projectUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_projectPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeleteProjectInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined - }, - DeleteUserPayload: { - __assertStep: ObjectStep, - clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); - }, - user($object) { - return $object.get("result"); - }, - query() { - return rootValue(); - }, - userEdge: { - 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 = userUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_userPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("UserOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); } }, - DeleteUserInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined - }, DeleteMemberPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, member($object) { return $object.get("result"); @@ -33832,42 +28373,33 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - memberEdge: { - 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 = memberUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_memberPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("MemberOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + memberEdge($mutation, fieldArgs) { + 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 = memberUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_memberPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeleteMemberInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } }, DeletePostPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, post($object) { return $object.get("result"); @@ -33875,42 +28407,33 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - postEdge: { - 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 = postUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_postPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("PostOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + postEdge($mutation, fieldArgs) { + 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 = postUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_postPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeletePostInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } - }, - rowId: undefined + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } }, DeletePostStatusPayload: { __assertStep: ObjectStep, clientMutationId($mutation) { - return $mutation.getStepForKey("clientMutationId", !0) ?? constant(null); + return $mutation.getStepForKey("result").getMeta("clientMutationId"); }, postStatus($object) { return $object.get("result"); @@ -33918,37 +28441,62 @@ ${String(oldPlan21)}`); query() { return rootValue(); }, - postStatusEdge: { - 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 = post_statusUniques[0].attributes.reduce((memo, attributeName) => { - memo[attributeName] = $result.get(attributeName); - return memo; - }, Object.create(null)); - return resource_post_statusPgResource.find(spec); - } - })(), - $value = args.getRaw("orderBy"); - applyOrderToPlan($select, $value, info.schema.getType("PostStatusOrderBy")); - const $connection = connection($select), - $single = $select.row(first($select)); - return new EdgeStep($connection, $single); - }, - args: { - orderBy: undefined - } + postStatusEdge($mutation, fieldArgs) { + 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 = post_statusUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_post_statusPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); } }, DeletePostStatusInput: { - clientMutationId: { - applyPlan($input, val) { - $input.set("clientMutationId", val.get()); - } + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } + }, + DeleteUserPayload: { + __assertStep: ObjectStep, + clientMutationId($mutation) { + return $mutation.getStepForKey("result").getMeta("clientMutationId"); + }, + user($object) { + return $object.get("result"); }, - rowId: undefined + query() { + return rootValue(); + }, + userEdge($mutation, fieldArgs) { + 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 = userUniques[0].attributes.reduce((memo, attributeName) => { + memo[attributeName] = $result.get(attributeName); + return memo; + }, Object.create(null)); + return resource_userPgResource.find(spec); + } + })(); + fieldArgs.apply($select, "orderBy"); + const $connection = connection($select), + $single = $select.row(first($select)); + return new EdgeStep($connection, $single); + } + }, + DeleteUserInput: { + clientMutationId(qb, val) { + qb.setMeta("clientMutationId", val); + } } }; export const schema = makeGrafastSchema({ diff --git a/src/lib/config/env.config.ts b/src/lib/config/env.config.ts index 5b79974..d242eef 100644 --- a/src/lib/config/env.config.ts +++ b/src/lib/config/env.config.ts @@ -8,6 +8,9 @@ export const { HOST = "0.0.0.0", DATABASE_URL, SKIP_AUTH, + POLAR_ACCESS_TOKEN, + POLAR_WEBHOOK_SECRET, + CHECKOUT_SUCCESS_URL, AUTH_BASE_URL, } = process.env; diff --git a/src/lib/drizzle/migrations/0013_light_quicksilver.sql b/src/lib/drizzle/migrations/0013_light_quicksilver.sql new file mode 100644 index 0000000..d88e5ac --- /dev/null +++ b/src/lib/drizzle/migrations/0013_light_quicksilver.sql @@ -0,0 +1,2 @@ +CREATE TYPE "public"."tier" AS ENUM('basic', 'team', 'enterprise');--> statement-breakpoint +ALTER TABLE "user" ADD COLUMN "tier" "tier"; \ No newline at end of file diff --git a/src/lib/drizzle/migrations/meta/0013_snapshot.json b/src/lib/drizzle/migrations/meta/0013_snapshot.json new file mode 100644 index 0000000..a80a2df --- /dev/null +++ b/src/lib/drizzle/migrations/meta/0013_snapshot.json @@ -0,0 +1,1284 @@ +{ + "id": "f8056501-0df1-4448-9e73-6dacf1280eb3", + "prevId": "a421c7d3-44cf-46fa-8445-cef0a3d830c7", + "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": { + "comment_id_index": { + "name": "comment_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "comment_post_id_index": { + "name": "comment_post_id_index", + "columns": [ + { + "expression": "post_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "comment_user_id_index": { + "name": "comment_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "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": { + "downvote_id_index": { + "name": "downvote_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "downvote_post_id_index": { + "name": "downvote_post_id_index", + "columns": [ + { + "expression": "post_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "downvote_user_id_index": { + "name": "downvote_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "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.invitation": { + "name": "invitation", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "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": { + "invitation_id_index": { + "name": "invitation_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "invitation_organization_id_index": { + "name": "invitation_organization_id_index", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "invitation_organization_id_organization_id_fk": { + "name": "invitation_organization_id_organization_id_fk", + "tableFrom": "invitation", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "invitation_organizationId_email_unique": { + "name": "invitation_organizationId_email_unique", + "nullsNotDistinct": false, + "columns": [ + "organization_id", + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.member": { + "name": "member", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "organization_id": { + "name": "organization_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "member_id_index": { + "name": "member_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "member_user_id_index": { + "name": "member_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "member_organization_id_index": { + "name": "member_organization_id_index", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "member_user_id_user_id_fk": { + "name": "member_user_id_user_id_fk", + "tableFrom": "member", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "member_organization_id_organization_id_fk": { + "name": "member_organization_id_organization_id_fk", + "tableFrom": "member", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "member_userId_organizationId_unique": { + "name": "member_userId_organizationId_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id", + "organization_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": true + }, + "slug": { + "name": "slug", + "type": "text", + "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": { + "organization_id_index": { + "name": "organization_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "organization_slug_index": { + "name": "organization_slug_index", + "columns": [ + { + "expression": "slug", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "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 + }, + "status_id": { + "name": "status_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "status_updated_at": { + "name": "status_updated_at", + "type": "timestamp(6) with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "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": { + "post_id_index": { + "name": "post_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "post_project_id_index": { + "name": "post_project_id_index", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "post_user_id_index": { + "name": "post_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "post_status_id_index": { + "name": "post_status_id_index", + "columns": [ + { + "expression": "status_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "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" + }, + "post_status_id_post_status_id_fk": { + "name": "post_status_id_post_status_id_fk", + "tableFrom": "post", + "tableTo": "post_status", + "columnsFrom": [ + "status_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.post_status": { + "name": "post_status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "project_id": { + "name": "project_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": 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": { + "post_status_unique_id_index": { + "name": "post_status_unique_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "post_status_status_project_id_index": { + "name": "post_status_status_project_id_index", + "columns": [ + { + "expression": "status", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "post_status_project_id_index": { + "name": "post_status_project_id_index", + "columns": [ + { + "expression": "project_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "post_status_project_id_project_id_fk": { + "name": "post_status_project_id_project_id_fk", + "tableFrom": "post_status", + "tableTo": "project", + "columnsFrom": [ + "project_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": true + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "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": { + "project_id_index": { + "name": "project_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "project_organization_id_index": { + "name": "project_organization_id_index", + "columns": [ + { + "expression": "organization_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "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_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": { + "upvote_id_index": { + "name": "upvote_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "upvote_post_id_index": { + "name": "upvote_post_id_index", + "columns": [ + { + "expression": "post_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "upvote_user_id_index": { + "name": "upvote_user_id_index", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "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 + }, + "tier": { + "name": "tier", + "type": "tier", + "typeSchema": "public", + "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 + }, + "email": { + "name": "email", + "type": "text", + "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": { + "user_id_index": { + "name": "user_id_index", + "columns": [ + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "user_hidra_id_index": { + "name": "user_hidra_id_index", + "columns": [ + { + "expression": "hidra_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "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" + ] + }, + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.role": { + "name": "role", + "schema": "public", + "values": [ + "owner", + "admin", + "member" + ] + }, + "public.tier": { + "name": "tier", + "schema": "public", + "values": [ + "basic", + "team", + "enterprise" + ] + } + }, + "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 d659f29..65cf1b8 100644 --- a/src/lib/drizzle/migrations/meta/_journal.json +++ b/src/lib/drizzle/migrations/meta/_journal.json @@ -92,6 +92,13 @@ "when": 1745336522400, "tag": "0012_clammy_impossible_man", "breakpoints": true + }, + { + "idx": 13, + "version": "7", + "when": 1745349016010, + "tag": "0013_light_quicksilver", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/lib/drizzle/schema/user.table.ts b/src/lib/drizzle/schema/user.table.ts index 1fd0158..126f8f1 100644 --- a/src/lib/drizzle/schema/user.table.ts +++ b/src/lib/drizzle/schema/user.table.ts @@ -1,9 +1,14 @@ -import { pgTable, text, uniqueIndex, uuid } from "drizzle-orm/pg-core"; +import { pgEnum, pgTable, text, uniqueIndex, uuid } from "drizzle-orm/pg-core"; import { defaultDate, defaultId } from "./constants"; import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; +/** + * Subscription tiers defined for users. + */ +export const tier = pgEnum("tier", ["basic", "team", "enterprise"]); + /** * User table. */ @@ -14,6 +19,7 @@ export const users = pgTable( // HIDRA ID mapped to `sub` claim hidraId: uuid().notNull().unique(), username: text().unique(), + tier: tier(), firstName: text(), lastName: text(), email: text().notNull().unique(), diff --git a/src/lib/graphql/index.ts b/src/lib/graphql/index.ts index 9ee54b0..403cbff 100644 --- a/src/lib/graphql/index.ts +++ b/src/lib/graphql/index.ts @@ -1 +1,4 @@ -export { createGraphQLContext, type GraphQLContext } from "./context"; +export { + createGraphQLContext, + type GraphQLContext, +} from "./context"; diff --git a/src/lib/plugins/postgraphile/MemberRBAC.plugin.ts b/src/lib/plugins/postgraphile/MemberRBAC.plugin.ts index 9096447..4c40775 100644 --- a/src/lib/plugins/postgraphile/MemberRBAC.plugin.ts +++ b/src/lib/plugins/postgraphile/MemberRBAC.plugin.ts @@ -17,12 +17,15 @@ const validatePermissions = (propName: string, scope: MutationScope) => // biome-ignore lint/suspicious/noExplicitAny: SmartFieldPlanResolver is not an exported type (plan: any, _: ExecutableStep, fieldArgs: FieldArgs) => { const $input = fieldArgs.getRaw(["input", propName]); + // NB: this is a little hacky, but a "step" can not be undefined, and since `patch` only exists on `update` mutations, we fallback to `input` + const $patch = + scope === "update" ? fieldArgs.getRaw(["input", "patch"]) : $input; const $currentUser = context().get("currentUser"); const $db = context().get("db"); sideEffect( - [$input, $currentUser, $db], - async ([input, currentUser, db]) => { + [$input, $patch, $currentUser, $db], + async ([input, patch, currentUser, db]) => { if (!currentUser) { throw new Error("Unauthorized"); } @@ -77,11 +80,20 @@ const validatePermissions = (propName: string, scope: MutationScope) => if (userRole.role !== "owner") { throw new Error("Insufficient permissions"); } - } else { - // Restrict current users from updating their own role unless they are an owner - if (scope === "update" && member.role !== "owner") { - throw new Error("Insufficient permissions"); + + // Disallow updates that include adding an additional owner + // TODO: remove when add owner / transfer ownership is resolved + if (patch.role === "owner") { + throw new Error("Organizations can only have one owner"); } + } else { + // Restrict current users from updating their own role + throw new Error("Insufficient permissions"); + + // TODO: replace above with below when ownership transfers are allowed + // if (scope === "update" && member.role !== "owner") { + // throw new Error("Insufficient permissions"); + // } } } }, diff --git a/src/lib/plugins/postgraphile/OrganizationRBAC.plugin.ts b/src/lib/plugins/postgraphile/OrganizationRBAC.plugin.ts index 4bea288..283655a 100644 --- a/src/lib/plugins/postgraphile/OrganizationRBAC.plugin.ts +++ b/src/lib/plugins/postgraphile/OrganizationRBAC.plugin.ts @@ -8,47 +8,68 @@ import * as dbSchema from "lib/drizzle/schema"; import type { GraphQLContext } from "lib/graphql"; import type { ExecutableStep, FieldArgs } from "postgraphile/grafast"; -type MutationScope = "update" | "delete"; +type MutationScope = "create" | "update" | "delete"; const validatePermissions = (propName: string, scope: MutationScope) => EXPORTABLE( (and, eq, dbSchema, context, sideEffect, propName, scope) => // biome-ignore lint/suspicious/noExplicitAny: SmartFieldPlanResolver is not an exported type (plan: any, _: ExecutableStep, fieldArgs: FieldArgs) => { - const $organizationId = fieldArgs.getRaw(["input", propName]); + const $organization = fieldArgs.getRaw(["input", propName]); const $currentUser = context().get("currentUser"); const $db = context().get("db"); sideEffect( - [$organizationId, $currentUser, $db], - async ([organizationId, currentUser, db]) => { - if (!currentUser) { + [$organization, $currentUser, $db], + async ([organization, currentUser, db]) => { + // Do not allow users that are not subscribed to create, update, or delete organizations + if (!currentUser?.tier) { throw new Error("Unauthorized"); } const { members } = dbSchema; - const [userRole] = await db - .select({ role: members.role }) - .from(members) - .where( - and( - eq(members.userId, currentUser.id), - eq(members.organizationId, organizationId as string), - ), - ); + if (scope === "create") { + if (currentUser.tier === "basic") { + // TODO: discuss validation. This checks how many organizations the user is *an owner* of, not strictly *a member* of. + const userMemberships = await db + .select() + .from(members) + .where( + and( + eq(members.userId, currentUser.id), + eq(members.role, "owner"), + ), + ); - // Only allow owners to delete organizations - if (scope === "delete" && userRole.role !== "owner") { - throw new Error("Insufficient permissions"); - } + // If a user has a basic subscription, only allow for 1 organization to be created + if (userMemberships.length > 0) { + throw new Error("Maximum number of organizations reached."); + } + } + } else { + const [userRole] = await db + .select({ role: members.role }) + .from(members) + .where( + and( + eq(members.userId, currentUser.id), + eq(members.organizationId, organization as string), + ), + ); + + // Only allow owners to delete organizations + if (scope === "delete" && userRole.role !== "owner") { + throw new Error("Insufficient permissions"); + } - // Only allow admins and owners to update organizations - if ( - scope === "update" && - (!userRole || userRole.role === "member") - ) { - throw new Error("Insufficient permissions"); + // Only allow admins and owners to update organizations + if ( + scope === "update" && + (!userRole || userRole.role === "member") + ) { + throw new Error("Insufficient permissions"); + } } }, ); @@ -63,6 +84,7 @@ const validatePermissions = (propName: string, scope: MutationScope) => */ const OrganizationRBACPlugin = makeWrapPlansPlugin({ Mutation: { + createOrganization: validatePermissions("organization", "create"), updateOrganization: validatePermissions("rowId", "update"), deleteOrganization: validatePermissions("rowId", "delete"), }, diff --git a/src/lib/plugins/postgraphile/ProjectRBAC.plugin.ts b/src/lib/plugins/postgraphile/ProjectRBAC.plugin.ts index 4cbbf88..0f54e75 100644 --- a/src/lib/plugins/postgraphile/ProjectRBAC.plugin.ts +++ b/src/lib/plugins/postgraphile/ProjectRBAC.plugin.ts @@ -23,7 +23,8 @@ const validatePermissions = (propName: string, scope: MutationScope) => sideEffect( [$project, $currentUser, $db], async ([project, currentUser, db]) => { - if (!currentUser) { + // Do not allow users that are not subscribed to create, update, or delete projects + if (!currentUser?.tier) { throw new Error("Unauthorized"); } @@ -56,6 +57,19 @@ const validatePermissions = (propName: string, scope: MutationScope) => if (!userRole || userRole.role === "member") { throw new Error("Insufficient permissions"); } + + // If the current user has a basic subscription, validate the current number of projects for the organization + if (scope === "create" && currentUser.tier === "basic") { + const currentProjects = await db + .select() + .from(projects) + .where(eq(projects.organizationId, organizationId)); + + // Do not allow users to create a new project if the maximum number of allow projects has been met + if (currentProjects.length >= 3) { + throw new Error("Maximum number of projects reached."); + } + } }, ); diff --git a/src/server.ts b/src/server.ts index f98c2fa..37ea071 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,23 +1,32 @@ import { useParserCache } from "@envelop/parser-cache"; import { useValidationCache } from "@envelop/validation-cache"; import { EnvelopArmor } from "@escape.tech/graphql-armor"; +import { Checkout, CustomerPortal, Webhooks } from "@polar-sh/hono"; import { useGrafast, useMoreDetailedErrors } from "grafast/envelop"; import { createYoga } from "graphql-yoga"; import { Hono } from "hono"; import { cors } from "hono/cors"; +import { eq } from "drizzle-orm"; import { schema } from "generated/graphql/schema.executable"; import appConfig from "lib/config/app.config"; import { + CHECKOUT_SUCCESS_URL, HOST, + POLAR_ACCESS_TOKEN, + POLAR_WEBHOOK_SECRET, PORT, SKIP_AUTH, isDevEnv, isProdEnv, } from "lib/config/env.config"; +import { dbPool as db } from "lib/db/db"; +import { users } from "lib/drizzle/schema"; import { createGraphQLContext } from "lib/graphql/context"; import { useAuth } from "lib/plugins/envelop"; +import type { SelectUser } from "lib/drizzle/schema"; + // TODO run on Bun runtime instead of Node, track https://github.com/oven-sh/bun/issues/11785 /** @@ -79,6 +88,90 @@ app.use( }), ); +app.get( + "/checkout", + Checkout({ + accessToken: POLAR_ACCESS_TOKEN, + successUrl: CHECKOUT_SUCCESS_URL, + server: isDevEnv ? "sandbox" : "production", + }), +); + +app.get( + "/portal", + CustomerPortal({ + accessToken: POLAR_ACCESS_TOKEN, + getCustomerId: async ({ req }) => { + const { searchParams } = new URL(req.url); + const customerId = searchParams.get("customerId")!; + + return customerId; + }, + server: isDevEnv ? "sandbox" : "production", + }), +); + +app.post( + "/polar/webhooks", + Webhooks({ + webhookSecret: POLAR_WEBHOOK_SECRET!, + onSubscriptionCreated: async (payload) => { + const isBackfeedProduct = /backfeed/i.test(payload.data.product.name); + + if (!isBackfeedProduct) return; + + const tier = payload.data.product.metadata.title as SelectUser["tier"]; + const hidraId = payload.data.customer.externalId; + + if (hidraId && tier) { + await db.update(users).set({ tier }).where(eq(users.hidraId, hidraId)); + + console.log( + `${tier.toUpperCase()} Subscription Tier set for User: ${hidraId}`, + ); + } + }, + onSubscriptionUpdated: async (payload) => { + const isBackfeedProduct = /backfeed/i.test(payload.data.product.name); + + if (!isBackfeedProduct) return; + + // NB: important to check that this is handled only on `active` status. When a sub is canceled this event is triggered, but we want to wait until it is revoked to handle the tier being set to NULL. + if (payload.data.status === "active") { + const tier = payload.data.product.metadata.title as SelectUser["tier"]; + const hidraId = payload.data.customer.externalId; + + if (hidraId && tier) { + await db + .update(users) + .set({ tier }) + .where(eq(users.hidraId, hidraId)); + + console.log( + `${tier.toUpperCase()} Subscription Tier set for User: ${hidraId}`, + ); + } + } + }, + onSubscriptionRevoked: async (payload) => { + const isBackfeedProduct = /backfeed/i.test(payload.data.product.name); + + if (!isBackfeedProduct) return; + + const hidraId = payload.data.customer.externalId; + + if (hidraId) { + await db + .update(users) + .set({ tier: null }) + .where(eq(users.hidraId, hidraId)); + + console.log(`Subscription Tier revoked for User: ${hidraId}`); + } + }, + }), +); + // mount GraphQL API app.use("/graphql", async (c) => yoga.handle(c.req.raw, {}));