@prisma/orm-target-postgres 8.0.0-rc.21-dev.6 → 8.0.0-rc.21-dev.8

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 (148) hide show
  1. package/dist/{adapter-BIWKN0d7-B2BpKdVy.mjs → adapter-B84yJpi7-8wwdWq5R.mjs} +6 -6
  2. package/dist/{adapter-BIWKN0d7-B2BpKdVy.mjs.map → adapter-B84yJpi7-8wwdWq5R.mjs.map} +1 -1
  3. package/dist/adapter.d.mts +1 -1
  4. package/dist/adapter.mjs +5 -5
  5. package/dist/adapter__adapter.mjs +2 -2
  6. package/dist/adapter__control.d.mts +1 -1
  7. package/dist/adapter__control.mjs +4 -4
  8. package/dist/adapter__control.mjs.map +1 -1
  9. package/dist/adapter__runtime.mjs +4 -4
  10. package/dist/adapter__runtime.mjs.map +1 -1
  11. package/dist/adapter__sql-renderer.mjs +1 -1
  12. package/dist/{authoring-DOlbnTzz-BWXtiq9i.mjs → authoring-Bm8PD9ls-clXbYDiN.mjs} +209 -48
  13. package/dist/authoring-Bm8PD9ls-clXbYDiN.mjs.map +1 -0
  14. package/dist/{autoincrement-widths-D7Uub-uA-DccZpX6Q.mjs → autoincrement-widths-DkD24r-C-D4O96GJZ.mjs} +3 -3
  15. package/dist/{autoincrement-widths-D7Uub-uA-DccZpX6Q.mjs.map → autoincrement-widths-DkD24r-C-D4O96GJZ.mjs.map} +1 -1
  16. package/dist/{check-expressions-CCFJKC7N-DHEJIG2S.mjs → check-expressions-C_lM7sSK-Dtv6p3hg.mjs} +3 -3
  17. package/dist/{check-expressions-CCFJKC7N-DHEJIG2S.mjs.map → check-expressions-C_lM7sSK-Dtv6p3hg.mjs.map} +1 -1
  18. package/dist/{codec-registry-qdVGkdp_-DCI2nWSt.mjs → codec-registry-DVjibYBY-BeOUp5fk.mjs} +4 -4
  19. package/dist/{codec-registry-qdVGkdp_-DCI2nWSt.mjs.map → codec-registry-DVjibYBY-BeOUp5fk.mjs.map} +1 -1
  20. package/dist/{codecs-BcYLh1iB-Dxi2UgkJ.mjs → codecs-BqCmavY8-CC-ZbbTA.mjs} +12 -5
  21. package/dist/codecs-BqCmavY8-CC-ZbbTA.mjs.map +1 -0
  22. package/dist/{contract-contributions-DTGGTwRZ-BmYIo6M5.mjs → contract-contributions-rxCSM_1W-d9oohAzB.mjs} +16 -41
  23. package/dist/contract-contributions-rxCSM_1W-d9oohAzB.mjs.map +1 -0
  24. package/dist/{contract-free-Bjx-Ktot.mjs → contract-free-BrY8qnvY.mjs} +3 -3
  25. package/dist/{contract-free-Bjx-Ktot.mjs.map → contract-free-BrY8qnvY.mjs.map} +1 -1
  26. package/dist/{control-policy-B1Zvw6VN-DN4QDwpc.mjs → control-policy-BncmQ6LO-B8SXRfP_.mjs} +9 -9
  27. package/dist/{control-policy-B1Zvw6VN-DN4QDwpc.mjs.map → control-policy-BncmQ6LO-B8SXRfP_.mjs.map} +1 -1
  28. package/dist/{control-m9LWRUnY.d.mts → control-s1_5W_8t.d.mts} +179 -74
  29. package/dist/control-s1_5W_8t.d.mts.map +1 -0
  30. package/dist/{data-type-entries-DhUYJbVb-4NUH6vR_.mjs → data-type-entries-ZHPz2h_f-CNUmPGgf.mjs} +3 -3
  31. package/dist/{data-type-entries-DhUYJbVb-4NUH6vR_.mjs.map → data-type-entries-ZHPz2h_f-CNUmPGgf.mjs.map} +1 -1
  32. package/dist/{data-types-B7S_CHZd-C9JA40Ir.mjs → data-types-DklKHVmp-Bl-nwUa-.mjs} +21 -4
  33. package/dist/data-types-DklKHVmp-Bl-nwUa-.mjs.map +1 -0
  34. package/dist/{date-time-now-generators-C2aktlrc-uf9LqU6E.d.mts → date-time-now-generators-BZj5G1E3-BylrCrgW.d.mts} +4 -4
  35. package/dist/date-time-now-generators-BZj5G1E3-BylrCrgW.d.mts.map +1 -0
  36. package/dist/{date-time-now-generators-BrJ1cMzo-CxURsw2O.mjs → date-time-now-generators-Cc4PvFeB-XQWJz_4f.mjs} +21 -11
  37. package/dist/date-time-now-generators-Cc4PvFeB-XQWJz_4f.mjs.map +1 -0
  38. package/dist/{ddl-DiUFjVZe-DETlNlJh.mjs → ddl-LpR9foVX-YBmyKx74.mjs} +3 -3
  39. package/dist/{ddl-DiUFjVZe-DETlNlJh.mjs.map → ddl-LpR9foVX-YBmyKx74.mjs.map} +1 -1
  40. package/dist/{descriptor-meta-CGRsMMdO-tQxNSE_j.mjs → descriptor-meta-C2F_xt0P-D7gfqNS0.mjs} +17 -12
  41. package/dist/descriptor-meta-C2F_xt0P-D7gfqNS0.mjs.map +1 -0
  42. package/dist/{descriptor-meta-I7Ih-0hE-CrOjEir4.mjs → descriptor-meta-C2YuDfV8-B_u19j25.mjs} +4 -4
  43. package/dist/{descriptor-meta-I7Ih-0hE-CrOjEir4.mjs.map → descriptor-meta-C2YuDfV8-B_u19j25.mjs.map} +1 -1
  44. package/dist/{diff-database-schema-ASDRsuei-3Yro3-Tw.mjs → diff-database-schema-CcR7BN-A-BuftnIR2.mjs} +9 -9
  45. package/dist/{diff-database-schema-ASDRsuei-3Yro3-Tw.mjs.map → diff-database-schema-CcR7BN-A-BuftnIR2.mjs.map} +1 -1
  46. package/dist/{errors-Di_apgWJ-BLXRTfFj.mjs → errors-DG6xgXgr-Cb1XcPcb.mjs} +6 -5
  47. package/dist/errors-DG6xgXgr-Cb1XcPcb.mjs.map +1 -0
  48. package/dist/{full-text-CcHf5wkL.mjs → full-text-7szWl7EC.mjs} +3 -3
  49. package/dist/{full-text-CcHf5wkL.mjs.map → full-text-7szWl7EC.mjs.map} +1 -1
  50. package/dist/{full-text-index-definition-B0kQDs_M-8N6Slj3l.mjs → full-text-index-definition-BRNRSgZK-l_2TBarg.mjs} +3 -3
  51. package/dist/{full-text-index-definition-B0kQDs_M-8N6Slj3l.mjs.map → full-text-index-definition-BRNRSgZK-l_2TBarg.mjs.map} +1 -1
  52. package/dist/{full-text-parsers-hI_qtk-Q-DqTMF4n2.mjs → full-text-parsers-Dd5DOdBA-BTeOSzUj.mjs} +4 -4
  53. package/dist/{full-text-parsers-hI_qtk-Q-DqTMF4n2.mjs.map → full-text-parsers-Dd5DOdBA-BTeOSzUj.mjs.map} +1 -1
  54. package/dist/{full-text-search-document-7AKd6oOw-S-rsh3SZ.mjs → full-text-search-document-DWzECXD--BqrLGXsX.mjs} +5 -5
  55. package/dist/{full-text-search-document-7AKd6oOw-S-rsh3SZ.mjs.map → full-text-search-document-DWzECXD--BqrLGXsX.mjs.map} +1 -1
  56. package/dist/{index-types-DfnDGeQU-BWcrd_SP.mjs → index-types-5g7gXoWK-CBvkTIbr.mjs} +3 -3
  57. package/dist/{index-types-DfnDGeQU-BWcrd_SP.mjs.map → index-types-5g7gXoWK-CBvkTIbr.mjs.map} +1 -1
  58. package/dist/{infer-psl-contract-BZnLgJj6-EjqMFHxE.mjs → infer-psl-contract-CT9H9Xnw-l2pNPAyO.mjs} +70 -17
  59. package/dist/infer-psl-contract-CT9H9Xnw-l2pNPAyO.mjs.map +1 -0
  60. package/dist/migration-Be_iuIpn.mjs.map +1 -1
  61. package/dist/{native-type-normalizer-BpTZ6sm1.mjs → native-type-normalizer-DgHcQkwl.mjs} +2 -2
  62. package/dist/{native-type-normalizer-BpTZ6sm1.mjs.map → native-type-normalizer-DgHcQkwl.mjs.map} +1 -1
  63. package/dist/{op-factory-call-CUu2s6l7-CaAVzTwP.mjs → op-factory-call-BRaCqnFh-avSVdAgI.mjs} +8 -8
  64. package/dist/{op-factory-call-CUu2s6l7-CaAVzTwP.mjs.map → op-factory-call-BRaCqnFh-avSVdAgI.mjs.map} +1 -1
  65. package/dist/{pack-DKR4BRIY.d.mts → pack-BtgCVVid.d.mts} +184 -100
  66. package/dist/pack-BtgCVVid.d.mts.map +1 -0
  67. package/dist/{planner-C69ALB15-CasiGSdJ.mjs → planner-BsLpyYHC-IEpACcdS.mjs} +10 -10
  68. package/dist/{planner-C69ALB15-CasiGSdJ.mjs.map → planner-BsLpyYHC-IEpACcdS.mjs.map} +1 -1
  69. package/dist/{planner-ddl-builders-BHvruDX3-Sw7yWuWE.mjs → planner-ddl-builders-Dmr6ph8i-5FWxE6Wu.mjs} +3 -3
  70. package/dist/{planner-ddl-builders-BHvruDX3-Sw7yWuWE.mjs.map → planner-ddl-builders-Dmr6ph8i-5FWxE6Wu.mjs.map} +1 -1
  71. package/dist/{planner-identity-values-Cp0Cvrg7-BxMk9Qaf.mjs → planner-identity-values-BwYhwYeo-CaSwyXgC.mjs} +3 -3
  72. package/dist/{planner-identity-values-Cp0Cvrg7-BxMk9Qaf.mjs.map → planner-identity-values-BwYhwYeo-CaSwyXgC.mjs.map} +1 -1
  73. package/dist/{planner-produced-postgres-migration-BGo--l2b-ww24WTkY.mjs → planner-produced-postgres-migration-CU7D_5IE-Cv-o4-Hh.mjs} +4 -4
  74. package/dist/{planner-produced-postgres-migration-BGo--l2b-ww24WTkY.mjs.map → planner-produced-postgres-migration-CU7D_5IE-Cv-o4-Hh.mjs.map} +1 -1
  75. package/dist/{planner-sql-checks-Dhx-R5GJ-GyHfROia.mjs → planner-sql-checks-DOGD6v7y-BWkRMsXt.mjs} +19 -10
  76. package/dist/{planner-sql-checks-Dhx-R5GJ-GyHfROia.mjs.map → planner-sql-checks-DOGD6v7y-BWkRMsXt.mjs.map} +1 -1
  77. package/dist/{postgres-codec-traits-Cpq3LqzZ-D_WitJjX.mjs → postgres-codec-traits-BhLP9ipO-D5kVsAxr.mjs} +3 -3
  78. package/dist/{postgres-codec-traits-Cpq3LqzZ-D_WitJjX.mjs.map → postgres-codec-traits-BhLP9ipO-D5kVsAxr.mjs.map} +1 -1
  79. package/dist/{postgres-contract-view-CvoOn_Xj-Dr0DQlVT.mjs → postgres-contract-view-DBmVHV5m-DDZR3cBh.mjs} +8 -8
  80. package/dist/{postgres-contract-view-CvoOn_Xj-Dr0DQlVT.mjs.map → postgres-contract-view-DBmVHV5m-DDZR3cBh.mjs.map} +1 -1
  81. package/dist/{postgres-migration-69O9MUBt-BQ1_mj4S.mjs → postgres-migration-DrLpuKus-DOU9Rbkb.mjs} +11 -11
  82. package/dist/{postgres-migration-69O9MUBt-BQ1_mj4S.mjs.map → postgres-migration-DrLpuKus-DOU9Rbkb.mjs.map} +1 -1
  83. package/dist/{postgres-schema-CNNW8eA3-CwosQz5e.mjs → postgres-schema-CEGf780E-cyGo2Sii.mjs} +4 -4
  84. package/dist/{postgres-schema-CNNW8eA3-CwosQz5e.mjs.map → postgres-schema-CEGf780E-cyGo2Sii.mjs.map} +1 -1
  85. package/dist/{prisma7-binding-DFb9yHdO.d.mts → prisma7-binding-0UXq-q2N.d.mts} +191 -100
  86. package/dist/prisma7-binding-0UXq-q2N.d.mts.map +1 -0
  87. package/dist/{prisma7-binding-CcrXBBbM.mjs → prisma7-binding-BvvPWMwt.mjs} +27 -9
  88. package/dist/prisma7-binding-BvvPWMwt.mjs.map +1 -0
  89. package/dist/{render-ops-Dr6RDk6z-CSGJsR6N.mjs → render-ops-CbRkpwwx-C6wSWcTl.mjs} +4 -4
  90. package/dist/{render-ops-Dr6RDk6z-CSGJsR6N.mjs.map → render-ops-CbRkpwwx-C6wSWcTl.mjs.map} +1 -1
  91. package/dist/{resolve-ddl-schema-p68Q5F1u-DZAQNXpi.mjs → resolve-ddl-schema-BhOYD95_-DhUQYNLi.mjs} +3 -3
  92. package/dist/{resolve-ddl-schema-p68Q5F1u-DZAQNXpi.mjs.map → resolve-ddl-schema-BhOYD95_-DhUQYNLi.mjs.map} +1 -1
  93. package/dist/{runtime-DGgnFCG7.d.mts → runtime-BbPgK4gH.d.mts} +2 -2
  94. package/dist/{runtime-DGgnFCG7.d.mts.map → runtime-BbPgK4gH.d.mts.map} +1 -1
  95. package/dist/{sql-renderer-BdWJPa5F-DUvahuXZ.mjs → sql-renderer-BdWJPa5F-B8cdiqmK.mjs} +3 -3
  96. package/dist/{sql-renderer-BdWJPa5F-DUvahuXZ.mjs.map → sql-renderer-BdWJPa5F-B8cdiqmK.mjs.map} +1 -1
  97. package/dist/{sql-utils-CnnGiZBc.d.mts → sql-utils-Bq4nuPvy.d.mts} +6 -2
  98. package/dist/{sql-utils-CnnGiZBc.d.mts.map → sql-utils-Bq4nuPvy.d.mts.map} +1 -1
  99. package/dist/{sql-utils-0j_6QstU-DAfnt5Mu.mjs → sql-utils-ylvfJ1RJ-03xGdSLI.mjs} +34 -4
  100. package/dist/sql-utils-ylvfJ1RJ-03xGdSLI.mjs.map +1 -0
  101. package/dist/target.d.mts +7 -7
  102. package/dist/target.mjs +32 -32
  103. package/dist/target__codecs.mjs +2 -2
  104. package/dist/target__contract-free.mjs +3 -3
  105. package/dist/target__control.d.mts +2 -2
  106. package/dist/target__control.mjs +38 -25
  107. package/dist/target__control.mjs.map +1 -1
  108. package/dist/target__data-types.mjs +2 -2
  109. package/dist/target__diff-database-schema.mjs +1 -1
  110. package/dist/target__errors.mjs +1 -1
  111. package/dist/target__full-text-index-authoring.mjs +2 -2
  112. package/dist/target__full-text.mjs +2 -2
  113. package/dist/target__issue-planner.mjs +1 -1
  114. package/dist/target__migration.mjs +2 -2
  115. package/dist/target__native-type-normalizer.mjs +1 -1
  116. package/dist/target__op-factory-call.mjs +1 -1
  117. package/dist/target__pack.d.mts +1 -1
  118. package/dist/target__pack.mjs +1 -1
  119. package/dist/target__planner-ddl-builders.mjs +1 -1
  120. package/dist/target__planner-identity-values.mjs +1 -1
  121. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  122. package/dist/target__planner-sql-checks.mjs +1 -1
  123. package/dist/target__planner.mjs +2 -2
  124. package/dist/target__prisma7-binding.d.mts +1 -1
  125. package/dist/target__prisma7-binding.mjs +1 -1
  126. package/dist/target__render-ops.mjs +1 -1
  127. package/dist/target__runtime.d.mts +2 -2
  128. package/dist/target__runtime.mjs +7 -7
  129. package/dist/target__runtime.mjs.map +1 -1
  130. package/dist/target__schema-ir-annotations.mjs +1 -1
  131. package/dist/target__sql-utils.d.mts +2 -2
  132. package/dist/target__sql-utils.mjs +4 -4
  133. package/dist/target__types.mjs +2 -2
  134. package/package.json +9 -9
  135. package/dist/authoring-DOlbnTzz-BWXtiq9i.mjs.map +0 -1
  136. package/dist/codecs-BcYLh1iB-Dxi2UgkJ.mjs.map +0 -1
  137. package/dist/contract-contributions-DTGGTwRZ-BmYIo6M5.mjs.map +0 -1
  138. package/dist/control-m9LWRUnY.d.mts.map +0 -1
  139. package/dist/data-types-B7S_CHZd-C9JA40Ir.mjs.map +0 -1
  140. package/dist/date-time-now-generators-BrJ1cMzo-CxURsw2O.mjs.map +0 -1
  141. package/dist/date-time-now-generators-C2aktlrc-uf9LqU6E.d.mts.map +0 -1
  142. package/dist/descriptor-meta-CGRsMMdO-tQxNSE_j.mjs.map +0 -1
  143. package/dist/errors-Di_apgWJ-BLXRTfFj.mjs.map +0 -1
  144. package/dist/infer-psl-contract-BZnLgJj6-EjqMFHxE.mjs.map +0 -1
  145. package/dist/pack-DKR4BRIY.d.mts.map +0 -1
  146. package/dist/prisma7-binding-CcrXBBbM.mjs.map +0 -1
  147. package/dist/prisma7-binding-DFb9yHdO.d.mts.map +0 -1
  148. package/dist/sql-utils-0j_6QstU-DAfnt5Mu.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-Bm8PD9ls-clXbYDiN.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/authoring-Bm8PD9ls.mjs"],"sourcesContent":["import { D as PG_TIMESTAMP_DATE_CODEC_ID, O as PG_TIMESTAMP_INSTANT_CODEC_ID, _ as PG_INTERVAL_STRING_CODEC_ID, s as PG_ENUM_CODEC_ID, w as PG_TIMESTAMPTZ_DATE_CODEC_ID } from \"./codec-ids-D0wjQdEW.mjs\";\nimport { l as postgresError } from \"./errors-DG6xgXgr.mjs\";\nimport { t as PostgresNativeEnum } from \"./postgres-native-enum-CdP3b_-R.mjs\";\nimport { f as weightGroupsOf, l as POSTGRES_TEXT_SEARCH_LANGUAGES, o as fullTextIndexProblems, r as describeFullTextIndexProblem, t as FULL_TEXT_INDEX_TYPE } from \"./full-text-index-definition-BRNRSgZK.mjs\";\nimport { t as postgresCodecTraitsOf } from \"./postgres-codec-traits-BhLP9ipO.mjs\";\nimport { _ as PostgresRlsPolicy, d as PostgresNativeEnumSchema, f as PostgresRlsEnablementSchema, h as PostgresRole, m as PostgresRoleSchema, p as PostgresRlsPolicySchema, v as PostgresRlsEnablement } from \"./postgres-schema-CEGf780E.mjs\";\nimport { r as computeContentHash } from \"./canonicalize-RdxoUHao.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { sqlTargetTypeConstructors } from \"@internal/family-sql/pack\";\nimport { temporalTypeAliases } from \"@internal/framework-components/authoring\";\nimport { blockAttribute, bool, dataTypeValue, entityRef, fieldRef, identifier, leafDiagnostic, list, mapBlock, modelAttribute, oneOf, optional, str, structBlock } from \"@internal/psl-parser\";\nimport { generatedIdColumnAliases } from \"@internal/sql-contract/generated-id-column-aliases\";\nimport { exactNameBodyWarning } from \"@internal/sql-contract/index-naming\";\nimport { SQL_EXPRESSION_DATA_TYPE_ID, requireSqlExpression, sqlTextFromStored } from \"@internal/sql-contract/sql-expression\";\nimport { assertWireNamePrefixLength, normalizeSqlBody } from \"@internal/sql-schema-ir/naming\";\nimport { assertDefined, invariant } from \"@internal/utils/assertions\";\n//#region src/core/type-constructors.ts\n/** The data type of every size argument on Postgres, such as a length or a precision: a typmod is an `int4`. */\nconst PG_SIZE_TYPE = \"pg/int4\";\n/**\n* The base PSL scalars as zero-arg type constructors in the unified authoring\n* channel. Each names a codec; the column's database type is its data type's.\n*\n* The type position is the only storage decider: a mutation-default generator\n* (`@onCreate(uuid())`) never re-picks a column's storage.\n*/\nconst postgresScalarAuthoringTypes = {\n\tString: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"Variable-length text stored as PostgreSQL text.\",\n\t\toutput: { codecId: \"pg/text@1\" }\n\t},\n\tBoolean: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A true or false value stored as PostgreSQL boolean.\",\n\t\toutput: { codecId: \"pg/bool@1\" }\n\t},\n\tInt: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A signed 32-bit integer represented as a JavaScript number.\",\n\t\toutput: { codecId: \"pg/int4@1\" }\n\t},\n\tBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A signed 64-bit integer represented as a JavaScript bigint.\",\n\t\toutput: { codecId: \"pg/int8@1\" }\n\t},\n\tFloat: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A double-precision floating-point number.\",\n\t\toutput: { codecId: \"pg/float8@1\" }\n\t},\n\tDecimal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An exact decimal value stored as PostgreSQL numeric.\",\n\t\toutput: { codecId: \"pg/numeric@1\" }\n\t},\n\tJson: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A JSON value stored as PostgreSQL json.\",\n\t\toutput: { codecId: \"pg/json@1\" }\n\t},\n\tJsonb: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A JSON value stored in PostgreSQL binary jsonb format.\",\n\t\toutput: { codecId: \"pg/jsonb@1\" }\n\t},\n\tBytes: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"Binary data stored as PostgreSQL bytea.\",\n\t\toutput: { codecId: \"pg/bytea@1\" }\n\t}\n};\nconst postgresNativeAuthoringTypes = {\n\tVarChar: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"Variable-length text with an optional maximum character length.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"length\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/varchar@1\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tChar: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"Fixed-length, blank-padded text with an optional character length.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"length\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/char@1\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tNumeric: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"An exact decimal value with optional precision and scale.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}, {\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"scale\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/numeric@1\",\n\t\t\ttypeParams: {\n\t\t\t\tprecision: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0\n\t\t\t\t},\n\t\t\t\tscale: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tTimestampTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A date and time without a time zone, represented as Temporal.PlainDateTime.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamp-temporal@1\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestamptzTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant represented as Temporal.Instant, with optional fractional-second precision.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz-temporal@1\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimeTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A time of day without a time zone, represented as Temporal.PlainTime.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/time-temporal@1\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimetz: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A time of day with a UTC offset stored as PostgreSQL timetz and represented as ISO 8601 text.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timetz@1\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tUuid: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A universally unique identifier stored as PostgreSQL uuid.\",\n\t\toutput: { codecId: \"pg/uuid@1\" }\n\t},\n\tInet: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"An IPv4 or IPv6 address with an optional subnet mask.\",\n\t\toutput: { codecId: \"pg/inet@1\" }\n\t},\n\tSmallInt: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A signed 16-bit integer represented as a JavaScript number.\",\n\t\toutput: { codecId: \"pg/int2@1\" }\n\t},\n\tReal: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A single-precision floating-point number.\",\n\t\toutput: { codecId: \"pg/float4@1\" }\n\t},\n\tDateTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A calendar date represented as Temporal.PlainDate.\",\n\t\toutput: { codecId: \"pg/date-temporal@1\" }\n\t},\n\tDateString: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A PostgreSQL date represented as ISO 8601 text rather than Temporal.PlainDate.\",\n\t\toutput: { codecId: \"pg/date-string@1\" }\n\t},\n\tTimestampString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A timestamp without a time zone represented as ISO 8601 text.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamp-string@1\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestamptzJsDate: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"An instant stored as PostgreSQL timestamptz and represented as a JavaScript Date.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: PG_TIMESTAMPTZ_DATE_CODEC_ID,\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestampJsDate: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A date and time stored as PostgreSQL timestamp and represented as a JavaScript Date, read and written as UTC.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: PG_TIMESTAMP_DATE_CODEC_ID,\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestampInstant: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A date and time stored as PostgreSQL timestamp and represented as Temporal.Instant, read and written as UTC.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: PG_TIMESTAMP_INSTANT_CODEC_ID,\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimestamptzString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A timestamp with time zone represented as ISO 8601 text, the instant in UTC.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/timestamptz-string@1\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tTimeString: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A time of day without a time zone represented as ISO 8601 text.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/time-string@1\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tBit: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A fixed-length bit string with an optional length in bits.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"length\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/bit@1\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tVarBit: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A variable-length bit string with an optional maximum length in bits.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"length\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/varbit@1\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tIntervalParts: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A span of time stored as PostgreSQL interval and represented as { months, days, micros }, with optional fractional-second precision.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"pg/interval@1\",\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t},\n\tIntervalString: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tdocumentation: \"A span of time stored as PostgreSQL interval and represented as an ISO 8601 duration such as P1Y2M, with optional fractional-second precision.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: PG_SIZE_TYPE,\n\t\t\tname: \"precision\",\n\t\t\toptional: true\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: PG_INTERVAL_STRING_CODEC_ID,\n\t\t\ttypeParams: { precision: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t}\n};\nconst precision = {\n\tkind: \"value\",\n\tdataType: PG_SIZE_TYPE,\n\tname: \"precision\",\n\toptional: true\n};\n/**\n* The convenience date and time types. Each is a type choice: its `as` and `storage` arguments choose the explicit type it becomes, and `precision` is passed on to that type. ADR 279.\n*/\nconst postgresConvenienceDateTimeTypes = {\n\tDateTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A moment in time. `as` is what the application reads: jsDate (a JavaScript Date), temporal (Temporal.Instant) or string. `storage` is timestamptz or timestamp, a timestamp read and written as UTC.\",\n\t\targs: [\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"as\",\n\t\t\t\tvalues: [\n\t\t\t\t\t\"jsDate\",\n\t\t\t\t\t\"temporal\",\n\t\t\t\t\t\"string\"\n\t\t\t\t],\n\t\t\t\tdefault: \"jsDate\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"storage\",\n\t\t\t\tvalues: [\"timestamptz\", \"timestamp\"],\n\t\t\t\tdefault: \"timestamptz\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\tprecision\n\t\t],\n\t\tchoices: [\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"jsDate\",\n\t\t\t\t\tstorage: \"timestamptz\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestamptzJsDate\",\n\t\t\t\tdefaults: { precision: 3 }\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"temporal\",\n\t\t\t\t\tstorage: \"timestamptz\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestamptzTemporal\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"timestamptz\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestamptzString\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"jsDate\",\n\t\t\t\t\tstorage: \"timestamp\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestampJsDate\",\n\t\t\t\tdefaults: { precision: 3 }\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"temporal\",\n\t\t\t\t\tstorage: \"timestamp\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestampInstant\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"timestamp\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimestampString\"\n\t\t\t}\n\t\t]\n\t},\n\tDate: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A calendar date. `as` is what the application reads: string, such as \\\"2024-02-29\\\", or temporal (Temporal.PlainDate).\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, {\n\t\t\tkind: \"option\",\n\t\t\tname: \"storage\",\n\t\t\tvalues: [\"date\"],\n\t\t\tdefault: \"date\",\n\t\t\toptional: true\n\t\t}],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"date\"\n\t\t\t},\n\t\t\ttype: \"DateString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"date\"\n\t\t\t},\n\t\t\ttype: \"DateTemporal\"\n\t\t}]\n\t},\n\tTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A time of day. `as` is what the application reads: string, such as \\\"09:30:00\\\", or temporal (Temporal.PlainTime). `storage` is time, or timetz with as: string.\",\n\t\targs: [\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"as\",\n\t\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\t\tdefault: \"string\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"storage\",\n\t\t\t\tvalues: [\"time\", \"timetz\"],\n\t\t\t\tdefault: \"time\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\tprecision\n\t\t],\n\t\tchoices: [\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"time\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimeString\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"temporal\",\n\t\t\t\t\tstorage: \"time\"\n\t\t\t\t},\n\t\t\t\ttype: \"TimeTemporal\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"timetz\"\n\t\t\t\t},\n\t\t\t\ttype: \"Timetz\"\n\t\t\t}\n\t\t]\n\t},\n\tDuration: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A length of time. `as` is what the application reads: string, an ISO 8601 duration such as \\\"P1M\\\", or parts, the object { months, days, micros }.\",\n\t\targs: [\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"as\",\n\t\t\t\tvalues: [\"string\", \"parts\"],\n\t\t\t\tdefault: \"string\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"option\",\n\t\t\t\tname: \"storage\",\n\t\t\t\tvalues: [\"interval\"],\n\t\t\t\tdefault: \"interval\",\n\t\t\t\toptional: true\n\t\t\t},\n\t\t\tprecision\n\t\t],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"interval\"\n\t\t\t},\n\t\t\ttype: \"IntervalString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"parts\",\n\t\t\t\tstorage: \"interval\"\n\t\t\t},\n\t\t\ttype: \"IntervalParts\"\n\t\t}]\n\t}\n};\n/**\n* The base scalars and native types as type constructors. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.\n*/\nconst postgresScalarAndNativeTypeConstructors = {\n\t...postgresNativeAuthoringTypes,\n\t...postgresScalarAuthoringTypes,\n\t...postgresConvenienceDateTimeTypes\n};\n//#endregion\n//#region src/core/authoring.ts\nconst PSL_POLICY_INVALID_MAP = \"PSL_POLICY_INVALID_MAP\";\nconst PSL_FULL_TEXT_INDEX_TOO_MANY_GROUPS = \"PSL_FULL_TEXT_INDEX_TOO_MANY_GROUPS\";\nconst PSL_FULL_TEXT_INDEX_EMPTY_GROUP = \"PSL_FULL_TEXT_INDEX_EMPTY_GROUP\";\nconst PSL_FULL_TEXT_INDEX_DUPLICATE_FIELD = \"PSL_FULL_TEXT_INDEX_DUPLICATE_FIELD\";\nconst PSL_FULL_TEXT_INDEX_REQUIRES_NAME = \"PSL_FULL_TEXT_INDEX_REQUIRES_NAME\";\nconst PSL_FULL_TEXT_INDEX_NAME_XOR_MAP = \"PSL_FULL_TEXT_INDEX_NAME_XOR_MAP\";\nconst PSL_FULL_TEXT_INDEX_TEXT_FIELD = \"PSL_FULL_TEXT_INDEX_TEXT_FIELD\";\nconst PSL_NATIVE_ENUM_DUPLICATE_MEMBER_VALUE = \"PSL_NATIVE_ENUM_DUPLICATE_MEMBER_VALUE\";\nconst PSL_NATIVE_ENUM_MISSING_MEMBERS = \"PSL_NATIVE_ENUM_MISSING_MEMBERS\";\nconst PSL_ROLE_BLOCK_OUTSIDE_UNBOUND_NAMESPACE = \"PSL_ROLE_BLOCK_OUTSIDE_UNBOUND_NAMESPACE\";\n/**\n* `pg.enum(<ref>)` registers as an ordinary type constructor whose sole\n* positional argument names a `native_enum` entity instead of carrying a\n* literal value. The interpreter resolves the ref to the `native_enum`\n* entity generically (driven by `entityRefArg`); the `pg/enum@1` codec\n* descriptor's `columnFromEntity` hook (see `codecs.ts`) converts that\n* entity into the column's `typeParams`. The column's type name comes from the\n* `pg/enum` data type, which renders `typeParams.typeName`.\n*/\nconst postgresAuthoringTypes = {\n\t.../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: PG_SIZE_TYPE }),\n\t...generatedIdColumnAliases,\n\tBigIntNumber: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A PostgreSQL 64-bit integer represented as a JavaScript number within its safe integer range.\",\n\t\toutput: { codecId: \"pg/int8number@1\" }\n\t},\n\tUnboundedInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An arbitrary-precision integer stored as PostgreSQL numeric and represented as bigint.\",\n\t\toutput: { codecId: \"pg/unboundedint@1\" }\n\t},\n\tpg: { enum: {\n\t\tkind: \"typeConstructor\",\n\t\tinferred: true,\n\t\tentityRefArg: {\n\t\t\tindex: 0,\n\t\t\tentityKind: \"native_enum\"\n\t\t},\n\t\toutput: { codecId: PG_ENUM_CODEC_ID }\n\t} },\n\ttemporal: /* @__PURE__ */ postgresTemporalTypeAliases()\n};\n/**\n* The created-at and updated-at aliases, on the type bare `DateTime` becomes: a `timestamptz(3)` column read as a JavaScript `Date` (ADR 279).\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction postgresTemporalTypeAliases() {\n\treturn temporalTypeAliases({\n\t\tcodecId: PG_TIMESTAMPTZ_DATE_CODEC_ID,\n\t\ttypeParams: { precision: 3 }\n\t}, \"a JavaScript Date\");\n}\nconst policyTargetParam = {\n\ttype: entityRef({ kind: \"model\" }),\n\tdocumentation: \"The model protected by this policy; it must declare @@rls.\"\n};\nconst policyRolesParam = {\n\ttype: optional(list(oneOf(entityRef({\n\t\tkind: \"block\",\n\t\tkeyword: \"role\"\n\t}), identifier()))),\n\tdocumentation: \"The database roles to which this policy applies.\"\n};\nfunction policyUsingParam(ctx) {\n\treturn {\n\t\ttype: optional(dataTypeValue(SQL_EXPRESSION_DATA_TYPE_ID, ctx.dataTypes)),\n\t\tdocumentation: \"A SQL predicate controlling which rows this policy permits.\"\n\t};\n}\nfunction policyWithCheckParam(ctx) {\n\treturn {\n\t\ttype: optional(dataTypeValue(SQL_EXPRESSION_DATA_TYPE_ID, ctx.dataTypes)),\n\t\tdocumentation: \"A SQL predicate checking rows being written by this policy.\"\n\t};\n}\nconst policyPermissiveParam = {\n\ttype: optional(bool()),\n\tdocumentation: \"Whether the policy is permissive (combined with OR) rather than restrictive (combined with AND).\"\n};\nfunction policyUsingOnlySpec(ctx) {\n\treturn structBlock({ parameters: {\n\t\ttarget: policyTargetParam,\n\t\troles: policyRolesParam,\n\t\tusing: policyUsingParam(ctx),\n\t\tpermissive: policyPermissiveParam\n\t} });\n}\nfunction policyWithCheckOnlySpec(ctx) {\n\treturn structBlock({ parameters: {\n\t\ttarget: policyTargetParam,\n\t\troles: policyRolesParam,\n\t\twithCheck: policyWithCheckParam(ctx),\n\t\tpermissive: policyPermissiveParam\n\t} });\n}\nfunction policyBothPredicatesSpec(ctx) {\n\treturn structBlock({ parameters: {\n\t\ttarget: policyTargetParam,\n\t\troles: policyRolesParam,\n\t\tusing: policyUsingParam(ctx),\n\t\twithCheck: policyWithCheckParam(ctx),\n\t\tpermissive: policyPermissiveParam\n\t} });\n}\nfunction roleSpec() {\n\treturn structBlock({ parameters: {} });\n}\nfunction nativeEnumSpec() {\n\treturn mapBlock({ value: {\n\t\ttype: str(),\n\t\tdocumentation: \"The member value stored in the database enum type.\"\n\t} });\n}\n/**\n* The block keyword that authors each row-level security operation. The keyword is the operation, so\n* a policy block has no `operation` parameter. The reader looks a block's operation up here, and\n* `contract infer` and `contract print` look up the keyword to write.\n*/\nconst POLICY_BLOCK_KEYWORDS = {\n\tselect: \"policy_select\",\n\tinsert: \"policy_insert\",\n\tupdate: \"policy_update\",\n\tdelete: \"policy_delete\",\n\tall: \"policy_all\"\n};\nfunction isRlsPolicyOperation(value) {\n\treturn Object.hasOwn(POLICY_BLOCK_KEYWORDS, value);\n}\n/** The operation a `policy_<operation>` block keyword authors, or `undefined` for another keyword. */\nfunction policyOperationOfKeyword(keyword) {\n\treturn Object.keys(POLICY_BLOCK_KEYWORDS).filter(isRlsPolicyOperation).find((operation) => POLICY_BLOCK_KEYWORDS[operation] === keyword);\n}\n/**\n* Assembles a {@link PostgresRlsPolicy} from lowered inputs: normalizes the\n* predicates, computes the content-hash wire name, and constructs the frozen\n* entity. The single hash-assembly body shared by the PSL block lowering\n* ({@link lowerRlsPolicyFromBlock}) and the TS entity-handle lowering\n* ({@link postgresLowerEntityHandles}) so the two surfaces cannot drift.\n*/\nfunction buildRlsPolicyEntity(input) {\n\tconst permissive = input.permissive ?? true;\n\tconst wireHash = computeContentHash({\n\t\t...ifDefined(\"using\", input.using !== void 0 ? normalizeSqlBody(input.using) : void 0),\n\t\t...ifDefined(\"withCheck\", input.withCheck !== void 0 ? normalizeSqlBody(input.withCheck) : void 0),\n\t\troles: input.roles,\n\t\toperation: input.operation,\n\t\tpermissive\n\t});\n\treturn new PostgresRlsPolicy({\n\t\tnaming: {\n\t\t\tkind: \"wire\",\n\t\t\tprefix: input.prefix,\n\t\t\thash: wireHash\n\t\t},\n\t\ttableName: input.tableName,\n\t\tnamespaceId: input.namespaceId,\n\t\toperation: input.operation,\n\t\troles: input.roles,\n\t\tusing: input.using,\n\t\twithCheck: input.withCheck,\n\t\tpermissive\n\t});\n}\nfunction lowerRlsPolicyFromBlock(block, ctx) {\n\tconst prefix = block.name;\n\tconst operation = policyOperationOfKeyword(block.keyword) ?? \"select\";\n\tconst target = block.resolvedModelRefs?.[\"target\"];\n\tassertDefined(target, `lowerRlsPolicyFromBlock: policy \"${block.name}\" reached the factory without a projected \\`target\\` coordinate; the interpreter projects checked model references before invoking entity factories.`);\n\tconst roles = block.values.roles === void 0 ? [] : block.values.roles.map((role) => typeof role === \"string\" ? role : role.declaration.name).sort();\n\tconst using = block.values.using === void 0 ? void 0 : sqlTextFromStored(block.values.using.value.value);\n\tconst withCheck = block.values.withCheck === void 0 ? void 0 : sqlTextFromStored(block.values.withCheck.value.value);\n\tconst permissive = block.values.permissive ?? true;\n\tconst mapAttr = block.attributes[\"map\"];\n\tif (mapAttr !== void 0) {\n\t\tconst exactName = mapAttr.args[\"name\"];\n\t\tinvariant(typeof exactName === \"string\", \"@@map on a policy block parses one string argument\");\n\t\tctx.warnings?.push(exactNameBodyWarning(\"policy\", exactName));\n\t\treturn new PostgresRlsPolicy({\n\t\t\tnaming: {\n\t\t\t\tkind: \"exact\",\n\t\t\t\tname: exactName\n\t\t\t},\n\t\t\ttableName: target.tableName,\n\t\t\tnamespaceId: target.namespaceId,\n\t\t\toperation,\n\t\t\troles,\n\t\t\tusing,\n\t\t\twithCheck,\n\t\t\tpermissive\n\t\t});\n\t}\n\treturn buildRlsPolicyEntity({\n\t\tprefix,\n\t\ttableName: target.tableName,\n\t\tnamespaceId: target.namespaceId,\n\t\toperation,\n\t\troles,\n\t\t...ifDefined(\"using\", using),\n\t\t...ifDefined(\"withCheck\", withCheck),\n\t\tpermissive\n\t});\n}\nconst policyEntityTypeOutput = {\n\tfactory: lowerRlsPolicyFromBlock,\n\tpslPlacement: (entity) => ({ namespaceId: entity.namespaceId })\n};\nfunction lowerNativeEnumFromBlock(block, ctx) {\n\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\tconst diagnostics = ctx.diagnostics;\n\tconst mapAttr = block.attributes[\"map\"];\n\tlet typeName = block.name;\n\tif (mapAttr !== void 0) {\n\t\tconst mapped = mapAttr.args[\"name\"];\n\t\tinvariant(typeof mapped === \"string\", \"@@map on a native_enum block parses one string argument\");\n\t\ttypeName = mapped;\n\t}\n\tlet memberError = false;\n\tconst seenValues = /* @__PURE__ */ new Set();\n\tconst members = [];\n\tfor (const [memberName, value] of Object.entries(block.values)) {\n\t\tif (seenValues.has(value)) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: PSL_NATIVE_ENUM_DUPLICATE_MEMBER_VALUE,\n\t\t\t\tmessage: `native_enum \"${block.name}\": duplicate member value \"${value}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: block.parameterSpans[memberName] ?? block.span\n\t\t\t});\n\t\t\tmemberError = true;\n\t\t\tcontinue;\n\t\t}\n\t\tseenValues.add(value);\n\t\tmembers.push(value);\n\t}\n\tif (memberError) return void 0;\n\tif (members.length === 0) {\n\t\tdiagnostics?.push({\n\t\t\tcode: PSL_NATIVE_ENUM_MISSING_MEMBERS,\n\t\t\tmessage: `native_enum \"${block.name}\" must have at least one member`,\n\t\t\tsourceId,\n\t\t\tspan: block.span\n\t\t});\n\t\treturn;\n\t}\n\treturn new PostgresNativeEnum({\n\t\ttypeName,\n\t\tmembers\n\t});\n}\n/**\n* `native_enum`'s entity-type factory output, checked separately from the assembled\n* `postgresAuthoringEntityTypes` map below: `deriveValueSet` is SQL-family surface\n* ({@link SqlValueSetDerivingEntityTypeOutput}), not part of the framework\n* `AuthoringEntityTypeFactoryOutput` shape, so folding it directly into the map's single\n* `satisfies AuthoringEntityTypeNamespace` check would trip an excess-property error. Checking it\n* here against the intersection of both shapes keeps it structurally valid against each without\n* widening the map's own check.\n*/\nconst nativeEnumEntityTypeOutput = {\n\tfactory: lowerNativeEnumFromBlock,\n\tderiveValueSet: (entity) => ({\n\t\tkind: \"valueSet\",\n\t\tvalues: [...entity.members]\n\t})\n};\n/**\n* Lowers a `role <name> {}` block into a {@link PostgresRole}. Roles are\n* cluster-scoped in Postgres, so the block must be declared inside\n* `namespace unbound { … }` — any other lexical namespace (a named schema,\n* or the default bucket top-level declarations resolve to) is a load-time\n* diagnostic. The lowered entity carries the unbound coordinate.\n*/\nfunction lowerRoleFromBlock(block, ctx) {\n\tif (block.namespaceId !== UNBOUND_NAMESPACE_ID) {\n\t\tctx.diagnostics?.push({\n\t\t\tcode: PSL_ROLE_BLOCK_OUTSIDE_UNBOUND_NAMESPACE,\n\t\t\tmessage: `\\`role\\` block \"${block.name}\" must be declared inside \\`namespace unbound { }\\`, not in namespace \"${block.namespaceId}\"`,\n\t\t\tsourceId: ctx.sourceId ?? \"unknown\",\n\t\t\tspan: block.span\n\t\t});\n\t\treturn;\n\t}\n\treturn new PostgresRole({\n\t\tname: block.name,\n\t\tnamespaceId: UNBOUND_NAMESPACE_ID\n\t});\n}\nconst postgresAuthoringEntityTypes = {\n\trole: {\n\t\tkind: \"entity\",\n\t\tdiscriminator: \"role\",\n\t\tvalidatorSchema: PostgresRoleSchema,\n\t\toutput: { factory: lowerRoleFromBlock }\n\t},\n\trls: {\n\t\tkind: \"entity\",\n\t\tdiscriminator: \"rls\",\n\t\tvalidatorSchema: PostgresRlsEnablementSchema,\n\t\toutput: { factory: (input) => new PostgresRlsEnablement(input) }\n\t},\n\tpolicy: {\n\t\tkind: \"entity\",\n\t\tdiscriminator: \"policy\",\n\t\tvalidatorSchema: PostgresRlsPolicySchema,\n\t\toutput: policyEntityTypeOutput\n\t},\n\tnative_enum: {\n\t\tkind: \"entity\",\n\t\tdiscriminator: \"native_enum\",\n\t\tvalidatorSchema: PostgresNativeEnumSchema,\n\t\toutput: nativeEnumEntityTypeOutput\n\t}\n};\nconst policyRequiresRls = {\n\tparameter: \"target\",\n\tattribute: \"rls\"\n};\nconst policyMapAttribute = blockAttribute(\"map\", {\n\tdocumentation: \"Maps this row-level security policy to its PostgreSQL policy name.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The nonempty PostgreSQL policy name.\"\n\t}],\n\trefine: (parsed, ctx, attributeNode) => parsed.name === \"\" ? [leafDiagnostic(ctx, attributeNode, \"@@map policy name must be a non-empty string\", PSL_POLICY_INVALID_MAP)] : []\n});\nconst policyBlockAttributes = { map: () => policyMapAttribute };\nconst nativeEnumMapAttribute = blockAttribute(\"map\", {\n\tdocumentation: \"Maps this native enum to its PostgreSQL type name.\",\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str(),\n\t\tdocumentation: \"The PostgreSQL enum type name.\"\n\t}]\n});\nconst postgresAuthoringPslBlockDescriptors = {\n\t[POLICY_BLOCK_KEYWORDS.select]: {\n\t\tkind: \"pslBlock\",\n\t\tkeyword: POLICY_BLOCK_KEYWORDS.select,\n\t\tdocumentation: \"Defines a row-level security policy controlling which rows can be selected.\",\n\t\tdiscriminator: \"policy\",\n\t\tname: { required: true },\n\t\tspec: policyUsingOnlySpec,\n\t\trequiresModelAttribute: policyRequiresRls,\n\t\tattributes: policyBlockAttributes\n\t},\n\t[POLICY_BLOCK_KEYWORDS.delete]: {\n\t\tkind: \"pslBlock\",\n\t\tkeyword: POLICY_BLOCK_KEYWORDS.delete,\n\t\tdocumentation: \"Defines a row-level security policy controlling which rows can be deleted.\",\n\t\tdiscriminator: \"policy\",\n\t\tname: { required: true },\n\t\tspec: policyUsingOnlySpec,\n\t\trequiresModelAttribute: policyRequiresRls,\n\t\tattributes: policyBlockAttributes\n\t},\n\t[POLICY_BLOCK_KEYWORDS.insert]: {\n\t\tkind: \"pslBlock\",\n\t\tkeyword: POLICY_BLOCK_KEYWORDS.insert,\n\t\tdocumentation: \"Defines a row-level security policy checking rows being inserted.\",\n\t\tdiscriminator: \"policy\",\n\t\tname: { required: true },\n\t\tspec: policyWithCheckOnlySpec,\n\t\trequiresModelAttribute: policyRequiresRls,\n\t\tattributes: policyBlockAttributes\n\t},\n\t[POLICY_BLOCK_KEYWORDS.update]: {\n\t\tkind: \"pslBlock\",\n\t\tkeyword: POLICY_BLOCK_KEYWORDS.update,\n\t\tdocumentation: \"Defines a row-level security policy controlling row visibility and checks for updates.\",\n\t\tdiscriminator: \"policy\",\n\t\tname: { required: true },\n\t\tspec: policyBothPredicatesSpec,\n\t\trequiresModelAttribute: policyRequiresRls,\n\t\tattributes: policyBlockAttributes\n\t},\n\t[POLICY_BLOCK_KEYWORDS.all]: {\n\t\tkind: \"pslBlock\",\n\t\tkeyword: POLICY_BLOCK_KEYWORDS.all,\n\t\tdocumentation: \"Defines a row-level security policy applying to all operations.\",\n\t\tdiscriminator: \"policy\",\n\t\tname: { required: true },\n\t\tspec: policyBothPredicatesSpec,\n\t\trequiresModelAttribute: policyRequiresRls,\n\t\tattributes: policyBlockAttributes\n\t},\n\tnative_enum: {\n\t\tkind: \"pslBlock\",\n\t\tkeyword: \"native_enum\",\n\t\tdocumentation: \"Defines a PostgreSQL enum type with named string-valued members.\",\n\t\tdiscriminator: \"native_enum\",\n\t\tname: { required: true },\n\t\tspec: nativeEnumSpec,\n\t\tnameIsStorageName: true,\n\t\tattributes: { map: () => nativeEnumMapAttribute }\n\t},\n\t/**\n\t* PSL block descriptor for `role` (e.g. `role anon {}`). Name-only, no\n\t* parameters and no body content. Declared inside `namespace unbound { }`\n\t* — see {@link lowerRoleFromBlock} for the placement check and the\n\t* coordinate the lowered entity carries.\n\t*/\n\trole: {\n\t\tkind: \"pslBlock\",\n\t\tkeyword: \"role\",\n\t\tdocumentation: \"Declares an existing database role in namespace unbound for use in security policies.\",\n\t\tdiscriminator: \"role\",\n\t\tname: { required: true },\n\t\tspec: roleSpec\n\t}\n};\nconst postgresRlsSpec = modelAttribute(\"rls\", { documentation: \"Enables PostgreSQL row-level security on this model’s table.\" });\nconst postgresRlsSpecFactory = () => postgresRlsSpec;\nconst [firstLanguage, ...remainingLanguages] = POSTGRES_TEXT_SEARCH_LANGUAGES;\nconst fullTextField = fieldRef();\nfunction postgresFullTextIndexSpec(ctx) {\n\treturn modelAttribute(\"fullTextIndex\", {\n\t\tdocumentation: \"Indexes text fields for full-text search. Each item of the list is a weight group, strongest first; a nested list puts several fields in one group. Pass the index from the table's `indexes` to `fullTextMatches` and `fullTextRank` to search the same document.\",\n\t\tpositional: [{\n\t\t\tkey: \"fields\",\n\t\t\ttype: oneOf(fullTextField, list(oneOf(fullTextField, list(fullTextField)), { allowEmpty: false })),\n\t\t\tdocumentation: \"The fields to index: one field, or a list of fields and lists of fields. Each top-level item is a weight group, from A down to D.\"\n\t\t}],\n\t\tnamed: {\n\t\t\tlanguage: {\n\t\t\t\ttype: optional(oneOf(str(firstLanguage), ...remainingLanguages.map((language) => str(language)))),\n\t\t\t\tdocumentation: \"The text-search configuration. Defaults to `english`, and must match the language the query operations are given.\"\n\t\t\t},\n\t\t\tname: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The index name. Mutually exclusive with `map`.\"\n\t\t\t},\n\t\t\tmap: {\n\t\t\t\ttype: optional(str()),\n\t\t\t\tdocumentation: \"The database index name. Mutually exclusive with `name`.\"\n\t\t\t},\n\t\t\twhere: {\n\t\t\t\ttype: optional(dataTypeValue(SQL_EXPRESSION_DATA_TYPE_ID, ctx.dataTypes)),\n\t\t\t\tdocumentation: \"The SQL predicate restricting rows included in a partial index.\"\n\t\t\t}\n\t\t},\n\t\trefine: (value, ctx, attributeNode) => {\n\t\t\tconst diagnostics = fullTextIndexProblems({ weightGroups: weightGroupsOf(value.fields, isFieldName) }).filter(isPslFullTextIndexProblem).map((problem) => leafDiagnostic(ctx, attributeNode, describeFullTextIndexProblem(\"`@@fullTextIndex`\", problem), FULL_TEXT_INDEX_PROBLEM_CODES[problem.kind]));\n\t\t\tif (value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@fullTextIndex` requires a `name` or `map` argument\", PSL_FULL_TEXT_INDEX_REQUIRES_NAME));\n\t\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@fullTextIndex` takes at most one of `name` and `map`\", PSL_FULL_TEXT_INDEX_NAME_XOR_MAP));\n\t\t\treturn diagnostics;\n\t\t}\n\t});\n}\nfunction isFieldName(value) {\n\treturn typeof value === \"string\";\n}\nfunction isPslFullTextIndexProblem(problem) {\n\treturn problem.kind !== \"unique\" && problem.kind !== \"no-fields\";\n}\nconst FULL_TEXT_INDEX_PROBLEM_CODES = {\n\t\"too-many-groups\": PSL_FULL_TEXT_INDEX_TOO_MANY_GROUPS,\n\t\"empty-group\": PSL_FULL_TEXT_INDEX_EMPTY_GROUP,\n\t\"duplicate-field\": PSL_FULL_TEXT_INDEX_DUPLICATE_FIELD,\n\t\"not-text\": PSL_FULL_TEXT_INDEX_TEXT_FIELD\n};\nconst postgresFullTextIndexSpecFactory = (ctx) => postgresFullTextIndexSpec(ctx);\n/**\n* `@@` model attributes contributed by the Postgres target pack.\n*\n* `@@rls` is argument-less: presence marks the model's table\n* RLS-controlled. It lowers to a {@link PostgresRlsEnablement} marker in\n* the namespace's `entries.rls`, keyed by the model's table name — the\n* marker (never the policy set) is what drives\n* `ENABLE`/`DISABLE ROW LEVEL SECURITY` planning.\n*/\nconst postgresAuthoringModelAttributes = {\n\trls: {\n\t\tkind: \"modelAttribute\",\n\t\tattribute: \"rls\",\n\t\tspec: postgresRlsSpecFactory,\n\t\tlower: (_parsed, ctx) => ({\n\t\t\tkey: ctx.storageName,\n\t\t\tentity: new PostgresRlsEnablement({\n\t\t\t\ttableName: ctx.storageName,\n\t\t\t\tnamespaceId: ctx.namespaceId\n\t\t\t})\n\t\t})\n\t},\n\tfullTextIndex: {\n\t\tkind: \"modelAttribute\",\n\t\tattribute: \"fullTextIndex\",\n\t\tspec: postgresFullTextIndexSpecFactory,\n\t\trepeatable: true,\n\t\tlower: (parsed, ctx) => {\n\t\t\tconst fieldGroups = weightGroupsOf(parsed.fields, isFieldName);\n\t\t\tconst problems = fullTextIndexProblems({\n\t\t\t\tweightGroups: fieldGroups,\n\t\t\t\tcodecs: {\n\t\t\t\t\tcodecIdOf: (fieldName) => ctx.fieldStorageName(fieldName) === void 0 ? void 0 : ctx.fieldCodecId(fieldName),\n\t\t\t\t\ttraitsOf: postgresCodecTraitsOf\n\t\t\t\t}\n\t\t\t}).filter(isPslFullTextIndexProblem);\n\t\t\tfor (const problem of problems) ctx.diagnostics?.push({\n\t\t\t\tcode: FULL_TEXT_INDEX_PROBLEM_CODES[problem.kind],\n\t\t\t\tmessage: describeFullTextIndexProblem(\"`@@fullTextIndex`\", problem, (fieldName) => `${ctx.modelName}.${fieldName}`),\n\t\t\t\tsourceId: ctx.sourceId ?? \"unknown\"\n\t\t\t});\n\t\t\tif (problems.length > 0) return void 0;\n\t\t\tconst weightGroups = fieldGroups.map((group) => group.map((fieldName) => {\n\t\t\t\tconst columnName = ctx.fieldStorageName(fieldName);\n\t\t\t\tassertDefined(columnName, `@@fullTextIndex field \"${fieldName}\" has no storage column`);\n\t\t\t\treturn columnName;\n\t\t\t}));\n\t\t\treturn { index: {\n\t\t\t\tcolumns: weightGroups.flat(),\n\t\t\t\ttype: FULL_TEXT_INDEX_TYPE,\n\t\t\t\toptions: {\n\t\t\t\t\tweightGroups,\n\t\t\t\t\tlanguage: parsed.language ?? \"english\"\n\t\t\t\t},\n\t\t\t\twhere: parsed.where === void 0 ? void 0 : sqlTextFromStored(parsed.where.value.value),\n\t\t\t\tunique: void 0,\n\t\t\t\tname: parsed.name,\n\t\t\t\tmap: parsed.map\n\t\t\t} };\n\t\t}\n\t}\n};\nfunction predicateText(predicate, what) {\n\treturn predicate === void 0 ? void 0 : requireSqlExpression(predicate, what).text;\n}\n/**\n* Resolves an entity handle's `target` ref to a table coordinate of this\n* contract, or throws the load-time diagnostic naming the handle: a\n* cross-space target is rejected (you cannot CREATE POLICY on a table\n* another space owns) and an unresolved target names the model.\n*/\nfunction requireLocalTarget(refs, subject) {\n\tconst target = refs[\"target\"];\n\tif (target !== void 0 && target.kind === \"resolved\") return {\n\t\tnamespaceId: target.namespaceId,\n\t\ttableName: target.tableName\n\t};\n\tif (target !== void 0 && target.kind === \"cross-space\") throw postgresError(\"CONTRACT.POLICY_INVALID\", `defineContract: ${subject} targets model \"${target.modelName ?? target.tableName}\", which lives in another contract space. Policies and rlsEnabled entries must target a model declared in this contract.`, { meta: {\n\t\tmodel: target.modelName ?? target.tableName,\n\t\treason: \"cross-space-target\"\n\t} });\n\tthrow postgresError(\"CONTRACT.MODEL_UNKNOWN\", `defineContract: ${subject} targets model \"${target?.modelName ?? \"<anonymous>\"}\", which is not in the contract's models. Add the model to \\`models\\`.`, { meta: { model: target?.modelName ?? \"<anonymous>\" } });\n}\n/**\n* The SQL-family entity-handle batch lowering hook for the Postgres pack\n* (`SqlEntityHandleLoweringContribution`). Receives every `entities` handle\n* whose kind this pack registered — batch, so the cross-entity diagnostics\n* (duplicate prefix, policy without rlsEnabled, duplicate role) can see\n* sibling handles — and lowers them with the same keying and hash assembly\n* as the PSL path: `policy` keyed by prefix (wire name via\n* {@link buildRlsPolicyEntity}), `rls` keyed by table name, `role` keyed by\n* name and filed under the default namespace (roles are declared\n* contract-wide; PSL has no role block to set a precedent).\n*/\nfunction postgresLowerEntityHandles(input) {\n\tconst enablements = /* @__PURE__ */ new Map();\n\tconst roles = /* @__PURE__ */ new Map();\n\tconst policies = [];\n\tconst coordinateKey = (coordinate) => `${coordinate.namespaceId} ${coordinate.tableName}`;\n\tfor (const { handle, refs } of input.handles) switch (handle.entityKind) {\n\t\tcase \"rls\": {\n\t\t\tconst coordinate = requireLocalTarget(refs, \"an rlsEnabled entry\");\n\t\t\tconst key = coordinateKey(coordinate);\n\t\t\tif (!enablements.has(key)) enablements.set(key, {\n\t\t\t\tcoordinate,\n\t\t\t\tentity: new PostgresRlsEnablement({\n\t\t\t\t\ttableName: coordinate.tableName,\n\t\t\t\t\tnamespaceId: coordinate.namespaceId\n\t\t\t\t})\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tcase \"role\": {\n\t\t\tconst roleHandle = blindCast(handle);\n\t\t\tif (roles.has(roleHandle.name)) throw postgresError(\"CONTRACT.ROLE_INVALID\", `defineContract: role \"${roleHandle.name}\" is declared more than once in the entities list.`, { meta: {\n\t\t\t\trole: roleHandle.name,\n\t\t\t\treason: \"duplicate\"\n\t\t\t} });\n\t\t\troles.set(roleHandle.name, new PostgresRole({\n\t\t\t\tname: roleHandle.name,\n\t\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID\n\t\t\t}));\n\t\t\tbreak;\n\t\t}\n\t\tcase \"policy\": {\n\t\t\tconst policyHandle = blindCast(handle);\n\t\t\tpolicies.push({\n\t\t\t\thandle: policyHandle,\n\t\t\t\trefs\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tdefault: throw postgresError(\"CONTRACT.ENTITY_KIND_INVALID\", `defineContract: the postgres pack does not lower \"${handle.entityKind}\" handles from the entities list.`, { meta: { entityKind: handle.entityKind } });\n\t}\n\tconst rows = [];\n\tconst seenPrefixes = /* @__PURE__ */ new Set();\n\tfor (const { handle: policy, refs } of policies) {\n\t\tconst prefix = policy.name;\n\t\tassertWireNamePrefixLength(prefix, \"defineContract: policy prefix\");\n\t\tconst coordinate = requireLocalTarget(refs, `policy \"${prefix}\"`);\n\t\tif (!enablements.has(coordinateKey(coordinate))) {\n\t\t\tconst target = refs[\"target\"];\n\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `defineContract: policy \"${prefix}\" targets model \"${target?.modelName ?? coordinate.tableName}\", whose table is not RLS-enabled. Add rlsEnabled(<model>) to the entities list.`, { meta: {\n\t\t\t\tprefix,\n\t\t\t\tmodel: target?.modelName ?? coordinate.tableName,\n\t\t\t\treason: \"target-not-rls-enabled\"\n\t\t\t} });\n\t\t}\n\t\tconst prefixKey = `${coordinate.namespaceId} ${prefix}`;\n\t\tif (seenPrefixes.has(prefixKey)) throw postgresError(\"CONTRACT.POLICY_INVALID\", `defineContract: policy prefix \"${prefix}\" is declared more than once in namespace \"${coordinate.namespaceId}\". Policy prefixes must be unique per namespace.`, { meta: {\n\t\t\tprefix,\n\t\t\tnamespaceId: coordinate.namespaceId,\n\t\t\treason: \"duplicate-prefix\"\n\t\t} });\n\t\tseenPrefixes.add(prefixKey);\n\t\tconst roleNames = [...new Set(policy.roles.map((roleHandle) => roleHandle.name))].sort();\n\t\trows.push({\n\t\t\tnamespaceId: coordinate.namespaceId,\n\t\t\tentityKind: \"policy\",\n\t\t\tkey: prefix,\n\t\t\tentity: buildRlsPolicyEntity({\n\t\t\t\tprefix,\n\t\t\t\ttableName: coordinate.tableName,\n\t\t\t\tnamespaceId: coordinate.namespaceId,\n\t\t\t\toperation: policy.operation,\n\t\t\t\troles: roleNames,\n\t\t\t\t...ifDefined(\"using\", predicateText(policy.using, `Policy \"${prefix}\" using`)),\n\t\t\t\t...ifDefined(\"withCheck\", predicateText(policy.withCheck, `Policy \"${prefix}\" withCheck`))\n\t\t\t})\n\t\t});\n\t}\n\tfor (const { coordinate, entity } of enablements.values()) rows.push({\n\t\tnamespaceId: coordinate.namespaceId,\n\t\tentityKind: \"rls\",\n\t\tkey: coordinate.tableName,\n\t\tentity\n\t});\n\tfor (const [name, entity] of roles) rows.push({\n\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\tentityKind: \"role\",\n\t\tkey: name,\n\t\tentity\n\t});\n\treturn rows;\n}\n//#endregion\nexport { postgresAuthoringTypes as a, postgresScalarAndNativeTypeConstructors as c, postgresAuthoringPslBlockDescriptors as i, postgresScalarAuthoringTypes as l, postgresAuthoringEntityTypes as n, postgresLowerEntityHandles as o, postgresAuthoringModelAttributes as r, postgresNativeAuthoringTypes as s, POLICY_BLOCK_KEYWORDS as t };\n\n//# sourceMappingURL=authoring-Bm8PD9ls.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,eAAe;;;;;;;;AAQrB,MAAM,+BAA+B;CACpC,QAAQ;EACP,MAAM;EACN,UAAU;EACV,eAAe;EACf,QAAQ,EAAE,SAAS,YAAY;CAChC;CACA,SAAS;EACR,MAAM;EACN,UAAU;EACV,eAAe;EACf,QA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EACvF,KAAK,KAAK;GACT,aAAa,WAAW;GACxB,YAAY;GACZ,KAAK;GACL,QAAQ,qBAAqB;IAC5B;IACA,WAAW,WAAW;IACtB,aAAa,WAAW;IACxB,WAAW,OAAO;IAClB,OAAO;IACP,GAAG,UAAU,SAAS,cAAc,OAAO,OAAO,WAAW,OAAO,QAAQ,CAAC;IAC7E,GAAG,UAAU,aAAa,cAAc,OAAO,WAAW,WAAW,OAAO,YAAY,CAAC;GAC1F,CAAC;EACF,CAAC;CACF;CACA,KAAK,MAAM,EAAE,YAAY,YAAY,YAAY,OAAO,GAAG,KAAK,KAAK;EACpE,aAAa,WAAW;EACxB,YAAY;EACZ,KAAK,WAAW;EAChB;CACD,CAAC;CACD,KAAK,MAAM,CAAC,MAAM,WAAW,OAAO,KAAK,KAAK;EAC7C,aAAa;EACb,YAAY;EACZ,KAAK;EACL;CACD,CAAC;CACD,OAAO;AACR"}
