@prisma/orm-target-postgres 8.0.0-rc.23-dev.11 → 8.0.0-rc.23-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.
Files changed (115) hide show
  1. package/dist/{adapter-BRTXHtXv-CTn1Kl9-.mjs → adapter-BRTXHtXv-DBeQuJnG.mjs} +5 -5
  2. package/dist/{adapter-BRTXHtXv-CTn1Kl9-.mjs.map → adapter-BRTXHtXv-DBeQuJnG.mjs.map} +1 -1
  3. package/dist/adapter.mjs +5 -5
  4. package/dist/adapter__adapter.mjs +2 -2
  5. package/dist/adapter__control.mjs +4 -4
  6. package/dist/adapter__runtime.mjs +5 -5
  7. package/dist/adapter__sql-renderer.mjs +1 -1
  8. package/dist/{authoring-BD4uEpBM-DIJiGq4e.mjs → authoring-BbS0bin5-U9tXyzS6.mjs} +6 -6
  9. package/dist/{authoring-BD4uEpBM-DIJiGq4e.mjs.map → authoring-BbS0bin5-U9tXyzS6.mjs.map} +1 -1
  10. package/dist/{autoincrement-widths-B_JzBc-a-R7zoqIc3.mjs → autoincrement-widths-PwZcc5Co-1O2WEMYq.mjs} +3 -3
  11. package/dist/{autoincrement-widths-B_JzBc-a-R7zoqIc3.mjs.map → autoincrement-widths-PwZcc5Co-1O2WEMYq.mjs.map} +1 -1
  12. package/dist/{check-expressions-DL9WtMO5-CUcbN2JG.mjs → check-expressions-Ch-A_NJN-BscDa8xT.mjs} +3 -3
  13. package/dist/{check-expressions-DL9WtMO5-CUcbN2JG.mjs.map → check-expressions-Ch-A_NJN-BscDa8xT.mjs.map} +1 -1
  14. package/dist/{codec-registry-7LHPD8C1-BALCyEB-.mjs → codec-registry-B0LsFn7Z-ej9yKwTq.mjs} +4 -4
  15. package/dist/{codec-registry-7LHPD8C1-BALCyEB-.mjs.map → codec-registry-B0LsFn7Z-ej9yKwTq.mjs.map} +1 -1
  16. package/dist/{codecs-CV-_K-z0-DZc60ccR.mjs → codecs-Bzj3M0Q3-C2oFSIGs.mjs} +4 -4
  17. package/dist/{codecs-CV-_K-z0-DZc60ccR.mjs.map → codecs-Bzj3M0Q3-C2oFSIGs.mjs.map} +1 -1
  18. package/dist/{contract-contributions-n5CdvwA9-CuIvRgJp.mjs → contract-contributions-n5CdvwA9-BgUoiuTT.mjs} +8 -8
  19. package/dist/{contract-contributions-n5CdvwA9-CuIvRgJp.mjs.map → contract-contributions-n5CdvwA9-BgUoiuTT.mjs.map} +1 -1
  20. package/dist/{contract-free-DmNEp1_Y.mjs → contract-free-DiRem1nw.mjs} +3 -3
  21. package/dist/{contract-free-DmNEp1_Y.mjs.map → contract-free-DiRem1nw.mjs.map} +1 -1
  22. package/dist/{control-policy-CR-lrrd1-CESfQKqn.mjs → control-policy-DKnVhEWD-xuJIvCy9.mjs} +9 -9
  23. package/dist/{control-policy-CR-lrrd1-CESfQKqn.mjs.map → control-policy-DKnVhEWD-xuJIvCy9.mjs.map} +1 -1
  24. package/dist/{data-type-entries-dmLDRSOf-BJADXpXD.mjs → data-type-entries-CVxsfjF3-Bd0cSfuG.mjs} +3 -3
  25. package/dist/{data-type-entries-dmLDRSOf-BJADXpXD.mjs.map → data-type-entries-CVxsfjF3-Bd0cSfuG.mjs.map} +1 -1
  26. package/dist/{data-types-B47LbZ3z-DRVqjvQZ.mjs → data-types-DWfwErIu-DF85cgmu.mjs} +4 -4
  27. package/dist/{data-types-B47LbZ3z-DRVqjvQZ.mjs.map → data-types-DWfwErIu-DF85cgmu.mjs.map} +1 -1
  28. package/dist/{date-time-now-generators-BMMGy0vy-BEbt_79F.mjs → date-time-now-generators-BORO1_nc-BdCe3ppq.mjs} +4 -4
  29. package/dist/{date-time-now-generators-BMMGy0vy-BEbt_79F.mjs.map → date-time-now-generators-BORO1_nc-BdCe3ppq.mjs.map} +1 -1
  30. package/dist/{ddl-qu-IzeH4-CFpSpY0X.mjs → ddl-DCQLfg18-BgWGYC7L.mjs} +3 -3
  31. package/dist/{ddl-qu-IzeH4-CFpSpY0X.mjs.map → ddl-DCQLfg18-BgWGYC7L.mjs.map} +1 -1
  32. package/dist/{descriptor-meta-CKsHlt_c-UQ14enZp.mjs → descriptor-meta-CKsHlt_c-DkP2ZqQd.mjs} +3 -3
  33. package/dist/{descriptor-meta-CKsHlt_c-UQ14enZp.mjs.map → descriptor-meta-CKsHlt_c-DkP2ZqQd.mjs.map} +1 -1
  34. package/dist/{descriptor-meta-DWKp5Q1s-DplRJE9N.mjs → descriptor-meta-xBYwG7xG-DWAZTiD5.mjs} +11 -11
  35. package/dist/{descriptor-meta-DWKp5Q1s-DplRJE9N.mjs.map → descriptor-meta-xBYwG7xG-DWAZTiD5.mjs.map} +1 -1
  36. package/dist/{diff-database-schema-CX_XzsE0-BwaMw0Gq.mjs → diff-database-schema-J96mtg_F-BHpzbMoj.mjs} +9 -9
  37. package/dist/{diff-database-schema-CX_XzsE0-BwaMw0Gq.mjs.map → diff-database-schema-J96mtg_F-BHpzbMoj.mjs.map} +1 -1
  38. package/dist/{errors-DpdPXR_L-DailcY-X.mjs → errors-C4-Dp3gI-B5jY5eJj.mjs} +4 -4
  39. package/dist/errors-C4-Dp3gI-B5jY5eJj.mjs.map +1 -0
  40. package/dist/{full-text-B9mXDcsJ.mjs → full-text-DGFJd1R3.mjs} +3 -3
  41. package/dist/{full-text-B9mXDcsJ.mjs.map → full-text-DGFJd1R3.mjs.map} +1 -1
  42. package/dist/{full-text-index-definition-MfjtL-x7-ImaTAFMs.mjs → full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs} +3 -3
  43. package/dist/{full-text-index-definition-MfjtL-x7-ImaTAFMs.mjs.map → full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs.map} +1 -1
  44. package/dist/{full-text-parsers-DIfNR9AQ-tVmTju-Y.mjs → full-text-parsers-D-2uupNS-6woSZ16T.mjs} +4 -4
  45. package/dist/{full-text-parsers-DIfNR9AQ-tVmTju-Y.mjs.map → full-text-parsers-D-2uupNS-6woSZ16T.mjs.map} +1 -1
  46. package/dist/{full-text-search-document-Ceg9d2K0-DJ4MklAU.mjs → full-text-search-document-BqqvjJoC-HaoeMaM5.mjs} +5 -5
  47. package/dist/{full-text-search-document-Ceg9d2K0-DJ4MklAU.mjs.map → full-text-search-document-BqqvjJoC-HaoeMaM5.mjs.map} +1 -1
  48. package/dist/{index-types-B5sQ5Vw0-DfXKO9-v.mjs → index-types-DGrgbAd4-DuGWdvol.mjs} +3 -3
  49. package/dist/{index-types-B5sQ5Vw0-DfXKO9-v.mjs.map → index-types-DGrgbAd4-DuGWdvol.mjs.map} +1 -1
  50. package/dist/{infer-psl-contract-DR0Uie7w-CkaPSdPc.mjs → infer-psl-contract-CAoJuV8y-Da9y8zwV.mjs} +8 -8
  51. package/dist/{infer-psl-contract-DR0Uie7w-CkaPSdPc.mjs.map → infer-psl-contract-CAoJuV8y-Da9y8zwV.mjs.map} +1 -1
  52. package/dist/migration-Be_iuIpn.mjs.map +1 -1
  53. package/dist/{native-type-normalizer-DEN9YgA5.mjs → native-type-normalizer-PGvExTgu.mjs} +2 -2
  54. package/dist/{native-type-normalizer-DEN9YgA5.mjs.map → native-type-normalizer-PGvExTgu.mjs.map} +1 -1
  55. package/dist/{op-factory-call-DlZ_wHv_-Dh_yijWZ.mjs → op-factory-call-THEIwT0J-DQM3Y94S.mjs} +8 -8
  56. package/dist/{op-factory-call-DlZ_wHv_-Dh_yijWZ.mjs.map → op-factory-call-THEIwT0J-DQM3Y94S.mjs.map} +1 -1
  57. package/dist/{planner-BO6cvHnU-DtlizdVY.mjs → planner-BlY3pVTF-B-yPNIGN.mjs} +10 -10
  58. package/dist/{planner-BO6cvHnU-DtlizdVY.mjs.map → planner-BlY3pVTF-B-yPNIGN.mjs.map} +1 -1
  59. package/dist/{planner-ddl-builders-B1gra_GO-gl5gnaqr.mjs → planner-ddl-builders-Ds3Xcsg7-5-bR7xgo.mjs} +3 -3
  60. package/dist/{planner-ddl-builders-B1gra_GO-gl5gnaqr.mjs.map → planner-ddl-builders-Ds3Xcsg7-5-bR7xgo.mjs.map} +1 -1
  61. package/dist/{planner-identity-values-CAnifzzT-D1ncWy3d.mjs → planner-identity-values-CQZbvcx0-BpAvjtip.mjs} +3 -3
  62. package/dist/{planner-identity-values-CAnifzzT-D1ncWy3d.mjs.map → planner-identity-values-CQZbvcx0-BpAvjtip.mjs.map} +1 -1
  63. package/dist/{planner-produced-postgres-migration-BA0ACEpG-Bu613xfQ.mjs → planner-produced-postgres-migration-CorJVpul-dA0T7JYO.mjs} +4 -4
  64. package/dist/{planner-produced-postgres-migration-BA0ACEpG-Bu613xfQ.mjs.map → planner-produced-postgres-migration-CorJVpul-dA0T7JYO.mjs.map} +1 -1
  65. package/dist/{planner-sql-checks-RKQqd_b5-CesTHuGH.mjs → planner-sql-checks-BOdYkh9L-hXxekxJX.mjs} +5 -5
  66. package/dist/{planner-sql-checks-RKQqd_b5-CesTHuGH.mjs.map → planner-sql-checks-BOdYkh9L-hXxekxJX.mjs.map} +1 -1
  67. package/dist/{postgres-codec-traits-DeZiroEE-BACV_wuh.mjs → postgres-codec-traits-D9YEvK6F-BsKaAhCA.mjs} +3 -3
  68. package/dist/{postgres-codec-traits-DeZiroEE-BACV_wuh.mjs.map → postgres-codec-traits-D9YEvK6F-BsKaAhCA.mjs.map} +1 -1
  69. package/dist/{postgres-contract-view-yDfay91x-BBinYMBq.mjs → postgres-contract-view-WtPiaMZp-C-CQAB1E.mjs} +9 -9
  70. package/dist/{postgres-contract-view-yDfay91x-BBinYMBq.mjs.map → postgres-contract-view-WtPiaMZp-C-CQAB1E.mjs.map} +1 -1
  71. package/dist/{postgres-migration-BPr4WRWw-CN_b66o1.mjs → postgres-migration-BuxK0qNO-BgQHf6H6.mjs} +11 -11
  72. package/dist/{postgres-migration-BPr4WRWw-CN_b66o1.mjs.map → postgres-migration-BuxK0qNO-BgQHf6H6.mjs.map} +1 -1
  73. package/dist/{postgres-schema-BBWgs4fX-DWdYxNi8.mjs → postgres-schema-zd_p5Lg2-BdJlG7Cg.mjs} +4 -4
  74. package/dist/{postgres-schema-BBWgs4fX-DWdYxNi8.mjs.map → postgres-schema-zd_p5Lg2-BdJlG7Cg.mjs.map} +1 -1
  75. package/dist/{prisma7-binding-BA8iSLxQ.mjs → prisma7-binding-BDJ3kwsK.mjs} +7 -7
  76. package/dist/{prisma7-binding-BA8iSLxQ.mjs.map → prisma7-binding-BDJ3kwsK.mjs.map} +1 -1
  77. package/dist/{registry-Ctq7UGkA-_DnAcgYm.mjs → registry-D4AyYsXr-CgiiMuFS.mjs} +3 -3
  78. package/dist/{registry-Ctq7UGkA-_DnAcgYm.mjs.map → registry-D4AyYsXr-CgiiMuFS.mjs.map} +1 -1
  79. package/dist/{render-ops-B0ZfUiTN-BdoDg9mi.mjs → render-ops-B5Mh0MpJ-Dc_dH1Sk.mjs} +4 -4
  80. package/dist/{render-ops-B0ZfUiTN-BdoDg9mi.mjs.map → render-ops-B5Mh0MpJ-Dc_dH1Sk.mjs.map} +1 -1
  81. package/dist/{resolve-ddl-schema-DwoTc0nu-CvyB2Tfu.mjs → resolve-ddl-schema-ChjIoY0I-D7TWkRXc.mjs} +3 -3
  82. package/dist/{resolve-ddl-schema-DwoTc0nu-CvyB2Tfu.mjs.map → resolve-ddl-schema-ChjIoY0I-D7TWkRXc.mjs.map} +1 -1
  83. package/dist/{sql-renderer-D6fBWtjL-D1QcI-Cf.mjs → sql-renderer-D6fBWtjL-BOe5jc4e.mjs} +3 -3
  84. package/dist/{sql-renderer-D6fBWtjL-D1QcI-Cf.mjs.map → sql-renderer-D6fBWtjL-BOe5jc4e.mjs.map} +1 -1
  85. package/dist/{sql-utils-VXrIh8dJ-DVxo_Ygp.mjs → sql-utils-CRPhDLp1-wbgQW5TM.mjs} +3 -3
  86. package/dist/{sql-utils-VXrIh8dJ-DVxo_Ygp.mjs.map → sql-utils-CRPhDLp1-wbgQW5TM.mjs.map} +1 -1
  87. package/dist/target.mjs +32 -32
  88. package/dist/target__codecs.mjs +3 -3
  89. package/dist/target__contract-free.mjs +3 -3
  90. package/dist/target__control.mjs +16 -16
  91. package/dist/target__control.mjs.map +1 -1
  92. package/dist/target__data-types.mjs +2 -2
  93. package/dist/target__diff-database-schema.mjs +1 -1
  94. package/dist/target__errors.mjs +1 -1
  95. package/dist/target__full-text-index-authoring.mjs +2 -2
  96. package/dist/target__full-text.mjs +2 -2
  97. package/dist/target__issue-planner.mjs +1 -1
  98. package/dist/target__migration.mjs +1 -1
  99. package/dist/target__native-type-normalizer.mjs +1 -1
  100. package/dist/target__op-factory-call.mjs +1 -1
  101. package/dist/target__pack.mjs +1 -1
  102. package/dist/target__planner-ddl-builders.mjs +1 -1
  103. package/dist/target__planner-identity-values.mjs +1 -1
  104. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  105. package/dist/target__planner-sql-checks.mjs +1 -1
  106. package/dist/target__planner.mjs +2 -2
  107. package/dist/target__prisma7-binding.mjs +1 -1
  108. package/dist/target__render-ops.mjs +1 -1
  109. package/dist/target__runtime.mjs +7 -7
  110. package/dist/target__runtime.mjs.map +1 -1
  111. package/dist/target__schema-ir-annotations.mjs +1 -1
  112. package/dist/target__sql-utils.mjs +3 -3
  113. package/dist/target__types.mjs +2 -2
  114. package/package.json +10 -10
  115. package/dist/errors-DpdPXR_L-DailcY-X.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"diff-database-schema-CX_XzsE0-BwaMw0Gq.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/diff-database-schema-CX_XzsE0.mjs"],"sourcesContent":["import { u as postgresError } from \"./errors-DpdPXR_L.mjs\";\nimport { i as fullTextIndexDefinitionOf, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-MfjtL-x7.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-BBWgs4fX.mjs\";\nimport { t as postgresAccessMethodOf } from \"./index-types-B5sQ5Vw0.mjs\";\nimport { t as postgresResolveDefault } from \"./default-normalizer-BqK6XxdC.mjs\";\nimport { c as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, o as PostgresSchemaNodeKind, r as PostgresExtensionSchemaNode, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-OQRI_GIM.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-yFPLQ6U0.mjs\";\nimport { n as renderFullTextIndexDocument } from \"./full-text-search-document-Ceg9d2K0.mjs\";\nimport { r as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-DwoTc0nu.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-CR-lrrd1.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\textensions: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst extensions = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tfor (const extension of Object.values(ns.extension)) extensions.push(new PostgresExtensionSchemaNode({\n\t\t\tname: extension.name,\n\t\t\tlocation: ns.id === UNBOUND_NAMESPACE_ID ? { kind: \"searchPath\" } : {\n\t\t\t\tkind: \"declared\",\n\t\t\t\tschemaName: resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id)\n\t\t\t},\n\t\t\tcontrol: extension.control\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && entriesKey !== \"extension\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst fullText = fullTextIndexDefinitionOf(i);\n\t\t\t\tif (fullText !== void 0) return new SqlIndexIR({\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: postgresAccessMethodOf(FULL_TEXT_INDEX_TYPE),\n\t\t\t\t\toptions: void 0,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\texpression: renderFullTextIndexDocument(fullText),\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, fullText.weightGroups.flat())\n\t\t\t\t});\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\textensions,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\n/**\n* The installed extension a `not-expected` issue reports, if it reports one. An extension the contract does not declare is never this contract's to report or drop: Postgres always has `plpgsql`, hosts preinstall many more, and a sibling contract space may declare it. Only a plan drops one, and only one its origin contract declared.\n*/\nfunction undeclaredExtensionName(issue) {\n\tif (issueOutcome(issue) !== \"not-expected\" || issue.actual === void 0) return void 0;\n\tconst node = blindCast(issue.actual);\n\treturn PostgresExtensionSchemaNode.is(node) ? node.name : void 0;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\textensions: [...expected.extensions],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (undeclaredExtensionName(issue) !== void 0) return false;\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\textensions: [...actual.extensions],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst originSchemas = input.originSchemas ?? [];\n\tconst originExtensions = new Set(input.originExtensions ?? []);\n\tconst relationalOwned = /* @__PURE__ */ new Set([...ownedSchemaNames(expected), ...originSchemas]);\n\tconst structuralOwned = /* @__PURE__ */ new Set([...ownedSchemaNames(fullExpected), ...originSchemas]);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tconst extensionName = undeclaredExtensionName(issue);\n\t\t\tif (extensionName !== void 0) return originExtensions.has(extensionName);\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { diffPostgresSchema as n, contractToPostgresDatabaseSchemaNode as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-CX_XzsE0.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;EACA;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;CACD;AACD;AACA,SAAS,cAAc,MAAM;CAC5B,OAAO,CAAC,aAAa,GAAG;EACvB,UAAU,uBAAuB;EACjC,IAAI;CACL,CAAC;AACF;;;;;;;AAOA,SAAS,gBAAgB,aAAa,WAAW,SAAS;CACzD,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,eAAe,aAAa,SAAS,GAAG;EAC1E,UAAU,yBAAyB;EACnC,IAAI,UAAU;CACf,CAAC,CAAC;AACH;AACA,SAAS,aAAa,QAAQ,aAAa;CAC1C,OAAO,IAAI,yBAAyB;EACnC,QAAQ,SAAS,OAAO,MAAM,OAAO,MAAM;EAC3C,WAAW,OAAO;EAClB;EACA,WAAW,OAAO;EAClB,OAAO,CAAC,GAAG,OAAO,KAAK;EACvB,OAAO,OAAO;EACd,WAAW,OAAO;EAClB,YAAY,OAAO;EACnB,WAAW,CAAC,eAAe,aAAa,OAAO,SAAS,GAAG,GAAG,OAAO,MAAM,IAAI,aAAa,CAAC;CAC9F,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,qCAAqC,UAAU,SAAS;CAChE,IAAI,aAAa,MAAM,OAAO,IAAI,2BAA2B;EAC5D,YAAY,CAAC;EACb,OAAO,CAAC;EACR,YAAY,CAAC;EACb,iBAAiB,CAA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GAAG,aAAa,CAAC;CACjG,MAAM,kCAAkC,IAAI,IAAI,CAAC,GAAG,iBAAiB,YAAY,GAAG,GAAG,aAAa,CAAC;CACrG,OAAO;EACN;EACA,QAAQ;EACR,QAAQ,UAAU,YAAY,UAAU,YAAY,CAAC,CAAC,CAAC,QAAQ,UAAU;GACxE,MAAM,gBAAgB,wBAAwB,KAAK;GACnD,IAAI,kBAAkB,KAAK,GAAG,OAAO,iBAAiB,IAAI,aAAa;GACvE,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;GACnD,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,MAAM,cAAc,+BAA+B,OAAO,8BAA8B;GACxF,MAAM,mBAAmB,MAAM,KAAK;GACpC,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,QAAQ,gBAAgB,eAAe,kBAAkB,gBAAA,CAAiB,IAAI,gBAAgB;EAC/F,CAAC;CACF;AACD"}
