@prisma/orm-target-postgres 8.0.0-rc.1-dev.11 → 8.0.0-rc.1-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-Ddgpoq1S-BjseYB90.mjs → adapter-BU8nEWqE-K2ArH64L.mjs} +4 -4
- package/dist/{adapter-Ddgpoq1S-BjseYB90.mjs.map → adapter-BU8nEWqE-K2ArH64L.mjs.map} +1 -1
- package/dist/adapter.mjs +3 -3
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.mjs +4 -4
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{aggregates-BmF5h9ht.mjs → aggregates-Dh6HPdvC.mjs} +37 -11
- package/dist/aggregates-Dh6HPdvC.mjs.map +1 -0
- package/dist/{codecs-BqvYbD8j.mjs → codecs-C9-AwMlR.mjs} +2 -2
- package/dist/{codecs-BqvYbD8j.mjs.map → codecs-C9-AwMlR.mjs.map} +1 -1
- package/dist/{codecs-B5ZWvB6I-DyHzqNQV.mjs → codecs-dXnwOH7P-CIr-fArt.mjs} +50 -8
- package/dist/codecs-dXnwOH7P-CIr-fArt.mjs.map +1 -0
- package/dist/{control-CBjpao4L.mjs → control-BhwmYxwz.mjs} +5 -5
- package/dist/{control-CBjpao4L.mjs.map → control-BhwmYxwz.mjs.map} +1 -1
- package/dist/{control-adapter-D4fT5c42-xeEY2Qy4.mjs → control-adapter-CDXxUXH4--2IlV_vH.mjs} +8 -5
- package/dist/{control-adapter-D4fT5c42-xeEY2Qy4.mjs.map → control-adapter-CDXxUXH4--2IlV_vH.mjs.map} +1 -1
- package/dist/{control-policy-DsZAbgzB-DRv2BiZp.mjs → control-policy-Cb-V9Wyh--ztBA5LG.mjs} +4 -4
- package/dist/{control-policy-DsZAbgzB-DRv2BiZp.mjs.map → control-policy-Cb-V9Wyh--ztBA5LG.mjs.map} +1 -1
- package/dist/{descriptor-meta--MCrvIgj-CjXgTwsw.mjs → descriptor-meta--MCrvIgj-C3t8smGK.mjs} +4 -4
- package/dist/{descriptor-meta--MCrvIgj-CjXgTwsw.mjs.map → descriptor-meta--MCrvIgj-C3t8smGK.mjs.map} +1 -1
- package/dist/{descriptor-meta-CwrzNafe-DO6eGe9T.mjs → descriptor-meta-ChnNOqso-Cc2MT-p1.mjs} +3 -3
- package/dist/{descriptor-meta-CwrzNafe-DO6eGe9T.mjs.map → descriptor-meta-ChnNOqso-Cc2MT-p1.mjs.map} +1 -1
- package/dist/{diff-database-schema-wkN6289o-CNZoBfTy.mjs → diff-database-schema-Cgc6yPAr-Dtc6WYDZ.mjs} +3 -3
- package/dist/{diff-database-schema-wkN6289o-CNZoBfTy.mjs.map → diff-database-schema-Cgc6yPAr-Dtc6WYDZ.mjs.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{op-factory-call-CyayLh7T-Dp409cas.mjs → op-factory-call-BuAJIO_9-D4AoU_gQ.mjs} +3 -3
- package/dist/{op-factory-call-CyayLh7T-Dp409cas.mjs.map → op-factory-call-BuAJIO_9-D4AoU_gQ.mjs.map} +1 -1
- package/dist/{planner-Z_q8OX5_-Ccaa65Pc.mjs → planner-DxwDv2Uf-BOSfEcQ1.mjs} +6 -6
- package/dist/{planner-Z_q8OX5_-Ccaa65Pc.mjs.map → planner-DxwDv2Uf-BOSfEcQ1.mjs.map} +1 -1
- package/dist/{planner-ddl-builders-BVKsooij-B_abn0ED.mjs → planner-ddl-builders-ConHfdcu-DwAriSzj.mjs} +3 -3
- package/dist/{planner-ddl-builders-BVKsooij-B_abn0ED.mjs.map → planner-ddl-builders-ConHfdcu-DwAriSzj.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-CDdv2rTU-C6zFqgeb.mjs → planner-produced-postgres-migration-C3rG2s2Q-B0Gg6xz7.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-CDdv2rTU-C6zFqgeb.mjs.map → planner-produced-postgres-migration-C3rG2s2Q-B0Gg6xz7.mjs.map} +1 -1
- package/dist/{postgres-migration-BdY4uI_M-CujBOPWE.mjs → postgres-migration-umkQroaU-71tHIp16.mjs} +3 -3
- package/dist/{postgres-migration-BdY4uI_M-CujBOPWE.mjs.map → postgres-migration-umkQroaU-71tHIp16.mjs.map} +1 -1
- package/dist/{sql-renderer-CZE98PJj-BmLyMQw_.mjs → sql-renderer-CZE98PJj-CHL66h-G.mjs} +2 -2
- package/dist/{sql-renderer-CZE98PJj-BmLyMQw_.mjs.map → sql-renderer-CZE98PJj-CHL66h-G.mjs.map} +1 -1
- package/dist/target.mjs +11 -11
- package/dist/target__aggregates.mjs +1 -1
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__control.mjs +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner.mjs +2 -2
- package/package.json +9 -9
- package/dist/aggregates-BmF5h9ht.mjs.map +0 -1
- package/dist/codecs-B5ZWvB6I-DyHzqNQV.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as renderLoweredSql, t as adapterError } from "./sql-renderer-CZE98PJj-
|
|
2
|
-
import { i as createPostgresCodecRegistryWithBuiltins, t as PostgresControlAdapter } from "./control-adapter-
|
|
1
|
+
import { n as renderLoweredSql, t as adapterError } from "./sql-renderer-CZE98PJj-CHL66h-G.mjs";
|
|
2
|
+
import { i as createPostgresCodecRegistryWithBuiltins, t as PostgresControlAdapter } from "./control-adapter-CDXxUXH4--2IlV_vH.mjs";
|
|
3
3
|
import { isDdlNode } from "@prisma/orm-family-sql/relational-core/ast";
|
|
4
4
|
import { APP_SPACE_ID } from "@prisma/orm-framework/components/control";
|
|
5
|
-
//#region ../../../3-targets/6-adapters/postgres/dist/adapter-
|
|
5
|
+
//#region ../../../3-targets/6-adapters/postgres/dist/adapter-BU8nEWqE.mjs
|
|
6
6
|
const defaultCapabilities = Object.freeze({
|
|
7
7
|
postgres: {
|
|
8
8
|
orderBy: true,
|
|
@@ -73,4 +73,4 @@ function createPostgresAdapterWithCodecRegistry(codecRegistry) {
|
|
|
73
73
|
//#endregion
|
|
74
74
|
export { createPostgresAdapterWithCodecRegistry as n, postgresRawCodecInferer as r, createPostgresAdapter as t };
|
|
75
75
|
|
|
76
|
-
//# sourceMappingURL=adapter-
|
|
76
|
+
//# sourceMappingURL=adapter-BU8nEWqE-K2ArH64L.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-
|
|
1
|
+
{"version":3,"file":"adapter-BU8nEWqE-K2ArH64L.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/adapter-BU8nEWqE.mjs"],"sourcesContent":["import { n as adapterError, t as renderLoweredSql } from \"./sql-renderer-CZE98PJj.mjs\";\nimport { i as createPostgresCodecRegistryWithBuiltins, t as PostgresControlAdapter } from \"./control-adapter-CDXxUXH4.mjs\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { isDdlNode } from \"@internal/sql-relational-core/ast\";\n//#region src/core/adapter.ts\nconst defaultCapabilities = Object.freeze({\n\tpostgres: {\n\t\torderBy: true,\n\t\tlimit: true,\n\t\tlateral: true,\n\t\tjsonAgg: true,\n\t\treturning: true,\n\t\tdistinctOn: true\n\t},\n\tsql: {\n\t\tenums: true,\n\t\treturning: true,\n\t\tdefaultInInsert: true,\n\t\tlateral: true,\n\t\tscalarList: true\n\t}\n});\nvar PostgresAdapterImpl = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"postgres\";\n\tprofile;\n\tcodecRegistry;\n\tconstructor(codecRegistry, profileId) {\n\t\tthis.codecRegistry = codecRegistry;\n\t\tconst controlAdapter = new PostgresControlAdapter(codecRegistry);\n\t\tthis.profile = Object.freeze({\n\t\t\tid: profileId ?? \"postgres/default@1\",\n\t\t\ttarget: \"postgres\",\n\t\t\tcapabilities: defaultCapabilities,\n\t\t\treadMarker: (queryable) => controlAdapter.readMarkerDiscriminated({\n\t\t\t\tfamilyId: \"sql\",\n\t\t\t\ttargetId: \"postgres\",\n\t\t\t\tquery: async (sql, params) => {\n\t\t\t\t\tconst rows = [];\n\t\t\t\t\tfor await (const row of queryable.query({\n\t\t\t\t\t\tsql,\n\t\t\t\t\t\t...params === void 0 ? {} : { params }\n\t\t\t\t\t})) rows.push(row);\n\t\t\t\t\treturn { rows };\n\t\t\t\t},\n\t\t\t\tclose: async () => {}\n\t\t\t}, APP_SPACE_ID)\n\t\t});\n\t}\n\tlower(ast, context) {\n\t\tif (isDdlNode(ast)) throw adapterError(\"RUNTIME.DDL_UNSUPPORTED\", \"lower() does not lower DDL on the runtime adapter — DDL lowering is a control-plane concern handled by the control adapter.\", { meta: { surface: \"runtime-adapter\" } });\n\t\treturn renderLoweredSql(ast, context.contract, this.codecRegistry);\n\t}\n};\n/** Codec-id lookup for bare-literal interpolations used by `fns.raw` on a postgres client. Contributed as the descriptor's static `rawCodecInferer` slot. */\nconst postgresRawCodecInferer = { inferCodec(value) {\n\tswitch (typeof value) {\n\t\tcase \"number\": return Number.isSafeInteger(value) && value % 1 === 0 ? \"pg/int4\" : \"pg/float8\";\n\t\tcase \"bigint\": return \"pg/int8\";\n\t\tcase \"string\": return \"pg/text\";\n\t\tcase \"boolean\": return \"pg/bool\";\n\t\tcase \"object\": if (value instanceof Uint8Array) return \"pg/bytea\";\n\t}\n\tthrow adapterError(\"RUNTIME.RAW_SQL_UNSUPPORTED_INTERPOLATION\", \"unsupported JS value type for raw-SQL interpolation: wrap this value in `param(...)` with an explicit codec\", { meta: { valueType: typeof value } });\n} };\nfunction createPostgresAdapter(options) {\n\tconst codecRegistry = createPostgresCodecRegistryWithBuiltins(options?.codecDescriptors);\n\treturn Object.freeze(new PostgresAdapterImpl(codecRegistry, options?.profileId));\n}\nfunction createPostgresAdapterWithCodecRegistry(codecRegistry) {\n\treturn Object.freeze(new PostgresAdapterImpl(codecRegistry));\n}\n//#endregion\nexport { createPostgresAdapterWithCodecRegistry as n, postgresRawCodecInferer as r, createPostgresAdapter as t };\n\n//# sourceMappingURL=adapter-BU8nEWqE.mjs.map"],"mappings":";;;;;AAKA,MAAM,sBAAsB,OAAO,OAAO;CACzC,UAAU;EACT,SAAS;EACT,OAAO;EACP,SAAS;EACT,SAAS;EACT,WAAW;EACX,YAAY;CACb;CACA,KAAK;EACJ,OAAO;EACP,WAAW;EACX,iBAAiB;EACjB,SAAS;EACT,YAAY;CACb;AACD,CAAC;AACD,IAAI,sBAAsB,MAAM;CAC/B,WAAW;CACX,WAAW;CACX;CACA;CACA,YAAY,eAAe,WAAW;EACrC,KAAK,gBAAgB;EACrB,MAAM,iBAAiB,IAAI,uBAAuB,aAAa;EAC/D,KAAK,UAAU,OAAO,OAAO;GAC5B,IAAI,aAAa;GACjB,QAAQ;GACR,cAAc;GACd,aAAa,cAAc,eAAe,wBAAwB;IACjE,UAAU;IACV,UAAU;IACV,OAAO,OAAO,KAAK,WAAW;KAC7B,MAAM,OAAO,CAAC;KACd,WAAW,MAAM,OAAO,UAAU,MAAM;MACvC;MACA,GAAG,WAAW,KAAK,IAAI,CAAC,IAAI,EAAE,OAAO;KACtC,CAAC,GAAG,KAAK,KAAK,GAAG;KACjB,OAAO,EAAE,KAAK;IACf;IACA,OAAO,YAAY,CAAC;GACrB,GAAG,YAAY;EAChB,CAAC;CACF;CACA,MAAM,KAAK,SAAS;EACnB,IAAI,UAAU,GAAG,GAAG,MAAM,aAAa,2BAA2B,+HAA+H,EAAE,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC;EACzO,OAAO,iBAAiB,KAAK,QAAQ,UAAU,KAAK,aAAa;CAClE;AACD;;AAEA,MAAM,0BAA0B,EAAE,WAAW,OAAO;CACnD,QAAQ,OAAO,OAAf;EACC,KAAK,UAAU,OAAO,OAAO,cAAc,KAAK,KAAK,QAAQ,MAAM,IAAI,YAAY;EACnF,KAAK,UAAU,OAAO;EACtB,KAAK,UAAU,OAAO;EACtB,KAAK,WAAW,OAAO;EACvB,KAAK,UAAU,IAAI,iBAAiB,YAAY,OAAO;CACxD;CACA,MAAM,aAAa,6CAA6C,+GAA+G,EAAE,MAAM,EAAE,WAAW,OAAO,MAAM,EAAE,CAAC;AACrN,EAAE;AACF,SAAS,sBAAsB,SAAS;CACvC,MAAM,gBAAgB,wCAAwC,SAAS,gBAAgB;CACvF,OAAO,OAAO,OAAO,IAAI,oBAAoB,eAAe,SAAS,SAAS,CAAC;AAChF;AACA,SAAS,uCAAuC,eAAe;CAC9D,OAAO,OAAO,OAAO,IAAI,oBAAoB,aAAa,CAAC;AAC5D"}
|
package/dist/adapter.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as qualifyName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
|
|
2
2
|
import { t as parsePostgresDefault } from "./default-normalizer-Ba5ZebHM-isV86rjy.mjs";
|
|
3
3
|
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-yvd3tqv-.mjs";
|
|
4
|
-
import { n as renderLoweredSql } from "./sql-renderer-CZE98PJj-
|
|
5
|
-
import { i as createPostgresCodecRegistryWithBuiltins, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-
|
|
6
|
-
import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-
|
|
4
|
+
import { n as renderLoweredSql } from "./sql-renderer-CZE98PJj-CHL66h-G.mjs";
|
|
5
|
+
import { i as createPostgresCodecRegistryWithBuiltins, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-CDXxUXH4--2IlV_vH.mjs";
|
|
6
|
+
import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-BU8nEWqE-K2ArH64L.mjs";
|
|
7
7
|
import { _ as timestamptzColumn, a as float4Column, b as varcharColumn, c as int4Column, d as jsonColumn, f as jsonbColumn, g as timestampColumn, h as timeColumn, i as charColumn, l as int8Column, m as textColumn, n as boolColumn, o as float8Column, p as numericColumn, r as byteaColumn, s as int2Column, t as bitColumn, u as intervalColumn, v as timetzColumn, y as varbitColumn } from "./column-types-Bh92dNjD.mjs";
|
|
8
8
|
export { PostgresControlAdapter, bitColumn, boolColumn, byteaColumn, charColumn, createPostgresAdapter, createPostgresBuiltinCodecLookup, createPostgresCodecRegistryWithBuiltins, escapeLiteral, float4Column, float8Column, int2Column, int4Column, int8Column, intervalColumn, jsonColumn, jsonbColumn, normalizeSchemaNativeType, numericColumn, parsePostgresDefault, postgresRawCodecInferer, qualifyName, quoteIdentifier, renderLoweredSql, textColumn, timeColumn, timestampColumn, timestamptzColumn, timetzColumn, varbitColumn, varcharColumn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-
|
|
1
|
+
import { r as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-BU8nEWqE-K2ArH64L.mjs";
|
|
2
2
|
export { createPostgresAdapter, postgresRawCodecInferer };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as qualifyName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
|
|
2
2
|
import { t as parsePostgresDefault } from "./default-normalizer-Ba5ZebHM-isV86rjy.mjs";
|
|
3
3
|
import { t as normalizeSchemaNativeType } from "./native-type-normalizer-yvd3tqv-.mjs";
|
|
4
|
-
import { i as createPostgresCodecRegistryWithBuiltins, n as assemblePostgresCodecRegistry, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-
|
|
5
|
-
import { t as postgresAdapterDescriptorMeta } from "./descriptor-meta--MCrvIgj-
|
|
4
|
+
import { i as createPostgresCodecRegistryWithBuiltins, n as assemblePostgresCodecRegistry, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-CDXxUXH4--2IlV_vH.mjs";
|
|
5
|
+
import { t as postgresAdapterDescriptorMeta } from "./descriptor-meta--MCrvIgj-C3t8smGK.mjs";
|
|
6
6
|
import { timestampNowControlDescriptor } from "@prisma/orm-family-sql/family/control";
|
|
7
7
|
import { int, num, oneOf, optional, str } from "@prisma/orm-framework/psl-parser";
|
|
8
8
|
import { builtinGeneratorRegistryMetadata } from "@prisma/orm-framework/ids";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter__control.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/control.mjs"],"sourcesContent":["import { i as createPostgresCodecRegistryWithBuiltins, n as assemblePostgresCodecRegistry, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from \"./control-adapter-D4fT5c42.mjs\";\nimport { t as postgresAdapterDescriptorMeta } from \"./descriptor-meta--MCrvIgj.mjs\";\nimport { parsePostgresDefault } from \"@internal/target-postgres/default-normalizer\";\nimport { normalizeSchemaNativeType } from \"@internal/target-postgres/native-type-normalizer\";\nimport { escapeLiteral, qualifyName, quoteIdentifier } from \"@internal/target-postgres/sql-utils\";\nimport { timestampNowControlDescriptor } from \"@internal/family-sql/control\";\nimport { builtinGeneratorRegistryMetadata } from \"@internal/ids\";\nimport { int, num, oneOf, optional, str } from \"@internal/psl-parser\";\n//#region src/core/control-mutation-defaults.ts\nfunction invalidArgumentDiagnostic(input) {\n\treturn {\n\t\tok: false,\n\t\tdiagnostic: {\n\t\t\tcode: \"PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT\",\n\t\t\tmessage: input.message,\n\t\t\tsourceId: input.context.sourceId,\n\t\t\tspan: input.span\n\t\t}\n\t};\n}\nfunction executionGenerator(id, params) {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"execution\",\n\t\t\tgenerated: {\n\t\t\t\tkind: \"generator\",\n\t\t\t\tid,\n\t\t\t\t...params ? { params } : {}\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerAutoincrement() {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: \"autoincrement()\"\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerNow() {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: \"now()\"\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerUlid() {\n\treturn executionGenerator(\"ulid\");\n}\nfunction lowerUuid(input) {\n\treturn input.call.args[\"version\"] === 7 ? executionGenerator(\"uuidv7\") : executionGenerator(\"uuidv4\");\n}\nfunction lowerCuid() {\n\treturn executionGenerator(\"cuid2\");\n}\nfunction lowerNanoid(input) {\n\tconst size = input.call.args[\"size\"];\n\treturn typeof size === \"number\" ? executionGenerator(\"nanoid\", { size }) : executionGenerator(\"nanoid\");\n}\nfunction lowerDbgenerated(input) {\n\tconst expression = input.call.args[\"expression\"];\n\tif (typeof expression !== \"string\" || expression.trim().length === 0) return invalidArgumentDiagnostic({\n\t\tcontext: input.context,\n\t\tspan: input.call.span,\n\t\tmessage: \"Default function \\\"dbgenerated\\\" argument cannot be empty.\"\n\t});\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression\n\t\t\t}\n\t\t}\n\t};\n}\nconst nowSig = {};\nconst autoincrementSig = {};\nconst ulidSig = {};\nconst uuidSig = { positional: [{\n\tkey: \"version\",\n\ttype: optional(oneOf(num(4), num(7)))\n}] };\nconst cuidSig = { positional: [{\n\tkey: \"version\",\n\ttype: num(2)\n}] };\nconst nanoidSig = { positional: [{\n\tkey: \"size\",\n\ttype: optional(int({\n\t\tmin: 2,\n\t\tmax: 255\n\t}))\n}] };\nconst dbgeneratedSig = { positional: [{\n\tkey: \"expression\",\n\ttype: str()\n}] };\nconst postgresDefaultFunctionRegistryEntries = [\n\t[\"autoincrement\", {\n\t\tsignature: autoincrementSig,\n\t\tlower: lowerAutoincrement,\n\t\tusageSignatures: [\"autoincrement()\"]\n\t}],\n\t[\"now\", {\n\t\tsignature: nowSig,\n\t\tlower: lowerNow,\n\t\tusageSignatures: [\"now()\"]\n\t}],\n\t[\"uuid\", {\n\t\tsignature: uuidSig,\n\t\tlower: lowerUuid,\n\t\tusageSignatures: [\n\t\t\t\"uuid()\",\n\t\t\t\"uuid(4)\",\n\t\t\t\"uuid(7)\"\n\t\t]\n\t}],\n\t[\"cuid\", {\n\t\tsignature: cuidSig,\n\t\tlower: lowerCuid,\n\t\tusageSignatures: [\"cuid(2)\"]\n\t}],\n\t[\"ulid\", {\n\t\tsignature: ulidSig,\n\t\tlower: lowerUlid,\n\t\tusageSignatures: [\"ulid()\"]\n\t}],\n\t[\"nanoid\", {\n\t\tsignature: nanoidSig,\n\t\tlower: lowerNanoid,\n\t\tusageSignatures: [\"nanoid()\", \"nanoid(<2-255>)\"]\n\t}],\n\t[\"dbgenerated\", {\n\t\tsignature: dbgeneratedSig,\n\t\tlower: lowerDbgenerated,\n\t\tusageSignatures: [\"dbgenerated(\\\"...\\\")\"]\n\t}]\n];\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel, with explicit `nativeType` values pinned to the codec manifests\n* (`codecLookup.targetTypesFor(codecId)[0]`).\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*/\nconst postgresScalarAuthoringTypes = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/text@1\",\n\t\t\tnativeType: \"text\"\n\t\t}\n\t},\n\tBoolean: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/bool@1\",\n\t\t\tnativeType: \"bool\"\n\t\t}\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int4@1\",\n\t\t\tnativeType: \"int4\"\n\t\t}\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int8@1\",\n\t\t\tnativeType: \"int8\"\n\t\t}\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/float8@1\",\n\t\t\tnativeType: \"float8\"\n\t\t}\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\tnativeType: \"numeric\"\n\t\t}\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz@1\",\n\t\t\tnativeType: \"timestamptz\"\n\t\t}\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/json@1\",\n\t\t\tnativeType: \"json\"\n\t\t}\n\t},\n\tJsonb: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/jsonb@1\",\n\t\t\tnativeType: \"jsonb\"\n\t\t}\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/bytea@1\",\n\t\t\tnativeType: \"bytea\"\n\t\t}\n\t}\n};\nconst postgresNativeAuthoringTypes = {\n\tVarChar: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"length\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/varchar@1\",\n\t\t\tnativeType: \"character varying\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tChar: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"length\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/char@1\",\n\t\t\tnativeType: \"character\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tNumeric: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}, {\n\t\t\tkind: \"number\",\n\t\t\tname: \"scale\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\tnativeType: \"numeric\",\n\t\t\ttypeParams: {\n\t\t\t\tprecision: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0\n\t\t\t\t},\n\t\t\t\tscale: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tTimestamp: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamp@1\",\n\t\t\tnativeType: \"timestamp\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestamptz: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz@1\",\n\t\t\tnativeType: \"timestamptz\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTime: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/time@1\",\n\t\t\tnativeType: \"time\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimetz: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timetz@1\",\n\t\t\tnativeType: \"timetz\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tUuid: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/uuid@1\",\n\t\t\tnativeType: \"uuid\"\n\t\t}\n\t},\n\tInet: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/inet@1\",\n\t\t\tnativeType: \"inet\"\n\t\t}\n\t},\n\tSmallInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int2@1\",\n\t\t\tnativeType: \"int2\"\n\t\t}\n\t},\n\tReal: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/float4@1\",\n\t\t\tnativeType: \"float4\"\n\t\t}\n\t},\n\tDate: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/date@1\",\n\t\t\tnativeType: \"date\"\n\t\t}\n\t}\n};\nconst postgresAuthoringTypes = {\n\t...postgresScalarAuthoringTypes,\n\t...postgresNativeAuthoringTypes\n};\nfunction createPostgresDefaultFunctionRegistry() {\n\treturn new Map(postgresDefaultFunctionRegistryEntries);\n}\nfunction createPostgresMutationDefaultGeneratorDescriptors() {\n\treturn [...builtinGeneratorRegistryMetadata.map(({ id, applicableCodecIds }) => ({\n\t\tid,\n\t\tapplicableCodecIds\n\t})), timestampNowControlDescriptor()];\n}\n//#endregion\n//#region src/exports/control.ts\nconst postgresAdapterDescriptor = {\n\t...postgresAdapterDescriptorMeta,\n\tauthoring: {\n\t\ttype: postgresAuthoringTypes,\n\t\tvalueObjectStorageType: \"Jsonb\"\n\t},\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: createPostgresDefaultFunctionRegistry(),\n\t\tgeneratorDescriptors: createPostgresMutationDefaultGeneratorDescriptors()\n\t},\n\tcreate(stack) {\n\t\treturn new PostgresControlAdapter(assemblePostgresCodecRegistry([\n\t\t\tstack.target,\n\t\t\t...stack.adapter === void 0 ? [] : [stack.adapter],\n\t\t\t...stack.extensions\n\t\t]));\n\t}\n};\n//#endregion\nexport { PostgresControlAdapter, createPostgresBuiltinCodecLookup, createPostgresCodecRegistryWithBuiltins, postgresAdapterDescriptor as default, escapeLiteral, normalizeSchemaNativeType, parsePostgresDefault, qualifyName, quoteIdentifier };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,0BAA0B,OAAO;CACzC,OAAO;EACN,IAAI;EACJ,YAAY;GACX,MAAM;GACN,SAAS,MAAM;GACf,UAAU,MAAM,QAAQ;GACxB,MAAM,MAA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OAAO;EACN,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,SAAS;EACR,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,UAAU;EACT,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,MAAM;EACL,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,OAAO;EACN,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;CACA,OAAO;EACN,MAAM;EACN,QAAQ;GACP,SAAS;GACT,YAAY;EACb;CACD;AACD;AACA,MAAM,+BAA+B;CACpC,SAAS;EACR,MAAM;EACN,MAAM,CAAC;GACN,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,UAAU;EACX,CAAC;EACD,QAAQ;GACP,SAAS;GACT,YAAY;GACZ,YAAY,EAAE,QAAQ;IACrB,MAAM;IACN,OAAO;GACR,EAAE;EACH;CACD;CACA,MAAM;EACL,MAAM;EACN,MAAM,CAAC;GACN,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,UAAU;EACX,CAAC;EACD,QAAQ;GACP,SAAS;GACT,YAAY;GACZ,YAAY,EAAE,QAAQ;IACrB,MAAM;IACN,OAAO;GACR,EAAE;EACH;CACD;CACA,SAAS;EACR,MAAM;EACN,MAAM,CAAC;GACN,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,UAAU;EACX,GAAG;GACF,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,UAAU;EACX,CAAC;EACD,QAAQ;GACP,SAAS;GACT,YAAY;GACZ,YAAY;IACX,WAAW;KACV,MAAM;KACN,OAAO;IACR;IACA,OAAO;KACN,MAAM;KACN,OAAO;IACR;GACD;EACD;CACD;CACA,WAAW;EACV,MAAM;EACN,MAAM,CAAC;GACN,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,UAAU;EACX,CAAC;EACD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ChF;EACA;CACD,EAAE,GAAG,8BAA8B,CAAC;AACrC;AAGA,MAAM,4BAA4B;CACjC,GAAG;CACH,WAAW;EACV,MAAM;EACN,wBAAwB;CACzB;CACA,yBAAyB;EACxB,yBAAyB,sCAAsC;EAC/D,sBAAsB,kDAAkD;CACzE;CACA,OAAO,OAAO;EACb,OAAO,IAAI,uBAAuB,8BAA8B;GAC/D,MAAM;GACN,GAAG,MAAM,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,OAAO;GACjD,GAAG,MAAM;EACV,CAAC,CAAC;CACH;AACD"}
|
|
1
|
+
{"version":3,"file":"adapter__control.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/control.mjs"],"sourcesContent":["import { i as createPostgresCodecRegistryWithBuiltins, n as assemblePostgresCodecRegistry, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from \"./control-adapter-CDXxUXH4.mjs\";\nimport { t as postgresAdapterDescriptorMeta } from \"./descriptor-meta--MCrvIgj.mjs\";\nimport { parsePostgresDefault } from \"@internal/target-postgres/default-normalizer\";\nimport { normalizeSchemaNativeType } from \"@internal/target-postgres/native-type-normalizer\";\nimport { escapeLiteral, qualifyName, quoteIdentifier } from \"@internal/target-postgres/sql-utils\";\nimport { timestampNowControlDescriptor } from \"@internal/family-sql/control\";\nimport { builtinGeneratorRegistryMetadata } from \"@internal/ids\";\nimport { int, num, oneOf, optional, str } from \"@internal/psl-parser\";\n//#region src/core/control-mutation-defaults.ts\nfunction invalidArgumentDiagnostic(input) {\n\treturn {\n\t\tok: false,\n\t\tdiagnostic: {\n\t\t\tcode: \"PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT\",\n\t\t\tmessage: input.message,\n\t\t\tsourceId: input.context.sourceId,\n\t\t\tspan: input.span\n\t\t}\n\t};\n}\nfunction executionGenerator(id, params) {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"execution\",\n\t\t\tgenerated: {\n\t\t\t\tkind: \"generator\",\n\t\t\t\tid,\n\t\t\t\t...params ? { params } : {}\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerAutoincrement() {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: \"autoincrement()\"\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerNow() {\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression: \"now()\"\n\t\t\t}\n\t\t}\n\t};\n}\nfunction lowerUlid() {\n\treturn executionGenerator(\"ulid\");\n}\nfunction lowerUuid(input) {\n\treturn input.call.args[\"version\"] === 7 ? executionGenerator(\"uuidv7\") : executionGenerator(\"uuidv4\");\n}\nfunction lowerCuid() {\n\treturn executionGenerator(\"cuid2\");\n}\nfunction lowerNanoid(input) {\n\tconst size = input.call.args[\"size\"];\n\treturn typeof size === \"number\" ? executionGenerator(\"nanoid\", { size }) : executionGenerator(\"nanoid\");\n}\nfunction lowerDbgenerated(input) {\n\tconst expression = input.call.args[\"expression\"];\n\tif (typeof expression !== \"string\" || expression.trim().length === 0) return invalidArgumentDiagnostic({\n\t\tcontext: input.context,\n\t\tspan: input.call.span,\n\t\tmessage: \"Default function \\\"dbgenerated\\\" argument cannot be empty.\"\n\t});\n\treturn {\n\t\tok: true,\n\t\tvalue: {\n\t\t\tkind: \"storage\",\n\t\t\tdefaultValue: {\n\t\t\t\tkind: \"function\",\n\t\t\t\texpression\n\t\t\t}\n\t\t}\n\t};\n}\nconst nowSig = {};\nconst autoincrementSig = {};\nconst ulidSig = {};\nconst uuidSig = { positional: [{\n\tkey: \"version\",\n\ttype: optional(oneOf(num(4), num(7)))\n}] };\nconst cuidSig = { positional: [{\n\tkey: \"version\",\n\ttype: num(2)\n}] };\nconst nanoidSig = { positional: [{\n\tkey: \"size\",\n\ttype: optional(int({\n\t\tmin: 2,\n\t\tmax: 255\n\t}))\n}] };\nconst dbgeneratedSig = { positional: [{\n\tkey: \"expression\",\n\ttype: str()\n}] };\nconst postgresDefaultFunctionRegistryEntries = [\n\t[\"autoincrement\", {\n\t\tsignature: autoincrementSig,\n\t\tlower: lowerAutoincrement,\n\t\tusageSignatures: [\"autoincrement()\"]\n\t}],\n\t[\"now\", {\n\t\tsignature: nowSig,\n\t\tlower: lowerNow,\n\t\tusageSignatures: [\"now()\"]\n\t}],\n\t[\"uuid\", {\n\t\tsignature: uuidSig,\n\t\tlower: lowerUuid,\n\t\tusageSignatures: [\n\t\t\t\"uuid()\",\n\t\t\t\"uuid(4)\",\n\t\t\t\"uuid(7)\"\n\t\t]\n\t}],\n\t[\"cuid\", {\n\t\tsignature: cuidSig,\n\t\tlower: lowerCuid,\n\t\tusageSignatures: [\"cuid(2)\"]\n\t}],\n\t[\"ulid\", {\n\t\tsignature: ulidSig,\n\t\tlower: lowerUlid,\n\t\tusageSignatures: [\"ulid()\"]\n\t}],\n\t[\"nanoid\", {\n\t\tsignature: nanoidSig,\n\t\tlower: lowerNanoid,\n\t\tusageSignatures: [\"nanoid()\", \"nanoid(<2-255>)\"]\n\t}],\n\t[\"dbgenerated\", {\n\t\tsignature: dbgeneratedSig,\n\t\tlower: lowerDbgenerated,\n\t\tusageSignatures: [\"dbgenerated(\\\"...\\\")\"]\n\t}]\n];\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel, with explicit `nativeType` values pinned to the codec manifests\n* (`codecLookup.targetTypesFor(codecId)[0]`).\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@default(uuid())`) never re-picks a column's storage.\n*/\nconst postgresScalarAuthoringTypes = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/text@1\",\n\t\t\tnativeType: \"text\"\n\t\t}\n\t},\n\tBoolean: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/bool@1\",\n\t\t\tnativeType: \"bool\"\n\t\t}\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int4@1\",\n\t\t\tnativeType: \"int4\"\n\t\t}\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int8@1\",\n\t\t\tnativeType: \"int8\"\n\t\t}\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/float8@1\",\n\t\t\tnativeType: \"float8\"\n\t\t}\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\tnativeType: \"numeric\"\n\t\t}\n\t},\n\tDateTime: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz@1\",\n\t\t\tnativeType: \"timestamptz\"\n\t\t}\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/json@1\",\n\t\t\tnativeType: \"json\"\n\t\t}\n\t},\n\tJsonb: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/jsonb@1\",\n\t\t\tnativeType: \"jsonb\"\n\t\t}\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/bytea@1\",\n\t\t\tnativeType: \"bytea\"\n\t\t}\n\t}\n};\nconst postgresNativeAuthoringTypes = {\n\tVarChar: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"length\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/varchar@1\",\n\t\t\tnativeType: \"character varying\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tChar: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"length\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/char@1\",\n\t\t\tnativeType: \"character\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tNumeric: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 1,\n\t\t\toptional: true\n\t\t}, {\n\t\t\tkind: \"number\",\n\t\t\tname: \"scale\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\tnativeType: \"numeric\",\n\t\t\ttypeParams: {\n\t\t\t\tprecision: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0\n\t\t\t\t},\n\t\t\t\tscale: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tTimestamp: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamp@1\",\n\t\t\tnativeType: \"timestamp\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestamptz: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz@1\",\n\t\t\tnativeType: \"timestamptz\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTime: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/time@1\",\n\t\t\tnativeType: \"time\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimetz: {\n\t\tkind: \"typeConstructor\",\n\t\targs: [{\n\t\t\tkind: \"number\",\n\t\t\tname: \"precision\",\n\t\t\tinteger: true,\n\t\t\tminimum: 0,\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timetz@1\",\n\t\t\tnativeType: \"timetz\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tUuid: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/uuid@1\",\n\t\t\tnativeType: \"uuid\"\n\t\t}\n\t},\n\tInet: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/inet@1\",\n\t\t\tnativeType: \"inet\"\n\t\t}\n\t},\n\tSmallInt: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/int2@1\",\n\t\t\tnativeType: \"int2\"\n\t\t}\n\t},\n\tReal: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/float4@1\",\n\t\t\tnativeType: \"float4\"\n\t\t}\n\t},\n\tDate: {\n\t\tkind: \"typeConstructor\",\n\t\toutput: {\n\t\t\tcodecId: \"pg/date@1\",\n\t\t\tnativeType: \"date\"\n\t\t}\n\t}\n};\nconst postgresAuthoringTypes = {\n\t...postgresScalarAuthoringTypes,\n\t...postgresNativeAuthoringTypes\n};\nfunction createPostgresDefaultFunctionRegistry() {\n\treturn new Map(postgresDefaultFunctionRegistryEntries);\n}\nfunction createPostgresMutationDefaultGeneratorDescriptors() {\n\treturn [...builtinGeneratorRegistryMetadata.map(({ id, applicableCodecIds }) => ({\n\t\tid,\n\t\tapplicableCodecIds\n\t})), timestampNowControlDescriptor()];\n}\n//#endregion\n//#region src/exports/control.ts\nconst postgresAdapterDescriptor = {\n\t...postgresAdapterDescriptorMeta,\n\tauthoring: {\n\t\ttype: postgresAuthoringTypes,\n\t\tvalueObjectStorageType: \"Jsonb\"\n\t},\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: createPostgresDefaultFunctionRegistry(),\n\t\tgeneratorDescriptors: createPostgresMutationDefaultGeneratorDescriptors()\n\t},\n\tcreate(stack) {\n\t\treturn new PostgresControlAdapter(assemblePostgresCodecRegistry([\n\t\t\tstack.target,\n\t\t\t...stack.adapter === void 0 ? [] : [stack.adapter],\n\t\t\t...stack.extensions\n\t\t]));\n\t}\n};\n//#endregion\nexport { PostgresControlAdapter, createPostgresBuiltinCodecLookup, createPostgresCodecRegistryWithBuiltins, postgresAdapterDescriptor as default, escapeLiteral, normalizeSchemaNativeType, parsePostgresDefault, qualifyName, quoteIdentifier };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,0BAA0B,OAAO;CACzC,OAAO;EACN,IAAI;EACJ,YAAY;GACX,MAAM;GACN,SAAS,MAAM;GACf,UAAU,MAAM,QAAQ;GACxB,MAAM,MAAM;EACb;CACD;AACD;AACA,SAAS,mBAAmB,IAAI,QAAQ;CACv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AAM,4BAA4B;CACjC,GAAG;CACH,WAAW;EACV,MAAM;EACN,wBAAwB;CACzB;CACA,yBAAyB;EACxB,yBAAyB,sCAAsC;EAC/D,sBAAsB,kDAAkD;CACzE;CACA,OAAO,OAAO;EACb,OAAO,IAAI,uBAAuB,8BAA8B;GAC/D,MAAM;GACN,GAAG,MAAM,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,OAAO;GACjD,GAAG,MAAM;EACV,CAAC,CAAC;CACH;AACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as postgresCodecRegistry } from "./codecs-
|
|
2
|
-
import { n as assemblePostgresCodecRegistry } from "./control-adapter-
|
|
3
|
-
import { n as createPostgresAdapterWithCodecRegistry, r as postgresRawCodecInferer } from "./adapter-
|
|
4
|
-
import { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from "./descriptor-meta--MCrvIgj-
|
|
1
|
+
import { n as postgresCodecRegistry } from "./codecs-C9-AwMlR.mjs";
|
|
2
|
+
import { n as assemblePostgresCodecRegistry } from "./control-adapter-CDXxUXH4--2IlV_vH.mjs";
|
|
3
|
+
import { n as createPostgresAdapterWithCodecRegistry, r as postgresRawCodecInferer } from "./adapter-BU8nEWqE-K2ArH64L.mjs";
|
|
4
|
+
import { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from "./descriptor-meta--MCrvIgj-C3t8smGK.mjs";
|
|
5
5
|
import { builtinGeneratorIds } from "@prisma/orm-framework/ids";
|
|
6
6
|
import { timestampNowRuntimeGenerator } from "@prisma/orm-family-sql/family/runtime";
|
|
7
7
|
import { generateId } from "@prisma/orm-framework/ids/runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter__runtime.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/runtime.mjs"],"sourcesContent":["import { n as assemblePostgresCodecRegistry } from \"./control-adapter-
|
|
1
|
+
{"version":3,"file":"adapter__runtime.mjs","names":[],"sources":["../../../../3-targets/6-adapters/postgres/dist/runtime.mjs"],"sourcesContent":["import { n as assemblePostgresCodecRegistry } from \"./control-adapter-CDXxUXH4.mjs\";\nimport { n as createPostgresAdapterWithCodecRegistry, r as postgresRawCodecInferer } from \"./adapter-BU8nEWqE.mjs\";\nimport { n as postgresQueryOperations, t as postgresAdapterDescriptorMeta } from \"./descriptor-meta--MCrvIgj.mjs\";\nimport { postgresCodecRegistry } from \"@internal/target-postgres/codecs\";\nimport { builtinGeneratorIds } from \"@internal/ids\";\nimport { timestampNowRuntimeGenerator } from \"@internal/family-sql/runtime\";\nimport { generateId } from \"@internal/ids/runtime\";\n//#region src/exports/runtime.ts\nfunction createPostgresMutationDefaultGenerators() {\n\treturn [...builtinGeneratorIds.map((id) => ({\n\t\tid,\n\t\tgenerate: (params) => {\n\t\t\treturn generateId(params ? {\n\t\t\t\tid,\n\t\t\t\tparams\n\t\t\t} : { id });\n\t\t},\n\t\tstability: \"field\"\n\t})), timestampNowRuntimeGenerator()];\n}\nconst postgresRuntimeAdapterDescriptor = {\n\t...postgresAdapterDescriptorMeta,\n\tcodecs: () => Array.from(postgresCodecRegistry.values()),\n\tqueryOperations: () => postgresQueryOperations(),\n\tmutationDefaultGenerators: createPostgresMutationDefaultGenerators,\n\trawCodecInferer: postgresRawCodecInferer,\n\tcreate(stack) {\n\t\treturn createPostgresAdapterWithCodecRegistry(assemblePostgresCodecRegistry([\n\t\t\tstack.target,\n\t\t\tstack.adapter,\n\t\t\t...stack.extensions\n\t\t]));\n\t}\n};\n//#endregion\nexport { postgresRuntimeAdapterDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,0CAA0C;CAClD,OAAO,CAAC,GAAG,oBAAoB,KAAK,QAAQ;EAC3C;EACA,WAAW,WAAW;GACrB,OAAO,WAAW,SAAS;IAC1B;IACA;GACD,IAAI,EAAE,GAAG,CAAC;EACX;EACA,WAAW;CACZ,EAAE,GAAG,6BAA6B,CAAC;AACpC;AACA,MAAM,mCAAmC;CACxC,GAAG;CACH,cAAc,MAAM,KAAK,sBAAsB,OAAO,CAAC;CACvD,uBAAuB,wBAAwB;CAC/C,2BAA2B;CAC3B,iBAAiB;CACjB,OAAO,OAAO;EACb,OAAO,uCAAuC,8BAA8B;GAC3E,MAAM;GACN,MAAM;GACN,GAAG,MAAM;EACV,CAAC,CAAC;CACH;AACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as renderLoweredSql } from "./sql-renderer-CZE98PJj-
|
|
1
|
+
import { n as renderLoweredSql } from "./sql-renderer-CZE98PJj-CHL66h-G.mjs";
|
|
2
2
|
export { renderLoweredSql };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { C as PG_TIMESTAMP_CODEC_ID, E as PG_UNBOUNDED_INT_CODEC_ID, F as SQL_VARCHAR_CODEC_ID, M as SQL_INT_CODEC_ID, P as SQL_TIMESTAMP_CODEC_ID, S as PG_TIMESTAMPTZ_CODEC_ID, T as PG_TIME_CODEC_ID, a as PG_DATE_CODEC_ID, b as PG_TEXT_ARRAY_CODEC_ID, c as PG_FLOAT8_CODEC_ID, d as PG_INT2_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_INT_CODEC_ID, h as PG_INTERVAL_CODEC_ID, j as SQL_FLOAT_CODEC_ID, k as PG_VARCHAR_CODEC_ID, l as PG_FLOAT_CODEC_ID, m as PG_INT8_NUMBER_CODEC_ID, p as PG_INT8_CODEC_ID, s as PG_FLOAT4_CODEC_ID, u as PG_INET_CODEC_ID, w as PG_TIMETZ_CODEC_ID, x as PG_TEXT_CODEC_ID, y as PG_NUMERIC_CODEC_ID } from "./codec-ids-C5Rkltkw-DMf87l9s.mjs";
|
|
2
|
+
import { AggregateExpr, CastExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
2
3
|
//#region ../../../3-targets/3-targets/postgres/dist/aggregates.mjs
|
|
3
4
|
const overCodec = (codecId) => ({
|
|
4
5
|
kind: "codec",
|
|
@@ -29,15 +30,28 @@ const produces = (operation, input, codecId) => ({
|
|
|
29
30
|
},
|
|
30
31
|
nullable: true
|
|
31
32
|
});
|
|
32
|
-
/**
|
|
33
|
+
/** The same, for an operation that builds its own expression. */
|
|
34
|
+
const producesVia = (operation, input, codecId, lower) => ({
|
|
35
|
+
...produces(operation, input, codecId),
|
|
36
|
+
lower
|
|
37
|
+
});
|
|
38
|
+
/** The SQL aggregate a lossless variant computes with. `sumBigInt` is a `sum` read exactly, `countBigInt` a `count`, `avgDecimal` an `avg`: the variants differ in how the result is read, never in what the database computes. */
|
|
39
|
+
const computedWith = (fn) => ({ expr }) => new AggregateExpr(fn, expr);
|
|
40
|
+
/** `avg` over an integer column, rounded once. PostgreSQL computes the exact `numeric` mean and the cast turns that one value into the `double precision` the result codec reads; casting the input instead would round every value before it was accumulated. */
|
|
41
|
+
const avgCastToFloat8 = ({ expr }) => CastExpr.as(new AggregateExpr("avg", expr), "float8");
|
|
42
|
+
/** Integer codecs whose `sum` widens to `bigint` — every built-in integer bar the 64-bit ones, whose sum goes to `numeric` instead. */
|
|
33
43
|
const SUM_WIDENS_TO_INT8 = [
|
|
34
44
|
PG_INT2_CODEC_ID,
|
|
35
45
|
PG_INT4_CODEC_ID,
|
|
36
46
|
PG_INT_CODEC_ID,
|
|
37
47
|
SQL_INT_CODEC_ID
|
|
38
48
|
];
|
|
39
|
-
/**
|
|
40
|
-
const
|
|
49
|
+
/** The 64-bit integer codecs: PostgreSQL computes their `sum` as a `numeric`, a total free to leave the range an `int8` holds. */
|
|
50
|
+
const SUM_WIDENS_TO_NUMERIC = [PG_INT8_CODEC_ID, PG_INT8_NUMBER_CODEC_ID];
|
|
51
|
+
/** The integer codecs a `sum` reads back as a `number`: every fixed-width one, whatever its own application type. */
|
|
52
|
+
const FIXED_WIDTH_INTEGER_CODECS = [...SUM_WIDENS_TO_INT8, ...SUM_WIDENS_TO_NUMERIC];
|
|
53
|
+
/** Every built-in integer codec, the unbounded one included: `avg` over any of them is a `numeric` mean. */
|
|
54
|
+
const INTEGER_CODECS = [...FIXED_WIDTH_INTEGER_CODECS, PG_UNBOUNDED_INT_CODEC_ID];
|
|
41
55
|
/** Codecs over `double precision`, whose `sum` and `avg` stay there. */
|
|
42
56
|
const DOUBLE_PRECISION_CODECS = [
|
|
43
57
|
PG_FLOAT8_CODEC_ID,
|
|
@@ -75,26 +89,38 @@ const postgresAggregateDescriptors = [
|
|
|
75
89
|
{
|
|
76
90
|
operation: "count",
|
|
77
91
|
input: { kind: "any" },
|
|
92
|
+
output: {
|
|
93
|
+
kind: "codec",
|
|
94
|
+
codecId: PG_INT8_NUMBER_CODEC_ID
|
|
95
|
+
},
|
|
96
|
+
nullable: false,
|
|
97
|
+
emptyResultJson: 0
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
operation: "countBigInt",
|
|
101
|
+
input: { kind: "any" },
|
|
78
102
|
output: {
|
|
79
103
|
kind: "codec",
|
|
80
104
|
codecId: PG_INT8_CODEC_ID
|
|
81
105
|
},
|
|
82
|
-
nullable: false
|
|
106
|
+
nullable: false,
|
|
107
|
+
emptyResultJson: "0",
|
|
108
|
+
lower: computedWith("count")
|
|
83
109
|
},
|
|
84
|
-
...
|
|
85
|
-
|
|
86
|
-
|
|
110
|
+
...FIXED_WIDTH_INTEGER_CODECS.map((codecId) => produces("sum", overCodec(codecId), PG_INT8_NUMBER_CODEC_ID)),
|
|
111
|
+
...SUM_WIDENS_TO_INT8.map((codecId) => producesVia("sumBigInt", overCodec(codecId), PG_INT8_CODEC_ID, computedWith("sum"))),
|
|
112
|
+
...SUM_WIDENS_TO_NUMERIC.map((codecId) => producesVia("sumBigInt", overCodec(codecId), PG_UNBOUNDED_INT_CODEC_ID, computedWith("sum"))),
|
|
113
|
+
producesVia("sumBigInt", overCodec(PG_UNBOUNDED_INT_CODEC_ID), PG_UNBOUNDED_INT_CODEC_ID, computedWith("sum")),
|
|
87
114
|
produces("sum", overCodec(PG_FLOAT4_CODEC_ID), PG_FLOAT4_CODEC_ID),
|
|
88
115
|
...DOUBLE_PRECISION_CODECS.map((codecId) => produces("sum", overCodec(codecId), PG_FLOAT8_CODEC_ID)),
|
|
89
116
|
produces("sum", overCodec(PG_NUMERIC_CODEC_ID), PG_NUMERIC_CODEC_ID),
|
|
90
117
|
produces("sum", overCodec(PG_UNBOUNDED_INT_CODEC_ID), PG_UNBOUNDED_INT_CODEC_ID),
|
|
91
118
|
produces("sum", overCodec(PG_INTERVAL_CODEC_ID), PG_INTERVAL_CODEC_ID),
|
|
92
119
|
produces("sum", overCodec(PG_TIME_CODEC_ID), PG_INTERVAL_CODEC_ID),
|
|
93
|
-
...
|
|
94
|
-
|
|
120
|
+
...INTEGER_CODECS.map((codecId) => producesVia("avg", overCodec(codecId), PG_FLOAT8_CODEC_ID, avgCastToFloat8)),
|
|
121
|
+
...[...INTEGER_CODECS, PG_NUMERIC_CODEC_ID].map((codecId) => producesVia("avgDecimal", overCodec(codecId), PG_NUMERIC_CODEC_ID, computedWith("avg"))),
|
|
95
122
|
...[PG_FLOAT4_CODEC_ID, ...DOUBLE_PRECISION_CODECS].map((codecId) => produces("avg", overCodec(codecId), PG_FLOAT8_CODEC_ID)),
|
|
96
123
|
produces("avg", overCodec(PG_NUMERIC_CODEC_ID), PG_NUMERIC_CODEC_ID),
|
|
97
|
-
produces("avg", overCodec(PG_UNBOUNDED_INT_CODEC_ID), PG_NUMERIC_CODEC_ID),
|
|
98
124
|
produces("avg", overCodec(PG_INTERVAL_CODEC_ID), PG_INTERVAL_CODEC_ID),
|
|
99
125
|
produces("avg", overCodec(PG_TIME_CODEC_ID), PG_INTERVAL_CODEC_ID),
|
|
100
126
|
...orderingDescriptors("min"),
|
|
@@ -103,4 +129,4 @@ const postgresAggregateDescriptors = [
|
|
|
103
129
|
//#endregion
|
|
104
130
|
export { postgresAggregateDescriptors as t };
|
|
105
131
|
|
|
106
|
-
//# sourceMappingURL=aggregates-
|
|
132
|
+
//# sourceMappingURL=aggregates-Dh6HPdvC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregates-Dh6HPdvC.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/aggregates.mjs"],"sourcesContent":["import { C as PG_TIMESTAMP_CODEC_ID, E as PG_UNBOUNDED_INT_CODEC_ID, F as SQL_VARCHAR_CODEC_ID, M as SQL_INT_CODEC_ID, P as SQL_TIMESTAMP_CODEC_ID, S as PG_TIMESTAMPTZ_CODEC_ID, T as PG_TIME_CODEC_ID, a as PG_DATE_CODEC_ID, b as PG_TEXT_ARRAY_CODEC_ID, c as PG_FLOAT8_CODEC_ID, d as PG_INT2_CODEC_ID, f as PG_INT4_CODEC_ID, g as PG_INT_CODEC_ID, h as PG_INTERVAL_CODEC_ID, j as SQL_FLOAT_CODEC_ID, k as PG_VARCHAR_CODEC_ID, l as PG_FLOAT_CODEC_ID, m as PG_INT8_NUMBER_CODEC_ID, p as PG_INT8_CODEC_ID, s as PG_FLOAT4_CODEC_ID, u as PG_INET_CODEC_ID, w as PG_TIMETZ_CODEC_ID, x as PG_TEXT_CODEC_ID, y as PG_NUMERIC_CODEC_ID } from \"./codec-ids-C5Rkltkw.mjs\";\nimport { AggregateExpr, CastExpr } from \"@internal/sql-relational-core/ast\";\n//#region src/core/aggregates.ts\nconst overCodec = (codecId) => ({\n\tkind: \"codec\",\n\tcodecId\n});\nconst overTrait = (trait) => ({\n\tkind: \"trait\",\n\ttrait\n});\n/**\n* An aggregate whose result is one of the input values, so it carries the input's codec — type parameters included, since a `numeric(10,3)` minimum is still a `numeric(10,3)`.\n*/\nconst preservesInput = (operation, input) => ({\n\toperation,\n\tinput,\n\toutput: { kind: \"self\" },\n\tnullable: true\n});\n/**\n* An aggregate whose result is a new value. It names its result codec without type parameters: a sum leaves the input's width behind (a `numeric(10,3)` column sums to an unconstrained `numeric`), so carrying the input's parameters into the result would understate the range.\n*/\nconst produces = (operation, input, codecId) => ({\n\toperation,\n\tinput,\n\toutput: {\n\t\tkind: \"codec\",\n\t\tcodecId\n\t},\n\tnullable: true\n});\n/** The same, for an operation that builds its own expression. */\nconst producesVia = (operation, input, codecId, lower) => ({\n\t...produces(operation, input, codecId),\n\tlower\n});\n/** The SQL aggregate a lossless variant computes with. `sumBigInt` is a `sum` read exactly, `countBigInt` a `count`, `avgDecimal` an `avg`: the variants differ in how the result is read, never in what the database computes. */\nconst computedWith = (fn) => ({ expr }) => new AggregateExpr(fn, expr);\n/** `avg` over an integer column, rounded once. PostgreSQL computes the exact `numeric` mean and the cast turns that one value into the `double precision` the result codec reads; casting the input instead would round every value before it was accumulated. */\nconst avgCastToFloat8 = ({ expr }) => CastExpr.as(new AggregateExpr(\"avg\", expr), \"float8\");\n/** Integer codecs whose `sum` widens to `bigint` — every built-in integer bar the 64-bit ones, whose sum goes to `numeric` instead. */\nconst SUM_WIDENS_TO_INT8 = [\n\tPG_INT2_CODEC_ID,\n\tPG_INT4_CODEC_ID,\n\tPG_INT_CODEC_ID,\n\tSQL_INT_CODEC_ID\n];\n/** The 64-bit integer codecs: PostgreSQL computes their `sum` as a `numeric`, a total free to leave the range an `int8` holds. */\nconst SUM_WIDENS_TO_NUMERIC = [PG_INT8_CODEC_ID, PG_INT8_NUMBER_CODEC_ID];\n/** The integer codecs a `sum` reads back as a `number`: every fixed-width one, whatever its own application type. */\nconst FIXED_WIDTH_INTEGER_CODECS = [...SUM_WIDENS_TO_INT8, ...SUM_WIDENS_TO_NUMERIC];\n/** Every built-in integer codec, the unbounded one included: `avg` over any of them is a `numeric` mean. */\nconst INTEGER_CODECS = [...FIXED_WIDTH_INTEGER_CODECS, PG_UNBOUNDED_INT_CODEC_ID];\n/** Codecs over `double precision`, whose `sum` and `avg` stay there. */\nconst DOUBLE_PRECISION_CODECS = [\n\tPG_FLOAT8_CODEC_ID,\n\tPG_FLOAT_CODEC_ID,\n\tSQL_FLOAT_CODEC_ID\n];\n/**\n* Codecs whose `min`/`max` returns the input type and whose traits do not already say so: the temporal types, `inet`, and `text[]` advertise `order` or `equality`, which `uuid`, `bit`, `bit varying`, `bool`, `bytea`, `json`, and `jsonb` also advertise while having no `min`/`max` at all. An exact overload per supported codec is therefore the only honest shape — a trait fallback over `order` would claim the unsupported ones too.\n*/\nconst MIN_MAX_PRESERVING_CODECS = [\n\tPG_DATE_CODEC_ID,\n\tPG_TIMESTAMP_CODEC_ID,\n\tSQL_TIMESTAMP_CODEC_ID,\n\tPG_TIMESTAMPTZ_CODEC_ID,\n\tPG_TIME_CODEC_ID,\n\tPG_TIMETZ_CODEC_ID,\n\tPG_INTERVAL_CODEC_ID,\n\tPG_INET_CODEC_ID,\n\tPG_TEXT_ARRAY_CODEC_ID\n];\n/**\n* `min`/`max` over the character types, where the trait rung does hold: every `textual` codec returns its input type — except the two `varchar` codecs, whose result PostgreSQL widens to `text`, and which therefore claim themselves exactly and shadow the fallback.\n*/\nconst MIN_MAX_WIDENS_TO_TEXT = [PG_VARCHAR_CODEC_ID, SQL_VARCHAR_CODEC_ID];\nconst orderingDescriptors = (operation) => [\n\tpreservesInput(operation, overTrait(\"numeric\")),\n\tpreservesInput(operation, overTrait(\"textual\")),\n\t...MIN_MAX_WIDENS_TO_TEXT.map((codecId) => produces(operation, overCodec(codecId), PG_TEXT_CODEC_ID)),\n\t...MIN_MAX_PRESERVING_CODECS.map((codecId) => preservesInput(operation, overCodec(codecId)))\n];\n/**\n* Every aggregate overload the PostgreSQL target contributes. The adapter lists these on `types.aggregateDescriptors`, from where emission derives result types and the runtime builds its resolution registry.\n*/\nconst postgresAggregateDescriptors = [\n\t{\n\t\toperation: \"count\",\n\t\tinput: { kind: \"any\" },\n\t\toutput: {\n\t\t\tkind: \"codec\",\n\t\t\tcodecId: PG_INT8_NUMBER_CODEC_ID\n\t\t},\n\t\tnullable: false,\n\t\temptyResultJson: 0\n\t},\n\t{\n\t\toperation: \"countBigInt\",\n\t\tinput: { kind: \"any\" },\n\t\toutput: {\n\t\t\tkind: \"codec\",\n\t\t\tcodecId: PG_INT8_CODEC_ID\n\t\t},\n\t\tnullable: false,\n\t\temptyResultJson: \"0\",\n\t\tlower: computedWith(\"count\")\n\t},\n\t...FIXED_WIDTH_INTEGER_CODECS.map((codecId) => produces(\"sum\", overCodec(codecId), PG_INT8_NUMBER_CODEC_ID)),\n\t...SUM_WIDENS_TO_INT8.map((codecId) => producesVia(\"sumBigInt\", overCodec(codecId), PG_INT8_CODEC_ID, computedWith(\"sum\"))),\n\t...SUM_WIDENS_TO_NUMERIC.map((codecId) => producesVia(\"sumBigInt\", overCodec(codecId), PG_UNBOUNDED_INT_CODEC_ID, computedWith(\"sum\"))),\n\tproducesVia(\"sumBigInt\", overCodec(PG_UNBOUNDED_INT_CODEC_ID), PG_UNBOUNDED_INT_CODEC_ID, computedWith(\"sum\")),\n\tproduces(\"sum\", overCodec(PG_FLOAT4_CODEC_ID), PG_FLOAT4_CODEC_ID),\n\t...DOUBLE_PRECISION_CODECS.map((codecId) => produces(\"sum\", overCodec(codecId), PG_FLOAT8_CODEC_ID)),\n\tproduces(\"sum\", overCodec(PG_NUMERIC_CODEC_ID), PG_NUMERIC_CODEC_ID),\n\tproduces(\"sum\", overCodec(PG_UNBOUNDED_INT_CODEC_ID), PG_UNBOUNDED_INT_CODEC_ID),\n\tproduces(\"sum\", overCodec(PG_INTERVAL_CODEC_ID), PG_INTERVAL_CODEC_ID),\n\tproduces(\"sum\", overCodec(PG_TIME_CODEC_ID), PG_INTERVAL_CODEC_ID),\n\t...INTEGER_CODECS.map((codecId) => producesVia(\"avg\", overCodec(codecId), PG_FLOAT8_CODEC_ID, avgCastToFloat8)),\n\t...[...INTEGER_CODECS, PG_NUMERIC_CODEC_ID].map((codecId) => producesVia(\"avgDecimal\", overCodec(codecId), PG_NUMERIC_CODEC_ID, computedWith(\"avg\"))),\n\t...[PG_FLOAT4_CODEC_ID, ...DOUBLE_PRECISION_CODECS].map((codecId) => produces(\"avg\", overCodec(codecId), PG_FLOAT8_CODEC_ID)),\n\tproduces(\"avg\", overCodec(PG_NUMERIC_CODEC_ID), PG_NUMERIC_CODEC_ID),\n\tproduces(\"avg\", overCodec(PG_INTERVAL_CODEC_ID), PG_INTERVAL_CODEC_ID),\n\tproduces(\"avg\", overCodec(PG_TIME_CODEC_ID), PG_INTERVAL_CODEC_ID),\n\t...orderingDescriptors(\"min\"),\n\t...orderingDescriptors(\"max\")\n];\n//#endregion\nexport { postgresAggregateDescriptors };\n\n//# sourceMappingURL=aggregates.mjs.map"],"mappings":";;;AAGA,MAAM,aAAa,aAAa;CAC/B,MAAM;CACN;AACD;AACA,MAAM,aAAa,WAAW;CAC7B,MAAM;CACN;AACD;;;;AAIA,MAAM,kBAAkB,WAAW,WAAW;CAC7C;CACA;CACA,QAAQ,EAAE,MAAM,OAAO;CACvB,UAAU;AACX;;;;AAIA,MAAM,YAAY,WAAW,OAAO,aAAa;CAChD;CACA;CACA,QAAQ;EACP,MAAM;EACN;CACD;CACA,UAAU;AACX;;AAEA,MAAM,eAAe,WAAW,OAAO,SAAS,WAAW;CAC1D,GAAG,SAAS,WAAW,OAAO,OAAO;CACrC;AACD;;AAEA,MAAM,gBAAgB,QAAQ,EAAE,WAAW,IAAI,cAAc,IAAI,IAAI;;AAErE,MAAM,mBAAmB,EAAE,WAAW,SAAS,GAAG,IAAI,cAAc,OAAO,IAAI,GAAG,QAAQ;;AAE1F,MAAM,qBAAqB;CAC1B;CACA;CACA;CACA;AACD;;AAEA,MAAM,wBAAwB,CAAC,kBAAkB,uBAAuB;;AAExE,MAAM,6BAA6B,CAAC,GAAG,oBAAoB,GAAG,qBAAqB;;AAEnF,MAAM,iBAAiB,CAAC,GAAG,4BAA4B,yBAAyB;;AAEhF,MAAM,0BAA0B;CAC/B;CACA;CACA;AACD;;;;AAIA,MAAM,4BAA4B;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;;;AAIA,MAAM,yBAAyB,CAAC,qBAAqB,oBAAoB;AACzE,MAAM,uBAAuB,cAAc;CAC1C,eAAe,WAAW,U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C,GAAG,gBAAgB,mBAAmB,CAAC,CAAC,KAAK,YAAY,YAAY,cAAc,UAAU,OAAO,GAAG,qBAAqB,aAAa,KAAK,CAAC,CAAC;CACpJ,GAAG,CAAC,oBAAoB,GAAG,uBAAuB,CAAC,CAAC,KAAK,YAAY,SAAS,OAAO,UAAU,OAAO,GAAG,kBAAkB,CAAC;CAC5H,SAAS,OAAO,UAAU,mBAAmB,GAAG,mBAAmB;CACnE,SAAS,OAAO,UAAU,oBAAoB,GAAG,oBAAoB;CACrE,SAAS,OAAO,UAAU,gBAAgB,GAAG,oBAAoB;CACjE,GAAG,oBAAoB,KAAK;CAC5B,GAAG,oBAAoB,KAAK;AAC7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as buildPostgresCodecDescriptorRegistry } from "./codec-descriptor-LT7BpQta-BaDM8UQQ.mjs";
|
|
2
|
-
import { t as codecDescriptors } from "./codecs-
|
|
2
|
+
import { t as codecDescriptors } from "./codecs-dXnwOH7P-CIr-fArt.mjs";
|
|
3
3
|
import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
|
|
4
4
|
//#region ../../../3-targets/3-targets/postgres/dist/codecs.mjs
|
|
5
5
|
/**
|
|
@@ -12,4 +12,4 @@ const postgresCodecDescriptorRegistry = buildPostgresCodecDescriptorRegistry(cod
|
|
|
12
12
|
//#endregion
|
|
13
13
|
export { postgresCodecRegistry as n, postgresCodecDescriptorRegistry as t };
|
|
14
14
|
|
|
15
|
-
//# sourceMappingURL=codecs-
|
|
15
|
+
//# sourceMappingURL=codecs-C9-AwMlR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs-
|
|
1
|
+
{"version":3,"file":"codecs-C9-AwMlR.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/codecs.mjs"],"sourcesContent":["import { n as buildPostgresCodecDescriptorRegistry } from \"./codec-descriptor-LT7BpQta.mjs\";\nimport { C as pgTimestampColumn, D as pgUuidColumn, E as pgUnboundedIntColumn, O as pgVarbitColumn, S as pgTimeColumn, T as pgTimetzColumn, _ as pgIntervalColumn, a as pgCharColumn, b as pgNumericColumn, c as pgFloat4Column, d as pgInetColumn, f as pgInt2Column, g as pgIntColumn, h as pgInt8NumberColumn, i as pgBoolColumn, k as pgVarcharColumn, l as pgFloat8Column, m as pgInt8Column, n as isPgEnumParams, o as pgDateColumn, p as pgInt4Column, r as pgBitColumn, s as pgEnumDescriptor, t as codecDescriptors, u as pgFloatColumn, v as pgJsonColumn, w as pgTimestamptzColumn, x as pgTextColumn, y as pgJsonbColumn } from \"./codecs-dXnwOH7P.mjs\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/target-postgres`.\n*\n* Public consumer surface for the postgres codec set: the postgres adapter and any other consumer that needs to enumerate or look up a postgres codec by id consumes this rather than the raw descriptor array. See ADR 208.\n*/\nconst postgresCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);\nconst postgresCodecDescriptorRegistry = buildPostgresCodecDescriptorRegistry(codecDescriptors);\n//#endregion\nexport { isPgEnumParams, pgBitColumn, pgBoolColumn, pgCharColumn, pgDateColumn, pgEnumDescriptor, pgFloat4Column, pgFloat8Column, pgFloatColumn, pgInetColumn, pgInt2Column, pgInt4Column, pgInt8Column, pgInt8NumberColumn, pgIntColumn, pgIntervalColumn, pgJsonColumn, pgJsonbColumn, pgNumericColumn, pgTextColumn, pgTimeColumn, pgTimestampColumn, pgTimestamptzColumn, pgTimetzColumn, pgUnboundedIntColumn, pgUuidColumn, pgVarbitColumn, pgVarcharColumn, postgresCodecDescriptorRegistry, postgresCodecRegistry };\n\n//# sourceMappingURL=codecs.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,wBAAwB,6BAA6B,gBAAgB;AAC3E,MAAM,kCAAkC,qCAAqC,gBAAgB"}
|
|
@@ -7,7 +7,7 @@ import { CodecImpl, column, renderTsLiteral, voidParamsSchema } from "@prisma/or
|
|
|
7
7
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
8
8
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
9
9
|
import { type } from "arktype";
|
|
10
|
-
//#region ../../../3-targets/3-targets/postgres/dist/codecs-
|
|
10
|
+
//#region ../../../3-targets/3-targets/postgres/dist/codecs-dXnwOH7P.mjs
|
|
11
11
|
function renderLength(typeName, typeParams) {
|
|
12
12
|
const length = typeParams["length"];
|
|
13
13
|
if (length === void 0) return;
|
|
@@ -34,6 +34,45 @@ const pgNumericDecode = (wire) => {
|
|
|
34
34
|
};
|
|
35
35
|
const DECIMAL_INTEGER = /^-?\d+$/;
|
|
36
36
|
/**
|
|
37
|
+
* Requires an application value to be of the JS type the codec reads.
|
|
38
|
+
*
|
|
39
|
+
* A range check reads a value of the wrong type as a value out of range, and
|
|
40
|
+
* reports a number plainly inside the range as outside it — so the type is
|
|
41
|
+
* established first and answered for on its own terms, naming what a caller
|
|
42
|
+
* has to change.
|
|
43
|
+
*/
|
|
44
|
+
const requireJsType = (codecId, expected, value) => {
|
|
45
|
+
if (typeof value === expected) return;
|
|
46
|
+
throw postgresError("RUNTIME.ENCODE_FAILED", `${codecId} value must be a ${expected}, got ${typeof value} ${String(value)}`, { meta: {
|
|
47
|
+
codecId,
|
|
48
|
+
received: typeof value
|
|
49
|
+
} });
|
|
50
|
+
};
|
|
51
|
+
/** Writes a `bigint` application value as the decimal text the wire form of the exact integer codecs carries. */
|
|
52
|
+
const pgBigintEncode = (codecId, value) => {
|
|
53
|
+
requireJsType(codecId, "bigint", value);
|
|
54
|
+
return value.toString();
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Writes an application value as the decimal text these codecs carry as their
|
|
58
|
+
* canonical JSON.
|
|
59
|
+
*
|
|
60
|
+
* A schema-written literal default (`BigInt @default(0)`) arrives here as a
|
|
61
|
+
* `number`, since a number literal is the only integer a schema language
|
|
62
|
+
* writes, and one that is a safe integer names its value exactly. Past that
|
|
63
|
+
* range the literal was rounded before any of this ran, so the value written is
|
|
64
|
+
* not the value meant — which this refuses rather than minting an exact-looking
|
|
65
|
+
* total from it. A non-integral number is refused on the same terms.
|
|
66
|
+
*/
|
|
67
|
+
const pgBigintEncodeJson = (codecId, value) => {
|
|
68
|
+
if (typeof value !== "number") return pgBigintEncode(codecId, value);
|
|
69
|
+
if (!Number.isSafeInteger(value)) throw postgresError("RUNTIME.ENCODE_FAILED", `${codecId} number literal must be an integer within the safe integer range, got ${String(value)}`, { meta: {
|
|
70
|
+
codecId,
|
|
71
|
+
received: String(value)
|
|
72
|
+
} });
|
|
73
|
+
return BigInt(value).toString();
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
37
76
|
* Reads a wire or JSON value as a `bigint`, rejecting anything `BigInt()` would
|
|
38
77
|
* misread. A number-typed wire value must also be a safe integer: past
|
|
39
78
|
* ±(2^53 − 1) the driver's `number` has already rounded, so stringifying it
|
|
@@ -74,8 +113,11 @@ const pgInt8NumberGuard = (code, value) => {
|
|
|
74
113
|
} });
|
|
75
114
|
return value;
|
|
76
115
|
};
|
|
77
|
-
const
|
|
78
|
-
|
|
116
|
+
const pgInt8NumberEncodeJson = (value) => {
|
|
117
|
+
requireJsType("pg/int8number@1", "number", value);
|
|
118
|
+
return pgInt8NumberGuard("RUNTIME.ENCODE_FAILED", value);
|
|
119
|
+
};
|
|
120
|
+
const pgInt8NumberEncode = (value) => String(pgInt8NumberEncodeJson(value));
|
|
79
121
|
/**
|
|
80
122
|
* Reads an `int8` wire value as a `number`, throwing outside ±(2^53 − 1) and on
|
|
81
123
|
* non-integral input. Decimal text goes through `BigInt` before the range check
|
|
@@ -766,13 +808,13 @@ const pgInt2Column = () => column(pgInt2Descriptor.factory(), pgInt2Descriptor.c
|
|
|
766
808
|
*/
|
|
767
809
|
var PgInt8Codec = class extends CodecImpl {
|
|
768
810
|
async encode(value, _ctx) {
|
|
769
|
-
return value
|
|
811
|
+
return pgBigintEncode(PG_INT8_CODEC_ID, value);
|
|
770
812
|
}
|
|
771
813
|
async decode(wire, _ctx) {
|
|
772
814
|
return pgInt8Decode(wire);
|
|
773
815
|
}
|
|
774
816
|
encodeJson(value) {
|
|
775
|
-
return value
|
|
817
|
+
return pgBigintEncodeJson(PG_INT8_CODEC_ID, value);
|
|
776
818
|
}
|
|
777
819
|
decodeJson(json) {
|
|
778
820
|
if (typeof json !== "string") throw postgresError("RUNTIME.DECODE_FAILED", "pg/int8@1 database JSON value must be a decimal string", { meta: {
|
|
@@ -1017,13 +1059,13 @@ const pgNumericColumn = (params = {}) => column(pgNumericDescriptor.factory(para
|
|
|
1017
1059
|
*/
|
|
1018
1060
|
var PgUnboundedIntCodec = class extends CodecImpl {
|
|
1019
1061
|
async encode(value, _ctx) {
|
|
1020
|
-
return value
|
|
1062
|
+
return pgBigintEncode(PG_UNBOUNDED_INT_CODEC_ID, value);
|
|
1021
1063
|
}
|
|
1022
1064
|
async decode(wire, _ctx) {
|
|
1023
1065
|
return pgUnboundedIntDecode(wire);
|
|
1024
1066
|
}
|
|
1025
1067
|
encodeJson(value) {
|
|
1026
|
-
return value
|
|
1068
|
+
return pgBigintEncodeJson(PG_UNBOUNDED_INT_CODEC_ID, value);
|
|
1027
1069
|
}
|
|
1028
1070
|
decodeJson(json) {
|
|
1029
1071
|
if (typeof json !== "string") throw postgresError("RUNTIME.DECODE_FAILED", "pg/unboundedint@1 database JSON value must be a decimal string", { meta: {
|
|
@@ -1635,4 +1677,4 @@ const codecDescriptors = definePostgresCodecs([
|
|
|
1635
1677
|
//#endregion
|
|
1636
1678
|
export { postgresQualifyColumnType as A, pgTimestampColumn as C, pgUuidColumn as D, pgUnboundedIntColumn as E, pgVarbitColumn as O, pgTimeColumn as S, pgTimetzColumn as T, pgIntervalColumn as _, pgCharColumn as a, pgNumericColumn as b, pgFloat4Column as c, pgInetColumn as d, pgInt2Column as f, pgIntColumn as g, pgInt8NumberColumn as h, pgBoolColumn as i, pgVarcharColumn as k, pgFloat8Column as l, pgInt8Column as m, isPgEnumParams as n, pgDateColumn as o, pgInt4Column as p, pgBitColumn as r, pgEnumDescriptor as s, codecDescriptors as t, pgFloatColumn as u, pgJsonColumn as v, pgTimestamptzColumn as w, pgTextColumn as x, pgJsonbColumn as y };
|
|
1637
1679
|
|
|
1638
|
-
//# sourceMappingURL=codecs-
|
|
1680
|
+
//# sourceMappingURL=codecs-dXnwOH7P-CIr-fArt.mjs.map
|