@prisma/orm-target-postgres 8.0.0-rc.18-dev.28 → 8.0.0-rc.18-dev.30

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.
Files changed (84) hide show
  1. package/dist/adapter__control.mjs +13 -133
  2. package/dist/adapter__control.mjs.map +1 -1
  3. package/dist/adapter__runtime.mjs +2 -2
  4. package/dist/adapter__runtime.mjs.map +1 -1
  5. package/dist/{authoring-DhyLHFHA-pB4NuFxh.mjs → authoring-DtjMn8TZ-sv84Cdw_.mjs} +18 -34
  6. package/dist/authoring-DtjMn8TZ-sv84Cdw_.mjs.map +1 -0
  7. package/dist/{control-DmWVxA23.d.mts → control-BRE_BcLl.d.mts} +2 -2
  8. package/dist/{control-DmWVxA23.d.mts.map → control-BRE_BcLl.d.mts.map} +1 -1
  9. package/dist/{descriptor-meta-Bzs7kSyA-BjbnpZLW.mjs → descriptor-meta-C0yUaYLH-CUtYbbZp.mjs} +21 -3
  10. package/dist/descriptor-meta-C0yUaYLH-CUtYbbZp.mjs.map +1 -0
  11. package/dist/{diff-database-schema-BGcRo8FM.d.mts → diff-database-schema-Diw5m51r.d.mts} +2 -2
  12. package/dist/{diff-database-schema-BGcRo8FM.d.mts.map → diff-database-schema-Diw5m51r.d.mts.map} +1 -1
  13. package/dist/{indexes-DtIXFHAb-DBubdl32.d.mts → indexes-BX4ewz3l-CPzMc0-t.d.mts} +3 -3
  14. package/dist/{indexes-DtIXFHAb-DBubdl32.d.mts.map → indexes-BX4ewz3l-CPzMc0-t.d.mts.map} +1 -1
  15. package/dist/{issue-planner-DrWlNiAf.d.mts → issue-planner-BT5rqDNx.d.mts} +3 -3
  16. package/dist/{issue-planner-DrWlNiAf.d.mts.map → issue-planner-BT5rqDNx.d.mts.map} +1 -1
  17. package/dist/{migration-DO23kNde.d.mts → migration-BWZskUHP.d.mts} +3 -3
  18. package/dist/{migration-DO23kNde.d.mts.map → migration-BWZskUHP.d.mts.map} +1 -1
  19. package/dist/migration-CbOh59ZJ.mjs.map +1 -1
  20. package/dist/op-factory-call-CEyI7a78.d.mts +1 -0
  21. package/dist/{op-factory-call-kdPO0kgG-DV8hS6qA.d.mts → op-factory-call-DILl2zlf-BakJezLJ.d.mts} +4 -4
  22. package/dist/{op-factory-call-kdPO0kgG-DV8hS6qA.d.mts.map → op-factory-call-DILl2zlf-BakJezLJ.d.mts.map} +1 -1
  23. package/dist/{pack-CcQNl-gj.d.mts → pack-C-rgdVoH.d.mts} +6 -1
  24. package/dist/{pack-CcQNl-gj.d.mts.map → pack-C-rgdVoH.d.mts.map} +1 -1
  25. package/dist/{planner-C1czBCmI-C-x1Ip-_.mjs → planner-BIOXTf-E-CFs_l_0M.mjs} +7 -6
  26. package/dist/planner-BIOXTf-E-CFs_l_0M.mjs.map +1 -0
  27. package/dist/{planner-B_MRApHM.d.mts → planner-Bo92I5YX.d.mts} +3 -3
  28. package/dist/{planner-B_MRApHM.d.mts.map → planner-Bo92I5YX.d.mts.map} +1 -1
  29. package/dist/{planner-produced-postgres-migration-B6NsNaam-BmvloI2L.d.mts → planner-produced-postgres-migration-C8uYGzUj-DRmZY4_u.d.mts} +3 -3
  30. package/dist/planner-produced-postgres-migration-C8uYGzUj-DRmZY4_u.d.mts.map +1 -0
  31. package/dist/planner-produced-postgres-migration-DaDlRTID.d.mts +1 -0
  32. package/dist/{planner-produced-postgres-migration-F9joIngl-C04yYu-i.mjs → planner-produced-postgres-migration-Y7bMLPPc-tZeIl3hP.mjs} +3 -3
  33. package/dist/{planner-produced-postgres-migration-F9joIngl-C04yYu-i.mjs.map → planner-produced-postgres-migration-Y7bMLPPc-tZeIl3hP.mjs.map} +1 -1
  34. package/dist/{planner-sql-checks-CxlrM4J2-VqQpmMwn.d.mts → planner-sql-checks-CWOmxltY-CoWF8Eq0.d.mts} +3 -3
  35. package/dist/{planner-sql-checks-CxlrM4J2-VqQpmMwn.d.mts.map → planner-sql-checks-CWOmxltY-CoWF8Eq0.d.mts.map} +1 -1
  36. package/dist/planner-sql-checks-Cp3fcCNc.d.mts +1 -0
  37. package/dist/{postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts → postgres-contract-view-BFzIDwwN-pJ6gJGOT.d.mts} +2 -2
  38. package/dist/{postgres-contract-view-2OP5JnXl-D2fpy4-8.d.mts.map → postgres-contract-view-BFzIDwwN-pJ6gJGOT.d.mts.map} +1 -1
  39. package/dist/{postgres-contract-view-B-bLZB7o-zpuamDXT.mjs → postgres-contract-view-Ctg2ire_-smoqnU-u.mjs} +3 -3
  40. package/dist/{postgres-contract-view-B-bLZB7o-zpuamDXT.mjs.map → postgres-contract-view-Ctg2ire_-smoqnU-u.mjs.map} +1 -1
  41. package/dist/{postgres-migration-BbXm1l5I-DDy8IgYB.mjs → postgres-migration-BdFXT6xg-BPApPGX9.mjs} +3 -3
  42. package/dist/{postgres-migration-BbXm1l5I-DDy8IgYB.mjs.map → postgres-migration-BdFXT6xg-BPApPGX9.mjs.map} +1 -1
  43. package/dist/{postgres-migration-CRLV93uK-ThJW3tFf.d.mts → postgres-migration-HW4fCGNb-CLkytGtG.d.mts} +4 -4
  44. package/dist/{postgres-migration-CRLV93uK-ThJW3tFf.d.mts.map → postgres-migration-HW4fCGNb-CLkytGtG.d.mts.map} +1 -1
  45. package/dist/{prisma7-binding-C5RLV6kJ.d.mts → prisma7-binding-BXyT6bKE.d.mts} +6 -10
  46. package/dist/prisma7-binding-BXyT6bKE.d.mts.map +1 -0
  47. package/dist/{prisma7-binding-CzO7rkpS.mjs → prisma7-binding-DWeHpJrg.mjs} +3 -5
  48. package/dist/prisma7-binding-DWeHpJrg.mjs.map +1 -0
  49. package/dist/{runtime-1ioqDrqf.d.mts → runtime-BeTyqpCH.d.mts} +2 -2
  50. package/dist/{runtime-1ioqDrqf.d.mts.map → runtime-BeTyqpCH.d.mts.map} +1 -1
  51. package/dist/target.d.mts +16 -16
  52. package/dist/target.mjs +7 -7
  53. package/dist/target__control.d.mts +1 -1
  54. package/dist/target__control.mjs +77 -144
  55. package/dist/target__control.mjs.map +1 -1
  56. package/dist/target__diff-database-schema.d.mts +1 -1
  57. package/dist/target__issue-planner.d.mts +1 -1
  58. package/dist/target__migration.d.mts +2 -2
  59. package/dist/target__migration.mjs +1 -1
  60. package/dist/target__op-factory-call.d.mts +2 -2
  61. package/dist/target__pack.d.mts +1 -1
  62. package/dist/target__pack.mjs +1 -1
  63. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  64. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  65. package/dist/target__planner-sql-checks.d.mts +2 -2
  66. package/dist/target__planner.d.mts +1 -1
  67. package/dist/target__planner.mjs +1 -1
  68. package/dist/target__prisma7-binding.d.mts +1 -1
  69. package/dist/target__prisma7-binding.mjs +1 -1
  70. package/dist/target__runtime.d.mts +2 -2
  71. package/dist/target__runtime.mjs +2 -2
  72. package/dist/target__runtime.mjs.map +1 -1
  73. package/dist/{type-constructors-CrNUrtwZ-dmWF-mtV.mjs → type-constructors-BEZJxWcZ-Co2GJw1M.mjs} +5 -5
  74. package/dist/{type-constructors-CrNUrtwZ-dmWF-mtV.mjs.map → type-constructors-BEZJxWcZ-Co2GJw1M.mjs.map} +1 -1
  75. package/package.json +9 -9
  76. package/dist/authoring-DhyLHFHA-pB4NuFxh.mjs.map +0 -1
  77. package/dist/descriptor-meta-Bzs7kSyA-BjbnpZLW.mjs.map +0 -1
  78. package/dist/op-factory-call-CijzNDaJ.d.mts +0 -1
  79. package/dist/planner-C1czBCmI-C-x1Ip-_.mjs.map +0 -1
  80. package/dist/planner-produced-postgres-migration-B6NsNaam-BmvloI2L.d.mts.map +0 -1
  81. package/dist/planner-produced-postgres-migration-BW8GJFjS.d.mts +0 -1
  82. package/dist/planner-sql-checks-CB4oLSuZ.d.mts +0 -1
  83. package/dist/prisma7-binding-C5RLV6kJ.d.mts.map +0 -1
  84. package/dist/prisma7-binding-CzO7rkpS.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prisma7-binding-DWeHpJrg.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/prisma7-binding.mjs"],"sourcesContent":["import { A as pgTimestamptz, E as pgTime, F as pgUuid, L as pgVarchar, M as pgTimetz, O as pgTimestamp, R as postgresDataTypes, _ as pgInt8, a as pgBytea, b as pgJsonb, c as pgDate, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, m as pgInet, o as pgChar, p as pgFloat8, w as pgText, x as pgNumeric, y as pgJson } from \"./data-types-Cs-LkJBw.mjs\";\nimport { t as postgresDataTypeEntries } from \"./data-type-entries-CqnLlCkK.mjs\";\nimport { a as postgresCodecDescriptorRegistry } from \"./codec-registry-T79ktJL4.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-DyUXtYIT.mjs\";\nimport { t as postgresTargetDescriptorMeta } from \"./descriptor-meta-C0yUaYLH.mjs\";\nimport { n as defaultPrimaryKeyName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { i as buildPslDocumentAst, n as postgresPslTypeConstructors, o as createPostgresDefaultMapping, p as noColumnDefaults, s as noInferredDefaults } from \"./type-constructors-BEZJxWcZ.mjs\";\nimport { createDataTypeLookup } from \"@internal/framework-components/codec\";\nimport { authoringTypeConstructorArguments } from \"@internal/framework-components/authoring\";\nimport { SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { inferredTypeConstructors } from \"@internal/family-sql/psl-build\";\nimport { toModelName } from \"@internal/family-sql/psl-infer\";\nimport { flatPslModels } from \"@internal/framework-components/psl-ast\";\n//#region src/core/prisma7-temporal-defaults.ts\nconst RFC_3339 = /^(\\d{4}-\\d{2}-\\d{2})[Tt ](\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?)([Zz]|[+-]\\d{2}:\\d{2})$/;\n/**\n* What a Prisma 7 `DateTime` default, such as `2024-01-02T03:04:05.123+02:00`, means on a column of `dataType`, as the body of the type's tag: `date` keeps the written date, `time` and `timestamp` the written wall-clock time without the offset, `timetz` the time with the written offset, and `timestamptz` the written instant, offset included. The tag reads the body as Postgres reads the default Prisma 7 writes. `undefined` for text that is not an RFC 3339 date and time, or a type that is not a date or time type.\n*/\nfunction prisma7TemporalTagBody(text, dataType) {\n\tconst match = RFC_3339.exec(text);\n\tif (match === null) return void 0;\n\tconst [, date = \"\", clock = \"\", zone = \"\"] = match;\n\tconst offset = zone.toUpperCase();\n\tswitch (dataType) {\n\t\tcase pgDate.id: return date;\n\t\tcase pgTime.id: return clock;\n\t\tcase pgTimetz.id: return `${clock}${offset}`;\n\t\tcase pgTimestamp.id: return `${date}T${clock}`;\n\t\tcase pgTimestamptz.id: return `${date}T${clock}${offset}`;\n\t\tdefault: return;\n\t}\n}\nconst MICROSECONDS_PER_SECOND = 1000000n;\nconst POSTGRES_EPOCH_MS = Date.UTC(2e3, 0, 1);\n/**\n* The value PostgreSQL stores for a Prisma 7 `DateTime` default with more fraction digits than a column of `dataType` with `precision` holds, written in the same RFC 3339 form: the fraction is first rounded to microseconds as PostgreSQL reads text, then to `precision` digits as it rounds a value for its column, a tie going away from midnight on 2000-01-01, PostgreSQL's epoch. `undefined` when the column holds the text as written, or for a date column, which keeps only the date.\n*/\nfunction prisma7TemporalStored(text, dataType, precision) {\n\tconst match = RFC_3339.exec(text);\n\tif (match === null || dataType === pgDate.id) return void 0;\n\tconst [, date = \"\", clock = \"\", zone = \"\"] = match;\n\tconst [hms = \"\", fraction = \"\"] = clock.split(\".\");\n\tif (fraction.length <= precision) return void 0;\n\tconst [year, month, day] = date.split(\"-\").map(Number);\n\tconst [hour, minute, second] = hms.split(\":\").map(Number);\n\tconst wallMs = (/* @__PURE__ */ new Date(0)).setUTCFullYear(year ?? 0, (month ?? 1) - 1, day ?? 1);\n\tconst wall = (BigInt(wallMs - POSTGRES_EPOCH_MS) / 1000n + BigInt((hour ?? 0) * 3600 + (minute ?? 0) * 60 + (second ?? 0))) * MICROSECONDS_PER_SECOND + microsecondsOf(fraction);\n\tconst instant = dataType === pgTimestamptz.id ? wall - offsetMicroseconds(zone) : wall;\n\tconst tieGoesEarlier = (dataType === pgTimestamp.id || dataType === pgTimestamptz.id) && instant < 0n;\n\treturn `${printedWall(roundedTo(wall, 10n ** BigInt(6 - precision), tieGoesEarlier), precision)}${zone}`;\n}\n/** PostgreSQL reads the fraction of a second as a double and rounds it to whole microseconds. */\nfunction microsecondsOf(fraction) {\n\tif (fraction.length <= 6) return BigInt(fraction.padEnd(6, \"0\"));\n\tconst scaled = Number(`0.${fraction}`) * 1e6;\n\tconst floor = Math.floor(scaled);\n\tconst rest = scaled - floor;\n\tconst rounded = rest > .5 || rest === .5 && floor % 2 === 1 ? floor + 1 : floor;\n\treturn BigInt(rounded);\n}\nfunction offsetMicroseconds(zone) {\n\tconst offset = /^([+-])(\\d{2}):(\\d{2})$/.exec(zone);\n\tif (offset === null) return 0n;\n\tconst [, sign, hours = \"0\", minutes = \"0\"] = offset;\n\tconst seconds = BigInt(Number(hours) * 3600 + Number(minutes) * 60);\n\treturn (sign === \"-\" ? -seconds : seconds) * MICROSECONDS_PER_SECOND;\n}\nfunction roundedTo(value, step, tieGoesEarlier) {\n\tconst rest = (value % step + step) % step;\n\tconst below = value - rest;\n\tconst twice = rest * 2n;\n\tif (twice > step || twice === step && !tieGoesEarlier) return below + step;\n\treturn below;\n}\nfunction printedWall(microseconds, precision) {\n\tconst rest = (microseconds % MICROSECONDS_PER_SECOND + MICROSECONDS_PER_SECOND) % MICROSECONDS_PER_SECOND;\n\tconst seconds = (microseconds - rest) / MICROSECONDS_PER_SECOND;\n\tconst at = new Date(POSTGRES_EPOCH_MS + Number(seconds) * 1e3);\n\tconst two = (n) => String(n).padStart(2, \"0\");\n\treturn `${`${String(at.getUTCFullYear()).padStart(4, \"0\")}-${two(at.getUTCMonth() + 1)}-${two(at.getUTCDate())}`}T${`${two(at.getUTCHours())}:${two(at.getUTCMinutes())}:${two(at.getUTCSeconds())}`}${precision === 0 ? \"\" : `.${String(rest).padStart(6, \"0\").slice(0, precision)}`}`;\n}\n//#endregion\n//#region src/core/prisma7-type-map.ts\nconst of = (type, params = {}) => ({\n\tdataType: type.id,\n\tparams\n});\n/**\n* What Prisma 7.10.0 creates in Postgres for each Prisma 7 scalar and `@db.*` native type, as a data type and its parameters. Derived from the SQL recorded in `test/integration/test/fixtures/prisma7-source/reference/migration.sql`. A `@db.*` attribute's own arguments replace the parameters; without any, the column gets these, so `@db.Char` is the `character(1)` Postgres stores for Prisma 7's `CHAR`.\n*/\nconst prisma7PostgresTypes = {\n\tscalars: {\n\t\tString: of(pgText),\n\t\tBoolean: of(pgBool),\n\t\tInt: of(pgInt4),\n\t\tBigInt: of(pgInt8),\n\t\tFloat: of(pgFloat8),\n\t\tDecimal: of(pgNumeric, {\n\t\t\tprecision: 65,\n\t\t\tscale: 30\n\t\t}),\n\t\tDateTime: of(pgTimestamp, { precision: 3 }),\n\t\tJson: of(pgJsonb),\n\t\tBytes: of(pgBytea)\n\t},\n\tnativeTypes: {\n\t\tText: of(pgText),\n\t\tVarChar: of(pgVarchar),\n\t\tChar: of(pgChar, { length: 1 }),\n\t\tUuid: of(pgUuid),\n\t\tInet: of(pgInet),\n\t\tBoolean: of(pgBool),\n\t\tInteger: of(pgInt4),\n\t\tSmallInt: of(pgInt2),\n\t\tBigInt: of(pgInt8),\n\t\tReal: of(pgFloat4),\n\t\tDoublePrecision: of(pgFloat8),\n\t\tDecimal: of(pgNumeric),\n\t\tTimestamp: of(pgTimestamp),\n\t\tTimestamptz: of(pgTimestamptz),\n\t\tDate: of(pgDate),\n\t\tTime: of(pgTime),\n\t\tTimetz: of(pgTimetz),\n\t\tJson: of(pgJson),\n\t\tJsonB: of(pgJsonb),\n\t\tByteA: of(pgBytea)\n\t}\n};\nconst marked = inferredTypeConstructors({\n\tauthoringTypes: postgresPslTypeConstructors,\n\tcodecLookup: postgresCodecDescriptorRegistry,\n\tdataTypeLookup: createDataTypeLookup(postgresDataTypes)\n});\n/**\n* The constructor marked `inferred` for the column's data type, with every parameter Prisma 7 gives the column as an argument. The reader builds a contract, so it keeps each parameter rather than the fewest arguments printed PSL writes (design 13.8).\n*/\nfunction mappingOf({ dataType, params }) {\n\tconst markedConstructor = marked.get(dataType);\n\tconst args = markedConstructor === void 0 ? void 0 : authoringTypeConstructorArguments(markedConstructor.descriptor, {\n\t\tcodecId: markedConstructor.descriptor.output.codecId,\n\t\ttypeParams: params\n\t});\n\tif (markedConstructor === void 0 || args === void 0) throw new InternalError(`No constructor marked inferred writes ${dataType} with these parameters.`);\n\treturn {\n\t\tconstructorName: markedConstructor.path.join(\".\"),\n\t\targs: args.map(String)\n\t};\n}\nfunction mappingsOf(types) {\n\treturn Object.fromEntries(Object.entries(types).map(([name, type]) => [name, mappingOf(type)]));\n}\n/** {@link prisma7PostgresTypes} as the Prisma 7 reader takes it: each type's constructor call. */\nconst prisma7PostgresTypeMap = {\n\tscalars: mappingsOf(prisma7PostgresTypes.scalars),\n\tnativeTypes: mappingsOf(prisma7PostgresTypes.nativeTypes)\n};\n//#endregion\n//#region src/core/psl-infer/junction-relation-field-names.ts\nconst EMPTY_FOREIGN_KEY_EXTRAS = {\n\textraRelationsByTable: /* @__PURE__ */ new Map(),\n\tcrossSpaceFieldNamesByTable: /* @__PURE__ */ new Map(),\n\tdanglingForeignKeysByTable: /* @__PURE__ */ new Map()\n};\nfunction idTable(name) {\n\treturn new SqlTableIR({\n\t\tname,\n\t\tcolumns: { id: {\n\t\t\tname: \"id\",\n\t\t\ttypeText: \"int4\",\n\t\t\tnullable: false\n\t\t} },\n\t\tforeignKeys: [],\n\t\tuniques: [],\n\t\tindexes: [],\n\t\tprimaryKey: { columns: [\"id\"] }\n\t});\n}\n/**\n* The relation field names `contract infer` prints for an implicit\n* many-to-many junction table whose columns `A` and `B` reference `tableA`\n* and `tableB`, found by running infer's PSL construction on that table.\n*/\nfunction junctionRelationFieldNames(tableA, tableB) {\n\tlet junctionName = \"_junction\";\n\twhile ([tableA, tableB].some((table) => toModelName(table).name === toModelName(junctionName).name)) junctionName = `${junctionName}x`;\n\tconst column = (name) => ({\n\t\tname,\n\t\ttypeText: \"int4\",\n\t\tnullable: false\n\t});\n\tconst foreignKey = (columnName, referencedTable) => ({\n\t\tcolumns: [columnName],\n\t\treferencedTable,\n\t\treferencedColumns: [\"id\"]\n\t});\n\tconst junction = new SqlTableIR({\n\t\tname: junctionName,\n\t\tcolumns: {\n\t\t\tA: column(\"A\"),\n\t\t\tB: column(\"B\")\n\t\t},\n\t\tforeignKeys: [foreignKey(\"A\", tableA), foreignKey(\"B\", tableB)],\n\t\tuniques: [],\n\t\tindexes: [],\n\t\tprimaryKey: { columns: [\"A\", \"B\"] }\n\t});\n\tconst document = buildPslDocumentAst(new SqlSchemaIR({ tables: {\n\t\t[tableA]: idTable(tableA),\n\t\t[tableB]: idTable(tableB),\n\t\t[junctionName]: junction\n\t} }), {\n\t\tcolumnTypes: () => ({\n\t\t\tpath: [\"Int\"],\n\t\t\targs: []\n\t\t}),\n\t\tdefaultMapping: createPostgresDefaultMapping(),\n\t\tdefaultOf: noInferredDefaults,\n\t\tcolumnDefaults: noColumnDefaults\n\t}, EMPTY_FOREIGN_KEY_EXTRAS);\n\tconst junctionModelName = toModelName(junctionName).name;\n\tconst fields = flatPslModels(document).find((model) => model.name === junctionModelName)?.fields;\n\tconst scalarFieldCount = Object.keys(junction.columns).length;\n\tconst [a = \"\", b = \"\"] = (fields ?? []).slice(scalarFieldCount).map((field) => field.name);\n\treturn [a, b];\n}\n//#endregion\n//#region src/core/prisma7-binding.ts\n/** The date and time types a Prisma 7 `DateTime` default can be written on. */\nconst DATE_TIME_TYPES = /* @__PURE__ */ new Set([\n\tpgTimestamp.id,\n\tpgTimestamptz.id,\n\tpgDate.id,\n\tpgTime.id,\n\tpgTimetz.id\n]);\nconst ENTRIES = postgresDataTypeEntries();\n/** The tag the authoring entry of `dataType` writes its values with. */\nfunction tagOf(dataType) {\n\tconst written = ENTRIES[dataType]?.written;\n\treturn written?.kind === \"tag\" ? written.tag : void 0;\n}\n/** A date or time column without a precision holds microseconds. */\nfunction precisionOf(typeParams) {\n\tconst precision = typeParams?.[\"precision\"];\n\treturn typeof precision === \"number\" ? precision : 6;\n}\nfunction base64ToHex(base64) {\n\tif (!/^[A-Za-z0-9+/]*={0,2}$/.test(base64) || base64.length % 4 !== 0) return void 0;\n\treturn `\\\\x${Buffer.from(base64, \"base64\").toString(\"hex\")}`;\n}\n/**\n* What the Postgres target supplies to the Prisma 7 interpreter. A `Bytes` or\n* `DateTime` default is read through the tag its column type's authoring entry\n* writes, as the current schema language reads it: a `Bytes` default's base64\n* as the hex body of `bytea`, and a `DateTime` default as the body of the date\n* or time tag that keeps what the written value means on the column.\n*/\nconst prisma7PostgresBinding = {\n\ttarget: postgresTargetDescriptorMeta,\n\tcreateNamespace: postgresCreateNamespace,\n\tproviders: [\"postgresql\", \"postgres\"],\n\ttypeMap: prisma7PostgresTypeMap,\n\tnativeEnum: {\n\t\tentityKind: \"native_enum\",\n\t\ttypeConstructor: [\"pg\", \"enum\"]\n\t},\n\tindexTypes: {\n\t\tBTree: \"btree\",\n\t\tHash: \"hash\",\n\t\tGin: \"gin\",\n\t\tGist: \"gist\",\n\t\tSpGist: \"spgist\",\n\t\tBrin: \"brin\"\n\t},\n\t/** `NAMEDATALEN - 1`. */\n\tidentifierMaxBytes: 63,\n\tdefaultConstraintNames: {\n\t\tprimaryKey: defaultPrimaryKeyName,\n\t\tforeignKey: defaultForeignKeyName\n\t},\n\tjunctionRelationFieldNames,\n\tliteralDefaultForm: ({ dataType, typeParams }) => {\n\t\tif (dataType === pgJson.id || dataType === pgJsonb.id) return { kind: \"json\" };\n\t\tconst tag = tagOf(dataType);\n\t\tif (tag === void 0) return void 0;\n\t\tif (dataType === pgBytea.id) return {\n\t\t\tkind: \"tag\",\n\t\t\ttag,\n\t\t\tbody: base64ToHex\n\t\t};\n\t\tif (!DATE_TIME_TYPES.has(dataType)) return void 0;\n\t\treturn {\n\t\t\tkind: \"tag\",\n\t\t\ttag,\n\t\t\tbody: (text) => prisma7TemporalTagBody(text, dataType),\n\t\t\tfinerThanColumn: (text) => {\n\t\t\t\tconst heldDigits = precisionOf(typeParams);\n\t\t\t\tconst stored = prisma7TemporalStored(text, dataType, heldDigits);\n\t\t\t\treturn stored === void 0 ? void 0 : {\n\t\t\t\t\theldDigits,\n\t\t\t\t\tstored\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t}\n};\n//#endregion\nexport { prisma7PostgresBinding };\n\n//# sourceMappingURL=prisma7-binding.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,WAAW;;;;AAIjB,SAAS,uBAAuB,MAAM,UAAU;CAC/C,MAAM,QAAQ,SAAS,KAAK,IAAI;CAChC,IAAI,UAAU,MAAM,OAAO,KAAK;CAChC,MAAM,GAAG,OAAO,IAAI,QAAQ,IAAI,OAAO,MAAM;CAC7C,MAAM,SAAS,KAAK,YAAY;CAChC,QAAQ,UAAR;EACC,KAAK,OAAO,IAAI,OAAO;EACvB,KAAK,OAAO,IAAI,OAAO;EACvB,KAAK,SAAS,IAAI,OAAO,GAAG,QAAQ;EACpC,KAAK,YAAY,IAAI,OAAO,GAAG,KAAK,GAAG;EACvC,KAAK,cAAc,IAAI,OAAO,GAAG,KAAK,GAAG,QAAQ;EACjD,SAAS;CACV;AACD;AACA,MAAM,0BAA0B;AAChC,MAAM,oBAAoB,KAAK,IAAI,KAAK,GAAG,CAAC;;;;AAI5C,SAAS,sBAAsB,MAAM,UAAU,WAAW;CACzD,MAAM,QAAQ,SAAS,KAAK,IAAI;CAChC,IAAI,UAAU,QAAQ,aAAa,OAAO,IAAI,OAAO,KAAK;CAC1D,MAAM,GAAG,OAAO,IAAI,QAAQ,IAAI,OAAO,MAAM;CAC7C,MAAM,CAAC,MAAM,IAAI,WAAW,MAAM,MAAM,MAAM,GAAG;CACjD,IAAI,SAAS,UAAU,WAAW,OAAO,KAAK;CAC9C,M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AAO;EAC7E,MAAM,MAAM,MAAM,QAAQ;EAC1B,IAAI,QAAQ,KAAK,GAAG,OAAO,KAAK;EAChC,IAAI,aAAa,QAAQ,IAAI,OAAO;GACnC,MAAM;GACN;GACA,MAAM;EACP;EACA,IAAI,CAAC,gBAAgB,IAAI,QAAQ,GAAG,OAAO,KAAK;EAChD,OAAO;GACN,MAAM;GACN;GACA,OAAO,SAAS,uBAAuB,MAAM,QAAQ;GACrD,kBAAkB,SAAS;IAC1B,MAAM,aAAa,YAAY,UAAU;IACzC,MAAM,SAAS,sBAAsB,MAAM,UAAU,UAAU;IAC/D,OAAO,WAAW,KAAK,IAAI,KAAK,IAAI;KACnC;KACA;IACD;GACD;EACD;CACD;AACD"}