1
+ {"version":3,"file":"diff-database-schema-J96mtg_F-BHpzbMoj.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/diff-database-schema-J96mtg_F.mjs"],"sourcesContent":["import { u as postgresError } from \"./errors-C4-Dp3gI.mjs\";\nimport { i as fullTextIndexDefinitionOf, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-DzRCaPjb.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-zd_p5Lg2.mjs\";\nimport { t as postgresAccessMethodOf } from \"./index-types-DGrgbAd4.mjs\";\nimport { t as postgresResolveDefault } from \"./default-normalizer-BqK6XxdC.mjs\";\nimport { c as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, o as PostgresSchemaNodeKind, r as PostgresExtensionSchemaNode, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-OQRI_GIM.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-yFPLQ6U0.mjs\";\nimport { n as renderFullTextIndexDocument } from \"./full-text-search-document-BqqvjJoC.mjs\";\nimport { r as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-ChjIoY0I.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-DKnVhEWD.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { contractNamespaceToSchemaIR, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\textensions: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst extensions = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tfor (const extension of Object.values(ns.extension)) extensions.push(new PostgresExtensionSchemaNode({\n\t\t\tname: extension.name,\n\t\t\tlocation: ns.id === UNBOUND_NAMESPACE_ID ? { kind: \"searchPath\" } : {\n\t\t\t\tkind: \"declared\",\n\t\t\t\tschemaName: resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id)\n\t\t\t},\n\t\t\tcontrol: extension.control\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && entriesKey !== \"extension\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst fullText = fullTextIndexDefinitionOf(i);\n\t\t\t\tif (fullText !== void 0) return new SqlIndexIR({\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: postgresAccessMethodOf(FULL_TEXT_INDEX_TYPE),\n\t\t\t\t\toptions: void 0,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\texpression: renderFullTextIndexDocument(fullText),\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, fullText.weightGroups.flat())\n\t\t\t\t});\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\textensions,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\n/**\n* The installed extension a `not-expected` issue reports, if it reports one. An extension the contract does not declare is never this contract's to report or drop: Postgres always has `plpgsql`, hosts preinstall many more, and a sibling contract space may declare it. Only a plan drops one, and only one its origin contract declared.\n*/\nfunction undeclaredExtensionName(issue) {\n\tif (issueOutcome(issue) !== \"not-expected\" || issue.actual === void 0) return void 0;\n\tconst node = blindCast(issue.actual);\n\treturn PostgresExtensionSchemaNode.is(node) ? node.name : void 0;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\textensions: [...expected.extensions],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (undeclaredExtensionName(issue) !== void 0) return false;\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\textensions: [...actual.extensions],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst types = sqlTypeLookupsOf(input.frameworkComponents);\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst originSchemas = input.originSchemas ?? [];\n\tconst originExtensions = new Set(input.originExtensions ?? []);\n\tconst relationalOwned = /* @__PURE__ */ new Set([...ownedSchemaNames(expected), ...originSchemas]);\n\tconst structuralOwned = /* @__PURE__ */ new Set([...ownedSchemaNames(fullExpected), ...originSchemas]);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tconst extensionName = undeclaredExtensionName(issue);\n\t\t\tif (extensionName !== void 0) return originExtensions.has(extensionName);\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { diffPostgresSchema as n, contractToPostgresDatabaseSchemaNode as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-J96mtg_F.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAA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,kBAAkB,KAAK,GAAG,OAAO,iBAAiB,IAAI,aAAa;GACvE,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;GACnD,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,MAAM,cAAc,+BAA+B,OAAO,8BAA8B;GACxF,MAAM,mBAAmB,MAAM,KAAK;GACpC,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,QAAQ,gBAAgB,eAAe,kBAAkB,gBAAA,CAAiB,IAAI,gBAAgB;EAC/F,CAAC;CACF;AACD"}
@@ -1,6 +1,6 @@
1
1
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
2
2
  import { CliStructuredError } from "@prisma/orm-framework/errors/control";
3
- //#region ../../../3-targets/postgres/1-target/dist/errors-DpdPXR_L.mjs
3
+ //#region ../../../3-targets/postgres/1-target/dist/errors-C4-Dp3gI.mjs
4
4
  function postgresError(code, message, options) {
5
5
  return structuredError(code, message, options);
6
6
  }