@@ -1,5 +1,5 @@
1
- import { E as pgInt8, T as pgInt4, w as pgInt2 } from "./data-types-B7S_CHZd-C9JA40Ir.mjs";
2
- //#region ../../../3-targets/postgres/1-target/dist/autoincrement-widths-D7Uub-uA.mjs
1
+ import { E as pgInt8, T as pgInt4, w as pgInt2 } from "./data-types-DklKHVmp-Bl-nwUa-.mjs";
2
+ //#region ../../../3-targets/postgres/1-target/dist/autoincrement-widths-DkD24r-C.mjs
3
3
  const SMALL = {
4
4
  serialType: "SMALLSERIAL",
5
5
  sequenceType: "smallint",
@@ -55,4 +55,4 @@ function hasAutoincrementDefault(column) {
55
55
  //#endregion
56
56
  export { hasAutoincrementDefault as i, autoincrementWidthOfDataType as n, autoincrementWidthOfPseudoType as r, autoincrementWidth as t };
57
57
 
58
- //# sourceMappingURL=autoincrement-widths-D7Uub-uA-DccZpX6Q.mjs.map
58
+ //# sourceMappingURL=autoincrement-widths-DkD24r-C-D4O96GJZ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"autoincrement-widths-D7Uub-uA-DccZpX6Q.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/autoincrement-widths-D7Uub-uA.mjs"],"sourcesContent":["import { _ as pgInt8, g as pgInt4, h as pgInt2 } from \"./data-types-B7S_CHZd.mjs\";\n//#region src/core/migrations/autoincrement-widths.ts\nconst SMALL = {\n\tserialType: \"SMALLSERIAL\",\n\tsequenceType: \"smallint\",\n\tmaxValue: \"32767\"\n};\nconst REGULAR = {\n\tserialType: \"SERIAL\",\n\tsequenceType: \"integer\",\n\tmaxValue: \"2147483647\"\n};\nconst BIG = {\n\tserialType: \"BIGSERIAL\",\n\tsequenceType: \"bigint\",\n\tmaxValue: \"9223372036854775807\"\n};\nconst WIDTH_BY_COLUMN_TYPE = /* @__PURE__ */ new Map([\n\t[\"int2\", SMALL],\n\t[\"smallint\", SMALL],\n\t[\"int4\", REGULAR],\n\t[\"integer\", REGULAR],\n\t[\"int8\", BIG],\n\t[\"bigint\", BIG]\n]);\n/** The autoincrement width of a column of `columnType`; `undefined` for a column that is not a scalar smallint, integer or bigint. */\nfunction autoincrementWidth(columnType) {\n\treturn WIDTH_BY_COLUMN_TYPE.get(columnType.toLowerCase());\n}\nconst WIDTH_BY_PSEUDO_TYPE = /* @__PURE__ */ new Map([\n\t[\"smallserial\", SMALL],\n\t[\"serial2\", SMALL],\n\t[\"serial\", REGULAR],\n\t[\"serial4\", REGULAR],\n\t[\"bigserial\", BIG],\n\t[\"serial8\", BIG]\n]);\n/** The autoincrement width of a column written with a SERIAL pseudo-type, such as `SERIAL` or `bigserial`; `undefined` for any other type. Postgres stores the column as the width's `sequenceType`. */\nfunction autoincrementWidthOfPseudoType(columnType) {\n\treturn WIDTH_BY_PSEUDO_TYPE.get(columnType.trim().toLowerCase());\n}\nconst WIDTH_BY_DATA_TYPE = /* @__PURE__ */ new Map([\n\t[pgInt2.id, SMALL],\n\t[pgInt4.id, REGULAR],\n\t[pgInt8.id, BIG]\n]);\n/** The autoincrement width of a column whose data type is `dataTypeId`; `undefined` unless it is `pg/int2`, `pg/int4` or `pg/int8`. */\nfunction autoincrementWidthOfDataType(dataTypeId) {\n\treturn WIDTH_BY_DATA_TYPE.get(dataTypeId);\n}\n/** Whether a schema column takes its values from a sequence: a SERIAL column's `nextval(...)` default and an identity column both read as `autoincrement()`. */\nfunction hasAutoincrementDefault(column) {\n\treturn column.resolvedDefault?.kind === \"function\" && column.resolvedDefault.expression === \"autoincrement()\";\n}\n//#endregion\nexport { hasAutoincrementDefault as i, autoincrementWidthOfDataType as n, autoincrementWidthOfPseudoType as r, autoincrementWidth as t };\n\n//# sourceMappingURL=autoincrement-widths-D7Uub-uA.mjs.map"],"mappings":";;AAEA,MAAM,QAAQ;CACb,YAAY;CACZ,cAAc;CACd,UAAU;AACX;AACA,MAAM,UAAU;CACf,YAAY;CACZ,cAAc;CACd,UAAU;AACX;AACA,MAAM,MAAM;CACX,YAAY;CACZ,cAAc;CACd,UAAU;AACX;AACA,MAAM,uCAAuC,IAAI,IAAI;CACpD,CAAC,QAAQ,KAAK;CACd,CAAC,YAAY,KAAK;CAClB,CAAC,QAAQ,OAAO;CAChB,CAAC,WAAW,OAAO;CACnB,CAAC,QAAQ,GAAG;CACZ,CAAC,UAAU,GAAG;AACf,CAAC;;AAED,SAAS,mBAAmB,YAAY;CACvC,OAAO,qBAAqB,IAAI,WAAW,YAAY,CAAC;AACzD;AACA,MAAM,uCAAuC,IAAI,IAAI;CACpD,CAAC,eAAe,KAAK;CACrB,CAAC,WAAW,KAAK;CACjB,CAAC,UAAU,OAAO;CAClB,CAAC,WAAW,OAAO;CACnB,CAAC,aAAa,GAAG;CACjB,CAAC,WAAW,GAAG;AAChB,CAAC;;AAED,SAAS,+BAA+B,YAAY;CACnD,OAAO,qBAAqB,IAAI,WAAW,KAAK,CAAC,CAAC,YAAY,CAAC;AAChE;AACA,MAAM,qCAAqC,IAAI,IAAI;CAClD,CAAC,OAAO,IAAI,KAAK;CACjB,CAAC,OAAO,IAAI,OAAO;CACnB,CAAC,OAAO,IAAI,GAAG;AAChB,CAAC;;AAED,SAAS,6BAA6B,YAAY;CACjD,OAAO,mBAAmB,IAAI,UAAU;AACzC;;AAEA,SAAS,wBAAwB,QAAQ;CACxC,OAAO,OAAO,iBAAiB,SAAS,cAAc,OAAO,gBAAgB,eAAe;AAC7F"}
1
+ {"version":3,"file":"autoincrement-widths-DkD24r-C-D4O96GJZ.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/autoincrement-widths-DkD24r-C.mjs"],"sourcesContent":["import { _ as pgInt8, g as pgInt4, h as pgInt2 } from \"./data-types-DklKHVmp.mjs\";\n//#region src/core/migrations/autoincrement-widths.ts\nconst SMALL = {\n\tserialType: \"SMALLSERIAL\",\n\tsequenceType: \"smallint\",\n\tmaxValue: \"32767\"\n};\nconst REGULAR = {\n\tserialType: \"SERIAL\",\n\tsequenceType: \"integer\",\n\tmaxValue: \"2147483647\"\n};\nconst BIG = {\n\tserialType: \"BIGSERIAL\",\n\tsequenceType: \"bigint\",\n\tmaxValue: \"9223372036854775807\"\n};\nconst WIDTH_BY_COLUMN_TYPE = /* @__PURE__ */ new Map([\n\t[\"int2\", SMALL],\n\t[\"smallint\", SMALL],\n\t[\"int4\", REGULAR],\n\t[\"integer\", REGULAR],\n\t[\"int8\", BIG],\n\t[\"bigint\", BIG]\n]);\n/** The autoincrement width of a column of `columnType`; `undefined` for a column that is not a scalar smallint, integer or bigint. */\nfunction autoincrementWidth(columnType) {\n\treturn WIDTH_BY_COLUMN_TYPE.get(columnType.toLowerCase());\n}\nconst WIDTH_BY_PSEUDO_TYPE = /* @__PURE__ */ new Map([\n\t[\"smallserial\", SMALL],\n\t[\"serial2\", SMALL],\n\t[\"serial\", REGULAR],\n\t[\"serial4\", REGULAR],\n\t[\"bigserial\", BIG],\n\t[\"serial8\", BIG]\n]);\n/** The autoincrement width of a column written with a SERIAL pseudo-type, such as `SERIAL` or `bigserial`; `undefined` for any other type. Postgres stores the column as the width's `sequenceType`. */\nfunction autoincrementWidthOfPseudoType(columnType) {\n\treturn WIDTH_BY_PSEUDO_TYPE.get(columnType.trim().toLowerCase());\n}\nconst WIDTH_BY_DATA_TYPE = /* @__PURE__ */ new Map([\n\t[pgInt2.id, SMALL],\n\t[pgInt4.id, REGULAR],\n\t[pgInt8.id, BIG]\n]);\n/** The autoincrement width of a column whose data type is `dataTypeId`; `undefined` unless it is `pg/int2`, `pg/int4` or `pg/int8`. */\nfunction autoincrementWidthOfDataType(dataTypeId) {\n\treturn WIDTH_BY_DATA_TYPE.get(dataTypeId);\n}\n/** Whether a schema column takes its values from a sequence: a SERIAL column's `nextval(...)` default and an identity column both read as `autoincrement()`. */\nfunction hasAutoincrementDefault(column) {\n\treturn column.resolvedDefault?.kind === \"function\" && column.resolvedDefault.expression === \"autoincrement()\";\n}\n//#endregion\nexport { hasAutoincrementDefault as i, autoincrementWidthOfDataType as n, autoincrementWidthOfPseudoType as r, autoincrementWidth as t };\n\n//# sourceMappingURL=autoincrement-widths-DkD24r-C.mjs.map"],"mappings":";;AAEA,MAAM,QAAQ;CACb,YAAY;CACZ,cAAc;CACd,UAAU;AACX;AACA,MAAM,UAAU;CACf,YAAY;CACZ,cAAc;CACd,UAAU;AACX;AACA,MAAM,MAAM;CACX,YAAY;CACZ,cAAc;CACd,UAAU;AACX;AACA,MAAM,uCAAuC,IAAI,IAAI;CACpD,CAAC,QAAQ,KAAK;CACd,CAAC,YAAY,KAAK;CAClB,CAAC,QAAQ,OAAO;CAChB,CAAC,WAAW,OAAO;CACnB,CAAC,QAAQ,GAAG;CACZ,CAAC,UAAU,GAAG;AACf,CAAC;;AAED,SAAS,mBAAmB,YAAY;CACvC,OAAO,qBAAqB,IAAI,WAAW,YAAY,CAAC;AACzD;AACA,MAAM,uCAAuC,IAAI,IAAI;CACpD,CAAC,eAAe,KAAK;CACrB,CAAC,WAAW,KAAK;CACjB,CAAC,UAAU,OAAO;CAClB,CAAC,WAAW,OAAO;CACnB,CAAC,aAAa,GAAG;CACjB,CAAC,WAAW,GAAG;AAChB,CAAC;;AAED,SAAS,+BAA+B,YAAY;CACnD,OAAO,qBAAqB,IAAI,WAAW,KAAK,CAAC,CAAC,YAAY,CAAC;AAChE;AACA,MAAM,qCAAqC,IAAI,IAAI;CAClD,CAAC,OAAO,IAAI,KAAK;CACjB,CAAC,OAAO,IAAI,OAAO;CACnB,CAAC,OAAO,IAAI,GAAG;AAChB,CAAC;;AAED,SAAS,6BAA6B,YAAY;CACjD,OAAO,mBAAmB,IAAI,UAAU;AACzC;;AAEA,SAAS,wBAAwB,QAAQ;CACxC,OAAO,OAAO,iBAAiB,SAAS,cAAc,OAAO,gBAAgB,eAAe;AAC7F"}
@@ -1,6 +1,6 @@
1
- import { i as quoteIdentifier, n as escapeLiteral } from "./sql-utils-0j_6QstU-DAfnt5Mu.mjs";
1
+ import { a as quoteIdentifier, n as escapeLiteral } from "./sql-utils-ylvfJ1RJ-03xGdSLI.mjs";
2
2
  import { invariant } from "@prisma/orm-framework/utils/assertions";
3
- //#region ../../../3-targets/postgres/1-target/dist/check-expressions-CCFJKC7N.mjs
3
+ //#region ../../../3-targets/postgres/1-target/dist/check-expressions-C_lM7sSK.mjs
4
4
  /**
5
5
  * Renders the checks a Postgres column needs, as opaque predicate text.
6
6
  *
@@ -115,4 +115,4 @@ function arrayLiteral(values) {
115
115
  //#endregion
116
116
  export { postgresRenderCheckExpressions as t };
117
117
 
118
- //# sourceMappingURL=check-expressions-CCFJKC7N-DHEJIG2S.mjs.map
118
+ //# sourceMappingURL=check-expressions-C_lM7sSK-Dtv6p3hg.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"check-expressions-CCFJKC7N-DHEJIG2S.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/check-expressions-CCFJKC7N.mjs"],"sourcesContent":["import { i as quoteIdentifier, n as escapeLiteral } from \"./sql-utils-0j_6QstU.mjs\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/core/check-expressions.ts\n/**\n* Renders the checks a Postgres column needs, as opaque predicate text.\n*\n* A domain enum has no type-level enforcement, so membership is a\n* predicate: `IN` for a scalar, and `<@` containment for an array — an array\n* column cannot use `IN` at all (`operator does not exist: text[] = text`).\n* Array membership strips NULL elements first, leaving element nullability to\n* the separate element-non-null check emitted for semantically strict lists.\n*\n* Both forms compare members in the column's own type: the `IN` list and\n* the `<@` array literal are untyped, so Postgres reads each member as the\n* column (or element) type. A cast to `text` would compare the type's text\n* output instead, which for `inet` always carries the prefix length.\n*/\nfunction postgresRenderCheckExpressions(input) {\n\tconst candidates = [];\n\tconst column = quoteIdentifier(input.columnName);\n\tconst isMany = input.many !== false;\n\tconst elementNullable = input.many !== false && input.many.elementNullable;\n\tif (input.memberValues !== void 0) {\n\t\tinvariant(input.memberValues.length > 0, `check for \"${input.tableName}\".\"${input.columnName}\": empty member set; both authoring surfaces reject a member-less enum before rendering`);\n\t\tfor (const value of input.memberValues) invariant(typeof value === \"string\" || Number.isFinite(value), `check for \"${input.tableName}\".\"${input.columnName}\": non-finite numeric member`);\n\t\tcandidates.push({\n\t\t\tkind: \"membership\",\n\t\t\tcolumnName: input.columnName,\n\t\t\texpression: isMany ? `array_remove(${column}, NULL) <@ '${escapeLiteral(arrayLiteral(input.memberValues))}'` : `${column} IN (${input.memberValues.map(sqlLiteral).join(\", \")})`\n\t\t});\n\t}\n\tif (isMany && !elementNullable) candidates.push({\n\t\tkind: \"elementNotNull\",\n\t\tcolumnName: input.columnName,\n\t\texpression: `array_position(${column}, NULL) IS NULL`\n\t});\n\tif (input.valueObject !== void 0) candidates.push({\n\t\tkind: \"shape\",\n\t\tcolumnName: input.columnName,\n\t\texpression: valueObjectCheck(column, input.valueObject)\n\t});\n\treturn candidates;\n}\n/**\n* One strict `jsonpath` predicate over the whole column value. Strict mode keeps a comparison from unwrapping an array, and `IS TRUE` makes a predicate that evaluates to unknown fail the check, as a CHECK would otherwise pass on NULL. Member values are read through `keyvalue()`, so an absent member is never an error.\n*/\nfunction valueObjectCheck(column, columnValueObject) {\n\tconst field = {\n\t\tnullable: columnValueObject.nullable,\n\t\tmany: columnValueObject.many,\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tvalueObject: columnValueObject.valueObject\n\t\t}\n\t};\n\tconst predicate = fieldPredicate(field, \"$\");\n\tinvariant(predicate !== void 0, \"a column that holds a value object always has a predicate\");\n\tconst match = (path) => `jsonb_path_match(${column}, '${escapeLiteral(`strict ${path}`)}') IS TRUE`;\n\treturn field.nullable ? `${column} IS NULL OR ${match(`$.type() == \"null\" || (${predicate})`)}` : match(predicate);\n}\n/** What the value at `path` must satisfy, or `undefined` when any value is accepted. */\nfunction fieldPredicate(field, path) {\n\tif (field.many === false) return valuePredicate(field.type, path);\n\tconst element = valuePredicate(field.type, \"@\");\n\tconst { elementNullable } = field.many;\n\tconst invalidElement = element === void 0 ? elementNullable ? void 0 : \"@.type() == \\\"null\\\"\" : elementNullable ? `!(@.type() == \"null\" || (${element}))` : `!((${element}))`;\n\tconst isArray = `${path}.type() == \"array\"`;\n\treturn invalidElement === void 0 ? isArray : `${isArray} && !exists(${path}[*] ? (${invalidElement}))`;\n}\n/** A member of any JSON type accepts every value, JSON `null` included; a member of any other JSON type is of that type, so never JSON `null`. */\nfunction valuePredicate(type, path) {\n\tswitch (type.kind) {\n\t\tcase \"valueObject\": return objectPredicate(type.valueObject, path);\n\t\tcase \"anyObject\": return `${path}.type() == \"object\"`;\n\t\tcase \"scalar\":\n\t\t\tif (type.values !== void 0) return valueSetPredicate(type.values, path);\n\t\t\treturn type.jsonType === \"any\" ? void 0 : `${path}.type() == \"${type.jsonType}\"`;\n\t}\n}\nfunction valueSetPredicate(values, path) {\n\tconst alternatives = (jsonType, members) => `${path}.type() == \"${jsonType}\" && (${members.map((value) => `${path} == ${jsonPathLiteral(value)}`).join(\" || \")})`;\n\tconst strings = values.filter((value) => typeof value === \"string\");\n\tconst numbers = values.filter((value) => typeof value === \"number\");\n\tinvariant(values.length > 0, \"a value set restricting a value object member has no values\");\n\tif (numbers.length === 0) return alternatives(\"string\", strings);\n\tif (strings.length === 0) return alternatives(\"number\", numbers);\n\treturn `(${alternatives(\"string\", strings)}) || (${alternatives(\"number\", numbers)})`;\n}\nfunction objectPredicate(valueObject, path) {\n\tconst names = Object.keys(valueObject.fields).sort();\n\tconst members = names.flatMap((name) => {\n\t\tconst field = valueObject.fields[name];\n\t\tinvariant(field !== void 0, `value object member \"${name}\" is missing`);\n\t\tconst isMember = `@.key == ${jsonPathLiteral(name)}`;\n\t\tconst predicate = fieldPredicate(field, \"@.value\");\n\t\tif (!field.nullable) return [predicate === void 0 ? `exists(${path}.keyvalue() ? (${isMember}))` : `exists(${path}.keyvalue() ? (${isMember} && (${predicate})))`];\n\t\treturn predicate === void 0 ? [] : [`!exists(${path}.keyvalue() ? (${isMember} && !(@.value.type() == \"null\" || (${predicate}))))`];\n\t});\n\tconst otherKey = names.length === 0 ? `!exists(${path}.keyvalue())` : `!exists(${path}.keyvalue() ? (${names.map((name) => `@.key != ${jsonPathLiteral(name)}`).join(\" && \")}))`;\n\treturn [\n\t\t`${path}.type() == \"object\"`,\n\t\t...members,\n\t\totherKey\n\t].join(\" && \");\n}\nfunction jsonPathLiteral(value) {\n\treturn typeof value === \"string\" ? JSON.stringify(value) : String(value);\n}\nfunction sqlLiteral(value) {\n\treturn typeof value === \"string\" ? `'${escapeLiteral(value)}'` : String(value);\n}\nfunction arrayLiteral(values) {\n\treturn `{${values.map((value) => typeof value === \"string\" ? `\"${value.replace(/[\"\\\\]/g, \"\\\\$&\")}\"` : String(value)).join(\",\")}}`;\n}\n//#endregion\nexport { postgresRenderCheckExpressions as t };\n\n//# sourceMappingURL=check-expressions-CCFJKC7N.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,+BAA+B,OAAO;CAC9C,MAAM,aAAa,CAAC;CACpB,MAAM,SAAS,gBAAgB,MAAM,UAAU;CAC/C,MAAM,SAAS,MAAM,SAAS;CAC9B,MAAM,kBAAkB,MAAM,SAAS,SAAS,MAAM,KAAK;CA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SAAS;EACvC,MAAM,QAAQ,YAAY,OAAO;EACjC,UAAU,UAAU,KAAK,GAAG,wBAAwB,KAAK,aAAa;EACtE,MAAM,WAAW,YAAY,gBAAgB,IAAI;EACjD,MAAM,YAAY,eAAe,OAAO,SAAS;EACjD,IAAI,CAAC,MAAM,UAAU,OAAO,CAAC,cAAc,KAAK,IAAI,UAAU,KAAK,iBAAiB,SAAS,MAAM,UAAU,KAAK,iBAAiB,SAAS,OAAO,UAAU,IAAI;EACjK,OAAO,cAAc,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,iBAAiB,SAAS,qCAAqC,UAAU,KAAK;CACnI,CAAC;CACD,MAAM,WAAW,MAAM,WAAW,IAAI,WAAW,KAAK,gBAAgB,WAAW,KAAK,iBAAiB,MAAM,KAAK,SAAS,YAAY,gBAAgB,IAAI,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE;CAC7K,OAAO;EACN,GAAG,KAAK;EACR,GAAG;EACH;CACD,CAAC,CAAC,KAAK,MAAM;AACd;AACA,SAAS,gBAAgB,OAAO;CAC/B,OAAO,OAAO,UAAU,WAAW,KAAK,UAAU,KAAK,IAAI,OAAO,KAAK;AACxE;AACA,SAAS,WAAW,OAAO;CAC1B,OAAO,OAAO,UAAU,WAAW,IAAI,cAAc,KAAK,EAAE,KAAK,OAAO,KAAK;AAC9E;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,IAAI,OAAO,KAAK,UAAU,OAAO,UAAU,WAAW,IAAI,MAAM,QAAQ,UAAU,MAAM,EAAE,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AAChI"}
1
+ {"version":3,"file":"check-expressions-C_lM7sSK-Dtv6p3hg.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/check-expressions-C_lM7sSK.mjs"],"sourcesContent":["import { a as quoteIdentifier, n as escapeLiteral } from \"./sql-utils-ylvfJ1RJ.mjs\";\nimport { invariant } from \"@internal/utils/assertions\";\n//#region src/core/check-expressions.ts\n/**\n* Renders the checks a Postgres column needs, as opaque predicate text.\n*\n* A domain enum has no type-level enforcement, so membership is a\n* predicate: `IN` for a scalar, and `<@` containment for an array — an array\n* column cannot use `IN` at all (`operator does not exist: text[] = text`).\n* Array membership strips NULL elements first, leaving element nullability to\n* the separate element-non-null check emitted for semantically strict lists.\n*\n* Both forms compare members in the column's own type: the `IN` list and\n* the `<@` array literal are untyped, so Postgres reads each member as the\n* column (or element) type. A cast to `text` would compare the type's text\n* output instead, which for `inet` always carries the prefix length.\n*/\nfunction postgresRenderCheckExpressions(input) {\n\tconst candidates = [];\n\tconst column = quoteIdentifier(input.columnName);\n\tconst isMany = input.many !== false;\n\tconst elementNullable = input.many !== false && input.many.elementNullable;\n\tif (input.memberValues !== void 0) {\n\t\tinvariant(input.memberValues.length > 0, `check for \"${input.tableName}\".\"${input.columnName}\": empty member set; both authoring surfaces reject a member-less enum before rendering`);\n\t\tfor (const value of input.memberValues) invariant(typeof value === \"string\" || Number.isFinite(value), `check for \"${input.tableName}\".\"${input.columnName}\": non-finite numeric member`);\n\t\tcandidates.push({\n\t\t\tkind: \"membership\",\n\t\t\tcolumnName: input.columnName,\n\t\t\texpression: isMany ? `array_remove(${column}, NULL) <@ '${escapeLiteral(arrayLiteral(input.memberValues))}'` : `${column} IN (${input.memberValues.map(sqlLiteral).join(\", \")})`\n\t\t});\n\t}\n\tif (isMany && !elementNullable) candidates.push({\n\t\tkind: \"elementNotNull\",\n\t\tcolumnName: input.columnName,\n\t\texpression: `array_position(${column}, NULL) IS NULL`\n\t});\n\tif (input.valueObject !== void 0) candidates.push({\n\t\tkind: \"shape\",\n\t\tcolumnName: input.columnName,\n\t\texpression: valueObjectCheck(column, input.valueObject)\n\t});\n\treturn candidates;\n}\n/**\n* One strict `jsonpath` predicate over the whole column value. Strict mode keeps a comparison from unwrapping an array, and `IS TRUE` makes a predicate that evaluates to unknown fail the check, as a CHECK would otherwise pass on NULL. Member values are read through `keyvalue()`, so an absent member is never an error.\n*/\nfunction valueObjectCheck(column, columnValueObject) {\n\tconst field = {\n\t\tnullable: columnValueObject.nullable,\n\t\tmany: columnValueObject.many,\n\t\ttype: {\n\t\t\tkind: \"valueObject\",\n\t\t\tvalueObject: columnValueObject.valueObject\n\t\t}\n\t};\n\tconst predicate = fieldPredicate(field, \"$\");\n\tinvariant(predicate !== void 0, \"a column that holds a value object always has a predicate\");\n\tconst match = (path) => `jsonb_path_match(${column}, '${escapeLiteral(`strict ${path}`)}') IS TRUE`;\n\treturn field.nullable ? `${column} IS NULL OR ${match(`$.type() == \"null\" || (${predicate})`)}` : match(predicate);\n}\n/** What the value at `path` must satisfy, or `undefined` when any value is accepted. */\nfunction fieldPredicate(field, path) {\n\tif (field.many === false) return valuePredicate(field.type, path);\n\tconst element = valuePredicate(field.type, \"@\");\n\tconst { elementNullable } = field.many;\n\tconst invalidElement = element === void 0 ? elementNullable ? void 0 : \"@.type() == \\\"null\\\"\" : elementNullable ? `!(@.type() == \"null\" || (${element}))` : `!((${element}))`;\n\tconst isArray = `${path}.type() == \"array\"`;\n\treturn invalidElement === void 0 ? isArray : `${isArray} && !exists(${path}[*] ? (${invalidElement}))`;\n}\n/** A member of any JSON type accepts every value, JSON `null` included; a member of any other JSON type is of that type, so never JSON `null`. */\nfunction valuePredicate(type, path) {\n\tswitch (type.kind) {\n\t\tcase \"valueObject\": return objectPredicate(type.valueObject, path);\n\t\tcase \"anyObject\": return `${path}.type() == \"object\"`;\n\t\tcase \"scalar\":\n\t\t\tif (type.values !== void 0) return valueSetPredicate(type.values, path);\n\t\t\treturn type.jsonType === \"any\" ? void 0 : `${path}.type() == \"${type.jsonType}\"`;\n\t}\n}\nfunction valueSetPredicate(values, path) {\n\tconst alternatives = (jsonType, members) => `${path}.type() == \"${jsonType}\" && (${members.map((value) => `${path} == ${jsonPathLiteral(value)}`).join(\" || \")})`;\n\tconst strings = values.filter((value) => typeof value === \"string\");\n\tconst numbers = values.filter((value) => typeof value === \"number\");\n\tinvariant(values.length > 0, \"a value set restricting a value object member has no values\");\n\tif (numbers.length === 0) return alternatives(\"string\", strings);\n\tif (strings.length === 0) return alternatives(\"number\", numbers);\n\treturn `(${alternatives(\"string\", strings)}) || (${alternatives(\"number\", numbers)})`;\n}\nfunction objectPredicate(valueObject, path) {\n\tconst names = Object.keys(valueObject.fields).sort();\n\tconst members = names.flatMap((name) => {\n\t\tconst field = valueObject.fields[name];\n\t\tinvariant(field !== void 0, `value object member \"${name}\" is missing`);\n\t\tconst isMember = `@.key == ${jsonPathLiteral(name)}`;\n\t\tconst predicate = fieldPredicate(field, \"@.value\");\n\t\tif (!field.nullable) return [predicate === void 0 ? `exists(${path}.keyvalue() ? (${isMember}))` : `exists(${path}.keyvalue() ? (${isMember} && (${predicate})))`];\n\t\treturn predicate === void 0 ? [] : [`!exists(${path}.keyvalue() ? (${isMember} && !(@.value.type() == \"null\" || (${predicate}))))`];\n\t});\n\tconst otherKey = names.length === 0 ? `!exists(${path}.keyvalue())` : `!exists(${path}.keyvalue() ? (${names.map((name) => `@.key != ${jsonPathLiteral(name)}`).join(\" && \")}))`;\n\treturn [\n\t\t`${path}.type() == \"object\"`,\n\t\t...members,\n\t\totherKey\n\t].join(\" && \");\n}\nfunction jsonPathLiteral(value) {\n\treturn typeof value === \"string\" ? JSON.stringify(value) : String(value);\n}\nfunction sqlLiteral(value) {\n\treturn typeof value === \"string\" ? `'${escapeLiteral(value)}'` : String(value);\n}\nfunction arrayLiteral(values) {\n\treturn `{${values.map((value) => typeof value === \"string\" ? `\"${value.replace(/[\"\\\\]/g, \"\\\\$&\")}\"` : String(value)).join(\",\")}}`;\n}\n//#endregion\nexport { postgresRenderCheckExpressions as t };\n\n//# sourceMappingURL=check-expressions-C_lM7sSK.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAS,+BAA+B,OAAO;CAC9C,MAAM,aAAa,CAAC;CACpB,MAAM,SAAS,gBAAgB,MAAM,UAAU;CAC/C,MAAM,SAAS,MAAM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,YAAY,MAAM,CAAC,CAAC,KAAK;CACnD,MAAM,UAAU,MAAM,SAAS,SAAS;EACvC,MAAM,QAAQ,YAAY,OAAO;EACjC,UAAU,UAAU,KAAK,GAAG,wBAAwB,KAAK,aAAa;EACtE,MAAM,WAAW,YAAY,gBAAgB,IAAI;EACjD,MAAM,YAAY,eAAe,OAAO,SAAS;EACjD,IAAI,CAAC,MAAM,UAAU,OAAO,CAAC,cAAc,KAAK,IAAI,UAAU,KAAK,iBAAiB,SAAS,MAAM,UAAU,KAAK,iBAAiB,SAAS,OAAO,UAAU,IAAI;EACjK,OAAO,cAAc,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,iBAAiB,SAAS,qCAAqC,UAAU,KAAK;CACnI,CAAC;CACD,MAAM,WAAW,MAAM,WAAW,IAAI,WAAW,KAAK,gBAAgB,WAAW,KAAK,iBAAiB,MAAM,KAAK,SAAS,YAAY,gBAAgB,IAAI,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE;CAC7K,OAAO;EACN,GAAG,KAAK;EACR,GAAG;EACH;CACD,CAAC,CAAC,KAAK,MAAM;AACd;AACA,SAAS,gBAAgB,OAAO;CAC/B,OAAO,OAAO,UAAU,WAAW,KAAK,UAAU,KAAK,IAAI,OAAO,KAAK;AACxE;AACA,SAAS,WAAW,OAAO;CAC1B,OAAO,OAAO,UAAU,WAAW,IAAI,cAAc,KAAK,EAAE,KAAK,OAAO,KAAK;AAC9E;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,IAAI,OAAO,KAAK,UAAU,OAAO,UAAU,WAAW,IAAI,MAAM,QAAQ,UAAU,MAAM,EAAE,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AAChI"}
@@ -1,10 +1,10 @@
1
1
  import { n as buildPostgresCodecDescriptorRegistry } from "./codec-descriptor-DBeD0UlS-BfvrE-KZ.mjs";
2
- import { i as createPostgresBuiltinDataTypeLookup } from "./data-types-B7S_CHZd-C9JA40Ir.mjs";
3
- import { s as codecDescriptors } from "./codecs-BcYLh1iB-Dxi2UgkJ.mjs";
2
+ import { i as createPostgresBuiltinDataTypeLookup } from "./data-types-DklKHVmp-Bl-nwUa-.mjs";
3
+ import { s as codecDescriptors } from "./codecs-BqCmavY8-CC-ZbbTA.mjs";
4
4
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
5
5
  import { extractCodecLookup } from "@prisma/orm-framework/components/control";
6
6
  import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
7
- //#region ../../../3-targets/postgres/1-target/dist/codec-registry-qdVGkdp_.mjs
7
+ //#region ../../../3-targets/postgres/1-target/dist/codec-registry-DVjibYBY.mjs
8
8
  /**
9
9
  * Registry of every codec descriptor shipped by `@internal/target-postgres`.
10
10
  *
@@ -58,4 +58,4 @@ function createPostgresBuiltinCodecLookup() {
58
58
  //#endregion
59
59
  export { postgresCodecDescriptorRegistry as a, createPostgresCodecRegistryWithBuiltins as i, assemblePostgresCodecRegistryWithBuiltins as n, postgresCodecRegistry as o, createPostgresBuiltinCodecLookup as r, assemblePostgresCodecRegistry as t };
60
60
 
61
- //# sourceMappingURL=codec-registry-qdVGkdp_-DCI2nWSt.mjs.map
61
+ //# sourceMappingURL=codec-registry-DVjibYBY-BeOUp5fk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec-registry-qdVGkdp_-DCI2nWSt.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/codec-registry-qdVGkdp_.mjs"],"sourcesContent":["import { t as createPostgresBuiltinDataTypeLookup } from \"./data-types-B7S_CHZd.mjs\";\nimport { n as buildPostgresCodecDescriptorRegistry } from \"./codec-descriptor-DBeD0UlS.mjs\";\nimport { t as codecDescriptors } from \"./codecs-BcYLh1iB.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { extractCodecLookup } from \"@internal/framework-components/control\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/target-postgres`.\n*\n* Public consumer surface for the postgres codec set: the postgres adapter and any other consumer that needs to enumerate or look up a postgres codec by id consumes this rather than the raw descriptor array. See ADR 208.\n*/\nconst postgresCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);\nconst postgresCodecDescriptorRegistry = buildPostgresCodecDescriptorRegistry(codecDescriptors);\n//#endregion\n//#region src/core/codec-registry.ts\n/**\n* A registry of `descriptors`, refusing a codec whose data type `dataTypeLookup` does not have: the\n* SQL renderer writes a parameter's cast from the data type its codec represents.\n*/\nfunction buildPostgresCodecRegistry(descriptors, dataTypeLookup) {\n\tconst descriptorRegistry = buildPostgresCodecDescriptorRegistry(descriptors);\n\tconst validatedDescriptors = Array.from(descriptorRegistry.values());\n\tfor (const descriptor of validatedDescriptors) if (!dataTypeLookup.has(descriptor.dataType)) throw structuredError(\"CONTRACT.DATA_TYPE_UNREGISTERED\", `Codec \"${descriptor.codecId}\" represents data type \"${descriptor.dataType}\", which no component registers.`, {\n\t\twhy: \"A parameter of this codec is written with a cast named by its data type.\",\n\t\tfix: \"Pass the data type beside the codec: in `dataTypes` of createPostgresAdapter, or in the `dataTypes` of the extension that contributes the codec.\",\n\t\tmeta: {\n\t\t\tcodecId: descriptor.codecId,\n\t\t\tdataType: descriptor.dataType\n\t\t}\n\t});\n\tconst registry = {\n\t\t...extractCodecLookup([{\n\t\t\tid: \"postgres-codecs\",\n\t\t\ttypes: { codecTypes: { codecDescriptors: validatedDescriptors } }\n\t\t}]),\n\t\tdescriptorFor: (codecId) => descriptorRegistry.descriptorFor(codecId),\n\t\tvalues: () => descriptorRegistry.values()\n\t};\n\treturn Object.freeze(registry);\n}\nfunction assemblePostgresCodecRegistry(components, dataTypeLookup) {\n\treturn buildPostgresCodecRegistry(components.flatMap((component) => component.types?.codecTypes?.codecDescriptors ?? []), dataTypeLookup);\n}\nfunction assemblePostgresCodecRegistryWithBuiltins(extensions, dataTypeLookup) {\n\treturn buildPostgresCodecRegistry([...postgresCodecDescriptorRegistry.values(), ...extensions.flatMap((extension) => extension.types?.codecTypes?.codecDescriptors ?? [])], dataTypeLookup);\n}\n/** A registry of the built-in codecs and `codecDescriptors`, whose data types `dataTypeLookup` has. */\nfunction createPostgresCodecRegistryWithBuiltins(codecDescriptors = [], dataTypeLookup = createPostgresBuiltinDataTypeLookup()) {\n\treturn buildPostgresCodecRegistry([...postgresCodecDescriptorRegistry.values(), ...codecDescriptors], dataTypeLookup);\n}\n/**\n* Build a coherent PostgreSQL codec registry populated with built-in descriptors only.\n*\n* The returned registry supports both ordinary codec materialization and PostgreSQL target behavior. Stack-composed paths build the same combined registry from their complete ordered descriptor contributions.\n*/\nfunction createPostgresBuiltinCodecLookup() {\n\treturn createPostgresCodecRegistryWithBuiltins();\n}\n//#endregion\nexport { postgresCodecDescriptorRegistry as a, createPostgresCodecRegistryWithBuiltins as i, assemblePostgresCodecRegistryWithBuiltins as n, postgresCodecRegistry as o, createPostgresBuiltinCodecLookup as r, assemblePostgresCodecRegistry as t };\n\n//# sourceMappingURL=codec-registry-qdVGkdp_.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,wBAAwB,6BAA6B,gBAAgB;AAC3E,MAAM,kCAAkC,qCAAqC,gBAAgB;;;;;AAO7F,SAAS,2BAA2B,aAAa,gBAAgB;CAChE,MAAM,qBAAqB,qCAAqC,WAAW;CAC3E,MAAM,uBAAuB,MAAM,KAAK,mBAAmB,OAAO,CAAC;CACnE,KAAK,MAAM,cAAc,sBAAsB,IAAI,CAAC,eAAe,IAAI,WAAW,QAAQ,GAAG,MAAM,gBAAgB,mCAAmC,UAAU,WAAW,QAAQ,0BAA0B,WAAW,SAAS,mCAAmC;EACnQ,KAAK;EACL,KAAK;EACL,MAAM;GACL,SAAS,WAAW;GACpB,UAAU,WAAW;EACtB;CACD,CAAC;CACD,MAAM,WAAW;EAChB,GAAG,mBAAmB,CAAC;GACtB,IAAI;GACJ,OAAO,EAAE,YAAY,EAAE,kBAAkB,qBAAqB,EAAE;EACjE,CAAC,CAAC;EACF,gBAAgB,YAAY,mBAAmB,cAAc,OAAO;EACpE,cAAc,mBAAmB,OAAO;CACzC;CACA,OAAO,OAAO,OAAO,QAAQ;AAC9B;AACA,SAAS,8BAA8B,YAAY,gBAAgB;CAClE,OAAO,2BAA2B,WAAW,SAAS,cAAc,UAAU,OAAO,YAAY,oBAAoB,CAAC,CAAC,GAAG,cAAc;AACzI;AACA,SAAS,0CAA0C,YAAY,gBAAgB;CAC9E,OAAO,2BAA2B,CAAC,GAAG,gCAAgC,OAAO,GAAG,GAAG,WAAW,SAAS,cAAc,UAAU,OAAO,YAAY,oBAAoB,CAAC,CAAC,CAAC,GAAG,cAAc;AAC3L;;AAEA,SAAS,wCAAwC,mBAAmB,CAAC,GAAG,iBAAiB,oCAAoC,GAAG;CAC/H,OAAO,2BAA2B,CAAC,GAAG,gCAAgC,OAAO,GAAG,GAAG,gBAAgB,GAAG,cAAc;AACrH;;;;;;AAMA,SAAS,mCAAmC;CAC3C,OAAO,wCAAwC;AAChD"}
1
+ {"version":3,"file":"codec-registry-DVjibYBY-BeOUp5fk.mjs","names":[],"sources":["../../../../3-targets/postgres/1-target/dist/codec-registry-DVjibYBY.mjs"],"sourcesContent":["import { t as createPostgresBuiltinDataTypeLookup } from \"./data-types-DklKHVmp.mjs\";\nimport { n as buildPostgresCodecDescriptorRegistry } from \"./codec-descriptor-DBeD0UlS.mjs\";\nimport { t as codecDescriptors } from \"./codecs-BqCmavY8.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { extractCodecLookup } from \"@internal/framework-components/control\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/target-postgres`.\n*\n* Public consumer surface for the postgres codec set: the postgres adapter and any other consumer that needs to enumerate or look up a postgres codec by id consumes this rather than the raw descriptor array. See ADR 208.\n*/\nconst postgresCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);\nconst postgresCodecDescriptorRegistry = buildPostgresCodecDescriptorRegistry(codecDescriptors);\n//#endregion\n//#region src/core/codec-registry.ts\n/**\n* A registry of `descriptors`, refusing a codec whose data type `dataTypeLookup` does not have: the\n* SQL renderer writes a parameter's cast from the data type its codec represents.\n*/\nfunction buildPostgresCodecRegistry(descriptors, dataTypeLookup) {\n\tconst descriptorRegistry = buildPostgresCodecDescriptorRegistry(descriptors);\n\tconst validatedDescriptors = Array.from(descriptorRegistry.values());\n\tfor (const descriptor of validatedDescriptors) if (!dataTypeLookup.has(descriptor.dataType)) throw structuredError(\"CONTRACT.DATA_TYPE_UNREGISTERED\", `Codec \"${descriptor.codecId}\" represents data type \"${descriptor.dataType}\", which no component registers.`, {\n\t\twhy: \"A parameter of this codec is written with a cast named by its data type.\",\n\t\tfix: \"Pass the data type beside the codec: in `dataTypes` of createPostgresAdapter, or in the `dataTypes` of the extension that contributes the codec.\",\n\t\tmeta: {\n\t\t\tcodecId: descriptor.codecId,\n\t\t\tdataType: descriptor.dataType\n\t\t}\n\t});\n\tconst registry = {\n\t\t...extractCodecLookup([{\n\t\t\tid: \"postgres-codecs\",\n\t\t\ttypes: { codecTypes: { codecDescriptors: validatedDescriptors } }\n\t\t}]),\n\t\tdescriptorFor: (codecId) => descriptorRegistry.descriptorFor(codecId),\n\t\tvalues: () => descriptorRegistry.values()\n\t};\n\treturn Object.freeze(registry);\n}\nfunction assemblePostgresCodecRegistry(components, dataTypeLookup) {\n\treturn buildPostgresCodecRegistry(components.flatMap((component) => component.types?.codecTypes?.codecDescriptors ?? []), dataTypeLookup);\n}\nfunction assemblePostgresCodecRegistryWithBuiltins(extensions, dataTypeLookup) {\n\treturn buildPostgresCodecRegistry([...postgresCodecDescriptorRegistry.values(), ...extensions.flatMap((extension) => extension.types?.codecTypes?.codecDescriptors ?? [])], dataTypeLookup);\n}\n/** A registry of the built-in codecs and `codecDescriptors`, whose data types `dataTypeLookup` has. */\nfunction createPostgresCodecRegistryWithBuiltins(codecDescriptors = [], dataTypeLookup = createPostgresBuiltinDataTypeLookup()) {\n\treturn buildPostgresCodecRegistry([...postgresCodecDescriptorRegistry.values(), ...codecDescriptors], dataTypeLookup);\n}\n/**\n* Build a coherent PostgreSQL codec registry populated with built-in descriptors only.\n*\n* The returned registry supports both ordinary codec materialization and PostgreSQL target behavior. Stack-composed paths build the same combined registry from their complete ordered descriptor contributions.\n*/\nfunction createPostgresBuiltinCodecLookup() {\n\treturn createPostgresCodecRegistryWithBuiltins();\n}\n//#endregion\nexport { postgresCodecDescriptorRegistry as a, createPostgresCodecRegistryWithBuiltins as i, assemblePostgresCodecRegistryWithBuiltins as n, postgresCodecRegistry as o, createPostgresBuiltinCodecLookup as r, assemblePostgresCodecRegistry as t };\n\n//# sourceMappingURL=codec-registry-DVjibYBY.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,wBAAwB,6BAA6B,gBAAgB;AAC3E,MAAM,kCAAkC,qCAAqC,gBAAgB;;;;;AAO7F,SAAS,2BAA2B,aAAa,gBAAgB;CAChE,MAAM,qBAAqB,qCAAqC,WAAW;CAC3E,MAAM,uBAAuB,MAAM,KAAK,mBAAmB,OAAO,CAAC;CACnE,KAAK,MAAM,cAAc,sBAAsB,IAAI,CAAC,eAAe,IAAI,WAAW,QAAQ,GAAG,MAAM,gBAAgB,mCAAmC,UAAU,WAAW,QAAQ,0BAA0B,WAAW,SAAS,mCAAmC;EACnQ,KAAK;EACL,KAAK;EACL,MAAM;GACL,SAAS,WAAW;GACpB,UAAU,WAAW;EACtB;CACD,CAAC;CACD,MAAM,WAAW;EAChB,GAAG,mBAAmB,CAAC;GACtB,IAAI;GACJ,OAAO,EAAE,YAAY,EAAE,kBAAkB,qBAAqB,EAAE;EACjE,CAAC,CAAC;EACF,gBAAgB,YAAY,mBAAmB,cAAc,OAAO;EACpE,cAAc,mBAAmB,OAAO;CACzC;CACA,OAAO,OAAO,OAAO,QAAQ;AAC9B;AACA,SAAS,8BAA8B,YAAY,gBAAgB;CAClE,OAAO,2BAA2B,WAAW,SAAS,cAAc,UAAU,OAAO,YAAY,oBAAoB,CAAC,CAAC,GAAG,cAAc;AACzI;AACA,SAAS,0CAA0C,YAAY,gBAAgB;CAC9E,OAAO,2BAA2B,CAAC,GAAG,gCAAgC,OAAO,GAAG,GAAG,WAAW,SAAS,cAAc,UAAU,OAAO,YAAY,oBAAoB,CAAC,CAAC,CAAC,GAAG,cAAc;AAC3L;;AAEA,SAAS,wCAAwC,mBAAmB,CAAC,GAAG,iBAAiB,oCAAoC,GAAG;CAC/H,OAAO,2BAA2B,CAAC,GAAG,gCAAgC,OAAO,GAAG,GAAG,gBAAgB,GAAG,cAAc;AACrH;;;;;;AAMA,SAAS,mCAAmC;CAC3C,OAAO,wCAAwC;AAChD"}
@@ -1,7 +1,7 @@
1
1
  import { A as PG_TIMESTAMP_TEMPORAL_CODEC_ID, C as PG_TEXT_CODEC_ID, D as PG_TIMESTAMP_DATE_CODEC_ID, E as PG_TIMESTAMPTZ_TEMPORAL_CODEC_ID, F as PG_UNBOUNDED_INT_CODEC_ID, I as PG_UUID_CODEC_ID, L as PG_VARBIT_CODEC_ID, M as PG_TIME_STRING_CODEC_ID, N as PG_TIME_TEMPORAL_CODEC_ID, O as PG_TIMESTAMP_INSTANT_CODEC_ID, P as PG_TSQUERY_CODEC_ID, R as PG_VARCHAR_CODEC_ID, S as PG_TEXT_ARRAY_CODEC_ID, T as PG_TIMESTAMPTZ_STRING_CODEC_ID, _ as PG_INTERVAL_STRING_CODEC_ID, a as PG_DATE_STRING_CODEC_ID, b as PG_JSON_CODEC_ID, c as PG_FLOAT4_CODEC_ID, d as PG_INET_CODEC_ID, f as PG_INT2_CODEC_ID, g as PG_INTERVAL_CODEC_ID, h as PG_INT8_NUMBER_CODEC_ID, i as PG_CHAR_CODEC_ID, j as PG_TIMETZ_CODEC_ID, k as PG_TIMESTAMP_STRING_CODEC_ID, l as PG_FLOAT8_CODEC_ID, m as PG_INT8_CODEC_ID, n as PG_BOOL_CODEC_ID, o as PG_DATE_TEMPORAL_CODEC_ID, p as PG_INT4_CODEC_ID, r as PG_BYTEA_CODEC_ID, s as PG_ENUM_CODEC_ID, t as PG_BIT_CODEC_ID, u as PG_FLOAT_CODEC_ID, v as PG_INT_CODEC_ID, w as PG_TIMESTAMPTZ_DATE_CODEC_ID, x as PG_NUMERIC_CODEC_ID, y as PG_JSONB_CODEC_ID } from "./codec-ids-D0wjQdEW-EypD_iZj.mjs";
2
2
  import { a as postgresCodec, r as definePostgresCodecs, t as PostgresCodecDescriptor } from "./codec-descriptor-DBeD0UlS-BfvrE-KZ.mjs";
3
- import { a as errorTemporalUnavailableForDefault, c as errorTimestampTextWrongType, i as errorTemporalUnavailable, l as postgresError, o as errorTemporalUnrepresentable, r as errorTemporalNonIsoCalendar, s as errorTemporalWrongType, t as errorDateStyleNotIso } from "./errors-Di_apgWJ-BLXRTfFj.mjs";
4
- import { A as pgJsonb, B as pgTimestampStoredText, C as pgInet, D as pgInterval, E as pgInt8, F as pgText, G as pgTsquery, H as pgTimestamptzStoredText, I as pgTextArray, J as pgVarchar, K as pgUuid, L as pgTime, M as pgNumeric, N as pgNumericParams, O as pgIntervalStoredText, P as pgPrecisionParams, Q as postgresYearText, S as pgFloat8, T as pgInt4, U as pgTimetz, V as pgTimestamptz, X as postgresIntervalFields, _ as pgDate, a as formatIsoDuration, b as pgEnumParams, c as microsFromFraction, d as pgBool, f as pgBytea, g as pgCharacterLengthParams, h as pgChar, j as pgJsonbEnumRefusal, k as pgJson, l as pgBit, n as ISO_DURATION, o as intervalFieldsOf, q as pgVarbit, r as MICROS_PER_SECOND, s as isoYearText, t as BYTEA_TEXT, u as pgBitLengthParams, w as pgInt2, x as pgFloat4, y as pgEnum, z as pgTimestamp } from "./data-types-B7S_CHZd-C9JA40Ir.mjs";
3
+ import { a as errorTemporalUnavailableForDefault, c as errorTimestampTextWrongType, i as errorTemporalUnavailable, l as postgresError, o as errorTemporalUnrepresentable, r as errorTemporalNonIsoCalendar, s as errorTemporalWrongType, t as errorDateStyleNotIso } from "./errors-DG6xgXgr-Cb1XcPcb.mjs";
4
+ import { A as pgJsonb, B as pgTimestampStoredText, C as pgInet, D as pgInterval, E as pgInt8, F as pgText, G as pgTsquery, H as pgTimestamptzStoredText, I as pgTextArray, J as pgVarchar, K as pgUuid, L as pgTime, M as pgNumeric, N as pgNumericParams, O as pgIntervalStoredText, P as pgPrecisionParams, Q as postgresYearText, S as pgFloat8, T as pgInt4, U as pgTimetz, V as pgTimestamptz, X as postgresIntervalFields, _ as pgDate, a as formatIsoDuration, b as pgEnumParams, c as microsFromFraction, d as pgBool, f as pgBytea, g as pgCharacterLengthParams, h as pgChar, j as pgJsonbEnumRefusal, k as pgJson, l as pgBit, n as ISO_DURATION, o as intervalFieldsOf, q as pgVarbit, r as MICROS_PER_SECOND, s as isoYearText, t as BYTEA_TEXT, u as pgBitLengthParams, w as pgInt2, x as pgFloat4, y as pgEnum, z as pgTimestamp } from "./data-types-DklKHVmp-Bl-nwUa-.mjs";
5
5
  import { t as PostgresNativeEnum } from "./postgres-native-enum-CdP3b_-R-DgG3pi5p.mjs";
6
6
  import { CaseExpr, CastExpr, FunctionCallExpr, LiteralExpr, NullCheckExpr, SqlCharCodec, SqlFloatCodec, SqlIntCodec, SqlRawCodec, SqlTextCodec, SqlVarcharCodec, sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlRawDescriptor, sqlTextDescriptor, sqlVarcharDescriptor } from "@prisma/orm-family-sql/relational-core/ast";
7
7
  import { CodecImpl, SAFE_INTEGER_BIGINT_RANGE, column, dateTimeStoredText, decimalTextBigintLiteral, decimalTextNumberLiteral, floatNumberLiteral, floatToJson, isNonFiniteText, numeralText, readJsonFloat, readJsonIntegerText, refuseJsonValue, renderTsLiteral, storedNumeralText } from "@prisma/orm-framework/components/codec";
@@ -11,7 +11,7 @@ import { sqlRawDataType } from "@prisma/orm-family-sql/contract/data-type";
11
11
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
12
12
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
13
13
  import { parse } from "postgres-array";
14
- //#region ../../../3-targets/postgres/1-target/dist/codecs-BcYLh1iB.mjs
14
+ //#region ../../../3-targets/postgres/1-target/dist/codecs-BqCmavY8.mjs
15
15
  /**
16
16
  * A `numeric` value as its canonical decimal text. A number is written out without an exponent,
17
17
  * because `numeric` text has no exponent syntax and `toDataTypeValue` refuses one.
@@ -422,6 +422,7 @@ const TIMESTAMPTZ_DATE = {
422
422
  codecId: PG_TIMESTAMPTZ_DATE_CODEC_ID,
423
423
  typeDescription: "timestamp with time zone",
424
424
  stringType: "TimestamptzString",
425
+ finerTypes: "TimestamptzString and TimestamptzTemporal",
425
426
  textCodecId: PG_TIMESTAMPTZ_STRING_CODEC_ID,
426
427
  instantText: pgTimestamptzStoredText
427
428
  };
@@ -429,6 +430,7 @@ const TIMESTAMP_DATE = {
429
430
  codecId: PG_TIMESTAMP_DATE_CODEC_ID,
430
431
  typeDescription: "timestamp, read as UTC",
431
432
  stringType: "TimestampString",
433
+ finerTypes: "TimestampString and TimestampInstant",
432
434
  textCodecId: PG_TIMESTAMP_STRING_CODEC_ID,
433
435
  instantText: (text) => pgTimestamptzStoredText(`${pgTimestampStoredText(text)}Z`)
434
436
  };
@@ -458,8 +460,13 @@ function decodeDate(identity, wire) {
458
460
  if (date === void 0 || !isRepresentable(date)) throw invalidDate(identity);
459
461
  return date;
460
462
  }
461
- /** The `Date` a stored value names. A `Date` holds neither `infinity` nor an instant before 4714-11-24 BC or after +275760-09-13, so those are refused. */
463
+ /** Whether stored text has nonzero digits below a millisecond, which a `Date` drops. */
464
+ function hasDigitsBelowAMillisecond(text) {
465
+ return /[1-9]/.test(/\.(\d+)/.exec(text)?.[1]?.slice(3) ?? "");
466
+ }
467
+ /** The `Date` a stored value names. A `Date` holds neither `infinity`, nor an instant before 4714-11-24 BC or after +275760-09-13, nor digits below a millisecond, so those are refused. */
462
468
  function dateOfStoredText(identity, text) {
469
+ if (hasDigitsBelowAMillisecond(text)) return refuseJsonValue(identity.codecId, `an instant with no digits below a millisecond, which a Date drops: ${JSON.stringify(text)} has them, and ${identity.finerTypes} hold it`, text);
463
470
  const instant = storedInstant(identity, text);
464
471
  const date = instant === void 0 ? void 0 : new Date(instant);
465
472
  if (date === void 0 || !isRepresentable(date)) return refuseJsonValue(identity.codecId, `an instant a Date holds, from 4714-11-24 BC to +275760-09-13 and not infinity or -infinity, which ${identity.textCodecId} holds`, text);
@@ -1985,4 +1992,4 @@ const codecDescriptors = definePostgresCodecs([
1985
1992
  //#endregion
1986
1993
  export { pgTextColumn as A, postgresQualifyColumnType as B, pgIntColumn as C, pgJsonColumn as D, pgIntervalStringDescriptor as E, pgTimetzColumn as F, setFallbackTemporal as H, pgUnboundedIntColumn as I, pgUuidColumn as L, pgTimestampDateDescriptor as M, pgTimestamptzDateColumn as N, pgJsonbColumn as O, pgTimestamptzDateDescriptor as P, pgVarbitColumn as R, pgInt8NumberColumn as S, pgIntervalStringColumn as T, requireTemporal as V, pgFloatColumn as _, PgTimestamptzDateCodec as a, pgInt4Column as b, decodePostgresListText as c, pgBitColumn as d, pgBoolColumn as f, pgFloat8Column as g, pgFloat4Column as h, PgTimestampDateDescriptor as i, pgTimestampDateColumn as j, pgNumericColumn as k, isPgEnumParams as l, pgEnumDescriptor as m, PgIntervalStringDescriptor as n, PgTimestamptzDateDescriptor as o, pgCharColumn as p, PgTimestampDateCodec as r, codecDescriptors as s, PgIntervalStringCodec as t, parsePostgresListText as u, pgInetColumn as v, pgIntervalColumn as w, pgInt8Column as x, pgInt2Column as y, pgVarcharColumn as z };
1987
1994
 
1988
- //# sourceMappingURL=codecs-BcYLh1iB-Dxi2UgkJ.mjs.map
1995
+ //# sourceMappingURL=codecs-BqCmavY8-CC-ZbbTA.mjs.map