@@ -1,6 +1,6 @@
1
1
  import "./date-time-now-generators-CMkXVbMG-CYwplAuf.mjs";
2
2
  import "./full-text-collection-method-BIqQH9XN-CkW2x4u2.mjs";
3
- import "./postgres-contract-view-2OP5JnXl-D2fpy4-8.mjs";
3
+ import "./postgres-contract-view-BFzIDwwN-pJ6gJGOT.mjs";
4
4
  import { AnyCodecDescriptor } from "@prisma/orm-framework/components/codec";
5
5
  import { AnyEntityKindDescriptor, Namespace } from "@prisma/orm-framework/components/ir";
6
6
  import { SqlNamespaceInput, SqlStorage } from "@prisma/orm-family-sql/contract/types";
@@ -37,4 +37,4 @@ declare const postgresRuntimeTargetDescriptor: RuntimeTargetDescriptor<'sql', 'p
37
37
  };
38
38
  //#endregion
39
39
  export { postgresRuntimeTargetDescriptor as i, PostgresListDecoder as n, PostgresRuntimeTargetInstance as r, PostgresContractSerializer as t };
40
- //# sourceMappingURL=runtime-1ioqDrqf.d.mts.map
40
+ //# sourceMappingURL=runtime-BeTyqpCH.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-1ioqDrqf.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/runtime.d.mts"],"mappings":";;;;;;;;;;;;;;;cAec,mCAAmC,0BAA0B,SAAS;EAClF,qBAAqB;EACrB,YAAY,gCAAgC;YAClC,yBAAyB,cAAc,KAAK,0BAA0B,YAAY;EAC5F,kBAAkB,UAAU,SAAS,cAAc;;;;UAI3C,sCAAsC;KAC3C,uBAAuB,oBAAoB,gBAAgB,mBAAmB,qBAAqB;;;;;;;cAO1F,iCAAiC,2CAA2C;WAC/E,uBAAuB;WACvB,mBAAmB;WACnB,uBAAuB;WACvB,kCAAkC"}
1
+ {"version":3,"file":"runtime-BeTyqpCH.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/runtime.d.mts"],"mappings":";;;;;;;;;;;;;;;cAec,mCAAmC,0BAA0B,SAAS;EAClF,qBAAqB;EACrB,YAAY,gCAAgC;YAClC,yBAAyB,cAAc,KAAK,0BAA0B,YAAY;EAC5F,kBAAkB,UAAU,SAAS,cAAc;;;;UAI3C,sCAAsC;KAC3C,uBAAuB,oBAAoB,gBAAgB,mBAAmB,qBAAqB;;;;;;;cAO1F,iCAAiC,2CAA2C;WAC/E,uBAAuB;WACvB,mBAAmB;WACnB,uBAAuB;WACvB,kCAAkC"}
package/dist/target.d.mts CHANGED
@@ -24,38 +24,38 @@ import "./codec-types-DoxsMXp7.mjs";
24
24
  import { A as noNullValuesAst, B as timestamptz, C as createTable, D as int4, E as indexExistsAst, F as tableExistsAst, H as toRegclass, I as tableIsEmptyAst, L as tablePrimaryKeyAst, M as rlsEnabledAst, N as rlsPolicyExistsAst, O as int8, P as sequenceNameAvailableAst, R as text, S as createSchema, T as extensionExistsAst, V as timestamptzJsDate, _ as columnDefaultSequenceAst, a as IndexExistsCheckBuilder, b as columnTypeAst, c as TableExistsCheckBuilder, d as addConstraintAction, f as alterColumnTypeAction, g as columnDefaultAst, h as buildSignMarkerBootstrapQueries, i as ExtensionExistsCheckBuilder, j as pgTable, k as jsonb, l as TablePrimaryKeyCheckBuilder, m as buildControlTableBootstrapQueries, n as ColumnExistsCheckBuilder, o as RlsEnabledCheckBuilder, p as alterTable, r as ConstraintExistsCheckBuilder, s as RlsPolicyExistsCheckBuilder, t as ColumnDefaultCheckBuilder, u as addColumnAction, v as columnExistsAst, w as dropDefaultAction, x as constraintExistsAst, y as columnNullabilityAst, z as textArray } from "./contract-free-D1JEZVpQ.mjs";