@@ -80,7 +80,7 @@ function errorTemporalWrongType(codecId, temporalTag, stringType, received) {
80
80
  /** A date or time codec read text PostgreSQL printed under a DateStyle other than ISO, which no codec reads. */
81
81
  function errorDateStyleNotIso(codecId, received) {
82
82
  return postgresError("RUNTIME.DATE_STYLE_NOT_ISO", `Codec '${codecId}' read ${JSON.stringify(received)}, which PostgreSQL prints only when the connection's DateStyle is not ISO: the driver could not ensure the DateStyle=ISO the PostgreSQL target requires. Prisma reads dates and times only in DateStyle ISO.`, {
83
- why: "PostgreSQL prints a date or timestamp in the DateStyle of the connection. The PostgreSQL driver ensures DateStyle=ISO on every connection it uses: it starts each connection it opens with it, and sets it on a connection the application supplies before first use. A statement that sets DateStyle on a connection undoes that, and so does a connection pooler between Prisma and PostgreSQL that drops the startup option or runs each statement on another server connection.",
83
+ why: "PostgreSQL prints a date or timestamp in the DateStyle of the connection. The PostgreSQL driver ensures DateStyle=ISO on every connection it uses: it starts each connection it opens with it, and sets it on a connection the application supplies before first use. A statement that sets DateStyle on a connection undoes that, and so does a connection pooler between Prisma and PostgreSQL that drops the startup option or runs each statement on another server connection. A write that returns its row, such as create(), gets the row from the same statement, and Prisma decodes it only after PostgreSQL has run the statement: a single statement outside a transaction is already committed when this error is raised, and a transaction that ends with this error is rolled back.",
84
84
  fix: "Do not change DateStyle on a connection Prisma uses. Behind a connection pooler, set DateStyle on the role or database (ALTER ROLE <role> SET DateStyle = 'ISO'), so every server connection holds it.",
85
85
  meta: {
86
86
  codecId,
@@ -91,7 +91,7 @@ function errorDateStyleNotIso(codecId, received) {
91
91
  /** A money codec read text PostgreSQL printed under an `lc_monetary` other than C, which no codec reads. */
92
92
  function errorLcMonetaryNotC(codecId, received) {
93
93
  return postgresError("RUNTIME.LC_MONETARY_NOT_C", `Codec '${codecId}' read ${JSON.stringify(received)}, which PostgreSQL prints only when the connection's lc_monetary is not C: the driver could not ensure the lc_monetary=C the PostgreSQL target requires. Prisma reads money only as PostgreSQL prints it under lc_monetary C, as in $1,234.56 and -$1,234.56.`, {
94
- why: "PostgreSQL prints a money value in the lc_monetary locale of the connection, with that locale's currency symbol, separators and sign. The PostgreSQL driver ensures lc_monetary=C on every connection it uses: it starts each connection it opens with it, and sets it on a connection the application supplies before first use. A statement that sets lc_monetary on a connection undoes that, and so does a connection pooler between Prisma and PostgreSQL that drops the startup option or runs each statement on another server connection.",
94
+ why: "PostgreSQL prints a money value in the lc_monetary locale of the connection, with that locale's currency symbol, separators and sign. The PostgreSQL driver ensures lc_monetary=C on every connection it uses: it starts each connection it opens with it, and sets it on a connection the application supplies before first use. A statement that sets lc_monetary on a connection undoes that, and so does a connection pooler between Prisma and PostgreSQL that drops the startup option or runs each statement on another server connection. A write that returns its row, such as create(), gets the row from the same statement, and Prisma decodes it only after PostgreSQL has run the statement: a single statement outside a transaction is already committed when this error is raised, and a transaction that ends with this error is rolled back.",
95
95
  fix: "Do not change lc_monetary on a connection Prisma uses. Behind a connection pooler, set lc_monetary on the role or database (ALTER ROLE <role> SET lc_monetary = 'C'), so every server connection holds it.",
96
96
  meta: {
97
97
  codecId,
@@ -123,4 +123,4 @@ function errorTemporalNonIsoCalendar(codecId, calendarId) {
123
123
  //#endregion
124
124
  export { errorTemporalUnavailable as a, errorTemporalWrongType as c, errorTemporalNonIsoCalendar as i, errorTimestampTextWrongType as l, errorLcMonetaryNotC as n, errorTemporalUnavailableForDefault as o, errorPostgresMigrationStackMissing as r, errorTemporalUnrepresentable as s, errorDateStyleNotIso as t, postgresError as u };
125
125
 
126
- //# sourceMappingURL=errors-DpdPXR_L-DailcY-X.mjs.map
126
+ //# sourceMappingURL=errors-C4-Dp3gI-B5jY5eJj.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-C4-Dp3gI-B5jY5eJj.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/errors-C4-Dp3gI.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\nimport { CliStructuredError } from \"@internal/errors/control\";\n//#region src/core/errors.ts\nfunction postgresError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n/**\n* A `PostgresMigration` operation that needs the materialized control adapter\n* — named by `operation` (e.g. `createTable`, `dropColumn`, `dataTransform`) —\n* was invoked, but the migration was constructed without a `ControlStack`.\n* Concrete authoring usage always goes through the migration CLI entrypoint,\n* which assembles a stack from the loaded `prisma.config.ts`; reaching this\n* error means a test fixture or ad-hoc consumer instantiated `PostgresMigration`\n* with the no-arg form (legal for `operations` / `describe` introspection only).\n*\n* The `operation` argument is required so every throw site names the operation\n* that actually failed; a new operation cannot inherit a misattributed message.\n*\n* Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)\n* and `MIGRATION.DATA_TRANSFORM_CONTRACT_MISMATCH` (data-transform query\n* plan against wrong contract) because the missing input is the stack\n* itself, not the per-operation contract.\n*\n* Lives in `@internal/target-postgres/errors` rather than the shared\n* framework migration errors module because the failure is target-specific:\n* the contract it talks about (`PostgresMigration`, the Postgres control\n* adapter, the Postgres-target stack) only exists in this package.\n*/\nfunction errorPostgresMigrationStackMissing(operation) {\n\treturn new CliStructuredError(\"MIGRATION.POSTGRES_CONTROL_STACK_MISSING\", `PostgresMigration.${operation} requires a control adapter`, {\n\t\twhy: `PostgresMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its plan.`,\n\t\tfix: \"Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma.config.ts), or pass a ControlStack containing a Postgres adapter to the migration constructor in test fixtures.\",\n\t\tmeta: { operation }\n\t});\n}\nconst TEMPORAL_UNAVAILABLE_FIX = \"Run on a runtime with Temporal available, install a Temporal polyfill before creating the client, or write the column as a convenience type at its default, which needs no Temporal: `DateTime` reads a JavaScript `Date`, and `Date`, `Time` and `Duration` read ISO 8601 strings.\";\nfunction errorTemporalUnavailable(codecId, operation) {\n\treturn postgresError(\"RUNTIME.TEMPORAL_UNAVAILABLE\", `Codec '${codecId}' cannot ${operation} a value because this runtime has no global Temporal implementation.`, {\n\t\twhy: \"Temporal-backed codecs read and write their values through the global Temporal API, which this runtime does not provide.\",\n\t\tfix: TEMPORAL_UNAVAILABLE_FIX,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\toperation\n\t\t}\n\t});\n}\nfunction errorTemporalUnavailableForDefault(generatorId) {\n\treturn postgresError(\"RUNTIME.TEMPORAL_UNAVAILABLE\", `Mutation default generator '${generatorId}' cannot produce a value because this runtime has no global Temporal implementation.`, {\n\t\twhy: \"The generator answers a Temporal-backed column, so the value it produces is a Temporal value, which this runtime cannot construct.\",\n\t\tfix: TEMPORAL_UNAVAILABLE_FIX,\n\t\tmeta: { generatorId }\n\t});\n}\nfunction errorTemporalUnrepresentable(options) {\n\tconst { codecId, operation, stringType, value, detail } = options;\n\treturn postgresError(operation === \"decode\" ? \"RUNTIME.DECODE_FAILED\" : \"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' cannot represent the value ${operation === \"decode\" ? \"PostgreSQL returned\" : \"the application supplied\"}: ${JSON.stringify(value)} — ${detail}. Use ${stringType} to carry this column as ISO 8601 text.`, {\n\t\twhy: `${detail}. Temporal is the authoritative parser and range check for this codec, so a value it cannot express has no representation on this column.`,\n\t\tfix: `Author the column as ${stringType} to read and write it as ISO 8601 text, which holds every value the database accepts.`,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\toperation,\n\t\t\tvalue,\n\t\t\tstringType\n\t\t},\n\t\t...options.cause === void 0 ? {} : { cause: options.cause }\n\t});\n}\nfunction errorTemporalWrongType(codecId, temporalTag, stringType, received) {\n\treturn postgresError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' encodes a ${temporalTag}, but received ${received}.`, {\n\t\twhy: \"The codec serializes through the Temporal value's own toString(). A different type reaches PostgreSQL in a spelling it does not accept, and the resulting error names the column rather than the codec.\",\n\t\tfix: `Pass a ${temporalTag}, or author the column with its ${stringType} type to write ISO 8601 text.`,\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\ttemporalTag,\n\t\t\tstringType,\n\t\t\treceived\n\t\t}\n\t});\n}\n/** A date or time codec read text PostgreSQL printed under a DateStyle other than ISO, which no codec reads. */\nfunction errorDateStyleNotIso(codecId, received) {\n\treturn postgresError(\"RUNTIME.DATE_STYLE_NOT_ISO\", `Codec '${codecId}' read ${JSON.stringify(received)}, which PostgreSQL prints only when the connection's DateStyle is not ISO: the driver could not ensure the DateStyle=ISO the PostgreSQL target requires. Prisma reads dates and times only in DateStyle ISO.`, {\n\t\twhy: \"PostgreSQL prints a date or timestamp in the DateStyle of the connection. The PostgreSQL driver ensures DateStyle=ISO on every connection it uses: it starts each connection it opens with it, and sets it on a connection the application supplies before first use. A statement that sets DateStyle on a connection undoes that, and so does a connection pooler between Prisma and PostgreSQL that drops the startup option or runs each statement on another server connection. A write that returns its row, such as create(), gets the row from the same statement, and Prisma decodes it only after PostgreSQL has run the statement: a single statement outside a transaction is already committed when this error is raised, and a transaction that ends with this error is rolled back.\",\n\t\tfix: \"Do not change DateStyle on a connection Prisma uses. Behind a connection pooler, set DateStyle on the role or database (ALTER ROLE <role> SET DateStyle = 'ISO'), so every server connection holds it.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\treceived: received.slice(0, 100)\n\t\t}\n\t});\n}\n/** A money codec read text PostgreSQL printed under an `lc_monetary` other than C, which no codec reads. */\nfunction errorLcMonetaryNotC(codecId, received) {\n\treturn postgresError(\"RUNTIME.LC_MONETARY_NOT_C\", `Codec '${codecId}' read ${JSON.stringify(received)}, which PostgreSQL prints only when the connection's lc_monetary is not C: the driver could not ensure the lc_monetary=C the PostgreSQL target requires. Prisma reads money only as PostgreSQL prints it under lc_monetary C, as in $1,234.56 and -$1,234.56.`, {\n\t\twhy: \"PostgreSQL prints a money value in the lc_monetary locale of the connection, with that locale's currency symbol, separators and sign. The PostgreSQL driver ensures lc_monetary=C on every connection it uses: it starts each connection it opens with it, and sets it on a connection the application supplies before first use. A statement that sets lc_monetary on a connection undoes that, and so does a connection pooler between Prisma and PostgreSQL that drops the startup option or runs each statement on another server connection. A write that returns its row, such as create(), gets the row from the same statement, and Prisma decodes it only after PostgreSQL has run the statement: a single statement outside a transaction is already committed when this error is raised, and a transaction that ends with this error is rolled back.\",\n\t\tfix: \"Do not change lc_monetary on a connection Prisma uses. Behind a connection pooler, set lc_monetary on the role or database (ALTER ROLE <role> SET lc_monetary = 'C'), so every server connection holds it.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\treceived: received.slice(0, 100)\n\t\t}\n\t});\n}\n/** A string timestamp codec received something other than text, such as a `Date` from a contract emitted before its generator wrote text. */\nfunction errorTimestampTextWrongType(codecId, received) {\n\treturn postgresError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' writes ISO 8601 text, but received ${received}.`, {\n\t\twhy: \"The codec sends its value to PostgreSQL unchanged. A Date would be sent in the process's local time zone, and a timestamp column without a time zone would store the wrong wall-clock time.\",\n\t\tfix: \"Pass the timestamp as ISO 8601 text, such as \\\"2024-01-02T03:04:05.678\\\". If the value came from a generated default, emit the contract again: a contract emitted by an earlier version pairs this column with timestampNow, which generates a Date.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\treceived\n\t\t}\n\t});\n}\nfunction errorTemporalNonIsoCalendar(codecId, calendarId) {\n\treturn postgresError(\"RUNTIME.ENCODE_FAILED\", `Codec '${codecId}' accepts only the iso8601 calendar, but the value carries '${calendarId}'.`, {\n\t\twhy: \"PostgreSQL stores no calendar alongside a date, so a non-ISO calendar would be discarded on write and the value would read back as a different date than the one authored.\",\n\t\tfix: \"Convert the value with .withCalendar(\\\"iso8601\\\") before writing if the ISO projection is what you mean to store.\",\n\t\tmeta: {\n\t\t\tcodecId,\n\t\t\tcalendarId\n\t\t}\n\t});\n}\n//#endregion\nexport { errorTemporalUnavailable as a, errorTemporalWrongType as c, errorTemporalNonIsoCalendar as i, errorTimestampTextWrongType as l, errorLcMonetaryNotC as n, errorTemporalUnavailableForDefault as o, errorPostgresMigrationStackMissing as r, errorTemporalUnrepresentable as s, errorDateStyleNotIso as t, postgresError as u };\n\n//# sourceMappingURL=errors-C4-Dp3gI.mjs.map"],"mappings":";;;AAGA,SAAS,cAAc,MAAM,SAAS,SAAS;CAC9C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,mCAAmC,WAAW;CACtD,OAAO,IAAI,mBAAmB,4CAA4C,qBAAqB,UAAU,8BAA8B;EACtI,KAAK,qBAAqB,UAAU;EACpC,KAAK;EACL,MAAM,EAAE,UAAU;CACnB,CAAC;AACF;AACA,MAAM,2BAA2B;AACjC,SAAS,yBAAyB,SAAS,WAAW;CACrD,OAAO,cAAc,gCAAgC,UAAU,QAAQ,WAAW,UAAU,uEAAuE;EAClK,KAAK;EACL,KAAK;EACL,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,mCAAmC,aAAa;CACxD,OAAO,cAAc,gCAAgC,+BAA+B,YAAY,uFAAuF;EACtL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AM;GACL;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,4BAA4B,SAAS,YAAY;CACzD,OAAO,cAAc,yBAAyB,UAAU,QAAQ,8DAA8D,WAAW,KAAK;EAC7I,KAAK;EACL,KAAK;EACL,MAAM;GACL;GACA;EACD;CACD,CAAC;AACF"}
@@ -1,5 +1,5 @@
1
- import { u as postgresError } from "./errors-DpdPXR_L-DailcY-X.mjs";
2
- import { c as toTsquery, i as languageLiteral } from "./full-text-parsers-DIfNR9AQ-tVmTju-Y.mjs";
1
+ import { u as postgresError } from "./errors-C4-Dp3gI-B5jY5eJj.mjs";
2
+ import { c as toTsquery, i as languageLiteral } from "./full-text-parsers-D-2uupNS-6woSZ16T.mjs";
3
3
  //#region ../../../3-targets/postgres/1-target/dist/full-text.mjs
4
4
  /**
5
5
  * An empty term, `''`, is a `tsquery` syntax error; a single space parses as a term with no words,
@@ -36,4 +36,4 @@ function tsquery(first, ...values) {
36
36
  //#endregion
37
37
  export { tsquery as t };
38
38
 
39
- //# sourceMappingURL=full-text-B9mXDcsJ.mjs.map
39
+ //# sourceMappingURL=full-text-DGFJd1R3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"full-text-B9mXDcsJ.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text.mjs"],"sourcesContent":["import { u as postgresError } from \"./errors-DpdPXR_L.mjs\";\nimport \"./full-text-index-definition-MfjtL-x7.mjs\";\nimport { c as FullTextDocument, i as websearchToTsquery, l as fullTextDocument, n as plaintoTsquery, o as languageLiteral, r as toTsquery, t as phrasetoTsquery } from \"./full-text-parsers-DIfNR9AQ.mjs\";\n//#region src/core/tsquery-tag.ts\n/**\n* An empty term, `''`, is a `tsquery` syntax error; a single space parses as a term with no words,\n* as a stop word does.\n*/\nfunction quotedTerm(value) {\n\treturn value === \"\" ? \"' '\" : `'${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"'\", \"''\")}'`;\n}\nfunction literalPart(strings, index) {\n\tconst part = strings[index];\n\tif (part === void 0) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", `tsquery: literal part ${index} of the template has an invalid escape sequence.`, {\n\t\twhy: \"JavaScript gives a template tag no text for a literal part with an invalid escape such as \\\\u or \\\\x, so the tsquery syntax written there would be lost.\",\n\t\tfix: \"Write a literal backslash as \\\\\\\\, or remove the escape.\",\n\t\tmeta: {\n\t\t\thelper: \"tsquery\",\n\t\t\targument: `literal part ${index}`,\n\t\t\treceived: strings.raw[index]\n\t\t}\n\t});\n\treturn part;\n}\nfunction assemble(strings, values) {\n\treturn values.reduce((text, value, i) => `${text}${quotedTerm(value)}${literalPart(strings, i + 1)}`, literalPart(strings, 0));\n}\nfunction isTemplate(value) {\n\treturn Array.isArray(value);\n}\nfunction tsquery(first, ...values) {\n\tif (isTemplate(first)) return toTsquery(assemble(first, values));\n\tconst language = first.language ?? \"english\";\n\tlanguageLiteral(\"tsquery\", language);\n\treturn (strings, ...templateValues) => toTsquery(assemble(strings, templateValues), { language });\n}\n//#endregion\nexport { FullTextDocument, fullTextDocument, phrasetoTsquery, plaintoTsquery, toTsquery, tsquery, websearchToTsquery };\n\n//# sourceMappingURL=full-text.mjs.map"],"mappings":";;;;;;;AAQA,SAAS,WAAW,OAAO;CAC1B,OAAO,UAAU,KAAK,QAAQ,IAAI,MAAM,WAAW,MAAM,MAAM,CAAC,CAAC,WAAW,KAAK,IAAI,EAAE;AACxF;AACA,SAAS,YAAY,SAAS,OAAO;CACpC,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAK,GAAG,MAAM,cAAc,4BAA4B,yBAAyB,MAAM,mDAAmD;EACtJ,KAAK;EACL,KAAK;EACL,MAAM;GACL,QAAQ;GACR,UAAU,gBAAgB;GAC1B,UAAU,QAAQ,IAAI;EACvB;CACD,CAAC;CACD,OAAO;AACR;AACA,SAAS,SAAS,SAAS,QAAQ;CAClC,OAAO,OAAO,QAAQ,MAAM,OAAO,MAAM,GAAG,OAAO,WAAW,KAAK,IAAI,YAAY,SAAS,IAAI,CAAC,KAAK,YAAY,SAAS,CAAC,CAAC;AAC9H;AACA,SAAS,WAAW,OAAO;CAC1B,OAAO,MAAM,QAAQ,KAAK;AAC3B;AACA,SAAS,QAAQ,OAAO,GAAG,QAAQ;CAClC,IAAI,WAAW,KAAK,GAAG,OAAO,UAAU,SAAS,OAAO,MAAM,CAAC;CAC/D,MAAM,WAAW,MAAM,YAAY;CACnC,gBAAgB,WAAW,QAAQ;CACnC,QAAQ,SAAS,GAAG,mBAAmB,UAAU,SAAS,SAAS,cAAc,GAAG,EAAE,SAAS,CAAC;AACjG"}
1
+ {"version":3,"file":"full-text-DGFJd1R3.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text.mjs"],"sourcesContent":["import { u as postgresError } from \"./errors-C4-Dp3gI.mjs\";\nimport \"./full-text-index-definition-DzRCaPjb.mjs\";\nimport { c as FullTextDocument, i as websearchToTsquery, l as fullTextDocument, n as plaintoTsquery, o as languageLiteral, r as toTsquery, t as phrasetoTsquery } from \"./full-text-parsers-D-2uupNS.mjs\";\n//#region src/core/tsquery-tag.ts\n/**\n* An empty term, `''`, is a `tsquery` syntax error; a single space parses as a term with no words,\n* as a stop word does.\n*/\nfunction quotedTerm(value) {\n\treturn value === \"\" ? \"' '\" : `'${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"'\", \"''\")}'`;\n}\nfunction literalPart(strings, index) {\n\tconst part = strings[index];\n\tif (part === void 0) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", `tsquery: literal part ${index} of the template has an invalid escape sequence.`, {\n\t\twhy: \"JavaScript gives a template tag no text for a literal part with an invalid escape such as \\\\u or \\\\x, so the tsquery syntax written there would be lost.\",\n\t\tfix: \"Write a literal backslash as \\\\\\\\, or remove the escape.\",\n\t\tmeta: {\n\t\t\thelper: \"tsquery\",\n\t\t\targument: `literal part ${index}`,\n\t\t\treceived: strings.raw[index]\n\t\t}\n\t});\n\treturn part;\n}\nfunction assemble(strings, values) {\n\treturn values.reduce((text, value, i) => `${text}${quotedTerm(value)}${literalPart(strings, i + 1)}`, literalPart(strings, 0));\n}\nfunction isTemplate(value) {\n\treturn Array.isArray(value);\n}\nfunction tsquery(first, ...values) {\n\tif (isTemplate(first)) return toTsquery(assemble(first, values));\n\tconst language = first.language ?? \"english\";\n\tlanguageLiteral(\"tsquery\", language);\n\treturn (strings, ...templateValues) => toTsquery(assemble(strings, templateValues), { language });\n}\n//#endregion\nexport { FullTextDocument, fullTextDocument, phrasetoTsquery, plaintoTsquery, toTsquery, tsquery, websearchToTsquery };\n\n//# sourceMappingURL=full-text.mjs.map"],"mappings":";;;;;;;AAQA,SAAS,WAAW,OAAO;CAC1B,OAAO,UAAU,KAAK,QAAQ,IAAI,MAAM,WAAW,MAAM,MAAM,CAAC,CAAC,WAAW,KAAK,IAAI,EAAE;AACxF;AACA,SAAS,YAAY,SAAS,OAAO;CACpC,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAK,GAAG,MAAM,cAAc,4BAA4B,yBAAyB,MAAM,mDAAmD;EACtJ,KAAK;EACL,KAAK;EACL,MAAM;GACL,QAAQ;GACR,UAAU,gBAAgB;GAC1B,UAAU,QAAQ,IAAI;EACvB;CACD,CAAC;CACD,OAAO;AACR;AACA,SAAS,SAAS,SAAS,QAAQ;CAClC,OAAO,OAAO,QAAQ,MAAM,OAAO,MAAM,GAAG,OAAO,WAAW,KAAK,IAAI,YAAY,SAAS,IAAI,CAAC,KAAK,YAAY,SAAS,CAAC,CAAC;AAC9H;AACA,SAAS,WAAW,OAAO;CAC1B,OAAO,MAAM,QAAQ,KAAK;AAC3B;AACA,SAAS,QAAQ,OAAO,GAAG,QAAQ;CAClC,IAAI,WAAW,KAAK,GAAG,OAAO,UAAU,SAAS,OAAO,MAAM,CAAC;CAC/D,MAAM,WAAW,MAAM,YAAY;CACnC,gBAAgB,WAAW,QAAQ;CACnC,QAAQ,SAAS,GAAG,mBAAmB,UAAU,SAAS,SAAS,cAAc,GAAG,EAAE,SAAS,CAAC;AACjG"}
@@ -1,7 +1,7 @@
1
- import { u as postgresError } from "./errors-DpdPXR_L-DailcY-X.mjs";
1
+ import { u as postgresError } from "./errors-C4-Dp3gI-B5jY5eJj.mjs";
2
2
  import { type } from "arktype";
3
3
  import { invariant } from "@prisma/orm-framework/utils/assertions";
4
- //#region ../../../3-targets/postgres/1-target/dist/full-text-index-definition-MfjtL-x7.mjs
4
+ //#region ../../../3-targets/postgres/1-target/dist/full-text-index-definition-DzRCaPjb.mjs
5
5
  /** The weights Postgres's `setweight` takes, strongest first. Each weight group takes the next one. */
6
6
  const FULL_TEXT_WEIGHTS = [
7
7
  "A",
@@ -192,4 +192,4 @@ function invalidFullTextIndex(index, message, why) {
192
192
  //#endregion
193
193
  export { assertFullTextIndexes as a, fullTextIndexOptions as c, isFullTextSearchLanguage as d, weightGroupsOf as f, POSTGRES_TEXT_SEARCH_LANGUAGES as i, fullTextIndexProblems as l, FULL_TEXT_INDEX_TYPE as n, describeFullTextIndexProblem as o, FULL_TEXT_WEIGHTS as r, fullTextIndexDefinitionOf as s, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE as t, fullTextIndexType as u };
194
194
 
195
- //# sourceMappingURL=full-text-index-definition-MfjtL-x7-ImaTAFMs.mjs.map
195
+ //# sourceMappingURL=full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"full-text-index-definition-MfjtL-x7-ImaTAFMs.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-index-definition-MfjtL-x7.mjs"],"sourcesContent":["import { u as postgresError } from \"./errors-DpdPXR_L.mjs\";\nimport { type } from \"arktype\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/core/full-text-weight-groups.ts\n/** The weights Postgres's `setweight` takes, strongest first. Each weight group takes the next one. */\nconst FULL_TEXT_WEIGHTS = [\n\t\"A\",\n\t\"B\",\n\t\"C\",\n\t\"D\"\n];\nfunction weightGroupsOf(fields, isField) {\n\tif (isField(fields)) return [[fields]];\n\treturn fields.map((item) => isField(item) ? [item] : item);\n}\n//#endregion\n//#region src/core/text-search-languages.ts\n/**\n* The text-search configurations a stock PostgreSQL server ships with. The language reaches SQL as\n* an inline literal rather than a bound parameter, so only names on this list may be used.\n*/\nconst POSTGRES_TEXT_SEARCH_LANGUAGES = [\n\t\"simple\",\n\t\"arabic\",\n\t\"armenian\",\n\t\"basque\",\n\t\"catalan\",\n\t\"danish\",\n\t\"dutch\",\n\t\"english\",\n\t\"finnish\",\n\t\"french\",\n\t\"german\",\n\t\"greek\",\n\t\"hindi\",\n\t\"hungarian\",\n\t\"indonesian\",\n\t\"irish\",\n\t\"italian\",\n\t\"lithuanian\",\n\t\"nepali\",\n\t\"norwegian\",\n\t\"portuguese\",\n\t\"romanian\",\n\t\"russian\",\n\t\"serbian\",\n\t\"spanish\",\n\t\"swedish\",\n\t\"tamil\",\n\t\"turkish\",\n\t\"yiddish\"\n];\nconst DEFAULT_FULL_TEXT_SEARCH_LANGUAGE = \"english\";\nconst KNOWN_LANGUAGES = new Set(POSTGRES_TEXT_SEARCH_LANGUAGES);\nfunction isFullTextSearchLanguage(language) {\n\treturn KNOWN_LANGUAGES.has(language);\n}\n//#endregion\n//#region src/core/full-text-index-definition.ts\n/** The index type a full-text index is registered under. */\nconst FULL_TEXT_INDEX_TYPE = \"fullText\";\n/** The traits the codec of every column a full-text index covers must carry. */\nconst FULL_TEXT_COLUMN_TRAITS = [\"textual\"];\n/**\n* The rules of a full-text index, stated once: one to four weight groups, none empty, each field\n* once, text columns only, and not unique. Every site that checks a full-text index calls this.\n*/\nfunction fullTextIndexProblems(candidate) {\n\tconst { weightGroups } = candidate;\n\tconst problems = [];\n\tif (weightGroups.length === 0) problems.push({ kind: \"no-fields\" });\n\tif (weightGroups.length > FULL_TEXT_WEIGHTS.length) problems.push({\n\t\tkind: \"too-many-groups\",\n\t\tgroupCount: weightGroups.length\n\t});\n\tweightGroups.forEach((group, position) => {\n\t\tif (group.length === 0) problems.push({\n\t\t\tkind: \"empty-group\",\n\t\t\tposition\n\t\t});\n\t});\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const field of weightGroups.flat()) {\n\t\tif (seen.has(field)) problems.push({\n\t\t\tkind: \"duplicate-field\",\n\t\t\tfield\n\t\t});\n\t\tseen.add(field);\n\t}\n\tconst { codecs } = candidate;\n\tif (codecs !== void 0) for (const field of new Set(weightGroups.flat())) {\n\t\tconst codecId = codecs.codecIdOf(field);\n\t\tif (codecId === void 0 || !carriesFullTextTraits(codecs.traitsOf(codecId))) problems.push({\n\t\t\tkind: \"not-text\",\n\t\t\tfield,\n\t\t\tcodecId\n\t\t});\n\t}\n\tif (candidate.unique === true) problems.push({ kind: \"unique\" });\n\treturn problems;\n}\nfunction carriesFullTextTraits(traits) {\n\treturn traits !== void 0 && FULL_TEXT_COLUMN_TRAITS.every((trait) => traits.includes(trait));\n}\nfunction describeFullTextIndexProblem(subject, problem, fieldLabel = (field) => field) {\n\tswitch (problem.kind) {\n\t\tcase \"no-fields\": return `${subject} needs at least one field.`;\n\t\tcase \"too-many-groups\": return `${subject} takes at most ${FULL_TEXT_WEIGHTS.length} weight groups, one for each of the weights ${FULL_TEXT_WEIGHTS.join(\", \")}, but was given ${problem.groupCount}.`;\n\t\tcase \"empty-group\": return `${subject} has an empty weight group at position ${problem.position + 1}.`;\n\t\tcase \"duplicate-field\": return `${subject} names the field \"${fieldLabel(problem.field)}\" more than once.`;\n\t\tcase \"not-text\": return `${subject} indexes text columns, but \"${fieldLabel(problem.field)}\" is ${problem.codecId === void 0 ? \"not a stored scalar field\" : `stored as \\`${problem.codecId}\\``}.`;\n\t\tcase \"unique\": return `${subject} is unique, but Postgres builds no unique gin index.`;\n\t}\n}\n/** The options of a full-text index: its weight groups, as storage column names, and its language. */\nconst fullTextIndexOptions = type({\n\t\"+\": \"reject\",\n\tweightGroups: type(\"string > 0\").array().array().narrow((weightGroups, ctx) => {\n\t\tconst [problem] = fullTextIndexProblems({ weightGroups });\n\t\treturn problem === void 0 || ctx.reject({ message: describeFullTextIndexProblem(\"a full-text index\", problem) });\n\t}),\n\tlanguage: type.enumerated(...POSTGRES_TEXT_SEARCH_LANGUAGES)\n});\n/**\n* The registration of the full-text index type. Its options are the index's definition, not\n* storage parameters, and the target turns them into a `gin` index over the rendered search\n* document.\n*/\nconst fullTextIndexType = {\n\toptions: fullTextIndexOptions,\n\taccessMethod: \"gin\",\n\tcolumnTraits: FULL_TEXT_COLUMN_TRAITS\n};\n/**\n* The definition a full-text index carries, or `undefined` for an index of any other type. It\n* reads an index {@link assertFullTextIndexes} has accepted, as every loaded contract's has been.\n*/\nfunction fullTextIndexDefinitionOf(index) {\n\tif (index.type !== \"fullText\") return void 0;\n\tconst definition = fullTextIndexOptions(index.options ?? {});\n\tinvariant(!(definition instanceof type.errors), \"a full-text index is read only after its contract was checked\");\n\treturn definition;\n}\n/**\n* Refuses a table's full-text index the contract cannot carry: invalid options, a broken rule of\n* {@link fullTextIndexProblems}, `columns` that are not the fields of its weight groups, in order,\n* or a foreign key that names it as its backing index. The text-columns rule is checked only when\n* `traitsOf` is given.\n*/\nfunction assertFullTextIndexes(table, traitsOf) {\n\tconst codecs = traitsOf === void 0 ? void 0 : {\n\t\tcodecIdOf: (column) => table.columns[column]?.codecId,\n\t\ttraitsOf\n\t};\n\tfor (const index of table.indexes) assertFullTextIndex(index, codecs);\n\tfor (const foreignKey of table.foreignKeys) {\n\t\tconst backing = foreignKey.index;\n\t\tif (backing === void 0 || !(\"name\" in backing)) continue;\n\t\tconst index = table.indexes.find((candidate) => candidate.name === backing.name);\n\t\tif (index?.type !== \"fullText\") continue;\n\t\tthrow postgresError(\"CONTRACT.INDEX_INVALID\", `The foreign key on columns (${foreignKey.source.columns.join(\", \")}) is backed by full-text index \"${index.name}\".`, {\n\t\t\twhy: \"A full-text index is a gin index over a search document rendered from its weight groups, not over its columns, so it does not serve the foreign key's lookups.\",\n\t\t\tfix: \"Re-emit the contract from its source, where a relation cannot name a full-text index as its index.\",\n\t\t\tmeta: {\n\t\t\t\tindex: index.name,\n\t\t\t\tcolumns: foreignKey.source.columns\n\t\t\t}\n\t\t});\n\t}\n}\nfunction assertFullTextIndex(index, codecs) {\n\tif (index.type !== \"fullText\") return;\n\tconst definition = fullTextIndexOptions(index.options ?? {});\n\tif (definition instanceof type.errors) throw invalidFullTextIndex(index, `Full-text index \"${index.name}\" has invalid options: ${definition.summary}`, \"The options of a full-text index are its definition: its weight groups and its language.\");\n\tconst [problem] = fullTextIndexProblems({\n\t\tweightGroups: definition.weightGroups,\n\t\tunique: index.unique,\n\t\tcodecs\n\t});\n\tif (problem !== void 0) throw invalidFullTextIndex(index, describeFullTextIndexProblem(`Full-text index \"${index.name}\"`, problem), \"A full-text index is a gin index over text columns, in one to four weight groups that name each column once.\");\n\tconst fields = definition.weightGroups.flat();\n\tconst columns = index.columns ?? [];\n\tif (columns.length !== fields.length || columns.some((column, i) => column !== fields[i])) throw invalidFullTextIndex(index, `Full-text index \"${index.name}\" covers the columns [${columns.join(\", \")}], but its weight groups name [${fields.join(\", \")}].`, \"The columns of a full-text index are the fields of its weight groups, in order. Foreign-key backing and the printer read the columns; the search document is rendered from the groups, so the two must agree.\");\n}\nfunction invalidFullTextIndex(index, message, why) {\n\treturn postgresError(\"CONTRACT.INDEX_INVALID\", message, {\n\t\twhy,\n\t\tfix: \"Re-emit the contract from its `@@fullTextIndex` or `fullTextIndex` source rather than editing the index by hand.\",\n\t\tmeta: {\n\t\t\tindex: index.name,\n\t\t\tcolumns: index.columns,\n\t\t\toptions: index.options\n\t\t}\n\t});\n}\n//#endregion\nexport { fullTextIndexOptions as a, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE as c, FULL_TEXT_WEIGHTS as d, weightGroupsOf as f, fullTextIndexDefinitionOf as i, POSTGRES_TEXT_SEARCH_LANGUAGES as l, assertFullTextIndexes as n, fullTextIndexProblems as o, describeFullTextIndexProblem as r, fullTextIndexType as s, FULL_TEXT_INDEX_TYPE as t, isFullTextSearchLanguage as u };\n\n//# sourceMappingURL=full-text-index-definition-MfjtL-x7.mjs.map"],"mappings":";;;;;AAKA,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;AACD;AACA,SAAS,eAAe,QAAQ,SAAS;CACxC,IAAI,QAAQ,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC;CACrC,OAAO,OAAO,KAAK,SAAS,QAAQ,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI;AAC1D;;;;;AAOA,MAAM,iCAAiC;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,oCAAoC;AAC1C,MAAM,kBAAkB,IAAI,IAAI,8BAA8B;AAC9D,SAAS,yBAAyB,UAAU;CAC3C,OAAO,gBAAgB,IAAI,QAAQ;AACpC;;AAIA,MAAM,uBAAuB;;AAE7B,MAAM,0BAA0B,CAAC,SAAS;;;;;AAK1C,SAAS,sBAAsB,WAAW;CACzC,MAAM,EAAE,iBAAiB;CACzB,MAAM,WAAW,CAAC;CAClB,IAAI,aAAa,WAAW,GAAG,SAAS,KAAK,EAAE,MAAM,YAAY,CAAC;CAClE,IAAI,aAAa,SAAS,kBAAkB,QAAQ,SAAS,KAAK;EACjE,MAAM;EACN,YAAY,aAAa;CAC1B,CAAC;CACD,aAAa,SAAS,OAAO,aAAa;EACzC,IAAI,MAAM,WAAW,GAAG,SAAS,KAAK;GACrC,MAAM;GACN;EACD,CAAC;CACF,CAAC;CACD,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,SAAS,aAAa,KAAK,GAAG;EACxC,IAAI,KAAK,IAAI,KAAK,GAAG,SAAS,KAAK;GAClC,MAAM;GACN;EACD,CAAC;EACD,KAAK,IAAI,KAAK;CACf;CACA,MAAM,EAAE,W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WAAW;EACzB,QAAQ,MAAM;EACd;CACD,CAAC;CACD,IAAI,YAAY,KAAK,GAAG,MAAM,qBAAqB,OAAO,6BAA6B,oBAAoB,MAAM,KAAK,IAAI,OAAO,GAAG,8GAA8G;CAClP,MAAM,SAAS,WAAW,aAAa,KAAK;CAC5C,MAAM,UAAU,MAAM,WAAW,CAAC;CAClC,IAAI,QAAQ,WAAW,OAAO,UAAU,QAAQ,MAAM,QAAQ,MAAM,WAAW,OAAO,EAAE,GAAG,MAAM,qBAAqB,OAAO,oBAAoB,MAAM,KAAK,wBAAwB,QAAQ,KAAK,IAAI,EAAE,iCAAiC,OAAO,KAAK,IAAI,EAAE,KAAK,+MAA+M;AAC/c;AACA,SAAS,qBAAqB,OAAO,SAAS,KAAK;CAClD,OAAO,cAAc,0BAA0B,SAAS;EACvD;EACA,KAAK;EACL,MAAM;GACL,OAAO,MAAM;GACb,SAAS,MAAM;GACf,SAAS,MAAM;EAChB;CACD,CAAC;AACF"}
1
+ {"version":3,"file":"full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-index-definition-DzRCaPjb.mjs"],"sourcesContent":["import { u as postgresError } from \"./errors-C4-Dp3gI.mjs\";\nimport { type } from \"arktype\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/core/full-text-weight-groups.ts\n/** The weights Postgres's `setweight` takes, strongest first. Each weight group takes the next one. */\nconst FULL_TEXT_WEIGHTS = [\n\t\"A\",\n\t\"B\",\n\t\"C\",\n\t\"D\"\n];\nfunction weightGroupsOf(fields, isField) {\n\tif (isField(fields)) return [[fields]];\n\treturn fields.map((item) => isField(item) ? [item] : item);\n}\n//#endregion\n//#region src/core/text-search-languages.ts\n/**\n* The text-search configurations a stock PostgreSQL server ships with. The language reaches SQL as\n* an inline literal rather than a bound parameter, so only names on this list may be used.\n*/\nconst POSTGRES_TEXT_SEARCH_LANGUAGES = [\n\t\"simple\",\n\t\"arabic\",\n\t\"armenian\",\n\t\"basque\",\n\t\"catalan\",\n\t\"danish\",\n\t\"dutch\",\n\t\"english\",\n\t\"finnish\",\n\t\"french\",\n\t\"german\",\n\t\"greek\",\n\t\"hindi\",\n\t\"hungarian\",\n\t\"indonesian\",\n\t\"irish\",\n\t\"italian\",\n\t\"lithuanian\",\n\t\"nepali\",\n\t\"norwegian\",\n\t\"portuguese\",\n\t\"romanian\",\n\t\"russian\",\n\t\"serbian\",\n\t\"spanish\",\n\t\"swedish\",\n\t\"tamil\",\n\t\"turkish\",\n\t\"yiddish\"\n];\nconst DEFAULT_FULL_TEXT_SEARCH_LANGUAGE = \"english\";\nconst KNOWN_LANGUAGES = new Set(POSTGRES_TEXT_SEARCH_LANGUAGES);\nfunction isFullTextSearchLanguage(language) {\n\treturn KNOWN_LANGUAGES.has(language);\n}\n//#endregion\n//#region src/core/full-text-index-definition.ts\n/** The index type a full-text index is registered under. */\nconst FULL_TEXT_INDEX_TYPE = \"fullText\";\n/** The traits the codec of every column a full-text index covers must carry. */\nconst FULL_TEXT_COLUMN_TRAITS = [\"textual\"];\n/**\n* The rules of a full-text index, stated once: one to four weight groups, none empty, each field\n* once, text columns only, and not unique. Every site that checks a full-text index calls this.\n*/\nfunction fullTextIndexProblems(candidate) {\n\tconst { weightGroups } = candidate;\n\tconst problems = [];\n\tif (weightGroups.length === 0) problems.push({ kind: \"no-fields\" });\n\tif (weightGroups.length > FULL_TEXT_WEIGHTS.length) problems.push({\n\t\tkind: \"too-many-groups\",\n\t\tgroupCount: weightGroups.length\n\t});\n\tweightGroups.forEach((group, position) => {\n\t\tif (group.length === 0) problems.push({\n\t\t\tkind: \"empty-group\",\n\t\t\tposition\n\t\t});\n\t});\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const field of weightGroups.flat()) {\n\t\tif (seen.has(field)) problems.push({\n\t\t\tkind: \"duplicate-field\",\n\t\t\tfield\n\t\t});\n\t\tseen.add(field);\n\t}\n\tconst { codecs } = candidate;\n\tif (codecs !== void 0) for (const field of new Set(weightGroups.flat())) {\n\t\tconst codecId = codecs.codecIdOf(field);\n\t\tif (codecId === void 0 || !carriesFullTextTraits(codecs.traitsOf(codecId))) problems.push({\n\t\t\tkind: \"not-text\",\n\t\t\tfield,\n\t\t\tcodecId\n\t\t});\n\t}\n\tif (candidate.unique === true) problems.push({ kind: \"unique\" });\n\treturn problems;\n}\nfunction carriesFullTextTraits(traits) {\n\treturn traits !== void 0 && FULL_TEXT_COLUMN_TRAITS.every((trait) => traits.includes(trait));\n}\nfunction describeFullTextIndexProblem(subject, problem, fieldLabel = (field) => field) {\n\tswitch (problem.kind) {\n\t\tcase \"no-fields\": return `${subject} needs at least one field.`;\n\t\tcase \"too-many-groups\": return `${subject} takes at most ${FULL_TEXT_WEIGHTS.length} weight groups, one for each of the weights ${FULL_TEXT_WEIGHTS.join(\", \")}, but was given ${problem.groupCount}.`;\n\t\tcase \"empty-group\": return `${subject} has an empty weight group at position ${problem.position + 1}.`;\n\t\tcase \"duplicate-field\": return `${subject} names the field \"${fieldLabel(problem.field)}\" more than once.`;\n\t\tcase \"not-text\": return `${subject} indexes text columns, but \"${fieldLabel(problem.field)}\" is ${problem.codecId === void 0 ? \"not a stored scalar field\" : `stored as \\`${problem.codecId}\\``}.`;\n\t\tcase \"unique\": return `${subject} is unique, but Postgres builds no unique gin index.`;\n\t}\n}\n/** The options of a full-text index: its weight groups, as storage column names, and its language. */\nconst fullTextIndexOptions = type({\n\t\"+\": \"reject\",\n\tweightGroups: type(\"string > 0\").array().array().narrow((weightGroups, ctx) => {\n\t\tconst [problem] = fullTextIndexProblems({ weightGroups });\n\t\treturn problem === void 0 || ctx.reject({ message: describeFullTextIndexProblem(\"a full-text index\", problem) });\n\t}),\n\tlanguage: type.enumerated(...POSTGRES_TEXT_SEARCH_LANGUAGES)\n});\n/**\n* The registration of the full-text index type. Its options are the index's definition, not\n* storage parameters, and the target turns them into a `gin` index over the rendered search\n* document.\n*/\nconst fullTextIndexType = {\n\toptions: fullTextIndexOptions,\n\taccessMethod: \"gin\",\n\tcolumnTraits: FULL_TEXT_COLUMN_TRAITS\n};\n/**\n* The definition a full-text index carries, or `undefined` for an index of any other type. It\n* reads an index {@link assertFullTextIndexes} has accepted, as every loaded contract's has been.\n*/\nfunction fullTextIndexDefinitionOf(index) {\n\tif (index.type !== \"fullText\") return void 0;\n\tconst definition = fullTextIndexOptions(index.options ?? {});\n\tinvariant(!(definition instanceof type.errors), \"a full-text index is read only after its contract was checked\");\n\treturn definition;\n}\n/**\n* Refuses a table's full-text index the contract cannot carry: invalid options, a broken rule of\n* {@link fullTextIndexProblems}, `columns` that are not the fields of its weight groups, in order,\n* or a foreign key that names it as its backing index. The text-columns rule is checked only when\n* `traitsOf` is given.\n*/\nfunction assertFullTextIndexes(table, traitsOf) {\n\tconst codecs = traitsOf === void 0 ? void 0 : {\n\t\tcodecIdOf: (column) => table.columns[column]?.codecId,\n\t\ttraitsOf\n\t};\n\tfor (const index of table.indexes) assertFullTextIndex(index, codecs);\n\tfor (const foreignKey of table.foreignKeys) {\n\t\tconst backing = foreignKey.index;\n\t\tif (backing === void 0 || !(\"name\" in backing)) continue;\n\t\tconst index = table.indexes.find((candidate) => candidate.name === backing.name);\n\t\tif (index?.type !== \"fullText\") continue;\n\t\tthrow postgresError(\"CONTRACT.INDEX_INVALID\", `The foreign key on columns (${foreignKey.source.columns.join(\", \")}) is backed by full-text index \"${index.name}\".`, {\n\t\t\twhy: \"A full-text index is a gin index over a search document rendered from its weight groups, not over its columns, so it does not serve the foreign key's lookups.\",\n\t\t\tfix: \"Re-emit the contract from its source, where a relation cannot name a full-text index as its index.\",\n\t\t\tmeta: {\n\t\t\t\tindex: index.name,\n\t\t\t\tcolumns: foreignKey.source.columns\n\t\t\t}\n\t\t});\n\t}\n}\nfunction assertFullTextIndex(index, codecs) {\n\tif (index.type !== \"fullText\") return;\n\tconst definition = fullTextIndexOptions(index.options ?? {});\n\tif (definition instanceof type.errors) throw invalidFullTextIndex(index, `Full-text index \"${index.name}\" has invalid options: ${definition.summary}`, \"The options of a full-text index are its definition: its weight groups and its language.\");\n\tconst [problem] = fullTextIndexProblems({\n\t\tweightGroups: definition.weightGroups,\n\t\tunique: index.unique,\n\t\tcodecs\n\t});\n\tif (problem !== void 0) throw invalidFullTextIndex(index, describeFullTextIndexProblem(`Full-text index \"${index.name}\"`, problem), \"A full-text index is a gin index over text columns, in one to four weight groups that name each column once.\");\n\tconst fields = definition.weightGroups.flat();\n\tconst columns = index.columns ?? [];\n\tif (columns.length !== fields.length || columns.some((column, i) => column !== fields[i])) throw invalidFullTextIndex(index, `Full-text index \"${index.name}\" covers the columns [${columns.join(\", \")}], but its weight groups name [${fields.join(\", \")}].`, \"The columns of a full-text index are the fields of its weight groups, in order. Foreign-key backing and the printer read the columns; the search document is rendered from the groups, so the two must agree.\");\n}\nfunction invalidFullTextIndex(index, message, why) {\n\treturn postgresError(\"CONTRACT.INDEX_INVALID\", message, {\n\t\twhy,\n\t\tfix: \"Re-emit the contract from its `@@fullTextIndex` or `fullTextIndex` source rather than editing the index by hand.\",\n\t\tmeta: {\n\t\t\tindex: index.name,\n\t\t\tcolumns: index.columns,\n\t\t\toptions: index.options\n\t\t}\n\t});\n}\n//#endregion\nexport { fullTextIndexOptions as a, DEFAULT_FULL_TEXT_SEARCH_LANGUAGE as c, FULL_TEXT_WEIGHTS as d, weightGroupsOf as f, fullTextIndexDefinitionOf as i, POSTGRES_TEXT_SEARCH_LANGUAGES as l, assertFullTextIndexes as n, fullTextIndexProblems as o, describeFullTextIndexProblem as r, fullTextIndexType as s, FULL_TEXT_INDEX_TYPE as t, isFullTextSearchLanguage as u };\n\n//# sourceMappingURL=full-text-index-definition-DzRCaPjb.mjs.map"],"mappings":";;;;;AAKA,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;AACD;AACA,SAAS,eAAe,QAAQ,SAAS;CACxC,IAAI,QAAQ,MAAM,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC;CACrC,OAAO,OAAO,KAA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,QAAQ,MAAM,WAAW,OAAO,EAAE,GAAG,MAAM,qBAAqB,OAAO,oBAAoB,MAAM,KAAK,wBAAwB,QAAQ,KAAK,IAAI,EAAE,iCAAiC,OAAO,KAAK,IAAI,EAAE,KAAK,+MAA+M;AAC/c;AACA,SAAS,qBAAqB,OAAO,SAAS,KAAK;CAClD,OAAO,cAAc,0BAA0B,SAAS;EACvD;EACA,KAAK;EACL,MAAM;GACL,OAAO,MAAM;GACb,SAAS,MAAM;GACf,SAAS,MAAM;EAChB;CACD,CAAC;AACF"}
@@ -1,9 +1,9 @@
1
1
  import { I as PG_TSQUERY_CODEC_ID, T as PG_TEXT_CODEC_ID } from "./codec-ids-2htdtS66-CJPMZv1t.mjs";
2
- import { u as postgresError } from "./errors-DpdPXR_L-DailcY-X.mjs";
3
- import { d as isFullTextSearchLanguage, f as weightGroupsOf, i as POSTGRES_TEXT_SEARCH_LANGUAGES, l as fullTextIndexProblems, o as describeFullTextIndexProblem, r as FULL_TEXT_WEIGHTS } from "./full-text-index-definition-MfjtL-x7-ImaTAFMs.mjs";
2
+ import { u as postgresError } from "./errors-C4-Dp3gI-B5jY5eJj.mjs";
3
+ import { d as isFullTextSearchLanguage, f as weightGroupsOf, i as POSTGRES_TEXT_SEARCH_LANGUAGES, l as fullTextIndexProblems, o as describeFullTextIndexProblem, r as FULL_TEXT_WEIGHTS } from "./full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs";
4
4
  import { LiteralExpr } from "@prisma/orm-family-sql/relational-core/ast";
5
5
  import { buildOperation, toExpr } from "@prisma/orm-family-sql/relational-core/expression";
6
- //#region ../../../3-targets/postgres/1-target/dist/full-text-parsers-DIfNR9AQ.mjs
6
+ //#region ../../../3-targets/postgres/1-target/dist/full-text-parsers-D-2uupNS.mjs
7
7
  /**
8
8
  * A search document built from columns in weight groups, for `fullTextMatches` and `fullTextRank`
9
9
  * to search without a full-text index. Postgres uses an index only for a query over the same
@@ -136,4 +136,4 @@ const phrasetoTsquery = parser("phrasetoTsquery", "phraseto_tsquery");
136
136
  //#endregion
137
137
  export { normalizationLiteral as a, toTsquery as c, languageLiteral as i, websearchToTsquery as l, fullTextDocument as n, phrasetoTsquery as o, headlineOptionsLiteral as r, plaintoTsquery as s, FullTextDocument as t };
138
138
 
139
- //# sourceMappingURL=full-text-parsers-DIfNR9AQ-tVmTju-Y.mjs.map
139
+ //# sourceMappingURL=full-text-parsers-D-2uupNS-6woSZ16T.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"full-text-parsers-DIfNR9AQ-tVmTju-Y.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-parsers-DIfNR9AQ.mjs"],"sourcesContent":["import { I as PG_TSQUERY_CODEC_ID, T as PG_TEXT_CODEC_ID } from \"./codec-ids-2htdtS66.mjs\";\nimport { u as postgresError } from \"./errors-DpdPXR_L.mjs\";\nimport { d as FULL_TEXT_WEIGHTS, f as weightGroupsOf, l as POSTGRES_TEXT_SEARCH_LANGUAGES, o as fullTextIndexProblems, r as describeFullTextIndexProblem, u as isFullTextSearchLanguage } from \"./full-text-index-definition-MfjtL-x7.mjs\";\nimport { LiteralExpr } from \"@internal/sql-relational-core/ast\";\nimport { buildOperation, toExpr } from \"@internal/sql-relational-core/expression\";\n//#region src/core/full-text-document.ts\n/**\n* A search document built from columns in weight groups, for `fullTextMatches` and `fullTextRank`\n* to search without a full-text index. Postgres uses an index only for a query over the same\n* document, so to search an index, pass the index from the table's `indexes` instead.\n*/\nvar FullTextDocument = class FullTextDocument {\n\tweightGroups;\n\tconstructor(weightGroups) {\n\t\tthis.weightGroups = weightGroups;\n\t\tObject.freeze(this);\n\t}\n\tstatic of(groups) {\n\t\tconst weightGroups = weightGroupsOf(groups, (item) => !Array.isArray(item));\n\t\tlet position = 0;\n\t\tconst [problem] = fullTextIndexProblems({ weightGroups: weightGroups.map((group) => group.map(() => String(position++))) });\n\t\tif (problem !== void 0) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", describeFullTextIndexProblem(\"fullTextDocument: the document\", problem), {\n\t\t\twhy: `Each weight group takes one of the weights Postgres has, ${FULL_TEXT_WEIGHTS.join(\", \")}.`,\n\t\t\tfix: \"Pass one to four weight groups, none of them empty.\",\n\t\t\tmeta: {\n\t\t\t\thelper: \"fullTextDocument\",\n\t\t\t\targument: \"groups\",\n\t\t\t\treceived: weightGroups.length\n\t\t\t}\n\t\t});\n\t\treturn new FullTextDocument(weightGroups);\n\t}\n};\n/**\n* The search document of columns in weight groups, strongest first: `fullTextDocument([[f.title,\n* f.subtitle], [f.body]])`. Each group takes the next weight, `A` to `D`; a column named twice is\n* not refused, because column expressions have no name to compare.\n*/\nfunction fullTextDocument(groups) {\n\treturn FullTextDocument.of(groups);\n}\n//#endregion\n//#region src/core/full-text-options.ts\n/**\n* Options for the Postgres full-text operations, and the checks each one goes through.\n*\n* Every option here reaches the SQL as an inline literal rather than a bound parameter, because\n* Postgres accepts no parameter in these positions. Each is therefore validated before a statement\n* exists; anything unrecognized throws `RUNTIME.ARGUMENT_INVALID`.\n*\n* The headline markers are the only free text among them, and `checkMarker` restricts their\n* characters precisely so that the literal path never carries a quote or a backslash for\n* `escapeLiteral` to have to reason about.\n*/\nfunction invalid(method, argument, received, why, fix) {\n\treturn postgresError(\"RUNTIME.ARGUMENT_INVALID\", `${method}: ${why}`, {\n\t\twhy: \"The option is written into the SQL as an inline literal, not a bound parameter, so it is checked before the statement is built.\",\n\t\tfix,\n\t\tmeta: {\n\t\t\thelper: method,\n\t\t\targument,\n\t\t\treceived\n\t\t}\n\t});\n}\nfunction languageLiteral(method, language) {\n\tif (!isFullTextSearchLanguage(language)) throw invalid(method, \"language\", language, `'${language}' is not a PostgreSQL text-search configuration Prisma recognizes.`, `Pass one of: ${POSTGRES_TEXT_SEARCH_LANGUAGES.join(\", \")}.`);\n\treturn LiteralExpr.of(language);\n}\nfunction normalizationLiteral(method, normalization) {\n\tif (!Number.isInteger(normalization) || normalization < 0 || normalization > 63) throw invalid(method, \"normalization\", normalization, `normalization must be an integer between 0 and 63, received ${normalization}.`, \"Combine the flags documented for ts_rank, e.g. 32 to divide the rank by itself plus one.\");\n\treturn LiteralExpr.of(normalization);\n}\nfunction checkWordCount(method, argument, value) {\n\tif (!Number.isInteger(value) || value < 1) throw invalid(method, argument, value, `${argument} must be a positive integer, received ${value}.`, \"Pass a whole number of words, one or more.\");\n}\n/** Non-empty, and none of `\"` `,` `=` `\\` or whitespace. */\nconst MARKER = /^[^\"=,\\\\\\s]+$/;\nfunction checkMarker(method, argument, value) {\n\tif (!MARKER.test(value)) throw invalid(method, argument, value, `${argument} must be non-empty and free of \" , = \\\\ and whitespace, received ${JSON.stringify(value)}.`, \"ts_headline parses its options as a quoted, comma-separated list of Key=Value pairs, and the whole list reaches SQL as one literal, so a marker carrying those characters cannot survive either step. Use markup such as <mark> or <b>.\");\n}\n/**\n* The fourth `ts_headline` argument: one text literal of `Key=Value` pairs. Returns `undefined` when\n* nothing but the language was given, so the common call keeps rendering the three-argument form.\n*/\nfunction headlineOptionsLiteral(method, options) {\n\tconst pairs = [];\n\tif (options.startSel !== void 0) {\n\t\tcheckMarker(method, \"startSel\", options.startSel);\n\t\tpairs.push(`StartSel=${options.startSel}`);\n\t}\n\tif (options.stopSel !== void 0) {\n\t\tcheckMarker(method, \"stopSel\", options.stopSel);\n\t\tpairs.push(`StopSel=${options.stopSel}`);\n\t}\n\tif (options.maxWords !== void 0) {\n\t\tcheckWordCount(method, \"maxWords\", options.maxWords);\n\t\tpairs.push(`MaxWords=${options.maxWords}`);\n\t}\n\tif (options.minWords !== void 0) {\n\t\tcheckWordCount(method, \"minWords\", options.minWords);\n\t\tif (options.maxWords !== void 0 && options.minWords >= options.maxWords) throw invalid(method, \"minWords\", options.minWords, `minWords (${options.minWords}) must be below maxWords (${options.maxWords}).`, \"Postgres requires MinWords strictly below MaxWords. Lower minWords, or raise maxWords.\");\n\t\tpairs.push(`MinWords=${options.minWords}`);\n\t}\n\tif (options.highlightAll !== void 0) {\n\t\tif (typeof options.highlightAll !== \"boolean\") throw invalid(method, \"highlightAll\", options.highlightAll, `highlightAll must be a boolean, received ${JSON.stringify(options.highlightAll)}.`, \"Pass true to mark up the whole document, or false to extract fragments.\");\n\t\tpairs.push(`HighlightAll=${options.highlightAll}`);\n\t}\n\treturn pairs.length === 0 ? void 0 : LiteralExpr.of(pairs.join(\", \"));\n}\n//#endregion\n//#region src/core/full-text-parsers.ts\nconst TEXT_REF = { codecId: PG_TEXT_CODEC_ID };\nfunction parser(method, fn) {\n\treturn (text, options = {}) => buildOperation({\n\t\tmethod,\n\t\targs: [toExpr(text, TEXT_REF), languageLiteral(method, options.language ?? \"english\")],\n\t\treturns: {\n\t\t\tcodecId: PG_TSQUERY_CODEC_ID,\n\t\t\tnullable: false\n\t\t},\n\t\tlowering: {\n\t\t\ttargetFamily: \"sql\",\n\t\t\ttemplate: `${fn}({{arg0}}, {{self}})`\n\t\t}\n\t});\n}\n/** Postgres `websearch_to_tsquery`: search-box syntax with quotes, `or` and `-`. Never errors. */\nconst websearchToTsquery = parser(\"websearchToTsquery\", \"websearch_to_tsquery\");\n/**\n* Postgres `to_tsquery`: operator syntax (`'zebra' & !'graze'`, `zeb:*`), each word normalized.\n* Malformed input fails at execution, so pass only text the application wrote, never user input;\n* `tsquery` interpolates user input safely.\n*/\nconst toTsquery = parser(\"toTsquery\", \"to_tsquery\");\n/** Postgres `plainto_tsquery`: every word must match. */\nconst plaintoTsquery = parser(\"plaintoTsquery\", \"plainto_tsquery\");\n/** Postgres `phraseto_tsquery`: the words must match in order. */\nconst phrasetoTsquery = parser(\"phrasetoTsquery\", \"phraseto_tsquery\");\n//#endregion\nexport { headlineOptionsLiteral as a, FullTextDocument as c, websearchToTsquery as i, fullTextDocument as l, plaintoTsquery as n, languageLiteral as o, toTsquery as r, normalizationLiteral as s, phrasetoTsquery as t };\n\n//# sourceMappingURL=full-text-parsers-DIfNR9AQ.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI,mBAAmB,MAA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yE;EACzQ,MAAM,KAAK,gBAAgB,QAAQ,cAAc;CAClD;CACA,OAAO,MAAM,WAAW,IAAI,KAAK,IAAI,YAAY,GAAG,MAAM,KAAK,IAAI,CAAC;AACrE;AAGA,MAAM,WAAW,EAAE,SAAS,iBAAiB;AAC7C,SAAS,OAAO,QAAQ,IAAI;CAC3B,QAAQ,MAAM,UAAU,CAAC,MAAM,eAAe;EAC7C;EACA,MAAM,CAAC,OAAO,MAAM,QAAQ,GAAG,gBAAgB,QAAQ,QAAQ,YAAY,SAAS,CAAC;EACrF,SAAS;GACR,SAAS;GACT,UAAU;EACX;EACA,UAAU;GACT,cAAc;GACd,UAAU,GAAG,GAAG;EACjB;CACD,CAAC;AACF;;AAEA,MAAM,qBAAqB,OAAO,sBAAsB,sBAAsB;;;;;;AAM9E,MAAM,YAAY,OAAO,aAAa,YAAY;;AAElD,MAAM,iBAAiB,OAAO,kBAAkB,iBAAiB;;AAEjE,MAAM,kBAAkB,OAAO,mBAAmB,kBAAkB"}
1
+ {"version":3,"file":"full-text-parsers-D-2uupNS-6woSZ16T.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-parsers-D-2uupNS.mjs"],"sourcesContent":["import { I as PG_TSQUERY_CODEC_ID, T as PG_TEXT_CODEC_ID } from \"./codec-ids-2htdtS66.mjs\";\nimport { u as postgresError } from \"./errors-C4-Dp3gI.mjs\";\nimport { d as FULL_TEXT_WEIGHTS, f as weightGroupsOf, l as POSTGRES_TEXT_SEARCH_LANGUAGES, o as fullTextIndexProblems, r as describeFullTextIndexProblem, u as isFullTextSearchLanguage } from \"./full-text-index-definition-DzRCaPjb.mjs\";\nimport { LiteralExpr } from \"@internal/sql-relational-core/ast\";\nimport { buildOperation, toExpr } from \"@internal/sql-relational-core/expression\";\n//#region src/core/full-text-document.ts\n/**\n* A search document built from columns in weight groups, for `fullTextMatches` and `fullTextRank`\n* to search without a full-text index. Postgres uses an index only for a query over the same\n* document, so to search an index, pass the index from the table's `indexes` instead.\n*/\nvar FullTextDocument = class FullTextDocument {\n\tweightGroups;\n\tconstructor(weightGroups) {\n\t\tthis.weightGroups = weightGroups;\n\t\tObject.freeze(this);\n\t}\n\tstatic of(groups) {\n\t\tconst weightGroups = weightGroupsOf(groups, (item) => !Array.isArray(item));\n\t\tlet position = 0;\n\t\tconst [problem] = fullTextIndexProblems({ weightGroups: weightGroups.map((group) => group.map(() => String(position++))) });\n\t\tif (problem !== void 0) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", describeFullTextIndexProblem(\"fullTextDocument: the document\", problem), {\n\t\t\twhy: `Each weight group takes one of the weights Postgres has, ${FULL_TEXT_WEIGHTS.join(\", \")}.`,\n\t\t\tfix: \"Pass one to four weight groups, none of them empty.\",\n\t\t\tmeta: {\n\t\t\t\thelper: \"fullTextDocument\",\n\t\t\t\targument: \"groups\",\n\t\t\t\treceived: weightGroups.length\n\t\t\t}\n\t\t});\n\t\treturn new FullTextDocument(weightGroups);\n\t}\n};\n/**\n* The search document of columns in weight groups, strongest first: `fullTextDocument([[f.title,\n* f.subtitle], [f.body]])`. Each group takes the next weight, `A` to `D`; a column named twice is\n* not refused, because column expressions have no name to compare.\n*/\nfunction fullTextDocument(groups) {\n\treturn FullTextDocument.of(groups);\n}\n//#endregion\n//#region src/core/full-text-options.ts\n/**\n* Options for the Postgres full-text operations, and the checks each one goes through.\n*\n* Every option here reaches the SQL as an inline literal rather than a bound parameter, because\n* Postgres accepts no parameter in these positions. Each is therefore validated before a statement\n* exists; anything unrecognized throws `RUNTIME.ARGUMENT_INVALID`.\n*\n* The headline markers are the only free text among them, and `checkMarker` restricts their\n* characters precisely so that the literal path never carries a quote or a backslash for\n* `escapeLiteral` to have to reason about.\n*/\nfunction invalid(method, argument, received, why, fix) {\n\treturn postgresError(\"RUNTIME.ARGUMENT_INVALID\", `${method}: ${why}`, {\n\t\twhy: \"The option is written into the SQL as an inline literal, not a bound parameter, so it is checked before the statement is built.\",\n\t\tfix,\n\t\tmeta: {\n\t\t\thelper: method,\n\t\t\targument,\n\t\t\treceived\n\t\t}\n\t});\n}\nfunction languageLiteral(method, language) {\n\tif (!isFullTextSearchLanguage(language)) throw invalid(method, \"language\", language, `'${language}' is not a PostgreSQL text-search configuration Prisma recognizes.`, `Pass one of: ${POSTGRES_TEXT_SEARCH_LANGUAGES.join(\", \")}.`);\n\treturn LiteralExpr.of(language);\n}\nfunction normalizationLiteral(method, normalization) {\n\tif (!Number.isInteger(normalization) || normalization < 0 || normalization > 63) throw invalid(method, \"normalization\", normalization, `normalization must be an integer between 0 and 63, received ${normalization}.`, \"Combine the flags documented for ts_rank, e.g. 32 to divide the rank by itself plus one.\");\n\treturn LiteralExpr.of(normalization);\n}\nfunction checkWordCount(method, argument, value) {\n\tif (!Number.isInteger(value) || value < 1) throw invalid(method, argument, value, `${argument} must be a positive integer, received ${value}.`, \"Pass a whole number of words, one or more.\");\n}\n/** Non-empty, and none of `\"` `,` `=` `\\` or whitespace. */\nconst MARKER = /^[^\"=,\\\\\\s]+$/;\nfunction checkMarker(method, argument, value) {\n\tif (!MARKER.test(value)) throw invalid(method, argument, value, `${argument} must be non-empty and free of \" , = \\\\ and whitespace, received ${JSON.stringify(value)}.`, \"ts_headline parses its options as a quoted, comma-separated list of Key=Value pairs, and the whole list reaches SQL as one literal, so a marker carrying those characters cannot survive either step. Use markup such as <mark> or <b>.\");\n}\n/**\n* The fourth `ts_headline` argument: one text literal of `Key=Value` pairs. Returns `undefined` when\n* nothing but the language was given, so the common call keeps rendering the three-argument form.\n*/\nfunction headlineOptionsLiteral(method, options) {\n\tconst pairs = [];\n\tif (options.startSel !== void 0) {\n\t\tcheckMarker(method, \"startSel\", options.startSel);\n\t\tpairs.push(`StartSel=${options.startSel}`);\n\t}\n\tif (options.stopSel !== void 0) {\n\t\tcheckMarker(method, \"stopSel\", options.stopSel);\n\t\tpairs.push(`StopSel=${options.stopSel}`);\n\t}\n\tif (options.maxWords !== void 0) {\n\t\tcheckWordCount(method, \"maxWords\", options.maxWords);\n\t\tpairs.push(`MaxWords=${options.maxWords}`);\n\t}\n\tif (options.minWords !== void 0) {\n\t\tcheckWordCount(method, \"minWords\", options.minWords);\n\t\tif (options.maxWords !== void 0 && options.minWords >= options.maxWords) throw invalid(method, \"minWords\", options.minWords, `minWords (${options.minWords}) must be below maxWords (${options.maxWords}).`, \"Postgres requires MinWords strictly below MaxWords. Lower minWords, or raise maxWords.\");\n\t\tpairs.push(`MinWords=${options.minWords}`);\n\t}\n\tif (options.highlightAll !== void 0) {\n\t\tif (typeof options.highlightAll !== \"boolean\") throw invalid(method, \"highlightAll\", options.highlightAll, `highlightAll must be a boolean, received ${JSON.stringify(options.highlightAll)}.`, \"Pass true to mark up the whole document, or false to extract fragments.\");\n\t\tpairs.push(`HighlightAll=${options.highlightAll}`);\n\t}\n\treturn pairs.length === 0 ? void 0 : LiteralExpr.of(pairs.join(\", \"));\n}\n//#endregion\n//#region src/core/full-text-parsers.ts\nconst TEXT_REF = { codecId: PG_TEXT_CODEC_ID };\nfunction parser(method, fn) {\n\treturn (text, options = {}) => buildOperation({\n\t\tmethod,\n\t\targs: [toExpr(text, TEXT_REF), languageLiteral(method, options.language ?? \"english\")],\n\t\treturns: {\n\t\t\tcodecId: PG_TSQUERY_CODEC_ID,\n\t\t\tnullable: false\n\t\t},\n\t\tlowering: {\n\t\t\ttargetFamily: \"sql\",\n\t\t\ttemplate: `${fn}({{arg0}}, {{self}})`\n\t\t}\n\t});\n}\n/** Postgres `websearch_to_tsquery`: search-box syntax with quotes, `or` and `-`. Never errors. */\nconst websearchToTsquery = parser(\"websearchToTsquery\", \"websearch_to_tsquery\");\n/**\n* Postgres `to_tsquery`: operator syntax (`'zebra' & !'graze'`, `zeb:*`), each word normalized.\n* Malformed input fails at execution, so pass only text the application wrote, never user input;\n* `tsquery` interpolates user input safely.\n*/\nconst toTsquery = parser(\"toTsquery\", \"to_tsquery\");\n/** Postgres `plainto_tsquery`: every word must match. */\nconst plaintoTsquery = parser(\"plaintoTsquery\", \"plainto_tsquery\");\n/** Postgres `phraseto_tsquery`: the words must match in order. */\nconst phrasetoTsquery = parser(\"phrasetoTsquery\", \"phraseto_tsquery\");\n//#endregion\nexport { headlineOptionsLiteral as a, FullTextDocument as c, websearchToTsquery as i, fullTextDocument as l, plaintoTsquery as n, languageLiteral as o, toTsquery as r, normalizationLiteral as s, phrasetoTsquery as t };\n\n//# sourceMappingURL=full-text-parsers-D-2uupNS.mjs.map"],"mappings":";;;;;;;;;;;AAWA,IAAI,mBAAmB,MAAM,iBAAiB;CAC7C;CACA,YAAY,cAAc;EACzB,KAAK,eAAe;EACpB,OAAO,OAAO,IAAI;CACnB;CACA,OAAO,GAAG,QAAQ;EACjB,MAAM,eAAe,eAAe,SAAS,SAAS,CAAC,MAAM,QAAQ,IAAI,CAAC;EAC1E,IAAI,WAAW;EACf,MAAM,CAAC,WAAW,sBAAsB,EAAE,cAAc,aAAa,KAAK,UAAU,MAAM,UAAU,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC;EAC1H,IAAI,YAAY,KAAK,GAAG,MAAM,cAAc,4BAA4B,6BAA6B,kCAAkC,OAAO,GAAG;GAChJ,KAAK,4DAA4D,kBAAkB,KAAK,IAAI,EAAE;GAC9F,KAAK;GACL,MAAM;IACL,QAAQ;IACR,UAAU;IACV,UAAU,aAAa;GACxB;EACD,CAAC;EACD,OAAO,IAAI,iBAAiB,YAAY;CACzC;AACD;;;;;;AAMA,SAAS,iBAAiB,QAAQ;CACjC,OAAO,iBAAiB,GAAG,MAAM;AAClC;;;;;;;;;;;;AAcA,SAAS,QAAQ,QAAQ,UAAU,UAAU,KAAK,KAAK;CACtD,OAAO,cAAc,4BAA4B,GAAG,OAAO,IAAI,OAAO;EACrE,KAAK;EACL;EACA,MAAM;GACL,QAAQ;GACR;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,gBAAgB,QAAQ,UAAU;CAC1C,IAAI,CAAC,yBAAyB,QAAQ,GAAG,MAAM,QAAQ,QAAQ,YAA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QAAQ,UAAU,MAAM,QAAQ,QAAQ,YAAY,QAAQ,UAAU,aAAa,QAAQ,SAAS,4BAA4B,QAAQ,SAAS,KAAK,wFAAwF;EACrS,MAAM,KAAK,YAAY,QAAQ,UAAU;CAC1C;CACA,IAAI,QAAQ,iBAAiB,KAAK,GAAG;EACpC,IAAI,OAAO,QAAQ,iBAAiB,WAAW,MAAM,QAAQ,QAAQ,gBAAgB,QAAQ,cAAc,4CAA4C,KAAK,UAAU,QAAQ,YAAY,EAAE,IAAI,yEAAyE;EACzQ,MAAM,KAAK,gBAAgB,QAAQ,cAAc;CAClD;CACA,OAAO,MAAM,WAAW,IAAI,KAAK,IAAI,YAAY,GAAG,MAAM,KAAK,IAAI,CAAC;AACrE;AAGA,MAAM,WAAW,EAAE,SAAS,iBAAiB;AAC7C,SAAS,OAAO,QAAQ,IAAI;CAC3B,QAAQ,MAAM,UAAU,CAAC,MAAM,eAAe;EAC7C;EACA,MAAM,CAAC,OAAO,MAAM,QAAQ,GAAG,gBAAgB,QAAQ,QAAQ,YAAY,SAAS,CAAC;EACrF,SAAS;GACR,SAAS;GACT,UAAU;EACX;EACA,UAAU;GACT,cAAc;GACd,UAAU,GAAG,GAAG;EACjB;CACD,CAAC;AACF;;AAEA,MAAM,qBAAqB,OAAO,sBAAsB,sBAAsB;;;;;;AAM9E,MAAM,YAAY,OAAO,aAAa,YAAY;;AAElD,MAAM,iBAAiB,OAAO,kBAAkB,iBAAiB;;AAEjE,MAAM,kBAAkB,OAAO,mBAAmB,kBAAkB"}
@@ -1,8 +1,8 @@
1
- import { u as postgresError } from "./errors-DpdPXR_L-DailcY-X.mjs";
2
- import { a as quoteIdentifier } from "./sql-utils-VXrIh8dJ-DVxo_Ygp.mjs";
3
- import { l as fullTextIndexProblems, o as describeFullTextIndexProblem, r as FULL_TEXT_WEIGHTS } from "./full-text-index-definition-MfjtL-x7-ImaTAFMs.mjs";
1
+ import { u as postgresError } from "./errors-C4-Dp3gI-B5jY5eJj.mjs";
2
+ import { a as quoteIdentifier } from "./sql-utils-CRPhDLp1-wbgQW5TM.mjs";
3
+ import { l as fullTextIndexProblems, o as describeFullTextIndexProblem, r as FULL_TEXT_WEIGHTS } from "./full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs";
4
4
  import { assertDefined } from "@prisma/orm-framework/utils/assertions";
5
- //#region ../../../3-targets/postgres/1-target/dist/full-text-search-document-Ceg9d2K0.mjs
5
+ //#region ../../../3-targets/postgres/1-target/dist/full-text-search-document-BqqvjJoC.mjs
6
6
  /**
7
7
  * The search document of a full-text index: the expression the index is built over and the one
8
8
  * `fullTextMatches` and `fullTextRank` search. Postgres uses an expression index only when the
@@ -51,4 +51,4 @@ function renderFullTextIndexDocument(definition) {
51
51
  //#endregion
52
52
  export { renderFullTextIndexDocument as n, renderFullTextDocument as t };
53
53
 
54
- //# sourceMappingURL=full-text-search-document-Ceg9d2K0-DJ4MklAU.mjs.map
54
+ //# sourceMappingURL=full-text-search-document-BqqvjJoC-HaoeMaM5.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"full-text-search-document-Ceg9d2K0-DJ4MklAU.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-search-document-Ceg9d2K0.mjs"],"sourcesContent":["import { u as postgresError } from \"./errors-DpdPXR_L.mjs\";\nimport { a as quoteIdentifier } from \"./sql-utils-VXrIh8dJ.mjs\";\nimport { d as FULL_TEXT_WEIGHTS, o as fullTextIndexProblems, r as describeFullTextIndexProblem } from \"./full-text-index-definition-MfjtL-x7.mjs\";\nimport { assertDefined } from \"@internal/utils/assertions\";\n//#region src/core/full-text-search-document.ts\n/**\n* The search document of a full-text index: the expression the index is built over and the one\n* `fullTextMatches` and `fullTextRank` search. Postgres uses an expression index only when the\n* query carries the same expression, so the index DDL, the schema node and the query operations\n* all render it here, from weight groups their callers have already checked.\n*\n* One field alone is `to_tsvector(language, field)`. With more fields, each gets its own\n* `to_tsvector`, wrapped in `coalesce(field, '')` since one null would make the whole document\n* null, and they are joined with `||`. With more than one group, each field is weighted with its\n* group's weight, `A` for the first. The document depends on the groups and the language only, so\n* a column's nullability never changes it.\n*/\nfunction renderFullTextDocument(groups, writer) {\n\tconst fieldCount = groups.reduce((count, group) => count + group.length, 0);\n\tconst weighted = groups.length > 1;\n\tconst vectors = groups.flatMap((group, position) => group.map((field) => {\n\t\tconst column = writer.column(field);\n\t\tconst text = fieldCount > 1 ? `coalesce(${column}, '')` : column;\n\t\tconst vector = `to_tsvector(${writer.language}, ${text})`;\n\t\tif (!weighted) return vector;\n\t\tconst weight = FULL_TEXT_WEIGHTS[position];\n\t\tassertDefined(weight, `a full-text document has no weight for group ${position + 1}`);\n\t\treturn `setweight(${vector}, '${weight}')`;\n\t}));\n\tconst [only] = vectors;\n\tassertDefined(only, \"a full-text document has at least one field\");\n\treturn vectors.length === 1 ? only : `(${vectors.join(\" || \")})`;\n}\n/**\n* The search document over storage columns, as the index DDL and the schema node carry it. A\n* definition that breaks a rule of a full-text index is refused.\n*/\nfunction renderFullTextIndexDocument(definition) {\n\tconst { weightGroups } = definition;\n\tconst [problem] = fullTextIndexProblems({ weightGroups });\n\tif (problem !== void 0) throw postgresError(\"CONTRACT.INDEX_INVALID\", describeFullTextIndexProblem(\"The full-text index definition\", problem), {\n\t\twhy: \"Each field of a search document is weighted by the position of its group, so the document is rendered only from weight groups that follow the rules of a full-text index.\",\n\t\tfix: \"Pass one to four non-empty weight groups that name each column once.\",\n\t\tmeta: { weightGroups }\n\t});\n\treturn renderFullTextDocument(weightGroups, {\n\t\tcolumn: quoteIdentifier,\n\t\tlanguage: `'${definition.language}'`\n\t});\n}\n//#endregion\nexport { renderFullTextIndexDocument as n, renderFullTextDocument as t };\n\n//# sourceMappingURL=full-text-search-document-Ceg9d2K0.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,uBAAuB,QAAQ,QAAQ;CAC/C,MAAM,aAAa,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,QAAQ,CAAC;CAC1E,MAAM,WAAW,OAAO,SAAS;CACjC,MAAM,UAAU,OAAO,SAAS,OAAO,aAAa,MAAM,KAAK,UAAU;EACxE,MAAM,SAAS,OAAO,OAAO,KAAK;EAClC,MAAM,OAAO,aAAa,IAAI,YAAY,OAAO,SAAS;EAC1D,MAAM,SAAS,eAAe,OAAO,SAAS,IAAI,KAAK;EACvD,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,SAAS,kBAAkB;EACjC,cAAc,QAAQ,gDAAgD,WAAW,GAAG;EACpF,OAAO,aAAa,OAAO,KAAK,OAAO;CACxC,CAAC,CAAC;CACF,MAAM,CAAC,QAAQ;CACf,cAAc,MAAM,6CAA6C;CACjE,OAAO,QAAQ,WAAW,IAAI,OAAO,IAAI,QAAQ,KAAK,MAAM,EAAE;AAC/D;;;;;AAKA,SAAS,4BAA4B,YAAY;CAChD,MAAM,EAAE,iBAAiB;CACzB,MAAM,CAAC,WAAW,sBAAsB,EAAE,aAAa,CAAC;CACxD,IAAI,YAAY,KAAK,GAAG,MAAM,cAAc,0BAA0B,6BAA6B,kCAAkC,OAAO,GAAG;EAC9I,KAAK;EACL,KAAK;EACL,MAAM,EAAE,aAAa;CACtB,CAAC;CACD,OAAO,uBAAuB,cAAc;EAC3C,QAAQ;EACR,UAAU,IAAI,WAAW,SAAS;CACnC,CAAC;AACF"}
1
+ {"version":3,"file":"full-text-search-document-BqqvjJoC-HaoeMaM5.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/full-text-search-document-BqqvjJoC.mjs"],"sourcesContent":["import { u as postgresError } from \"./errors-C4-Dp3gI.mjs\";\nimport { a as quoteIdentifier } from \"./sql-utils-CRPhDLp1.mjs\";\nimport { d as FULL_TEXT_WEIGHTS, o as fullTextIndexProblems, r as describeFullTextIndexProblem } from \"./full-text-index-definition-DzRCaPjb.mjs\";\nimport { assertDefined } from \"@internal/utils/assertions\";\n//#region src/core/full-text-search-document.ts\n/**\n* The search document of a full-text index: the expression the index is built over and the one\n* `fullTextMatches` and `fullTextRank` search. Postgres uses an expression index only when the\n* query carries the same expression, so the index DDL, the schema node and the query operations\n* all render it here, from weight groups their callers have already checked.\n*\n* One field alone is `to_tsvector(language, field)`. With more fields, each gets its own\n* `to_tsvector`, wrapped in `coalesce(field, '')` since one null would make the whole document\n* null, and they are joined with `||`. With more than one group, each field is weighted with its\n* group's weight, `A` for the first. The document depends on the groups and the language only, so\n* a column's nullability never changes it.\n*/\nfunction renderFullTextDocument(groups, writer) {\n\tconst fieldCount = groups.reduce((count, group) => count + group.length, 0);\n\tconst weighted = groups.length > 1;\n\tconst vectors = groups.flatMap((group, position) => group.map((field) => {\n\t\tconst column = writer.column(field);\n\t\tconst text = fieldCount > 1 ? `coalesce(${column}, '')` : column;\n\t\tconst vector = `to_tsvector(${writer.language}, ${text})`;\n\t\tif (!weighted) return vector;\n\t\tconst weight = FULL_TEXT_WEIGHTS[position];\n\t\tassertDefined(weight, `a full-text document has no weight for group ${position + 1}`);\n\t\treturn `setweight(${vector}, '${weight}')`;\n\t}));\n\tconst [only] = vectors;\n\tassertDefined(only, \"a full-text document has at least one field\");\n\treturn vectors.length === 1 ? only : `(${vectors.join(\" || \")})`;\n}\n/**\n* The search document over storage columns, as the index DDL and the schema node carry it. A\n* definition that breaks a rule of a full-text index is refused.\n*/\nfunction renderFullTextIndexDocument(definition) {\n\tconst { weightGroups } = definition;\n\tconst [problem] = fullTextIndexProblems({ weightGroups });\n\tif (problem !== void 0) throw postgresError(\"CONTRACT.INDEX_INVALID\", describeFullTextIndexProblem(\"The full-text index definition\", problem), {\n\t\twhy: \"Each field of a search document is weighted by the position of its group, so the document is rendered only from weight groups that follow the rules of a full-text index.\",\n\t\tfix: \"Pass one to four non-empty weight groups that name each column once.\",\n\t\tmeta: { weightGroups }\n\t});\n\treturn renderFullTextDocument(weightGroups, {\n\t\tcolumn: quoteIdentifier,\n\t\tlanguage: `'${definition.language}'`\n\t});\n}\n//#endregion\nexport { renderFullTextIndexDocument as n, renderFullTextDocument as t };\n\n//# sourceMappingURL=full-text-search-document-BqqvjJoC.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,uBAAuB,QAAQ,QAAQ;CAC/C,MAAM,aAAa,OAAO,QAAQ,OAAO,UAAU,QAAQ,MAAM,QAAQ,CAAC;CAC1E,MAAM,WAAW,OAAO,SAAS;CACjC,MAAM,UAAU,OAAO,SAAS,OAAO,aAAa,MAAM,KAAK,UAAU;EACxE,MAAM,SAAS,OAAO,OAAO,KAAK;EAClC,MAAM,OAAO,aAAa,IAAI,YAAY,OAAO,SAAS;EAC1D,MAAM,SAAS,eAAe,OAAO,SAAS,IAAI,KAAK;EACvD,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,SAAS,kBAAkB;EACjC,cAAc,QAAQ,gDAAgD,WAAW,GAAG;EACpF,OAAO,aAAa,OAAO,KAAK,OAAO;CACxC,CAAC,CAAC;CACF,MAAM,CAAC,QAAQ;CACf,cAAc,MAAM,6CAA6C;CACjE,OAAO,QAAQ,WAAW,IAAI,OAAO,IAAI,QAAQ,KAAK,MAAM,EAAE;AAC/D;;;;;AAKA,SAAS,4BAA4B,YAAY;CAChD,MAAM,EAAE,iBAAiB;CACzB,MAAM,CAAC,WAAW,sBAAsB,EAAE,aAAa,CAAC;CACxD,IAAI,YAAY,KAAK,GAAG,MAAM,cAAc,0BAA0B,6BAA6B,kCAAkC,OAAO,GAAG;EAC9I,KAAK;EACL,KAAK;EACL,MAAM,EAAE,aAAa;CACtB,CAAC;CACD,OAAO,uBAAuB,cAAc;EAC3C,QAAQ;EACR,UAAU,IAAI,WAAW,SAAS;CACnC,CAAC;AACF"}
@@ -1,7 +1,7 @@
1
- import { n as FULL_TEXT_INDEX_TYPE, u as fullTextIndexType } from "./full-text-index-definition-MfjtL-x7-ImaTAFMs.mjs";
1
+ import { n as FULL_TEXT_INDEX_TYPE, u as fullTextIndexType } from "./full-text-index-definition-DzRCaPjb-0USKN1ZI.mjs";
2
2
  import { type } from "arktype";
3
3
  import { accessMethodOf, defineIndexTypes } from "@prisma/orm-family-sql/contract/index-types";
4
- //#region ../../../3-targets/postgres/1-target/dist/index-types-B5sQ5Vw0.mjs
4
+ //#region ../../../3-targets/postgres/1-target/dist/index-types-DGrgbAd4.mjs
5
5
  const postgresIndexTypes = defineIndexTypes().add("btree", { options: type("object") }).add("hash", { options: type("object") }).add("gin", { options: type("object") }).add("gist", { options: type("object") }).add("spgist", { options: type("object") }).add("brin", { options: type("object") }).add(FULL_TEXT_INDEX_TYPE, fullTextIndexType);
6
6
  /** The access method an index of this type is created with; a type Postgres does not register is its own. */
7
7
  function postgresAccessMethodOf(typeLiteral) {
@@ -11,4 +11,4 @@ function postgresAccessMethodOf(typeLiteral) {
11
11
  //#endregion
12
12
  export { postgresIndexTypes as n, postgresAccessMethodOf as t };
13
13
 
14
- //# sourceMappingURL=index-types-B5sQ5Vw0-DfXKO9-v.mjs.map
14
+ //# sourceMappingURL=index-types-DGrgbAd4-DuGWdvol.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-types-B5sQ5Vw0-DfXKO9-v.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/index-types-B5sQ5Vw0.mjs"],"sourcesContent":["import { s as fullTextIndexType, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-MfjtL-x7.mjs\";\nimport { type } from \"arktype\";\nimport { accessMethodOf, defineIndexTypes } from \"@internal/sql-contract/index-types\";\n//#region src/core/index-types.ts\nconst postgresIndexTypes = defineIndexTypes().add(\"btree\", { options: type(\"object\") }).add(\"hash\", { options: type(\"object\") }).add(\"gin\", { options: type(\"object\") }).add(\"gist\", { options: type(\"object\") }).add(\"spgist\", { options: type(\"object\") }).add(\"brin\", { options: type(\"object\") }).add(FULL_TEXT_INDEX_TYPE, fullTextIndexType);\n/** The access method an index of this type is created with; a type Postgres does not register is its own. */\nfunction postgresAccessMethodOf(typeLiteral) {\n\tconst entry = postgresIndexTypes.entries.find((candidate) => candidate.type === typeLiteral);\n\treturn entry === void 0 ? typeLiteral : accessMethodOf(entry);\n}\n//#endregion\nexport { postgresIndexTypes as n, postgresAccessMethodOf as t };\n\n//# sourceMappingURL=index-types-B5sQ5Vw0.mjs.map"],"mappings":";;;;AAIA,MAAM,qBAAqB,iBAAiB,CAAC,CAAC,IAAI,SAAS,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,sBAAsB,iBAAiB;;AAEjV,SAAS,uBAAuB,aAAa;CAC5C,MAAM,QAAQ,mBAAmB,QAAQ,MAAM,cAAc,UAAU,SAAS,WAAW;CAC3F,OAAO,UAAU,KAAK,IAAI,cAAc,eAAe,KAAK;AAC7D"}
1
+ {"version":3,"file":"index-types-DGrgbAd4-DuGWdvol.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/index-types-DGrgbAd4.mjs"],"sourcesContent":["import { s as fullTextIndexType, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-DzRCaPjb.mjs\";\nimport { type } from \"arktype\";\nimport { accessMethodOf, defineIndexTypes } from \"@internal/sql-contract/index-types\";\n//#region src/core/index-types.ts\nconst postgresIndexTypes = defineIndexTypes().add(\"btree\", { options: type(\"object\") }).add(\"hash\", { options: type(\"object\") }).add(\"gin\", { options: type(\"object\") }).add(\"gist\", { options: type(\"object\") }).add(\"spgist\", { options: type(\"object\") }).add(\"brin\", { options: type(\"object\") }).add(FULL_TEXT_INDEX_TYPE, fullTextIndexType);\n/** The access method an index of this type is created with; a type Postgres does not register is its own. */\nfunction postgresAccessMethodOf(typeLiteral) {\n\tconst entry = postgresIndexTypes.entries.find((candidate) => candidate.type === typeLiteral);\n\treturn entry === void 0 ? typeLiteral : accessMethodOf(entry);\n}\n//#endregion\nexport { postgresIndexTypes as n, postgresAccessMethodOf as t };\n\n//# sourceMappingURL=index-types-DGrgbAd4.mjs.map"],"mappings":";;;;AAIA,MAAM,qBAAqB,iBAAiB,CAAC,CAAC,IAAI,SAAS,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,sBAAsB,iBAAiB;;AAEjV,SAAS,uBAAuB,aAAa;CAC5C,MAAM,QAAQ,mBAAmB,QAAQ,MAAM,cAAc,UAAU,SAAS,WAAW;CAC3F,OAAO,UAAU,KAAK,IAAI,cAAc,eAAe,KAAK;AAC7D"}
@@ -1,10 +1,10 @@
1
1
  import { T as PG_TEXT_CODEC_ID } from "./codec-ids-2htdtS66-CJPMZv1t.mjs";
2
- import { u as postgresError } from "./errors-DpdPXR_L-DailcY-X.mjs";
3
- import { A as pgJson, j as pgJsonb, r as createPostgresBuiltinDataTypeLookup } from "./data-types-B47LbZ3z-DRVqjvQZ.mjs";
4
- import { r as createPostgresBuiltinCodecLookup } from "./codec-registry-7LHPD8C1-BALCyEB-.mjs";
5
- import { t as POLICY_BLOCK_KEYWORDS } from "./authoring-BD4uEpBM-DIJiGq4e.mjs";
6
- import { t as postgresRenderCheckExpressions } from "./check-expressions-DL9WtMO5-CUcbN2JG.mjs";
7
- import { t as postgresDataTypeEntries } from "./data-type-entries-dmLDRSOf-BJADXpXD.mjs";
2
+ import { u as postgresError } from "./errors-C4-Dp3gI-B5jY5eJj.mjs";
3
+ import { A as pgJson, j as pgJsonb, r as createPostgresBuiltinDataTypeLookup } from "./data-types-DWfwErIu-DF85cgmu.mjs";
4
+ import { r as createPostgresBuiltinCodecLookup } from "./codec-registry-B0LsFn7Z-ej9yKwTq.mjs";
5
+ import { t as POLICY_BLOCK_KEYWORDS } from "./authoring-BbS0bin5-U9tXyzS6.mjs";
6
+ import { t as postgresRenderCheckExpressions } from "./check-expressions-Ch-A_NJN-BscDa8xT.mjs";
7
+ import { t as postgresDataTypeEntries } from "./data-type-entries-CVxsfjF3-Bd0cSfuG.mjs";
8
8
  import { n as readPostgresDefault } from "./default-normalizer-BqK6XxdC-2OUb2ybG.mjs";
9
9
  import { codecForRef, readContractValue } from "@prisma/orm-framework/components/codec";
10
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
@@ -23,7 +23,7 @@ import { readReportedDefault } from "@prisma/orm-family-sql/family/control";
23
23
  import { isColumnDefault } from "@prisma/orm-framework/contract/types";
24
24
  import { buildChildRelationField, deriveRelationFieldName, inferRelations, toEnumName, toFieldName, toModelName } from "@prisma/orm-family-sql/family/psl-infer";
25
25
  import { escapePslString } from "@prisma/orm-family-sql/contract/data-type-support";
26
- //#region ../../../3-targets/postgres/1-target/dist/infer-psl-contract-DR0Uie7w.mjs
26
+ //#region ../../../3-targets/postgres/1-target/dist/infer-psl-contract-CAoJuV8y.mjs
27
27
  const SYNTHETIC_SPAN = {
28
28
  start: {
29
29
  offset: 0,
@@ -1236,4 +1236,4 @@ function buildPslDocumentAst(schemaIR, options, foreignKeyExtras, namespaceName,
1236
1236
  //#endregion
1237
1237
  export { positionalArg as _, buildFullTextIndexAttribute as a, buildModelConstraintAttribute as c, createPostgresDefaultMapping as d, inferPostgresPslContract as f, parseDefaultAttributeString as g, noInferredDefaults as h, buildExtensionBlock as i, buildNativeEnumBlock as l, noColumnDefaults as m, buildAttribute as n, buildIndexAttribute as o, namedArg as p, buildCheckAttribute as r, buildMapAttribute as s, SYNTHETIC_SPAN as t, buildPslDocumentAst as u, typeArgument as v };
1238
1238
 
1239
- //# sourceMappingURL=infer-psl-contract-DR0Uie7w-CkaPSdPc.mjs.map
1239
+ //# sourceMappingURL=infer-psl-contract-CAoJuV8y-Da9y8zwV.mjs.map