25
25
  import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrRO-_xPQVPF0.mjs";
26
26
  import { n as postgresNowGenerators, t as postgresNowGeneratorControlDescriptors } from "./date-time-now-generators-CMkXVbMG-CYwplAuf.mjs";
27
- import { n as postgresPslTypeConstructors, r as postgresScalarAuthoringTypes, t as postgresNativeAuthoringTypes } from "./control-DmWVxA23.mjs";
27
+ import { n as postgresPslTypeConstructors, r as postgresScalarAuthoringTypes, t as postgresNativeAuthoringTypes } from "./control-BRE_BcLl.mjs";
28
28
  import { i as dataTransform, r as DataTransformOptions, t as DataTransformClosure } from "./data-transform-nGy9rz87-CEOXAj91.mjs";
29
29
  import "./data-transform-C-3UJ3hC.mjs";
30
30
  import { A as pgTimestamptz, B as qualifiedEnumName, C as pgPrecisionParams, D as pgTimeStoredText, E as pgTime, F as pgUuid, I as pgVarbit, L as pgVarchar, M as pgTimetz, N as pgTimetzStoredText, O as pgTimestamp, P as pgTsquery, R as postgresDataTypeEntries, S as pgNumericParams, T as pgTextArray, _ as pgInt8, a as pgBytea, b as pgJsonb, c as pgDate, d as pgEnumParams, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, j as pgTimestamptzStoredText, k as pgTimestampStoredText, l as pgDateStoredText, m as pgInet, n as pgBit, o as pgChar, p as pgFloat8, r as pgBitLengthParams, s as pgCharacterLengthParams, t as createPostgresBuiltinDataTypeLookup, u as pgEnum, v as pgInterval, w as pgText, x as pgNumeric, y as pgJson, z as postgresDataTypes } from "./data-types-BTUMiCZS.mjs";
31
31
  import { n as postgresResolveDefault, r as readPostgresDefault, t as PostgresReportedDefault } from "./default-normalizer-P-u2VRBf.mjs";
32
- import { t as buildPostgresPlanDiff } from "./diff-database-schema-BGcRo8FM.mjs";
32
+ import { t as buildPostgresPlanDiff } from "./diff-database-schema-Diw5m51r.mjs";
33
33
  import { n as postgresError, t as errorPostgresMigrationStackMissing } from "./errors-BP-2V2_C.mjs";
34
34
  import { _ as plaintoTsquery, a as FullTextIndexReference, c as QueryOperationTypes, d as TsqueryArgument, f as TsqueryExpression, g as phrasetoTsquery, h as fullTextDocument, i as FullTextHeadlineOptions, l as QueryOperationTypesForCodecs, m as TsqueryParserOptions, n as FullTextDocumentColumn, o as FullTextMatchesOptions, p as TsqueryParser, r as FullTextDocumentGroups, s as FullTextRankOptions, t as FullTextDocument, u as TextArgument, v as toTsquery, y as websearchToTsquery } from "./operation-types-CK6URXeD-BsCK-mcK.mjs";
35
35
  import { n as PostgresTsqueryArgument, t as PostgresFullTextMethods } from "./full-text-collection-method-BIqQH9XN-CkW2x4u2.mjs";
36
36
  import { n as tsquery, t as TsqueryTag } from "./full-text-OAJrtCtv.mjs";
37
37
  import { t as postgresCodecTraitsOf } from "./full-text-index-authoring-Ca6bWXyG.mjs";
38
- import { i as stackDataTypes, n as alterTypeCheck, r as qualifyTableName, t as ColumnTypeCheck } from "./planner-sql-checks-CxlrM4J2-VqQpmMwn.mjs";
39
- import { A as RenameColumnCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as SetDefaultCall, I as SetNotNullCall, M as RenameIndexCall, N as RenamePostgresRlsPolicyCall, P as RenameTableCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, a as AddNativeEnumValueCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddForeignKeyCall, j as RenameConstraintCall, k as RawSqlCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddPrimaryKeyCall, p as CreatePostgresRlsPolicyCall, r as AddColumnWithTemporaryDefaultCall, s as AddRequiredColumnToEmptyTableCall, t as AddCheckConstraintCall, u as CreateExtensionCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from "./op-factory-call-kdPO0kgG-DV8hS6qA.mjs";
40
- import { n as planIssues, t as coalesceSubtreeIssues } from "./issue-planner-DrWlNiAf.mjs";
38
+ import { i as stackDataTypes, n as alterTypeCheck, r as qualifyTableName, t as ColumnTypeCheck } from "./planner-sql-checks-CWOmxltY-CoWF8Eq0.mjs";
39
+ import { A as RenameColumnCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as SetDefaultCall, I as SetNotNullCall, M as RenameIndexCall, N as RenamePostgresRlsPolicyCall, P as RenameTableCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, a as AddNativeEnumValueCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddForeignKeyCall, j as RenameConstraintCall, k as RawSqlCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddPrimaryKeyCall, p as CreatePostgresRlsPolicyCall, r as AddColumnWithTemporaryDefaultCall, s as AddRequiredColumnToEmptyTableCall, t as AddCheckConstraintCall, u as CreateExtensionCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from "./op-factory-call-DILl2zlf-BakJezLJ.mjs";
40
+ import { n as planIssues, t as coalesceSubtreeIssues } from "./issue-planner-BT5rqDNx.mjs";
41
41
  import { n as MARKER_LOCK_SQL, t as MARKER_LOCK_KEY } from "./marker-lock-BGBqXaQ4.mjs";
42
- import { t as PostgresContractView } from "./postgres-contract-view-2OP5JnXl-D2fpy4-8.mjs";
43
- import { t as PostgresMigration } from "./postgres-migration-CRLV93uK-ThJW3tFf.mjs";
44
- import { a as fn, c as placeholder, d as sql, f as unique, i as createExtension, l as primaryKey, n as checkExpression, o as foreignKey, r as col, s as lit, t as MigrationCLI, u as rawSql } from "./migration-DO23kNde.mjs";
42
+ import { t as PostgresContractView } from "./postgres-contract-view-BFzIDwwN-pJ6gJGOT.mjs";
43
+ import { t as PostgresMigration } from "./postgres-migration-HW4fCGNb-CLkytGtG.mjs";
44
+ import { a as fn, c as placeholder, d as sql, f as unique, i as createExtension, l as primaryKey, n as checkExpression, o as foreignKey, r as col, s as lit, t as MigrationCLI, u as rawSql } from "./migration-BWZskUHP.mjs";
45
45
  import { n as IntrospectedTypeText, r as introspectedTypeText, t as CatalogColumnType } from "./native-type-normalizer-DFE5L3YY.mjs";
46
- import "./op-factory-call-CijzNDaJ.mjs";
46
+ import "./op-factory-call-CEyI7a78.mjs";
47
47
  import "./operation-types-ECV4mkfb.mjs";
48
- import "./pack-CcQNl-gj.mjs";
49
- import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-B6NsNaam-BmvloI2L.mjs";
50
- import { n as createPostgresMigrationPlanner, t as contractToPostgresDatabaseSchemaNode } from "./planner-B_MRApHM.mjs";
48
+ import "./pack-C-rgdVoH.mjs";
49
+ import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-C8uYGzUj-DRmZY4_u.mjs";
50
+ import { n as createPostgresMigrationPlanner, t as contractToPostgresDatabaseSchemaNode } from "./planner-Bo92I5YX.mjs";
51
51
  import { t as buildColumnTypeSql } from "./planner-ddl-builders-DbG9_uAk.mjs";
52
52
  import { n as resolveIdentityValue, t as buildBuiltinIdentityValue } from "./planner-identity-values-B-NAiN7I.mjs";
53
- import "./planner-produced-postgres-migration-BW8GJFjS.mjs";
53
+ import "./planner-produced-postgres-migration-DaDlRTID.mjs";
54
54
  import { i as hasUniqueConstraint, n as hasForeignKey, r as hasIndex, t as buildSchemaLookupMap } from "./planner-schema-lookup-C4DHAddq.mjs";
55
- import "./planner-sql-checks-CB4oLSuZ.mjs";
56
- import { t as prisma7PostgresBinding } from "./prisma7-binding-C5RLV6kJ.mjs";
55
+ import "./planner-sql-checks-Cp3fcCNc.mjs";
56
+ import { t as prisma7PostgresBinding } from "./prisma7-binding-BXyT6bKE.mjs";
57
57
  import { t as renderOps } from "./render-ops-DPwhZt2W.mjs";
58
58
  import { t as renderCallsToTypeScript } from "./render-typescript-6sCFvMBh.mjs";
59
- import { n as PostgresListDecoder, r as PostgresRuntimeTargetInstance, t as PostgresContractSerializer } from "./runtime-1ioqDrqf.mjs";
59
+ import { n as PostgresListDecoder, r as PostgresRuntimeTargetInstance, t as PostgresContractSerializer } from "./runtime-BeTyqpCH.mjs";
60
60
  import { t as resolveDdlSchemaForNamespaceStorage } from "./schema-ir-annotations-DuuYh0gl.mjs";
61
61
  export { type AdaptedPostgresCodecDescriptor, AddCheckConstraintCall, AddColumnAction, AddColumnCall, AddColumnWithTemporaryDefaultCall, AddConstraintAction, AddForeignKeyCall, AddNativeEnumValueCall, AddPrimaryKeyCall, AddRequiredColumnToEmptyTableCall, AddUniqueCall, AlterColumnTypeAction, AlterColumnTypeCall, type AlterTableActionVisitor, type AnyAlterTableAction, type AnyPostgresCodecDescriptor, type AnyPostgresDdlNode, Bit, type CatalogColumnType, Char, CodecTypes, type ColumnDefaultCheckBuilder, type ColumnExistsCheckBuilder, type ColumnTypeCheck, type ConstraintExistsCheckBuilder, type ContentHashParts, CreateExtensionCall, CreateIndexCall, type CreateIndexElements, CreateNativeEnumTypeCall, CreatePostgresRlsPolicyCall, CreateSchemaCall, CreateTableCall, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE, DataTransformCall, type DataTransformClosure, type DataTransformOptions, type DdlIndexElements, DisableRowLevelSecurityCall, DropCheckConstraintCall, DropColumnCall, DropConstraintCall, DropDefaultAction, DropDefaultCall, DropIndexCall, DropNativeEnumTypeCall, DropNotNullCall, DropPostgresRlsPolicyCall, DropTableCall, EnableRowLevelSecurityCall, type ExtensionExistsCheckBuilder, FULL_TEXT_INDEX_TYPE, type FullTextColumnCodecs, FullTextDocument, type FullTextDocumentColumn, type FullTextDocumentGroups, type FullTextFieldsInput, type FullTextHeadlineOptions, type FullTextIndexCandidate, type FullTextIndexDefinition, type FullTextIndexProblem, type FullTextIndexReference, type FullTextMatchesOptions, type FullTextRankOptions, type FullTextSearchLanguage, type IndexExistsCheckBuilder, Interval, type IntrospectedTypeText, type JsonValue$1 as JsonValue, MARKER_LOCK_KEY, MARKER_LOCK_SQL, PostgresMigration as Migration, MigrationCLI, Numeric, PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_DATE_STRING_CODEC_ID, PG_DATE_TEMPORAL_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INT8_NUMBER_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_DATE_CODEC_ID, PG_TIMESTAMPTZ_STRING_CODEC_ID, PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, PG_TIMESTAMP_STRING_CODEC_ID, PG_TIMESTAMP_TEMPORAL_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_STRING_CODEC_ID, PG_TIME_TEMPORAL_CODEC_ID, PG_TSQUERY_CODEC_ID, PG_UNBOUNDED_INT_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, POLICY_COMMAND_SQL, POLICY_OPERATION_PREDICATES, ParameterizedOutputTypesForTypeParams, type PgBitDescriptor, type PgBoolDescriptor, type PgCharDescriptor, type PgEnumCodec, type PgEnumDescriptor, type PgEnumParams, type PgFloat4Descriptor, type PgFloat8Descriptor, type PgFloatDescriptor, type PgInetDescriptor, type PgInt2Descriptor, type PgInt4Descriptor, type PgInt8Descriptor, type PgInt8NumberDescriptor, type PgIntDescriptor, type PgInterval, type PgIntervalDescriptor, type PgJsonDescriptor, type PgJsonbDescriptor, type PgNumericDescriptor, type PgTextDescriptor, PgTimestamptzDateCodec, PgTimestamptzDateDescriptor, type PgTimetzDescriptor, type PgUnboundedIntDescriptor, type PgUuidDescriptor, type PgVarbitDescriptor, type PgVarcharDescriptor, PostgresAlterIndexRename, PostgresAlterPolicyRename, PostgresAlterTable, type PostgresCheckExpressionCandidate, type PostgresCheckExpressionInput, type PostgresCheckKind, PostgresCodecDescriptor, type PostgresCodecDescriptorRegistry, type PostgresCodecOptions, type PostgresCodecRegistry, type PostgresColumnDefault, type PostgresContract, PostgresContractSerializer, PostgresContractView, PostgresCreateIndex, PostgresCreatePolicy, PostgresCreateSchema, PostgresCreateTable, PostgresCreateType, PostgresDatabaseSchemaNode, type PostgresDatabaseSchemaNodeInput, PostgresDdlNode, type PostgresDdlVisitor, PostgresDisableRowLevelSecurity, PostgresDropIndex, PostgresDropPolicy, PostgresDropType, type PostgresFullTextMethods, PostgresListDecoder, PostgresNamespaceSchemaNode, type PostgresNamespaceSchemaNodeInput, PostgresNativeEnum, type PostgresNativeEnumInput, PostgresNativeEnumSchemaNode, type PostgresNativeEnumSchemaNodeInput, type PostgresPlanTargetDetails, PostgresPolicySchemaNode, type PostgresPolicySchemaNodeInput, type PostgresReportedDefault, PostgresRlsEnablement, type PostgresRlsEnablementInput, PostgresRlsPolicy, type PostgresRlsPolicyInput, PostgresRole, type PostgresRoleInput, PostgresRoleSchemaNode, type PostgresRoleSchemaNodeInput, PostgresRuntimeTargetInstance, PostgresSchema, PostgresSchemaNodeKind, PostgresTableSchemaNode, type PostgresTableSchemaNodeInput, PostgresTableSource, type PostgresTsqueryArgument, PostgresUnboundSchema, type QueryOperationTypes, type QueryOperationTypesForCodecs, RawSqlCall, RenameColumnCall, RenameConstraintCall, RenameIndexCall, RenamePostgresRlsPolicyCall, RenameTableCall, type RenderedRlsPolicyLiteral, type RlsEnabledCheckBuilder, type RlsPolicyExistsCheckBuilder, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, type SerializedRlsPolicy, SetDefaultCall, SetNotNullCall, type TableExistsCheckBuilder, type TablePrimaryKeyCheckBuilder, type TextArgument, Time, TimeString, Timestamp, TimestampString, Timestamptz, TimestamptzString, Timetz, type TsqueryArgument, type TsqueryExpression, type TsqueryParser, type TsqueryParserOptions, type TsqueryTag, TypeScriptRenderablePostgresMigration, VarBit, Varchar, addColumnAction, addConstraintAction, alterColumnTypeAction, alterTable, alterTypeCheck, assemblePostgresCodecRegistry, assemblePostgresCodecRegistryWithBuiltins, buildBuiltinIdentityValue, buildColumnTypeSql, buildControlTableBootstrapQueries, buildPostgresCodecDescriptorRegistry, buildPostgresPlanDiff, buildSchemaLookupMap, buildSignMarkerBootstrapQueries, checkExpression, coalesceSubtreeIssues, col, columnDefaultAst, columnDefaultSequenceAst, columnExistsAst, columnNullabilityAst, columnTypeAst, computeContentHash, constraintExistsAst, contractToPostgresDatabaseSchemaNode, createExtension, createPostgresBuiltinCodecLookup, createPostgresBuiltinDataTypeLookup, createPostgresCodecRegistryWithBuiltins, createPostgresMigrationPlanner, createSchema, createTable, dataTransform, decodePostgresListText, definePostgresCodecs, describeFullTextIndexProblem, dropDefaultAction, errorPostgresMigrationStackMissing, escapeLiteral, extensionExistsAst, fn, foreignKey, fullTextDocument, fullTextIndexProblems, hasForeignKey, hasIndex, hasUniqueConstraint, indexExistsAst, int4, int8, introspectedTypeText, isPgEnumParams, isPostgresCodecDescriptor, isPostgresSchema, jsonb, lit, noNullValuesAst, parsePostgresListText, pgBit, pgBitColumn, pgBitLengthParams, pgBool, pgBoolColumn, pgBytea, pgChar, pgCharColumn, pgCharacterLengthParams, pgDate, pgDateStoredText, pgEnum, pgEnumDescriptor, pgEnumParams, pgFloat4, pgFloat4Column, pgFloat8, pgFloat8Column, pgFloatColumn, pgInet, pgInetColumn, pgInt2, pgInt2Column, pgInt4, pgInt4Column, pgInt8, pgInt8Column, pgInt8NumberColumn, pgIntColumn, pgInterval, pgIntervalColumn, pgJson, pgJsonColumn, pgJsonb, pgJsonbColumn, pgNumeric, pgNumericColumn, pgNumericParams, pgPrecisionParams, pgTable, pgText, pgTextArray, pgTextColumn, pgTime, pgTimeStoredText, pgTimestamp, pgTimestampStoredText, pgTimestamptz, pgTimestamptzDateColumn, pgTimestamptzDateDescriptor, pgTimestamptzStoredText, pgTimetz, pgTimetzColumn, pgTimetzStoredText, pgTsquery, pgUnboundedIntColumn, pgUuid, pgUuidColumn, pgVarbit, pgVarbitColumn, pgVarchar, pgVarcharColumn, phrasetoTsquery, placeholder, plaintoTsquery, planIssues, policyInputFromSerialized, policyRoleList, postgresAggregateDescriptors, postgresCodec, postgresCodecDescriptorRegistry, postgresCodecRegistry, postgresCodecTraitsOf, postgresCreateNamespace, postgresDataTypeEntries, postgresDataTypes, postgresError, postgresNativeAuthoringTypes, postgresNowGeneratorControlDescriptors, postgresNowGenerators, postgresPslTypeConstructors, postgresRenderCheckExpressions, postgresResolveDefault, postgresScalarAuthoringTypes, primaryKey, prisma7PostgresBinding, qualifiedEnumName, qualifyName, qualifyTableName, quoteIdentifier, quoteQualifiedName, rawSql, readPostgresDefault, renderCallsToTypeScript, renderFullTextIndexDocument, renderOps, resolveDdlSchemaForNamespaceStorage, resolveIdentityValue, rlsEnabledAst, rlsPolicyExistsAst, sequenceNameAvailableAst, sql, stackDataTypes, tableExistsAst, tableIsEmptyAst, tablePrimaryKeyAst, text, textArray, timestamptz, timestamptzJsDate, toRegclass, toTsquery, tsquery, unique, validateEnumValueLength, websearchToTsquery, weightGroupsOf };
package/dist/target.mjs CHANGED
@@ -14,7 +14,7 @@ import { B as tablePrimaryKeyAst, E as extensionExistsAst, F as rlsPolicyExistsA
14
14
  import { a as jsonb, c as textArray, i as int8, l as timestamptz, n as buildSignMarkerBootstrapQueries, o as pgTable, r as int4, s as text, t as buildControlTableBootstrapQueries, u as timestamptzJsDate } from "./contract-free-Kwm74Hg9.mjs";
15
15
  import { t as postgresCodecTraitsOf } from "./postgres-codec-traits-D3muwxMS-OwnBG0Mz.mjs";
16
16
  import { i as policyRoleList, n as POLICY_OPERATION_PREDICATES, r as computeContentHash, t as POLICY_COMMAND_SQL } from "./canonicalize-RdxoUHao-DK_M6HU-.mjs";
17
- import { c as postgresNowGeneratorControlDescriptors, u as postgresNowGenerators } from "./authoring-DhyLHFHA-pB4NuFxh.mjs";
17
+ import { c as postgresNowGeneratorControlDescriptors, u as postgresNowGenerators } from "./authoring-DtjMn8TZ-sv84Cdw_.mjs";
18
18
  import { t as postgresRenderCheckExpressions } from "./check-expressions-7uCCP01t-WtUqfqkP.mjs";
19
19
  import { t as postgresDataTypeEntries } from "./data-type-entries-CqnLlCkK-uN0WjREd.mjs";
20
20
  import { n as PostgresSchemaNodeKind, r as PostgresTableSchemaNode, t as PostgresNativeEnumSchemaNode } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
@@ -28,19 +28,19 @@ import { t as buildColumnTypeSql } from "./planner-ddl-builders-B8PhQZ2T-D1KBJxc
28
28
  import { n as resolveIdentityValue, t as buildBuiltinIdentityValue } from "./planner-identity-values-BnxSwhlS-CzyBeK0a.mjs";
29
29
  import { a as planIssues, t as coalesceSubtreeIssues } from "./control-policy-BHjZnca1-DUWuKmdJ.mjs";
30
30
  import { n as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from "./diff-database-schema-DyCIRT80-C1zMCmRx.mjs";
31
- import { n as PostgresContractView, t as PostgresContractSerializer } from "./postgres-contract-view-B-bLZB7o-zpuamDXT.mjs";
31
+ import { n as PostgresContractView, t as PostgresContractSerializer } from "./postgres-contract-view-Ctg2ire_-smoqnU-u.mjs";
32
32
  import { t as dataTransform } from "./data-transform-CtHnNYhF-r19375h3.mjs";
33
- import { t as PostgresMigration } from "./postgres-migration-BbXm1l5I-DDy8IgYB.mjs";
33
+ import { t as PostgresMigration } from "./postgres-migration-BdFXT6xg-BPApPGX9.mjs";
34
34
  import { t as renderOps } from "./render-ops-MeXLgeOa-nL4PdJzz.mjs";
35
35
  import { t as renderCallsToTypeScript } from "./render-typescript-Dqp1Spgn-B128r1qw.mjs";
36
- import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-F9joIngl-C04yYu-i.mjs";
37
- import { t as createPostgresMigrationPlanner } from "./planner-C1czBCmI-C-x1Ip-_.mjs";
36
+ import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-Y7bMLPPc-tZeIl3hP.mjs";
37
+ import { t as createPostgresMigrationPlanner } from "./planner-BIOXTf-E-CFs_l_0M.mjs";
38
38
  import { n as MARKER_LOCK_SQL, t as MARKER_LOCK_KEY } from "./marker-lock-DFc1Tfv5-QMJSzMIa.mjs";
39
- import { _ as postgresNativeAuthoringTypes, v as postgresPslTypeConstructors, y as postgresScalarAuthoringTypes } from "./type-constructors-CrNUrtwZ-dmWF-mtV.mjs";
39
+ import { _ as postgresNativeAuthoringTypes, v as postgresPslTypeConstructors, y as postgresScalarAuthoringTypes } from "./type-constructors-BEZJxWcZ-Co2GJw1M.mjs";
40
40
  import { c as toTsquery, l as websearchToTsquery, n as fullTextDocument, o as phrasetoTsquery, s as plaintoTsquery, t as FullTextDocument } from "./full-text-parsers-CrMjTR2n-CHDNR_vE.mjs";
41
41
  import { t as tsquery } from "./full-text-CSMAiOYz.mjs";
42
42
  import { a as foreignKey, c as primaryKey, d as unique, i as fn, l as rawSql, n as checkExpression, o as lit, r as col, s as placeholder, t as MigrationCLI, u as sql } from "./migration-CbOh59ZJ.mjs";
43
43
  import { t as introspectedTypeText } from "./native-type-normalizer-a1XJSlk6.mjs";
44
44
  import { i as hasUniqueConstraint, n as hasForeignKey, r as hasIndex, t as buildSchemaLookupMap } from "./planner-schema-lookup-CdgWer9s.mjs";
45
- import { t as prisma7PostgresBinding } from "./prisma7-binding-CzO7rkpS.mjs";
45
+ import { t as prisma7PostgresBinding } from "./prisma7-binding-DWeHpJrg.mjs";
46
46
  export { AddCheckConstraintCall, AddColumnAction, AddColumnCall, AddColumnWithTemporaryDefaultCall, AddConstraintAction, AddForeignKeyCall, AddNativeEnumValueCall, AddPrimaryKeyCall, AddRequiredColumnToEmptyTableCall, AddUniqueCall, AlterColumnTypeAction, AlterColumnTypeCall, CreateExtensionCall, CreateIndexCall, CreateNativeEnumTypeCall, CreatePostgresRlsPolicyCall, CreateSchemaCall, CreateTableCall, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE, DataTransformCall, DisableRowLevelSecurityCall, DropCheckConstraintCall, DropColumnCall, DropConstraintCall, DropDefaultAction, DropDefaultCall, DropIndexCall, DropNativeEnumTypeCall, DropNotNullCall, DropPostgresRlsPolicyCall, DropTableCall, EnableRowLevelSecurityCall, FULL_TEXT_INDEX_TYPE, FullTextDocument, MARKER_LOCK_KEY, MARKER_LOCK_SQL, PostgresMigration as Migration, MigrationCLI, PG_BIT_CODEC_ID, PG_BOOL_CODEC_ID, PG_BYTEA_CODEC_ID, PG_CHAR_CODEC_ID, PG_DATE_STRING_CODEC_ID, PG_DATE_TEMPORAL_CODEC_ID, PG_ENUM_CODEC_ID, PG_FLOAT4_CODEC_ID, PG_FLOAT8_CODEC_ID, PG_FLOAT_CODEC_ID, PG_INET_CODEC_ID, PG_INT2_CODEC_ID, PG_INT4_CODEC_ID, PG_INT8_CODEC_ID, PG_INT8_NUMBER_CODEC_ID, PG_INTERVAL_CODEC_ID, PG_INT_CODEC_ID, PG_JSONB_CODEC_ID, PG_JSON_CODEC_ID, PG_NUMERIC_CODEC_ID, PG_TEXT_ARRAY_CODEC_ID, PG_TEXT_CODEC_ID, PG_TIMESTAMPTZ_DATE_CODEC_ID, PG_TIMESTAMPTZ_STRING_CODEC_ID, PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, PG_TIMESTAMP_STRING_CODEC_ID, PG_TIMESTAMP_TEMPORAL_CODEC_ID, PG_TIMETZ_CODEC_ID, PG_TIME_STRING_CODEC_ID, PG_TIME_TEMPORAL_CODEC_ID, PG_TSQUERY_CODEC_ID, PG_UNBOUNDED_INT_CODEC_ID, PG_UUID_CODEC_ID, PG_VARBIT_CODEC_ID, PG_VARCHAR_CODEC_ID, POLICY_COMMAND_SQL, POLICY_OPERATION_PREDICATES, PgTimestamptzDateCodec, PgTimestamptzDateDescriptor, PostgresAlterIndexRename, PostgresAlterPolicyRename, PostgresAlterTable, PostgresCodecDescriptor, PostgresContractSerializer, PostgresContractView, PostgresCreateIndex, PostgresCreatePolicy, PostgresCreateSchema, PostgresCreateTable, PostgresCreateType, PostgresDatabaseSchemaNode, PostgresDdlNode, PostgresDisableRowLevelSecurity, PostgresDropIndex, PostgresDropPolicy, PostgresDropType, PostgresNamespaceSchemaNode, PostgresNativeEnum, PostgresNativeEnumSchemaNode, PostgresPolicySchemaNode, PostgresRlsEnablement, PostgresRlsPolicy, PostgresRole, PostgresRoleSchemaNode, PostgresSchema, PostgresSchemaNodeKind, PostgresTableSchemaNode, PostgresTableSource, PostgresUnboundSchema, RawSqlCall, RenameColumnCall, RenameConstraintCall, RenameIndexCall, RenamePostgresRlsPolicyCall, RenameTableCall, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SetDefaultCall, SetNotNullCall, TypeScriptRenderablePostgresMigration, addColumnAction, addConstraintAction, alterColumnTypeAction, alterTable, alterTypeCheck, assemblePostgresCodecRegistry, assemblePostgresCodecRegistryWithBuiltins, buildBuiltinIdentityValue, buildColumnTypeSql, buildControlTableBootstrapQueries, buildPostgresCodecDescriptorRegistry, buildPostgresPlanDiff, buildSchemaLookupMap, buildSignMarkerBootstrapQueries, checkExpression, coalesceSubtreeIssues, col, columnDefaultAst, columnDefaultSequenceAst, columnExistsAst, columnNullabilityAst, columnTypeAst, computeContentHash, constraintExistsAst, contractToPostgresDatabaseSchemaNode, createExtension, createPostgresBuiltinCodecLookup, createPostgresBuiltinDataTypeLookup, createPostgresCodecRegistryWithBuiltins, createPostgresMigrationPlanner, createSchema, createTable, dataTransform, decodePostgresListText, definePostgresCodecs, describeFullTextIndexProblem, dropDefaultAction, errorPostgresMigrationStackMissing, escapeLiteral, extensionExistsAst, fn, foreignKey, fullTextDocument, fullTextIndexProblems, hasForeignKey, hasIndex, hasUniqueConstraint, indexExistsAst, int4, int8, introspectedTypeText, isPgEnumParams, isPostgresCodecDescriptor, isPostgresSchema, jsonb, lit, noNullValuesAst, parsePostgresListText, pgBit, pgBitColumn, pgBitLengthParams, pgBool, pgBoolColumn, pgBytea, pgChar, pgCharColumn, pgCharacterLengthParams, pgDate, pgDateStoredText, pgEnum, pgEnumDescriptor, pgEnumParams, pgFloat4, pgFloat4Column, pgFloat8, pgFloat8Column, pgFloatColumn, pgInet, pgInetColumn, pgInt2, pgInt2Column, pgInt4, pgInt4Column, pgInt8, pgInt8Column, pgInt8NumberColumn, pgIntColumn, pgInterval, pgIntervalColumn, pgJson, pgJsonColumn, pgJsonb, pgJsonbColumn, pgNumeric, pgNumericColumn, pgNumericParams, pgPrecisionParams, pgTable, pgText, pgTextArray, pgTextColumn, pgTime, pgTimeStoredText, pgTimestamp, pgTimestampStoredText, pgTimestamptz, pgTimestamptzDateColumn, pgTimestamptzDateDescriptor, pgTimestamptzStoredText, pgTimetz, pgTimetzColumn, pgTimetzStoredText, pgTsquery, pgUnboundedIntColumn, pgUuid, pgUuidColumn, pgVarbit, pgVarbitColumn, pgVarchar, pgVarcharColumn, phrasetoTsquery, placeholder, plaintoTsquery, planIssues, policyInputFromSerialized, policyRoleList, postgresAggregateDescriptors, postgresCodec, postgresCodecDescriptorRegistry, postgresCodecRegistry, postgresCodecTraitsOf, postgresCreateNamespace, postgresDataTypeEntries, postgresDataTypes, postgresError, postgresNativeAuthoringTypes, postgresNowGeneratorControlDescriptors, postgresNowGenerators, postgresPslTypeConstructors, postgresRenderCheckExpressions, postgresResolveDefault, postgresScalarAuthoringTypes, primaryKey, prisma7PostgresBinding, qualifiedEnumName, qualifyName, qualifyTableName, quoteIdentifier, quoteQualifiedName, rawSql, readPostgresDefault, renderCallsToTypeScript, renderFullTextIndexDocument, renderOps, resolveDdlSchemaForNamespaceStorage, resolveIdentityValue, rlsEnabledAst, rlsPolicyExistsAst, sequenceNameAvailableAst, sql, stackDataTypes, tableExistsAst, tableIsEmptyAst, tablePrimaryKeyAst, text, textArray, timestamptz, timestamptzJsDate, toRegclass, toTsquery, tsquery, unique, validateEnumValueLength, websearchToTsquery, weightGroupsOf };
@@ -1,4 +1,4 @@
1
1
  import { n as parsePostgresListText, t as decodePostgresListText } from "./list-decoder-BcrLExnx-hTa7qY7a.mjs";
2
2
  import { t as postgresNowGeneratorControlDescriptors } from "./date-time-now-generators-CMkXVbMG-CYwplAuf.mjs";
3
- import { i as postgresTargetDescriptor, n as postgresPslTypeConstructors, r as postgresScalarAuthoringTypes, t as postgresNativeAuthoringTypes } from "./control-DmWVxA23.mjs";
3
+ import { i as postgresTargetDescriptor, n as postgresPslTypeConstructors, r as postgresScalarAuthoringTypes, t as postgresNativeAuthoringTypes } from "./control-BRE_BcLl.mjs";
4
4
  export { decodePostgresListText, postgresTargetDescriptor as default, parsePostgresListText, postgresNativeAuthoringTypes, postgresNowGeneratorControlDescriptors, postgresPslTypeConstructors, postgresScalarAuthoringTypes };
@@ -7,18 +7,18 @@ import { P as setFallbackTemporal, i as decodePostgresListText, o as parsePostgr
7
7
  import { s as fullTextIndexDefinitionOf } from "./full-text-index-definition-BPxQQBuC-BrpDsuJu.mjs";
8
8
  import { i as PostgresRlsPolicy, n as PostgresRlsEnablement, o as PostgresRole } from "./postgres-schema-DyUXtYIT-vb-RxpRN.mjs";
9
9
  import { r as computeContentHash } from "./canonicalize-RdxoUHao-DK_M6HU-.mjs";
10
- import { c as postgresNowGeneratorControlDescriptors, t as POLICY_BLOCK_KEYWORDS } from "./authoring-DhyLHFHA-pB4NuFxh.mjs";
10
+ import { c as postgresNowGeneratorControlDescriptors, t as POLICY_BLOCK_KEYWORDS } from "./authoring-DtjMn8TZ-sv84Cdw_.mjs";
11
11
  import { t as postgresRenderCheckExpressions } from "./check-expressions-7uCCP01t-WtUqfqkP.mjs";
12
- import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-Bzs7kSyA-BjbnpZLW.mjs";
12
+ import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-C0yUaYLH-CUtYbbZp.mjs";
13
13
  import { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
14
14
  import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
15
15
  import { i as qualifyTableName } from "./planner-sql-checks-pkURMYMz-2QAIKyW-.mjs";
16
16
  import { r as diffPostgresSchema } from "./diff-database-schema-DyCIRT80-C1zMCmRx.mjs";
17
- import { t as PostgresContractSerializer } from "./postgres-contract-view-B-bLZB7o-zpuamDXT.mjs";
18
- import { o as postgresContractToSchema } from "./postgres-migration-BbXm1l5I-DDy8IgYB.mjs";
19
- import { t as createPostgresMigrationPlanner } from "./planner-C1czBCmI-C-x1Ip-_.mjs";
17
+ import { t as PostgresContractSerializer } from "./postgres-contract-view-Ctg2ire_-smoqnU-u.mjs";
18
+ import { o as postgresContractToSchema } from "./postgres-migration-BdFXT6xg-BPApPGX9.mjs";
19
+ import { t as createPostgresMigrationPlanner } from "./planner-BIOXTf-E-CFs_l_0M.mjs";
20
20
  import { n as MARKER_LOCK_SQL, t as MARKER_LOCK_KEY } from "./marker-lock-DFc1Tfv5-QMJSzMIa.mjs";
21
- import { _ as postgresNativeAuthoringTypes, a as buildIndexAttribute, c as buildNativeEnumBlock, d as inferPostgresPslContract, f as namedArg, g as positionalArg, h as parseDefaultAttributeString, i as buildFullTextIndexAttribute, n as buildAttribute, o as buildMapAttribute, r as buildCheckAttribute, s as buildModelConstraintAttribute, t as SYNTHETIC_SPAN, v as postgresPslTypeConstructors, y as postgresScalarAuthoringTypes } from "./type-constructors-CrNUrtwZ-dmWF-mtV.mjs";
21
+ import { _ as postgresNativeAuthoringTypes, a as buildIndexAttribute, c as buildNativeEnumBlock, d as inferPostgresPslContract, f as namedArg, g as positionalArg, h as parseDefaultAttributeString, i as buildFullTextIndexAttribute, n as buildAttribute, o as buildMapAttribute, r as buildCheckAttribute, s as buildModelConstraintAttribute, t as SYNTHETIC_SPAN, v as postgresPslTypeConstructors, y as postgresScalarAuthoringTypes } from "./type-constructors-BEZJxWcZ-Co2GJw1M.mjs";
22
22
  import { dataTypeParams, requiredParamKeys, validateCodecTypeParams } from "@prisma/orm-framework/components/codec";
23
23
  import { blindCast } from "@prisma/orm-framework/utils/casts";
24
24
  import { isSqlDataType, unquotedSqlBaseName } from "@prisma/orm-family-sql/contract/data-type";
@@ -36,9 +36,9 @@ import { printSqlExpressionLiteral, sqlTextsReadBack } from "@prisma/orm-family-
36
36
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
37
37
  import { notOk, ok, okVoid } from "@prisma/orm-framework/utils/result";
38
38
  import { SqlSchemaVerifierBase } from "@prisma/orm-family-sql/family/ir";
39
- import { defaultFunctionCallFor, fieldPresetCallFor, inferredTypeConstructors, mapDefault, pslTypeArgumentText } from "@prisma/orm-family-sql/family/psl-build";
40
- import { UNBOUND_PSL_NAMESPACE_NAME, UNSPECIFIED_PSL_NAMESPACE_ID, makePslNamespace, makePslNamespaceEntries } from "@prisma/orm-framework/components/psl-ast";
41
39
  import { effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
40
+ import { generatorCallsFor, inferredTypeConstructors, mapDefault, pslTypeArgumentText } from "@prisma/orm-family-sql/family/psl-build";
41
+ import { UNBOUND_PSL_NAMESPACE_NAME, UNSPECIFIED_PSL_NAMESPACE_ID, makePslNamespace, makePslNamespaceEntries } from "@prisma/orm-framework/components/psl-ast";
42
42
  import { Temporal } from "temporal-polyfill/full/implementation";
43
43
  import { SqlQueryError } from "@prisma/orm-family-sql/errors";
44
44
  import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
@@ -624,81 +624,45 @@ function refuseUnwritableLiteralDefault(input) {
624
624
  pslTypeName: input.pslTypeName
625
625
  });
626
626
  }
627
- function describePhases(phases) {
628
- return [phases.onCreate === void 0 ? void 0 : `"${phases.onCreate}" on create`, phases.onUpdate === void 0 ? void 0 : `"${phases.onUpdate}" on update`].filter((phase) => phase !== void 0).join(" and ");
629
- }
630
- function refuseGeneratorsNoPresetWritesTogether(phases) {
631
- throw unsupported(`column ${phases.coordinate} generates ${describePhases(phases)}, which cannot be written in Prisma 8 PSL.`, "The field preset in the configured stack that writes one of these generators for the column codec does not also write the other phase, so that phase would be dropped from the written file, and no default function in the configured stack writes the column's generators instead.", KEEP_SOURCE, {
632
- coordinate: phases.coordinate,
633
- onCreate: phases.onCreate,
634
- onUpdate: phases.onUpdate
635
- });
636
- }
627
+ const PHASE_TEXT = {
628
+ onCreate: "on create",
629
+ onUpdate: "on update"
630
+ };
637
631
  function describeGenerator(generator) {
638
632
  if (generator === void 0) return "no generator";
639
633
  const params = generator.params ?? {};
640
634
  return Object.keys(params).length === 0 ? `"${generator.id}"` : `"${generator.id}" with params ${canonicalizeJson(params)}`;
641
635
  }
642
- function describeDifference(difference) {
643
- switch (difference.part) {
644
- case "codecId": return `codec "${difference.printed}" instead of "${difference.column}"`;
645
- case "typeParams": return `type params ${canonicalizeJson(difference.printed ?? {})} instead of ${canonicalizeJson(difference.column ?? {})}`;
646
- case "onCreate":
647
- case "onUpdate": return `${difference.part === "onCreate" ? "on create" : "on update"} ${describeGenerator(difference.printed)} instead of ${describeGenerator(difference.column)}`;
648
- }
649
- }
650
- const COLUMN_TYPE_KINDS = {
651
- namedType: "a named type",
652
- valueObject: "a value object",
653
- enum: "an enum"
654
- };
655
- function describeUnwritableReason(reason) {
656
- switch (reason.kind) {
657
- case "columnType": return `its type ${reason.typeName} is ${COLUMN_TYPE_KINDS[reason.columnType]}, which the preset call would replace`;
658
- case "list": return "the column is a list, and a preset call cannot be a list element";
659
- case "unwritableArgument": return `its type param "${reason.argument}" is ${JSON.stringify(reason.value)}, which a PSL argument cannot carry`;
660
- case "argumentsRejected": return `the preset does not accept the call, since ${reason.message}`;
661
- }
662
- }
663
- function refuseUnwritablePresetCall(input) {
664
- throw unsupported(`column ${input.coordinate} cannot be written with field preset ${input.preset}: ${describeUnwritableReason(input.reason)}.`, "The printer writes a column's generators as the call of the field preset that writes the column's codec with them, or a create-only generator as the call of its default function. The preset call cannot be written for this column, and no default function in the configured stack writes its generators.", KEEP_SOURCE, {
636
+ function refuseGeneratorOnList(input) {
637
+ throw unsupported(`column ${input.coordinate} is a list and generates "${input.generatorId}" ${PHASE_TEXT[input.phase]}, which cannot be written in Prisma 8 PSL.`, "Prisma 8 PSL refuses `@onCreate(…)` and `@onUpdate(…)` on a list field, since a list has no generated value per element.", KEEP_SOURCE, {
665
638
  coordinate: input.coordinate,
666
- preset: input.preset,
667
- reason: input.reason
668
- });
669
- }
670
- function refusePresetCallReadingBackDifferently(input) {
671
- throw unsupported(`column ${input.coordinate} is written with field preset ${input.preset}, and that call reads back as a different column: ${input.differences.map(describeDifference).join("; ")}.`, "The printer writes a column's generators as the call of the field preset that writes the column's codec with them, and that call must read back with the column's codec, type params and generators. No default function in the configured stack writes its generators instead.", KEEP_SOURCE, {
672
- coordinate: input.coordinate,
673
- preset: input.preset,
674
- differences: input.differences
675
- });
676
- }
677
- function refuseGeneratorOnUpdate(phases) {
678
- throw unsupported(`column ${phases.coordinate} generates a value on update ("${phases.onUpdate}"), which cannot be written in Prisma 8 PSL.`, "`@default(…)` writes a generator for create only; a generator on update is written only through a field preset, and the configured stack has no field preset for the column codec that contract print can write with this generator.", KEEP_SOURCE, {
679
- coordinate: phases.coordinate,
680
- onCreate: phases.onCreate,
681
- onUpdate: phases.onUpdate
639
+ phase: input.phase,
640
+ generatorId: input.generatorId
682
641
  });
683
642
  }
684
643
  function refuseGeneratorWithoutPslFunction(input) {
685
- const { coordinate, onCreate, onUpdate, registeredBy } = input;
644
+ const { coordinate, phase, generatorId, codecId, registeredBy } = input;
686
645
  const meta = {
687
646
  coordinate,
688
- onCreate,
689
- onUpdate
647
+ phase,
648
+ generatorId,
649
+ codecId
690
650
  };
691
- if (registeredBy === void 0) throw unsupported(`column ${coordinate} is generated by "${onCreate}", which no component in the configured stack registers.`, "The printer writes each generator as the PSL call of the default function in the configured stack that produces it, and no component in the stack registers this generator.", "Add the extension that registers the generator and its default function to the config, or keep authoring this contract in its current source.", meta);
651
+ if (registeredBy === void 0) throw unsupported(`column ${coordinate} is generated by "${generatorId}" ${PHASE_TEXT[phase]}, which no component in the configured stack registers.`, `The printer writes each generator as \`@${phase}(fn(…))\` with the generator function the configured stack binds to the column's codec, and no component in the stack registers this generator.`, "Add the extension that registers the generator and its generator function to the config, or keep authoring this contract in its current source.", meta);
692
652
  const { componentId } = registeredBy;
693
- throw unsupported(`column ${coordinate} is generated by "${onCreate}", which ${componentId === void 0 ? "a configured component" : `"${componentId}"`} registers, but no default function in the configured stack declares how contract print writes it, and the stack has no field preset for the column codec that contract print can write with it.`, "The printer writes a generator as the call of the field preset that writes the column's codec with it, or else as the PSL call of the default function that declares `printArguments` for it. The configured stack has neither for this generator.", `If ${componentId === void 0 ? `the component that registers "${onCreate}"` : `"${componentId}"`} has a default function that produces ${componentId === void 0 ? "it" : `"${onCreate}"`}, its author must add \`printArguments\` for "${onCreate}" to it, as the upgrade instructions "contract-print-generated-values" for extension authors describe. Otherwise "${onCreate}" is written only through a field preset of the column codec, and the configured stack has none that contract print can write. Until then, keep authoring this contract in its current source.`, {
653
+ const registrant = componentId === void 0 ? "a configured component" : `"${componentId}"`;
654
+ throw unsupported(`column ${coordinate} is generated by "${generatorId}" ${PHASE_TEXT[phase]}, which ${registrant} registers, but no generator function in the configured stack writes it for codec "${codecId}".`, `The printer writes each generator as \`@${phase}(fn(…))\` with the generator function the configured stack binds to the column's codec, and no function bound to "${codecId}" produces this generator.`, `If ${componentId === void 0 ? `the component that registers "${generatorId}"` : `"${componentId}"`} declares a generator function that produces it, its author must bind that function to codec "${codecId}", as the upgrade instructions "default-generators-to-on-create" for extension authors describe. Until then, keep authoring this contract in its current source.`, {
694
655
  ...meta,
695
656
  ...ifDefined("componentId", componentId)
696
657
  });
697
658
  }
698
- function refuseGeneratorWithDatabaseDefault(input) {
699
- throw unsupported(`column ${input.coordinate} has both a generated value ("${input.onCreate}") and a database default, which cannot be written in Prisma 8 PSL.`, "`@default(…)` writes either the generator or the database default, so the other would be lost.", "Drop one of the two, or keep authoring this contract in its current source.", {
659
+ function refuseGeneratorReadingBackDifferently(input) {
660
+ throw unsupported(`column ${input.coordinate} generates ${describeGenerator(input.stored)} ${PHASE_TEXT[input.phase]}, but @${input.phase}(${input.call}) reads back as ${describeGenerator(input.readBack)}.`, "The printer writes each generator as the call of the generator function the configured stack binds to the column's codec, and that call must resolve back to the stored generator and params on the column.", KEEP_SOURCE, {
700
661
  coordinate: input.coordinate,
701
- onCreate: input.onCreate
662
+ phase: input.phase,
663
+ call: input.call,
664
+ stored: input.stored,
665
+ readBack: input.readBack
702
666
  });
703
667
  }
704
668
  /**
@@ -2110,62 +2074,47 @@ function buildColumnDefault(input) {
2110
2074
  });
2111
2075
  return parseDefaultAttributeString(result.attribute);
2112
2076
  }
2113
- function toPslArgument(argument) {
2114
- return argument.kind === "positional" ? positionalArg(argument.value) : namedArg(argument.name, argument.value);
2115
- }
2116
- /**
2117
- * How one column's execution generators are written in PSL: as the call of the field preset of the stack that writes the column's codec with them, or else a create-only generator as the `@default(<fn>(...))` call of the default function that declares `printArguments` for it. A column neither writes is refused, with the preset's reason when a preset writes its codec and generators.
2118
- */
2119
- function buildExecutionDefault(input) {
2120
- const { executionDefault, codecId, pslType, list, typeParams, coordinate, context } = input;
2121
- const onCreateId = executionDefault.onCreate?.id;
2122
- const onUpdateId = executionDefault.onUpdate?.id;
2123
- const phases = {
2124
- coordinate,
2125
- onCreate: onCreateId,
2126
- onUpdate: onUpdateId
2127
- };
2128
- const choice = fieldPresetCallFor({
2129
- fieldPresetsByCodecAndGenerator: context.fieldPresetsByCodecAndGenerator,
2130
- column: {
2077
+ function refuse(refusal, input) {
2078
+ const { coordinate, codecId, context } = input;
2079
+ const { phase, generator } = refusal;
2080
+ switch (refusal.kind) {
2081
+ case "on-list": return refuseGeneratorOnList({
2082
+ coordinate,
2083
+ phase,
2084
+ generatorId: generator.id
2085
+ });
2086
+ case "no-function": return refuseGeneratorWithoutPslFunction({
2087
+ coordinate,
2088
+ phase,
2089
+ generatorId: generator.id,
2131
2090
  codecId,
2132
- pslType,
2133
- list,
2134
- typeParams,
2135
- generators: executionDefault
2136
- }
2137
- });
2138
- if (choice.kind === "call") return {
2139
- kind: "preset",
2140
- path: choice.preset.path,
2141
- args: choice.arguments.map(toPslArgument)
2142
- };
2143
- const call = onCreateId === void 0 || onUpdateId !== void 0 ? void 0 : defaultFunctionCallFor(context.defaultFunctionPrintersByGenerator, onCreateId, executionDefault.onCreate?.params);
2144
- if (call !== void 0) return {
2145
- kind: "attribute",
2146
- attribute: buildAttribute("field", "default", [positionalArg(call)])
2147
- };
2148
- switch (choice.kind) {
2149
- case "cannotWrite":
2150
- if (choice.reason.kind === "phasesNotWrittenTogether") return refuseGeneratorsNoPresetWritesTogether(phases);
2151
- return refuseUnwritablePresetCall({
2152
- coordinate,
2153
- preset: choice.preset.path.join("."),
2154
- reason: choice.reason
2155
- });
2156
- case "readsBackDifferently": return refusePresetCallReadingBackDifferently({
2091
+ registeredBy: context.componentIdsByGenerator.has(generator.id) ? { componentId: context.componentIdsByGenerator.get(generator.id) } : void 0
2092
+ });
2093
+ case "reads-back-differently": return refuseGeneratorReadingBackDifferently({
2157
2094
  coordinate,
2158
- preset: choice.preset.path.join("."),
2159
- differences: choice.differences
2095
+ phase,
2096
+ call: refusal.text,
2097
+ stored: generator,
2098
+ readBack: refusal.readBack
2160
2099
  });
2161
- case "noPreset":
2162
- if (onUpdateId !== void 0) return refuseGeneratorOnUpdate(phases);
2163
- return refuseGeneratorWithoutPslFunction({
2164
- ...phases,
2165
- registeredBy: onCreateId !== void 0 && context.componentIdsByGenerator.has(onCreateId) ? { componentId: context.componentIdsByGenerator.get(onCreateId) } : void 0
2166
- });
2167
2100
  }
2168
2101
  }
2102
+ /**
2103
+ * The `@onCreate(fn(...))` and `@onUpdate(fn(...))` attributes that write one column's generators. A column whose generators cannot be written as calls that read back the same is refused.
2104
+ */
2105
+ function buildGeneratorAttributes(input) {
2106
+ const result = generatorCallsFor({
2107
+ executionDefault: input.executionDefault,
2108
+ field: {
2109
+ codecId: input.codecId,
2110
+ typeParams: input.typeParams
2111
+ },
2112
+ list: input.list,
2113
+ generatorFunctions: input.context.generatorFunctions
2114
+ });
2115
+ if (!result.ok) refuse(result.refusal, input);
2116
+ return result.calls.map(({ phase, text }) => buildAttribute("field", phase, [positionalArg(text)]));
2117
+ }
2169
2118
  /** The generated values of the contract, keyed by the column they fill. */
2170
2119
  function executionDefaultsByColumn(contract) {
2171
2120
  const byColumn = /* @__PURE__ */ new Map();
@@ -2179,7 +2128,7 @@ function executionDefaultsByColumn(contract) {
2179
2128
  function scalarFieldAttributes(input) {
2180
2129
  const attributes = [];
2181
2130
  if (input.isSingleColumnId) attributes.push(buildAttribute("field", "id", input.primaryKeyName === void 0 ? [] : [namedArg("map", `"${escapePslString(input.primaryKeyName)}"`)]));
2182
- const columnDefault = input.generatedDefault ?? buildColumnDefault({
2131
+ const columnDefault = buildColumnDefault({
2183
2132
  column: input.column,
2184
2133
  pslTypeName: input.pslTypeName,
2185
2134
  isEnum: input.isEnum,
@@ -2191,6 +2140,7 @@ function scalarFieldAttributes(input) {
2191
2140
  namedTypes: input.namedTypes
2192
2141
  });
2193
2142
  if (columnDefault !== void 0) attributes.push(columnDefault);
2143
+ attributes.push(...input.generatorAttributes);
2194
2144
  const mapName = pslFieldMapName(input.fieldName, input.columnName);
2195
2145
  if (mapName !== void 0) attributes.push(buildMapAttribute("field", mapName));
2196
2146
  return attributes;
@@ -2247,37 +2197,20 @@ function buildScalarFields(input) {
2247
2197
  coordinate,
2248
2198
  namespaceId: entry.namespaceId
2249
2199
  });
2250
- let { typeName, typeConstructor } = columnType;
2200
+ const { typeName, typeConstructor } = columnType;
2251
2201
  const execution = executionDefaults.get(JSON.stringify([
2252
2202
  entry.namespaceId,
2253
2203
  entry.tableName,
2254
2204
  columnName
2255
2205
  ]));
2256
- let generatedDefault;
2257
- if (execution !== void 0) {
2258
- const built = buildExecutionDefault({
2259
- executionDefault: execution,
2260
- codecId: column.codecId,
2261
- pslType: columnType,
2262
- list: !!field.many,
2263
- typeParams: column.typeParams,
2264
- coordinate,
2265
- context
2266
- });
2267
- if (built.kind === "preset") {
2268
- typeName = built.path.join(".");
2269
- typeConstructor = {
2270
- kind: "typeConstructor",
2271
- path: built.path,
2272
- args: built.args,
2273
- span: SYNTHETIC_SPAN
2274
- };
2275
- } else if (column.default !== void 0) refuseGeneratorWithDatabaseDefault({
2276
- coordinate,
2277
- onCreate: execution.onCreate?.id
2278
- });
2279
- else generatedDefault = built.attribute;
2280
- }
2206
+ const generatorAttributes = execution === void 0 ? [] : buildGeneratorAttributes({
2207
+ executionDefault: execution,
2208
+ codecId: column.codecId,
2209
+ list: !!field.many,
2210
+ typeParams: resolvedTypeParams(column, input.namedTypes),
2211
+ coordinate,
2212
+ context
2213
+ });
2281
2214
  fields.push({
2282
2215
  kind: "field",
2283
2216
  name: fieldName,
@@ -2297,7 +2230,7 @@ function buildScalarFields(input) {
2297
2230
  pslTypeName: columnType.typeName,
2298
2231
  isEnum: column.codecId === PG_ENUM_CODEC_ID,
2299
2232
  domainEnum: column.codecId === "pg/enum@1" || column.valueSet === void 0 ? void 0 : domainEnums[column.valueSet.entityName],
2300
- generatedDefault,
2233
+ generatorAttributes,
2301
2234
  context,
2302
2235
  namedTypes: input.namedTypes
2303
2236
  }),