@prisma/orm-family-sql 8.0.0-rc.14-dev.5 → 8.0.0-rc.14-dev.7

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 (195) hide show
  1. package/dist/{ast-CJd4157-.mjs → ast-5hifzBHC.mjs} +84 -35
  2. package/dist/ast-5hifzBHC.mjs.map +1 -0
  3. package/dist/{ast-B53rACdv.d.mts → ast-BQOF33Tw.d.mts} +40 -16
  4. package/dist/ast-BQOF33Tw.d.mts.map +1 -0
  5. package/dist/{authoring-entity-types-CZ-vdwYS-D6R9QovE.d.mts → authoring-entity-types-CZ-vdwYS-BCsVtN8A.d.mts} +2 -2
  6. package/dist/{authoring-entity-types-CZ-vdwYS-D6R9QovE.d.mts.map → authoring-entity-types-CZ-vdwYS-BCsVtN8A.d.mts.map} +1 -1
  7. package/dist/{authoring-type-constructors-DQZEX4Sb-D6uFhwhG.mjs → authoring-type-constructors-kt60uJ3j-BpulZfmt.mjs} +7 -4
  8. package/dist/authoring-type-constructors-kt60uJ3j-BpulZfmt.mjs.map +1 -0
  9. package/dist/builder.d.mts +2 -2
  10. package/dist/builder__runtime.d.mts +9 -9
  11. package/dist/builder__runtime.mjs +1 -1
  12. package/dist/builder__types.d.mts +2 -2
  13. package/dist/{codec-descriptor-registry-Cj-tqpFL.mjs → codec-descriptor-registry-B1v3GEdK.mjs} +13 -22
  14. package/dist/codec-descriptor-registry-B1v3GEdK.mjs.map +1 -0
  15. package/dist/{config-types-CEXpi8FV.mjs → config-types-BrBS_jH9.mjs} +2 -2
  16. package/dist/{config-types-CEXpi8FV.mjs.map → config-types-BrBS_jH9.mjs.map} +1 -1
  17. package/dist/{config-types-Bd3ud-mX.d.mts → config-types-VJ5O9Ert.d.mts} +4 -4
  18. package/dist/{config-types-Bd3ud-mX.d.mts.map → config-types-VJ5O9Ert.d.mts.map} +1 -1
  19. package/dist/{contract-builder-vmb0E3SP.mjs → contract-builder-39dhpN_w.mjs} +3 -3
  20. package/dist/contract-builder-39dhpN_w.mjs.map +1 -0
  21. package/dist/{contract-builder-6ujqQuj-.d.mts → contract-builder-ezejmfrY.d.mts} +48 -22
  22. package/dist/contract-builder-ezejmfrY.d.mts.map +1 -0
  23. package/dist/contract-emitter.d.mts +0 -1
  24. package/dist/contract-emitter.d.mts.map +1 -1
  25. package/dist/contract-emitter.mjs +1 -1
  26. package/dist/contract-prisma7__provider.d.mts +2 -2
  27. package/dist/contract-prisma7__provider.mjs +3 -3
  28. package/dist/contract-prisma7__provider.mjs.map +1 -1
  29. package/dist/contract-psl.d.mts +6 -6
  30. package/dist/contract-psl.d.mts.map +1 -1
  31. package/dist/contract-psl.mjs +1 -1
  32. package/dist/contract-psl__provider.d.mts +2 -2
  33. package/dist/contract-psl__provider.mjs +2 -2
  34. package/dist/contract-psl__provider.mjs.map +1 -1
  35. package/dist/contract-ts.d.mts +4 -4
  36. package/dist/contract-ts.mjs +4 -4
  37. package/dist/contract-ts__config-types.d.mts +1 -1
  38. package/dist/contract-ts__config-types.mjs +1 -1
  39. package/dist/contract-ts__contract-builder.d.mts +3 -3
  40. package/dist/contract-ts__contract-builder.mjs +3 -3
  41. package/dist/{contract-view-CPHxoAEX.d.mts → contract-view-BTFdP8wh.d.mts} +2 -2
  42. package/dist/{contract-view-CPHxoAEX.d.mts.map → contract-view-BTFdP8wh.d.mts.map} +1 -1
  43. package/dist/contract.d.mts +9 -9
  44. package/dist/contract.mjs +2 -2
  45. package/dist/contract__contract-view.d.mts +1 -1
  46. package/dist/contract__factories.d.mts +1 -1
  47. package/dist/contract__index-type-validation.d.mts +1 -1
  48. package/dist/contract__resolve-storage-table.d.mts +1 -1
  49. package/dist/contract__types.d.mts +4 -4
  50. package/dist/contract__types.mjs +2 -2
  51. package/dist/contract__validators.d.mts +1 -1
  52. package/dist/{control-2-eFP31F.mjs → control-BEikPMFg.mjs} +15 -14
  53. package/dist/control-BEikPMFg.mjs.map +1 -0
  54. package/dist/{control-adapter-C99J7aEF-B3_IhgH6.d.mts → control-adapter-C4_cgvzB-BwZx3_VD.d.mts} +11 -7
  55. package/dist/control-adapter-C4_cgvzB-BwZx3_VD.d.mts.map +1 -0
  56. package/dist/control-adapter-CDDbpxyt.d.mts +1 -0
  57. package/dist/{control-DmVQjyZd.d.mts → control-k5_z0qcA.d.mts} +22 -20
  58. package/dist/{control-DmVQjyZd.d.mts.map → control-k5_z0qcA.d.mts.map} +1 -1
  59. package/dist/{db-DLjWu9-f-COdzEg7b.d.mts → db-DLjWu9-f-BWg-lrGV.d.mts} +8 -8
  60. package/dist/{db-DLjWu9-f-COdzEg7b.d.mts.map → db-DLjWu9-f-BWg-lrGV.d.mts.map} +1 -1
  61. package/dist/{ddl-types-DD-i-Uj9-BRqLNUDm.d.mts → ddl-types-B23QEzDx-ridB7leA.d.mts} +5 -5
  62. package/dist/{ddl-types-DD-i-Uj9-BRqLNUDm.d.mts.map → ddl-types-B23QEzDx-ridB7leA.d.mts.map} +1 -1
  63. package/dist/{ddl-types-DOgOmDOh-Cs_MY05h.mjs → ddl-types-B700dqv--DOnQueWA.mjs} +3 -3
  64. package/dist/ddl-types-B700dqv--DOnQueWA.mjs.map +1 -0
  65. package/dist/{derived-checks-C6psACIj-BSBDa2_9.mjs → derived-checks-D8_YCVs5-CfBVLnya.mjs} +112 -109
  66. package/dist/derived-checks-D8_YCVs5-CfBVLnya.mjs.map +1 -0
  67. package/dist/{derived-checks-DPdD01O0-DNBs1ZDA.d.mts → derived-checks-DPdD01O0-zXZEuy5P.d.mts} +3 -3
  68. package/dist/{derived-checks-DPdD01O0-DNBs1ZDA.d.mts.map → derived-checks-DPdD01O0-zXZEuy5P.d.mts.map} +1 -1
  69. package/dist/{diff-DFOiwUHg.d.mts → diff-C_zQQTgw.d.mts} +6 -6
  70. package/dist/{diff-DFOiwUHg.d.mts.map → diff-C_zQQTgw.d.mts.map} +1 -1
  71. package/dist/{dist-ChyuAdtP.mjs → dist-DeiKZwAD.mjs} +4 -35
  72. package/dist/dist-DeiKZwAD.mjs.map +1 -0
  73. package/dist/{expression-Dl5WvxCA.d.mts → expression-B95FOcDX.d.mts} +7 -7
  74. package/dist/{expression-Dl5WvxCA.d.mts.map → expression-B95FOcDX.d.mts.map} +1 -1
  75. package/dist/{factories-P3qBQhO-.d.mts → factories-TIM9dI6S.d.mts} +2 -2
  76. package/dist/{factories-P3qBQhO-.d.mts.map → factories-TIM9dI6S.d.mts.map} +1 -1
  77. package/dist/family.d.mts +12 -12
  78. package/dist/family.mjs +4 -4
  79. package/dist/family__control-adapter.d.mts +2 -2
  80. package/dist/family__control.d.mts +4 -4
  81. package/dist/family__control.mjs +2 -2
  82. package/dist/family__diff.d.mts +2 -2
  83. package/dist/family__diff.mjs +1 -1
  84. package/dist/family__ir.d.mts +1 -1
  85. package/dist/family__ir.mjs +1 -1
  86. package/dist/family__migration.d.mts +1 -1
  87. package/dist/family__pack.d.mts +1 -1
  88. package/dist/family__pack.mjs +1 -1
  89. package/dist/family__pack.mjs.map +1 -1
  90. package/dist/family__psl-build.mjs +1 -1
  91. package/dist/family__runtime.d.mts +2 -2
  92. package/dist/{index-Cef8iy1o.d.mts → index-DrUd8HwS.d.mts} +3 -3
  93. package/dist/{index-Cef8iy1o.d.mts.map → index-DrUd8HwS.d.mts.map} +1 -1
  94. package/dist/{index-BNL2_qQY.d.mts → index-DrWMh8L0.d.mts} +11 -11
  95. package/dist/{index-BNL2_qQY.d.mts.map → index-DrWMh8L0.d.mts.map} +1 -1
  96. package/dist/{index-type-validation-CZ5L2lli.d.mts → index-type-validation-BAQWs-c_.d.mts} +3 -3
  97. package/dist/{index-type-validation-CZ5L2lli.d.mts.map → index-type-validation-BAQWs-c_.d.mts.map} +1 -1
  98. package/dist/{interpreter-Bcc3MIC5-C4dZrobt.mjs → interpreter-j1ewAXPb-BwieIKeF.mjs} +299 -157
  99. package/dist/interpreter-j1ewAXPb-BwieIKeF.mjs.map +1 -0
  100. package/dist/{ir-BJ-dsbe-.d.mts → ir-DI4cwMsy.d.mts} +3 -3
  101. package/dist/{ir-BJ-dsbe-.d.mts.map → ir-DI4cwMsy.d.mts.map} +1 -1
  102. package/dist/middleware-C6T9FExV.d.mts +1 -0
  103. package/dist/{middleware-CuGBptK0-UwVChCr2.d.mts → middleware-CuGBptK0-CGDI6sQU.d.mts} +2 -2
  104. package/dist/{middleware-CuGBptK0-UwVChCr2.d.mts.map → middleware-CuGBptK0-CGDI6sQU.d.mts.map} +1 -1
  105. package/dist/{migration-Csmr6bd8.d.mts → migration-CRsGI-9f.d.mts} +4 -4
  106. package/dist/{migration-Csmr6bd8.d.mts.map → migration-CRsGI-9f.d.mts.map} +1 -1
  107. package/dist/operations.d.mts +1 -1
  108. package/dist/orm-client.d.mts +14 -14
  109. package/dist/orm-client.mjs +4 -3
  110. package/dist/orm-client.mjs.map +1 -1
  111. package/dist/{pack-BUv79Jrr.d.mts → pack-DcSVDz7M.d.mts} +2 -2
  112. package/dist/{pack-BUv79Jrr.d.mts.map → pack-DcSVDz7M.d.mts.map} +1 -1
  113. package/dist/{plan-B7g2kDfQ-ZD3BfWYx.d.mts → plan-B7g2kDfQ-Do1iWC4q.d.mts} +4 -4
  114. package/dist/{plan-B7g2kDfQ-ZD3BfWYx.d.mts.map → plan-B7g2kDfQ-Do1iWC4q.d.mts.map} +1 -1
  115. package/dist/plan-BBBYfvlz.d.mts +2 -0
  116. package/dist/{prepared-statement-BHSj2pDk-D9a_Vwr-.d.mts → prepared-statement-BdsTSY7Y-ICyuLB7c.d.mts} +17 -17
  117. package/dist/{prepared-statement-BHSj2pDk-D9a_Vwr-.d.mts.map → prepared-statement-BdsTSY7Y-ICyuLB7c.d.mts.map} +1 -1
  118. package/dist/{psl-build-ph4eUJSB.mjs → psl-build-139T3MMA.mjs} +3 -3
  119. package/dist/{psl-build-ph4eUJSB.mjs.map → psl-build-139T3MMA.mjs.map} +1 -1
  120. package/dist/query-lane-context-B0R8L6W-.d.mts +1 -0
  121. package/dist/{query-lane-context-D6o9YrEV-BxW3-5e8.d.mts → query-lane-context-BSmWfohZ-QAWw_dXQ.d.mts} +6 -6
  122. package/dist/{query-lane-context-D6o9YrEV-BxW3-5e8.d.mts.map → query-lane-context-BSmWfohZ-QAWw_dXQ.d.mts.map} +1 -1
  123. package/dist/relational-core.d.mts +12 -12
  124. package/dist/relational-core.mjs +3 -3
  125. package/dist/relational-core__aggregate-descriptor-registry.d.mts +1 -1
  126. package/dist/relational-core__ast.d.mts +4 -4
  127. package/dist/relational-core__ast.mjs +3 -3
  128. package/dist/relational-core__codec-descriptor-registry.d.mts +4 -4
  129. package/dist/relational-core__codec-descriptor-registry.mjs +1 -1
  130. package/dist/relational-core__contract-free.d.mts +3 -3
  131. package/dist/relational-core__contract-free.mjs +1 -1
  132. package/dist/relational-core__contract-free.mjs.map +1 -1
  133. package/dist/relational-core__expression.d.mts +1 -1
  134. package/dist/relational-core__middleware.d.mts +2 -2
  135. package/dist/relational-core__plan.d.mts +3 -3
  136. package/dist/relational-core__query-lane-context.d.mts +2 -2
  137. package/dist/relational-core__types.d.mts +2 -2
  138. package/dist/{resolve-storage-table-Nyrgk4h8.d.mts → resolve-storage-table-DhgzQjow.d.mts} +2 -2
  139. package/dist/{resolve-storage-table-Nyrgk4h8.d.mts.map → resolve-storage-table-DhgzQjow.d.mts.map} +1 -1
  140. package/dist/{runtime-DgOeosYa.d.mts → runtime-I-W0bhvd.d.mts} +2 -2
  141. package/dist/{runtime-DgOeosYa.d.mts.map → runtime-I-W0bhvd.d.mts.map} +1 -1
  142. package/dist/runtime.d.mts +4 -4
  143. package/dist/runtime.mjs +6 -4
  144. package/dist/runtime.mjs.map +1 -1
  145. package/dist/runtime__internal__prepared-query.d.mts +1 -1
  146. package/dist/{schema-differ-DpG_gnur-3ciAcy28.d.mts → schema-differ-DpG_gnur-gLIPLPVI.d.mts} +3 -3
  147. package/dist/{schema-differ-DpG_gnur-3ciAcy28.d.mts.map → schema-differ-DpG_gnur-gLIPLPVI.d.mts.map} +1 -1
  148. package/dist/schema-ir.mjs +1 -1
  149. package/dist/schema-ir__types.mjs +1 -1
  150. package/dist/{schema-verify-DI0aJQ9d-Bgbmen10.mjs → schema-verify-DI0aJQ9d-DL-C6on7.mjs} +2 -2
  151. package/dist/{schema-verify-DI0aJQ9d-Bgbmen10.mjs.map → schema-verify-DI0aJQ9d-DL-C6on7.mjs.map} +1 -1
  152. package/dist/{sql-contract-serializer-C90xg7_q-DERDzTD5.mjs → sql-contract-serializer-C90xg7_q-DBJSt3MT.mjs} +2 -2
  153. package/dist/{sql-contract-serializer-C90xg7_q-DERDzTD5.mjs.map → sql-contract-serializer-C90xg7_q-DBJSt3MT.mjs.map} +1 -1
  154. package/dist/{sql-execution-plan-Db0j752I-faODNLY9.d.mts → sql-execution-plan-Db0j752I-uGUWy8sD.d.mts} +2 -2
  155. package/dist/{sql-execution-plan-Db0j752I-faODNLY9.d.mts.map → sql-execution-plan-Db0j752I-uGUWy8sD.d.mts.map} +1 -1
  156. package/dist/{sql-storage-8LqxeLAY-DH4DdUXx.d.mts → sql-storage-BSxD7_vv-C4ugLH39.d.mts} +10 -3
  157. package/dist/sql-storage-BSxD7_vv-C4ugLH39.d.mts.map +1 -0
  158. package/dist/{types-BFPRCYGW-CZrZyp1E.d.mts → types-BKJWoQ40-BzViF_9K.d.mts} +7 -7
  159. package/dist/{types-BFPRCYGW-CZrZyp1E.d.mts.map → types-BKJWoQ40-BzViF_9K.d.mts.map} +1 -1
  160. package/dist/{types-D8Se4rnB.mjs → types-BmXzMDQL.mjs} +9 -2
  161. package/dist/types-BmXzMDQL.mjs.map +1 -0
  162. package/dist/{types-C36_3E6_.d.mts → types-BoMDdzjD.d.mts} +3 -3
  163. package/dist/{types-C36_3E6_.d.mts.map → types-BoMDdzjD.d.mts.map} +1 -1
  164. package/dist/types-BsUJ1jWE.d.mts +1 -0
  165. package/dist/{types-DFJNPLXY-DyYKIhXA.d.mts → types-C0VMsES6-BLOPdA8Y.d.mts} +10 -10
  166. package/dist/{types-DFJNPLXY-DyYKIhXA.d.mts.map → types-C0VMsES6-BLOPdA8Y.d.mts.map} +1 -1
  167. package/dist/{types-yyhkYQNT-Dmoq-giA.mjs → types-C5QzgUrH-B7IJM6qN.mjs} +8 -14
  168. package/dist/types-C5QzgUrH-B7IJM6qN.mjs.map +1 -0
  169. package/dist/{types-BDUG29Df-LE85dIXP.d.mts → types-DTUyRqZv-DLh98w8w.d.mts} +3 -3
  170. package/dist/{types-BDUG29Df-LE85dIXP.d.mts.map → types-DTUyRqZv-DLh98w8w.d.mts.map} +1 -1
  171. package/dist/{types-Yui2yFf6-Dnc7RNUD.d.mts → types-Yui2yFf6-DQkiEr9B.d.mts} +2 -2
  172. package/dist/{types-Yui2yFf6-Dnc7RNUD.d.mts.map → types-Yui2yFf6-DQkiEr9B.d.mts.map} +1 -1
  173. package/dist/{validators-CJSyNFS4.d.mts → validators-CZNulH-_.d.mts} +3 -3
  174. package/dist/{validators-CJSyNFS4.d.mts.map → validators-CZNulH-_.d.mts.map} +1 -1
  175. package/package.json +18 -18
  176. package/dist/ast-B53rACdv.d.mts.map +0 -1
  177. package/dist/ast-CJd4157-.mjs.map +0 -1
  178. package/dist/authoring-type-constructors-DQZEX4Sb-D6uFhwhG.mjs.map +0 -1
  179. package/dist/codec-descriptor-registry-Cj-tqpFL.mjs.map +0 -1
  180. package/dist/contract-builder-6ujqQuj-.d.mts.map +0 -1
  181. package/dist/contract-builder-vmb0E3SP.mjs.map +0 -1
  182. package/dist/control-2-eFP31F.mjs.map +0 -1
  183. package/dist/control-adapter-C99J7aEF-B3_IhgH6.d.mts.map +0 -1
  184. package/dist/control-adapter-kl-cOML5.d.mts +0 -1
  185. package/dist/ddl-types-DOgOmDOh-Cs_MY05h.mjs.map +0 -1
  186. package/dist/derived-checks-C6psACIj-BSBDa2_9.mjs.map +0 -1
  187. package/dist/dist-ChyuAdtP.mjs.map +0 -1
  188. package/dist/interpreter-Bcc3MIC5-C4dZrobt.mjs.map +0 -1
  189. package/dist/middleware-RUh4qBBg.d.mts +0 -1
  190. package/dist/plan-CVje8E5I.d.mts +0 -2
  191. package/dist/query-lane-context-D54z0tof.d.mts +0 -1
  192. package/dist/sql-storage-8LqxeLAY-DH4DdUXx.d.mts.map +0 -1
  193. package/dist/types-D8Se4rnB.mjs.map +0 -1
  194. package/dist/types-Dul4Za_W.d.mts +0 -1
  195. package/dist/types-yyhkYQNT-Dmoq-giA.mjs.map +0 -1
@@ -1,25 +1,18 @@
1
1
  import { B as frozenCodecRef } from "./types-BPi4d3WI-D8PIEqBU.mjs";
2
2
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
3
- import { InternalError } from "@prisma/orm-framework/utils/internal-error";
3
+ import { InternalError, isInternalError } from "@prisma/orm-framework/utils/internal-error";
4
+ import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
5
  import { type } from "arktype";
5
- import { CodecDescriptorTemplateImpl, CodecImpl, column } from "@prisma/orm-framework/components/codec";
6
+ import { CodecDescriptorTemplateImpl, CodecImpl, SAFE_INTEGER_RANGE, codecForRef, column, decodeJsonFloat, decodeJsonInteger, decodeJsonString, encodeJsonFloat, isNonFiniteText } from "@prisma/orm-framework/components/codec";
7
+ import { withoutTrailing } from "@prisma/orm-framework/utils/text";
6
8
  //#region ../../../2-sql/4-lanes/relational-core/dist/exports/ast.mjs
7
9
  const INTEGER_TEXT = /^-?\d+$/;
8
10
  const DECIMAL_TEXT = /^-?\d+\.\d+$/;
9
- const NON_FINITE_WORDS = /* @__PURE__ */ new Set([
10
- "NaN",
11
- "Infinity",
12
- "-Infinity"
13
- ]);
14
11
  const DECIMAL_NUMERAL = /^(-?)0*(\d+)(\.\d+)?$/;
15
12
  /** Whether `text` is a whole number or a decimal as a contract source writes one. */
16
13
  function isNumeralText(text) {
17
14
  return INTEGER_TEXT.test(text) || DECIMAL_TEXT.test(text);
18
15
  }
19
- /** Whether `text` is one of the three words a floating-point value is written as. */
20
- function isNonFiniteText(text) {
21
- return NON_FINITE_WORDS.has(text);
22
- }
23
16
  /**
24
17
  * A written numeral as the contract stores it. Leading zeros and the sign of zero never change a
25
18
  * number, so they go; trailing zeros stay, because a type without a scale keeps them.
@@ -46,6 +39,17 @@ function numeralText(value) {
46
39
  if (point >= digits.length) return `${sign}${digits}${"0".repeat(point - digits.length)}`;
47
40
  return `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;
48
41
  }
42
+ /**
43
+ * The canonical form of a 64-bit integer type: digit text. A database reads an integer default back as a number when it is a safe integer, so a safe integer reads as its digit text too; any other number may already have lost digits and is refused.
44
+ */
45
+ const integerTextCanonicalForm = (value) => {
46
+ if (typeof value === "number" && Number.isSafeInteger(value)) return numeralText(value);
47
+ if (typeof value === "string" && INTEGER_TEXT.test(value)) return BigInt(value).toString();
48
+ throw structuredError("CONTRACT.CAST_REFUSED", `Expected digit text or a safe integer, got ${JSON.stringify(value)}.`, {
49
+ why: "A 64-bit integer type stores its value as digit text, and a number past the safe integer range may already have lost digits.",
50
+ fix: "Write the value as digit text."
51
+ });
52
+ };
49
53
  /** A string as a contract source writes it, with the escapes its string reader resolves. */
50
54
  function escapePslString(value) {
51
55
  return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
@@ -69,7 +73,7 @@ function createNumberClassifier(spec) {
69
73
  value
70
74
  };
71
75
  return (text) => {
72
- if (NON_FINITE_WORDS.has(text)) return as(spec.words, spec.words?.form === "number" ? Number(text) : text);
76
+ if (isNonFiniteText(text)) return as(spec.words, spec.words?.form === "number" ? Number(text) : text);
73
77
  if (DECIMAL_TEXT.test(text)) {
74
78
  const canonical = canonicalNumeralText(text);
75
79
  return as(spec.fraction, spec.fraction?.form === "number" ? Number(canonical) : canonical);
@@ -384,6 +388,59 @@ function canonicalDateTime(text, options, written = text) {
384
388
  }
385
389
  return printed(value, options.shape);
386
390
  }
391
+ /**
392
+ * Reads a column's literal default with the column's codec, built with its type parameters, and encodes it for the DDL renderer to inline. `undefined` when no codec descriptor has the column's codec id, so the renderer inlines the value as written.
393
+ *
394
+ * A `Date` is the one authored value JSON has no notation for, so it is encoded as it is. A `null` the codec refuses is SQL NULL, because SQL NULL has no stored form of its own; a codec that reads `null` (a JSON codec) makes it the JSON value null. Any other value the codec refuses is a `CONTRACT.DEFAULT_INVALID` naming the column.
395
+ */
396
+ async function encodeLiteralDefault(codecLookup, codecRef, value, where) {
397
+ const codec = codecForRef(codecLookup, codecRef);
398
+ if (codec === void 0) return void 0;
399
+ if (value instanceof Date) return {
400
+ kind: "wire",
401
+ wire: await codec.encode(value, {})
402
+ };
403
+ return encodeWithCodec(codec, value, (cause) => refusedDefault(where, codecRef.codecId, value, void 0, cause));
404
+ }
405
+ /**
406
+ * Reads and encodes each element of a list column's literal default with the column's codec, as {@link encodeLiteralDefault} does a single value, so a `null` element the codec refuses is SQL NULL. `undefined` when no codec descriptor has the column's codec id. An element the codec refuses is a `CONTRACT.DEFAULT_INVALID` naming the column and the element's 1-based position.
407
+ */
408
+ async function encodeListLiteralDefault(codecLookup, codecRef, elements, where) {
409
+ const codec = codecForRef(codecLookup, codecRef);
410
+ if (codec === void 0) return void 0;
411
+ return Promise.all(elements.map((element, index) => encodeWithCodec(codec, element, (cause) => refusedDefault(where, codecRef.codecId, element, index + 1, cause))));
412
+ }
413
+ async function encodeWithCodec(codec, value, refused) {
414
+ let decoded;
415
+ try {
416
+ decoded = codec.decodeJson(value);
417
+ } catch (error) {
418
+ if (isInternalError(error)) throw error;
419
+ if (value === null) return { kind: "sql-null" };
420
+ throw refused(error);
421
+ }
422
+ return {
423
+ kind: "wire",
424
+ wire: await codec.encode(decoded, {})
425
+ };
426
+ }
427
+ function refusedDefault(where, codecId, value, elementPosition, cause) {
428
+ const reason = cause instanceof Error ? cause.message : String(cause);
429
+ const subject = elementPosition === void 0 ? "default" : `default (element ${elementPosition})`;
430
+ return structuredError("CONTRACT.DEFAULT_INVALID", `Column "${where.table}"."${where.column}" has a ${subject} its codec ${codecId} refuses: ${reason}`, {
431
+ why: "A contract.json that an earlier version emitted, or a migration.ts it planned, can hold a default that this version's codec refuses, and so can either file after a hand edit.",
432
+ fix: "If contract.json holds the default, emit the contract again with this version, and correct the default in the contract source if emit refuses it. If a migration.ts sets it, correct it in that file.",
433
+ cause,
434
+ meta: {
435
+ table: where.table,
436
+ column: where.column,
437
+ codecId,
438
+ value,
439
+ ...ifDefined("elementPosition", elementPosition),
440
+ reason: "codec-refused-default"
441
+ }
442
+ });
443
+ }
387
444
  var JsonValueProjection = class {
388
445
  value;
389
446
  constructor(value) {
@@ -443,13 +500,19 @@ var JsonDocumentProjection = class JsonDocumentProjection extends JsonValueProje
443
500
  return new JsonDocumentProjection(this.value.rewrite(rewriter));
444
501
  }
445
502
  };
503
+ /**
504
+ * Shared encode/decode/render constants and codec id literals for the five SQL base codecs (`sql/char@1`, `sql/varchar@1`, `sql/int@1`, `sql/float@1`, `sql/text@1`).
505
+ *
506
+ * The codec implementations live in `sql-codecs.ts` (TML-2357). This module retains only the conversion helpers + emit-path renderers the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.
507
+ */
446
508
  const SQL_CHAR_CODEC_ID = "sql/char@1";
447
509
  const SQL_VARCHAR_CODEC_ID = "sql/varchar@1";
448
510
  const SQL_INT_CODEC_ID = "sql/int@1";
449
511
  const SQL_FLOAT_CODEC_ID = "sql/float@1";
450
512
  const SQL_TEXT_CODEC_ID = "sql/text@1";
451
513
  const sqlCharEncode = (value) => value;
452
- const sqlCharDecode = (wire) => wire.trimEnd();
514
+ /** A `character` value as the database returns it, without the spaces that pad it to its length. Only spaces pad it, so a trailing tab or newline is part of the value. */
515
+ const sqlCharDecode = (wire) => withoutTrailing(wire, " ");
453
516
  const sqlCharRenderOutputType = (typeParams) => {
454
517
  const length = typeParams.length;
455
518
  if (length === void 0) return void 0;
@@ -476,20 +539,6 @@ const sqlIntEncode = (value) => value;
476
539
  const sqlIntDecode = (wire) => wire;
477
540
  const sqlFloatEncode = (value) => value;
478
541
  const sqlFloatDecode = (wire) => wire;
479
- /**
480
- * JSON has no spelling for a non-finite number, and a database that holds one
481
- * emits it as a string — PostgreSQL writes `"NaN"` and `"Infinity"`. This
482
- * codec's application type is `number`, so both directions reject rather than
483
- * carry a value that type cannot hold.
484
- */
485
- const sqlFloatEncodeJson = (value) => {
486
- if (!Number.isFinite(value)) throw structuredError("RUNTIME.ENCODE_FAILED", `${SQL_FLOAT_CODEC_ID} application value must be a finite number, got ${value}`, { meta: { codec: SQL_FLOAT_CODEC_ID } });
487
- return value;
488
- };
489
- const sqlFloatDecodeJson = (json) => {
490
- if (typeof json !== "number" || !Number.isFinite(json)) throw structuredError("RUNTIME.DECODE_FAILED", `Expected a finite number for ${SQL_FLOAT_CODEC_ID}, got ${JSON.stringify(json)}`, { meta: { codec: SQL_FLOAT_CODEC_ID } });
491
- return json;
492
- };
493
542
  const sqlTextEncode = (value) => value;
494
543
  const sqlTextDecode = (wire) => wire;
495
544
  const lengthParamsSchema = type({ "length?": "number.integer > 0" });
@@ -504,7 +553,7 @@ var SqlTextCodec = class extends CodecImpl {
504
553
  return value;
505
554
  }
506
555
  decodeJson(json) {
507
- return json;
556
+ return decodeJsonString(this.id, json);
508
557
  }
509
558
  };
510
559
  var SqlTextDescriptor = class extends CodecDescriptorTemplateImpl {
@@ -533,7 +582,7 @@ var SqlIntCodec = class extends CodecImpl {
533
582
  return value;
534
583
  }
535
584
  decodeJson(json) {
536
- return json;
585
+ return decodeJsonInteger(this.id, json, SAFE_INTEGER_RANGE);
537
586
  }
538
587
  };
539
588
  var SqlIntDescriptor = class extends CodecDescriptorTemplateImpl {
@@ -559,10 +608,10 @@ var SqlFloatCodec = class extends CodecImpl {
559
608
  return sqlFloatDecode(wire);
560
609
  }
561
610
  encodeJson(value) {
562
- return sqlFloatEncodeJson(value);
611
+ return encodeJsonFloat(value);
563
612
  }
564
613
  decodeJson(json) {
565
- return sqlFloatDecodeJson(json);
614
+ return decodeJsonFloat(this.id, json);
566
615
  }
567
616
  };
568
617
  var SqlFloatDescriptor = class extends CodecDescriptorTemplateImpl {
@@ -591,7 +640,7 @@ var SqlCharCodec = class extends CodecImpl {
591
640
  return value;
592
641
  }
593
642
  decodeJson(json) {
594
- return json;
643
+ return decodeJsonString(this.id, json);
595
644
  }
596
645
  };
597
646
  var SqlCharDescriptor = class extends CodecDescriptorTemplateImpl {
@@ -623,7 +672,7 @@ var SqlVarcharCodec = class extends CodecImpl {
623
672
  return value;
624
673
  }
625
674
  decodeJson(json) {
626
- return json;
675
+ return decodeJsonString(this.id, json);
627
676
  }
628
677
  };
629
678
  var SqlVarcharDescriptor = class extends CodecDescriptorTemplateImpl {
@@ -645,6 +694,6 @@ var SqlVarcharDescriptor = class extends CodecDescriptorTemplateImpl {
645
694
  const sqlVarcharDescriptor = new SqlVarcharDescriptor();
646
695
  const sqlVarcharColumn = (params = {}) => column(sqlVarcharDescriptor.factory(params), sqlVarcharDescriptor.codecId, params, "varchar");
647
696
  //#endregion
648
- export { sqlCharDecode as A, sqlIntColumn as B, isNonFiniteText as C, printJsonBody as D, parseJsonBody as E, sqlFloatDecode as F, sqlTextDecode as G, sqlIntDescriptor as H, sqlFloatDecodeJson as I, sqlVarcharColumn as J, sqlTextDescriptor as K, sqlFloatDescriptor as L, sqlCharEncode as M, sqlCharRenderOutputType as N, signedRange as O, sqlFloatColumn as P, sqlVarcharRenderOutputType as Q, sqlFloatEncode as R, escapePslString as S, numeralText as T, sqlIntEncode as U, sqlIntDecode as V, sqlTextColumn as W, sqlVarcharDescriptor as X, sqlVarcharDecode as Y, sqlVarcharEncode as Z, SqlVarcharCodec as _, SQL_FLOAT_CODEC_ID as a, canonicalNumeralText as b, SQL_VARCHAR_CODEC_ID as c, SqlFloatCodec as d, SqlFloatDescriptor as f, SqlTextDescriptor as g, SqlTextCodec as h, SQL_CHAR_CODEC_ID as i, sqlCharDescriptor as j, sqlCharColumn as k, SqlCharCodec as l, SqlIntDescriptor as m, JsonDocumentProjection as n, SQL_INT_CODEC_ID as o, SqlIntCodec as p, sqlTextEncode as q, NativeJsonValueProjection as r, SQL_TEXT_CODEC_ID as s, CodecJsonValueProjection as t, SqlCharDescriptor as u, SqlVarcharDescriptor as v, isNumeralText as w, createNumberClassifier as x, canonicalDateTime as y, sqlFloatEncodeJson as z };
697
+ export { signedRange as A, sqlIntColumn as B, encodeLiteralDefault as C, numeralText as D, isNumeralText as E, sqlCharRenderOutputType as F, sqlTextDecode as G, sqlIntDescriptor as H, sqlFloatColumn as I, sqlVarcharColumn as J, sqlTextDescriptor as K, sqlFloatDecode as L, sqlCharDecode as M, sqlCharDescriptor as N, parseJsonBody as O, sqlCharEncode as P, sqlVarcharRenderOutputType as Q, sqlFloatDescriptor as R, encodeListLiteralDefault as S, integerTextCanonicalForm as T, sqlIntEncode as U, sqlIntDecode as V, sqlTextColumn as W, sqlVarcharDescriptor as X, sqlVarcharDecode as Y, sqlVarcharEncode as Z, SqlVarcharCodec as _, SQL_FLOAT_CODEC_ID as a, canonicalNumeralText as b, SQL_VARCHAR_CODEC_ID as c, SqlFloatCodec as d, SqlFloatDescriptor as f, SqlTextDescriptor as g, SqlTextCodec as h, SQL_CHAR_CODEC_ID as i, sqlCharColumn as j, printJsonBody as k, SqlCharCodec as l, SqlIntDescriptor as m, JsonDocumentProjection as n, SQL_INT_CODEC_ID as o, SqlIntCodec as p, sqlTextEncode as q, NativeJsonValueProjection as r, SQL_TEXT_CODEC_ID as s, CodecJsonValueProjection as t, SqlCharDescriptor as u, SqlVarcharDescriptor as v, escapePslString as w, createNumberClassifier as x, canonicalDateTime as y, sqlFloatEncode as z };
649
698
 
650
- //# sourceMappingURL=ast-CJd4157-.mjs.map
699
+ //# sourceMappingURL=ast-5hifzBHC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-5hifzBHC.mjs","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/ast.mjs"],"sourcesContent":["import { A as PreparedParamRef, B as isAggregateFn, C as LiteralExpr, D as OrExpr, E as OperationExpr, F as SubqueryExpr, G as queryAstKinds, H as isOrderByNulls, I as TableSource, K as whereExprKinds, L as UpdateAst, M as RawExpr, N as RawQueryAst, O as OrderByItem, P as SelectAst, R as WindowFuncExpr, S as ListExpression, T as NullCheckExpr, U as isQueryAst, V as isOrderByDirection, W as isWhereExpr, _ as InsertAst, a as CastExpr, b as JsonArrayAggExpr, c as DeleteAst, d as DoUpdateSetConflictAction, f as EqColJoinOn, g as IdentifierRef, h as FunctionSource, i as CaseExpr, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, m as FunctionCallExpr, n as AndExpr, o as ColumnRef, p as ExistsExpr, q as frozenCodecRef, r as BinaryExpr, s as DefaultValueExpr, t as AggregateExpr, u as DoNothingConflictAction, v as InsertOnConflict, w as NotExpr, x as JsonObjectExpr, y as JoinAst, z as aggregateFnNames } from \"../types-BPi4d3WI.mjs\";\nimport { a as ForeignKeyConstraint, c as PrimaryKeyConstraint, i as DdlNode, l as UniqueConstraint, n as DdlColumn, o as FunctionColumnDefault, r as DdlColumnDefault, s as LiteralColumnDefault, t as CheckExpressionConstraint, u as isDdlNode } from \"../ddl-types-B700dqv-.mjs\";\nimport { n as compact, t as collectOrderedParamRefs } from \"../util-DQQgv2j1.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { CodecDescriptorTemplateImpl, CodecImpl, SAFE_INTEGER_RANGE, codecForRef, column, decodeJsonFloat, decodeJsonInteger, decodeJsonString, encodeJsonFloat, isNonFiniteText } from \"@internal/framework-components/codec\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { InternalError, isInternalError } from \"@internal/utils/internal-error\";\nimport { withoutTrailing } from \"@internal/utils/text\";\nimport { type } from \"arktype\";\n//#region src/ast/data-type-support.ts\nconst INTEGER_TEXT = /^-?\\d+$/;\nconst DECIMAL_TEXT = /^-?\\d+\\.\\d+$/;\nconst DECIMAL_NUMERAL = /^(-?)0*(\\d+)(\\.\\d+)?$/;\n/** Whether `text` is a whole number or a decimal as a contract source writes one. */\nfunction isNumeralText(text) {\n\treturn INTEGER_TEXT.test(text) || DECIMAL_TEXT.test(text);\n}\n/**\n* A written numeral as the contract stores it. Leading zeros and the sign of zero never change a\n* number, so they go; trailing zeros stay, because a type without a scale keeps them.\n*/\nfunction canonicalNumeralText(text) {\n\tconst numeral = DECIMAL_NUMERAL.exec(text);\n\tif (numeral === null) return text;\n\tconst [, sign = \"\", whole = \"\", fraction = \"\"] = numeral;\n\tconst digits = `${whole}${fraction}`;\n\treturn /^[0.]+$/.test(digits) ? digits : `${sign}${digits}`;\n}\n/**\n* A number as a contract source writes it: no exponent, because no schema language has that syntax,\n* so the decimal point moves to where the exponent puts it. A non-finite number is its own word.\n*/\nfunction numeralText(value) {\n\tconst [coefficient = \"\", exponent] = String(value).split(\"e\");\n\tif (exponent === void 0) return coefficient;\n\tconst sign = coefficient.startsWith(\"-\") ? \"-\" : \"\";\n\tconst [whole = \"\", fraction = \"\"] = coefficient.slice(sign.length).split(\".\");\n\tconst digits = `${whole}${fraction}`;\n\tconst point = whole.length + Number(exponent);\n\tif (point <= 0) return `${sign}0.${\"0\".repeat(-point)}${digits}`;\n\tif (point >= digits.length) return `${sign}${digits}${\"0\".repeat(point - digits.length)}`;\n\treturn `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;\n}\n/**\n* The canonical form of a 64-bit integer type: digit text. A database reads an integer default back as a number when it is a safe integer, so a safe integer reads as its digit text too; any other number may already have lost digits and is refused.\n*/\nconst integerTextCanonicalForm = (value) => {\n\tif (typeof value === \"number\" && Number.isSafeInteger(value)) return numeralText(value);\n\tif (typeof value === \"string\" && INTEGER_TEXT.test(value)) return BigInt(value).toString();\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `Expected digit text or a safe integer, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A 64-bit integer type stores its value as digit text, and a number past the safe integer range may already have lost digits.\",\n\t\tfix: \"Write the value as digit text.\"\n\t});\n};\n/** A string as a contract source writes it, with the escapes its string reader resolves. */\nfunction escapePslString(value) {\n\treturn value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\");\n}\n/** The range of a signed integer of `bits` bits. */\nfunction signedRange(bits) {\n\tconst half = 2n ** (BigInt(bits) - 1n);\n\treturn {\n\t\tmin: -half,\n\t\tmax: half - 1n\n\t};\n}\n/**\n* The classifier one target's plain-number authoring entry carries: it reads the digits and says\n* which of the target's types the value is, in that type's canonical form. `undefined` means no\n* type of this target holds the number.\n*/\nfunction createNumberClassifier(spec) {\n\tconst as = (classification, value) => classification === void 0 ? void 0 : {\n\t\ttype: classification.type,\n\t\tvalue\n\t};\n\treturn (text) => {\n\t\tif (isNonFiniteText(text)) return as(spec.words, spec.words?.form === \"number\" ? Number(text) : text);\n\t\tif (DECIMAL_TEXT.test(text)) {\n\t\t\tconst canonical = canonicalNumeralText(text);\n\t\t\treturn as(spec.fraction, spec.fraction?.form === \"number\" ? Number(canonical) : canonical);\n\t\t}\n\t\tif (!INTEGER_TEXT.test(text)) return void 0;\n\t\tconst digits = BigInt(text);\n\t\tconst classification = spec.integers.find(({ min, max }) => digits >= min && digits <= max) ?? spec.largerWhole;\n\t\treturn as(classification, classification?.form === \"number\" ? Number(digits) : digits.toString());\n\t};\n}\n/**\n* Read a JSON body into the document it holds.\n*\n* `JSON.parse` reads a numeral too large for a double as `Infinity`, and `JSON.stringify` writes\n* that back as `null`, so a document holding one would not be the document stored; it is refused\n* here instead, naming where the number is.\n*/\nfunction parseJsonBody(text) {\n\tlet value;\n\ttry {\n\t\tvalue = JSON.parse(text);\n\t} catch (error) {\n\t\tthrow structuredError(\"CONTRACT.INVALID_JSON_LITERAL\", error instanceof Error ? error.message : String(error), {\n\t\t\twhy: \"The body is not a JSON document.\",\n\t\t\tfix: \"Write a JSON document.\"\n\t\t});\n\t}\n\tconst overflowed = nonFiniteNumberIn(value, \"\");\n\tif (overflowed !== void 0) throw structuredError(\"CONTRACT.INVALID_JSON_LITERAL\", `${overflowed.path} is ${overflowed.value}, which JSON cannot write back: the number in the text is outside the range a JSON number holds.`, {\n\t\twhy: \"JSON.parse reads a numeral too large for a double as Infinity, which JSON.stringify writes back as null.\",\n\t\tfix: \"Write a number JSON can hold, or write it as text.\"\n\t});\n\treturn value;\n}\n/** Write a document as the body of a JSON literal. */\nfunction printJsonBody(value) {\n\treturn JSON.stringify(value);\n}\nfunction nonFiniteNumberIn(value, path) {\n\tif (typeof value === \"number\") return Number.isFinite(value) ? void 0 : {\n\t\tpath: path === \"\" ? \"The value\" : path,\n\t\tvalue\n\t};\n\tif (Array.isArray(value)) {\n\t\tfor (const [index, element] of value.entries()) {\n\t\t\tconst found = nonFiniteNumberIn(element, `${path}[${index}]`);\n\t\t\tif (found !== void 0) return found;\n\t\t}\n\t\treturn;\n\t}\n\tif (typeof value === \"object\" && value !== null) for (const [key, member] of Object.entries(value)) {\n\t\tconst found = nonFiniteNumberIn(member, path === \"\" ? key : `${path}.${key}`);\n\t\tif (found !== void 0) return found;\n\t}\n}\n//#endregion\n//#region src/ast/date-time-canonical-form.ts\n/**\n* The reader the SQL targets build the canonical form of each date and time type with; ADR 254\n* states the forms and the text it reads.\n*/\nconst SHAPES = {\n\tdate: {\n\t\tdescription: \"a date\",\n\t\tplural: \"dates\",\n\t\texample: \"2024-01-01\",\n\t\tdate: true,\n\t\ttime: false,\n\t\toffset: false\n\t},\n\ttime: {\n\t\tdescription: \"a time of day\",\n\t\tplural: \"times of day\",\n\t\texample: \"12:34:56\",\n\t\tdate: false,\n\t\ttime: true,\n\t\toffset: false\n\t},\n\ttimeWithOffset: {\n\t\tdescription: \"a time of day with a UTC offset\",\n\t\tplural: \"times of day with a UTC offset\",\n\t\texample: \"12:34:56+02:00\",\n\t\tdate: false,\n\t\ttime: true,\n\t\toffset: true\n\t},\n\tdateTime: {\n\t\tdescription: \"a date and time\",\n\t\tplural: \"dates and times\",\n\t\texample: \"2024-01-01T12:34:56\",\n\t\tdate: true,\n\t\ttime: true,\n\t\toffset: false\n\t},\n\tinstant: {\n\t\tdescription: \"a date and time with a UTC offset\",\n\t\tplural: \"instants\",\n\t\texample: \"2024-01-01T12:34:56Z\",\n\t\tdate: true,\n\t\ttime: true,\n\t\toffset: true\n\t}\n};\nconst DATE_PREFIX = /^([+-]\\d{6}|\\d{4})-(\\d{2})-(\\d{2})/;\nconst TIME_PREFIX = /^(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d+))?)?/;\nconst OFFSET = /^([+-])(\\d{2})(?::(\\d{2})(?::(\\d{2}))?)?$/;\nconst MAX_FRACTION_DIGITS = 6;\nconst FRACTION_UNITS = {\n\t3: \"milliseconds\",\n\t6: \"microseconds\"\n};\nconst SECONDS_PER_DAY = 86400;\nconst MIDNIGHT = {\n\thour: 0,\n\tminute: 0,\n\tsecond: 0,\n\tfraction: \"\"\n};\nfunction refused(message) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", message, {\n\t\twhy: \"A date or time type stores one canonical form for each value (ADR 254).\",\n\t\tfix: \"Write text the type holds, as the message shows.\"\n\t});\n}\nfunction isLeapYear(year) {\n\treturn year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;\n}\nfunction daysInMonth(year, month) {\n\tif (month === 2) return isLeapYear(year) ? 29 : 28;\n\treturn [\n\t\t4,\n\t\t6,\n\t\t9,\n\t\t11\n\t].includes(month) ? 30 : 31;\n}\n/** Days from 1970-01-01 to a date of the proleptic Gregorian calendar, with year 0 as 1 BC. */\nfunction daysFromCivil({ year, month, day }) {\n\tconst shifted = month <= 2 ? year - 1 : year;\n\tconst era = Math.floor(shifted / 400);\n\tconst yearOfEra = shifted - era * 400;\n\tconst dayOfYear = Math.floor((153 * (month + (month > 2 ? -3 : 9)) + 2) / 5) + day - 1;\n\tconst dayOfEra = yearOfEra * 365 + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100) + dayOfYear;\n\treturn era * 146097 + dayOfEra - 719468;\n}\nfunction civilFromDays(days) {\n\tconst shifted = days + 719468;\n\tconst era = Math.floor(shifted / 146097);\n\tconst dayOfEra = shifted - era * 146097;\n\tconst yearOfEra = Math.floor((dayOfEra - Math.floor(dayOfEra / 1460) + Math.floor(dayOfEra / 36524) - Math.floor(dayOfEra / 146096)) / 365);\n\tconst dayOfYear = dayOfEra - (365 * yearOfEra + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100));\n\tconst monthIndex = Math.floor((5 * dayOfYear + 2) / 153);\n\tconst day = dayOfYear - Math.floor((153 * monthIndex + 2) / 5) + 1;\n\tconst month = monthIndex < 10 ? monthIndex + 3 : monthIndex - 9;\n\treturn {\n\t\tyear: yearOfEra + era * 400 + (month <= 2 ? 1 : 0),\n\t\tmonth,\n\t\tday\n\t};\n}\nfunction pad(value, width = 2) {\n\treturn String(value).padStart(width, \"0\");\n}\nfunction yearText(year) {\n\tif (year >= 0 && year <= 9999) return pad(year, 4);\n\treturn `${year < 0 ? \"-\" : \"+\"}${pad(Math.abs(year), 6)}`;\n}\nfunction dateText(date) {\n\treturn `${yearText(date.year)}-${pad(date.month)}-${pad(date.day)}`;\n}\nfunction timeText(time) {\n\tconst fraction = time.fraction.replace(/0+$/, \"\");\n\treturn `${pad(time.hour)}:${pad(time.minute)}:${pad(time.second)}${fraction === \"\" ? \"\" : `.${fraction}`}`;\n}\nfunction offsetText(seconds) {\n\tif (seconds === 0) return \"Z\";\n\tconst magnitude = Math.abs(seconds);\n\tconst rest = magnitude % 60;\n\treturn `${seconds < 0 ? \"-\" : \"+\"}${pad(Math.floor(magnitude / 3600))}:${pad(Math.floor(magnitude / 60) % 60)}${rest === 0 ? \"\" : `:${pad(rest)}`}`;\n}\n/**\n* The fields of an ISO 8601 date, time, or date and time, or `undefined` when the text is not one.\n* Ranges are checked by the caller, which words the refusal.\n*/\nfunction readWritten(text) {\n\tlet rest = text;\n\tlet date;\n\tlet timeFollows = true;\n\tconst dateMatch = DATE_PREFIX.exec(rest);\n\tif (dateMatch !== null) {\n\t\tconst [whole, yearDigits = \"\", month = \"\", day = \"\"] = dateMatch;\n\t\tif (yearDigits === \"-000000\") return void 0;\n\t\tdate = {\n\t\t\tyear: Number(yearDigits),\n\t\t\tmonth: Number(month),\n\t\t\tday: Number(day)\n\t\t};\n\t\trest = rest.slice(whole.length);\n\t\ttimeFollows = /^[Tt ]/.test(rest);\n\t\tif (timeFollows) rest = rest.slice(1);\n\t}\n\tlet time;\n\tlet fractionDigits = 0;\n\tif (timeFollows) {\n\t\tconst timeMatch = TIME_PREFIX.exec(rest);\n\t\tif (timeMatch === null) return void 0;\n\t\tconst [whole, hour = \"\", minute = \"\", second = \"00\", fraction = \"\"] = timeMatch;\n\t\ttime = {\n\t\t\thour: Number(hour),\n\t\t\tminute: Number(minute),\n\t\t\tsecond: Number(second),\n\t\t\tfraction\n\t\t};\n\t\tfractionDigits = fraction.length;\n\t\trest = rest.slice(whole.length);\n\t}\n\tlet offsetSeconds;\n\tif (rest === \"Z\" || rest === \"z\") offsetSeconds = 0;\n\telse if (rest !== \"\") {\n\t\tconst offset = OFFSET.exec(rest);\n\t\tif (offset === null) return void 0;\n\t\tconst [, sign, hours = \"\", minutes = \"00\", seconds = \"00\"] = offset;\n\t\tif (Number(minutes) > 59 || Number(seconds) > 59) return void 0;\n\t\tconst magnitude = Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds);\n\t\toffsetSeconds = sign === \"-\" ? -magnitude : magnitude;\n\t}\n\treturn {\n\t\tdate,\n\t\ttime,\n\t\toffsetSeconds,\n\t\tfractionDigits\n\t};\n}\nfunction withFraction(example, digits) {\n\treturn example.replace(/(\\d{2}:\\d{2}:\\d{2})/, `$1.${\"123456\".slice(0, digits)}`);\n}\n/** The value with an instant moved to UTC. */\nfunction normalized(written, shape) {\n\tconst clock = written.time ?? MIDNIGHT;\n\tconst offsetSeconds = written.offsetSeconds ?? 0;\n\tif (written.date === void 0 || shape !== \"instant\") return {\n\t\tdate: written.date,\n\t\ttime: clock,\n\t\toffsetSeconds\n\t};\n\tconst utc = daysFromCivil(written.date) * SECONDS_PER_DAY + clock.hour * 3600 + clock.minute * 60 + clock.second - offsetSeconds;\n\tconst days = Math.floor(utc / SECONDS_PER_DAY);\n\tconst secondOfDay = utc - days * SECONDS_PER_DAY;\n\treturn {\n\t\tdate: civilFromDays(days),\n\t\ttime: {\n\t\t\thour: Math.floor(secondOfDay / 3600),\n\t\t\tminute: Math.floor(secondOfDay / 60) % 60,\n\t\t\tsecond: secondOfDay % 60,\n\t\t\tfraction: clock.fraction\n\t\t},\n\t\toffsetSeconds: 0\n\t};\n}\nfunction position(value) {\n\tconst { time } = value;\n\treturn [\n\t\tvalue.date === void 0 ? 0 : daysFromCivil(value.date),\n\t\ttime.hour * 3600 + time.minute * 60 + time.second,\n\t\ttime.fraction.padEnd(MAX_FRACTION_DIGITS, \"0\")\n\t];\n}\nfunction isBefore(left, right) {\n\tif (left[0] !== right[0]) return left[0] < right[0];\n\tif (left[1] !== right[1]) return left[1] < right[1];\n\treturn left[2] < right[2];\n}\nfunction printed(value, shape) {\n\tconst { date, time, offsetSeconds } = value;\n\tif (date === void 0) return shape === \"timeWithOffset\" ? `${timeText(time)}${offsetText(offsetSeconds)}` : timeText(time);\n\tif (shape === \"date\") return dateText(date);\n\tif (shape === \"dateTime\") return `${dateText(date)}T${timeText(time)}`;\n\treturn `${dateText(date)}T${timeText(time)}Z`;\n}\n/** The position of a range bound, which the data type declares in canonical form. */\nfunction boundPosition(text, shape) {\n\tconst written = readWritten(text);\n\tif (written === void 0) throw new InternalError(`The range bound \"${text}\" is not in canonical form.`);\n\treturn position(normalized(written, shape));\n}\n/**\n* The canonical form of written date or time text, or a refusal with a message that says what is\n* wrong and shows text the type holds. `written` is the text as its author wrote it, which the\n* message shows, when a target rewrote it into ISO 8601 before calling this.\n*/\nfunction canonicalDateTime(text, options, written = text) {\n\tconst shape = SHAPES[options.shape];\n\tconst { dataTypeId: id } = options;\n\tconst parts = readWritten(text);\n\tif (parts === void 0) refused(`${id} cannot read \"${written}\". Write ${shape.description}, as in \"${shape.example}\".`);\n\tif (parts.date !== void 0 && !shape.date) refused(`${id} holds a time of day without a date, but \"${written}\" has a date. Write the time alone, as in \"${shape.example}\".`);\n\tif (parts.date === void 0 && shape.date) refused(shape.time ? `${id} holds ${shape.description}, but \"${written}\" has no date. Write the date too, as in \"${shape.example}\".` : `${id} holds a date, and \"${written}\" is a time of day. Write a date, as in \"${shape.example}\".`);\n\tif (parts.time !== void 0 && !shape.time) refused(`${id} holds a date without a time of day, but \"${written}\" has a time. Write the date alone, as in \"${shape.example}\".`);\n\tif (parts.time === void 0 && shape.offset) refused(`${id} holds ${shape.description}, but \"${written}\" has no time of day. Write the time too, as in \"${shape.example}\".`);\n\tif (parts.offsetSeconds !== void 0 && !shape.offset) refused(`${id} holds no UTC offset, but \"${written}\" has one. Leave it out, as in \"${shape.example}\".`);\n\tif (parts.offsetSeconds === void 0 && shape.offset) refused(`${id} needs a UTC offset, but \"${written}\" has none. Add Z for UTC or an offset such as +02:00, as in \"${shape.example}\".`);\n\tconst maxFractionDigits = options.maxFractionDigits ?? MAX_FRACTION_DIGITS;\n\tif (parts.fractionDigits > maxFractionDigits) refused(`\"${written}\" has ${parts.fractionDigits} digits after the decimal point, but ${id} holds ${FRACTION_UNITS[maxFractionDigits]}, so at most ${maxFractionDigits}. Round it, as in \"${withFraction(shape.example, maxFractionDigits)}\".`);\n\tconst { date, time } = parts;\n\tif (date !== void 0 && (date.month < 1 || date.month > 12 || date.day < 1 || date.day > daysInMonth(date.year, date.month))) refused(`\"${written}\" is not a date that exists. Write a real date, as in \"${shape.example}\".`);\n\tif (time !== void 0 && (time.hour > 23 || time.minute > 59 || time.second > 59)) refused(`\"${written}\" is not a time of day that exists: hours run from 00 to 23, and minutes and seconds from 00 to 59. Write one, as in \"${shape.example}\".`);\n\tconst offsetLimit = options.maxOffsetHours ?? 23;\n\tif (parts.offsetSeconds !== void 0 && Math.abs(parts.offsetSeconds) >= (offsetLimit + 1) * 3600) refused(`\"${written}\" has a UTC offset outside -${pad(offsetLimit)}:59 to +${pad(offsetLimit)}:59, which ${id} does not hold. Write a smaller offset, as in \"${shape.example}\".`);\n\tconst value = normalized(parts, options.shape);\n\tconst { range } = options;\n\tif (range !== void 0) {\n\t\tconst at = position(value);\n\t\tif (isBefore(at, boundPosition(range.earliest, options.shape)) || isBefore(boundPosition(range.latest, options.shape), at)) refused(`${id} holds ${shape.plural} from ${range.earliest} to ${range.latest}, and \"${written}\" is outside them.`);\n\t}\n\treturn printed(value, options.shape);\n}\n//#endregion\n//#region src/ast/ddl-default.ts\n/**\n* Reads a column's literal default with the column's codec, built with its type parameters, and encodes it for the DDL renderer to inline. `undefined` when no codec descriptor has the column's codec id, so the renderer inlines the value as written.\n*\n* A `Date` is the one authored value JSON has no notation for, so it is encoded as it is. A `null` the codec refuses is SQL NULL, because SQL NULL has no stored form of its own; a codec that reads `null` (a JSON codec) makes it the JSON value null. Any other value the codec refuses is a `CONTRACT.DEFAULT_INVALID` naming the column.\n*/\nasync function encodeLiteralDefault(codecLookup, codecRef, value, where) {\n\tconst codec = codecForRef(codecLookup, codecRef);\n\tif (codec === void 0) return void 0;\n\tif (value instanceof Date) return {\n\t\tkind: \"wire\",\n\t\twire: await codec.encode(value, {})\n\t};\n\treturn encodeWithCodec(codec, value, (cause) => refusedDefault(where, codecRef.codecId, value, void 0, cause));\n}\n/**\n* Reads and encodes each element of a list column's literal default with the column's codec, as {@link encodeLiteralDefault} does a single value, so a `null` element the codec refuses is SQL NULL. `undefined` when no codec descriptor has the column's codec id. An element the codec refuses is a `CONTRACT.DEFAULT_INVALID` naming the column and the element's 1-based position.\n*/\nasync function encodeListLiteralDefault(codecLookup, codecRef, elements, where) {\n\tconst codec = codecForRef(codecLookup, codecRef);\n\tif (codec === void 0) return void 0;\n\treturn Promise.all(elements.map((element, index) => encodeWithCodec(codec, element, (cause) => refusedDefault(where, codecRef.codecId, element, index + 1, cause))));\n}\nasync function encodeWithCodec(codec, value, refused) {\n\tlet decoded;\n\ttry {\n\t\tdecoded = codec.decodeJson(value);\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\tif (value === null) return { kind: \"sql-null\" };\n\t\tthrow refused(error);\n\t}\n\treturn {\n\t\tkind: \"wire\",\n\t\twire: await codec.encode(decoded, {})\n\t};\n}\nfunction refusedDefault(where, codecId, value, elementPosition, cause) {\n\tconst reason = cause instanceof Error ? cause.message : String(cause);\n\tconst subject = elementPosition === void 0 ? \"default\" : `default (element ${elementPosition})`;\n\treturn structuredError(\"CONTRACT.DEFAULT_INVALID\", `Column \"${where.table}\".\"${where.column}\" has a ${subject} its codec ${codecId} refuses: ${reason}`, {\n\t\twhy: \"A contract.json that an earlier version emitted, or a migration.ts it planned, can hold a default that this version's codec refuses, and so can either file after a hand edit.\",\n\t\tfix: \"If contract.json holds the default, emit the contract again with this version, and correct the default in the contract source if emit refuses it. If a migration.ts sets it, correct it in that file.\",\n\t\tcause,\n\t\tmeta: {\n\t\t\ttable: where.table,\n\t\t\tcolumn: where.column,\n\t\t\tcodecId,\n\t\t\tvalue,\n\t\t\t...ifDefined(\"elementPosition\", elementPosition),\n\t\t\treason: \"codec-refused-default\"\n\t\t}\n\t});\n}\n//#endregion\n//#region src/ast/json-value-projection.ts\nvar JsonValueProjection = class {\n\tvalue;\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n\tfold(folder) {\n\t\treturn this.value.fold(folder);\n\t}\n\tcollectColumnRefs() {\n\t\treturn this.value.collectColumnRefs();\n\t}\n\tcollectParamRefs() {\n\t\treturn this.value.collectParamRefs();\n\t}\n\tfreeze() {\n\t\tObject.freeze(this);\n\t}\n};\nvar CodecJsonValueProjection = class CodecJsonValueProjection extends JsonValueProjection {\n\tkind = \"codec\";\n\tcodec;\n\tconstructor(value, codec) {\n\t\tsuper(value);\n\t\tthis.codec = frozenCodecRef(codec);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.codec(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new CodecJsonValueProjection(this.value.rewrite(rewriter), this.codec);\n\t}\n};\nvar NativeJsonValueProjection = class NativeJsonValueProjection extends JsonValueProjection {\n\tkind = \"native\";\n\tconstructor(value) {\n\t\tsuper(value);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.native(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new NativeJsonValueProjection(this.value.rewrite(rewriter));\n\t}\n};\nvar JsonDocumentProjection = class JsonDocumentProjection extends JsonValueProjection {\n\tkind = \"document\";\n\tconstructor(value) {\n\t\tsuper(value);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.document(this);\n\t}\n\trewrite(rewriter) {\n\t\treturn new JsonDocumentProjection(this.value.rewrite(rewriter));\n\t}\n};\n//#endregion\n//#region src/ast/sql-codec-helpers.ts\n/**\n* Shared encode/decode/render constants and codec id literals for the five SQL base codecs (`sql/char@1`, `sql/varchar@1`, `sql/int@1`, `sql/float@1`, `sql/text@1`).\n*\n* The codec implementations live in `sql-codecs.ts` (TML-2357). This module retains only the conversion helpers + emit-path renderers the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.\n*/\nconst SQL_CHAR_CODEC_ID = \"sql/char@1\";\nconst SQL_VARCHAR_CODEC_ID = \"sql/varchar@1\";\nconst SQL_INT_CODEC_ID = \"sql/int@1\";\nconst SQL_FLOAT_CODEC_ID = \"sql/float@1\";\nconst SQL_TEXT_CODEC_ID = \"sql/text@1\";\nconst sqlCharEncode = (value) => value;\n/** A `character` value as the database returns it, without the spaces that pad it to its length. Only spaces pad it, so a trailing tab or newline is part of the value. */\nconst sqlCharDecode = (wire) => withoutTrailing(wire, \" \");\nconst sqlCharRenderOutputType = (typeParams) => {\n\tconst length = typeParams.length;\n\tif (length === void 0) return void 0;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length)) throw structuredError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"length\" in typeParams for Char, got ${String(length)}`, { meta: {\n\t\tcodec: SQL_CHAR_CODEC_ID,\n\t\tparam: \"length\",\n\t\treceived: String(length)\n\t} });\n\treturn `Char<${length}>`;\n};\nconst sqlVarcharEncode = (value) => value;\nconst sqlVarcharDecode = (wire) => wire;\nconst sqlVarcharRenderOutputType = (typeParams) => {\n\tconst length = typeParams.length;\n\tif (length === void 0) return void 0;\n\tif (typeof length !== \"number\" || !Number.isFinite(length) || !Number.isInteger(length)) throw structuredError(\"RUNTIME.TYPE_PARAMS_INVALID\", `renderOutputType: expected integer \"length\" in typeParams for Varchar, got ${String(length)}`, { meta: {\n\t\tcodec: SQL_VARCHAR_CODEC_ID,\n\t\tparam: \"length\",\n\t\treceived: String(length)\n\t} });\n\treturn `Varchar<${length}>`;\n};\nconst sqlIntEncode = (value) => value;\nconst sqlIntDecode = (wire) => wire;\nconst sqlFloatEncode = (value) => value;\nconst sqlFloatDecode = (wire) => wire;\nconst sqlTextEncode = (value) => value;\nconst sqlTextDecode = (wire) => wire;\n//#endregion\n//#region src/ast/sql-codecs.ts\nconst lengthParamsSchema = type({ \"length?\": \"number.integer > 0\" });\nvar SqlTextCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlTextEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlTextDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonString(this.id, json);\n\t}\n};\nvar SqlTextDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_TEXT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\ttargetTypes = [\"text\"];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqlTextCodec(this);\n\t}\n};\nconst sqlTextDescriptor = new SqlTextDescriptor();\nconst sqlTextColumn = () => column(sqlTextDescriptor.factory(), sqlTextDescriptor.codecId, void 0, \"text\");\nvar SqlIntCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlIntEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlIntDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonInteger(this.id, json, SAFE_INTEGER_RANGE);\n\t}\n};\nvar SqlIntDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_INT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"int\"];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqlIntCodec(this);\n\t}\n};\nconst sqlIntDescriptor = new SqlIntDescriptor();\nconst sqlIntColumn = () => column(sqlIntDescriptor.factory(), sqlIntDescriptor.codecId, void 0, \"int\");\nvar SqlFloatCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlFloatEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlFloatDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn encodeJsonFloat(value);\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonFloat(this.id, json);\n\t}\n};\nvar SqlFloatDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_FLOAT_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"numeric\"\n\t];\n\ttargetTypes = [\"float\"];\n\tparamsSchema = void 0;\n\tfactory() {\n\t\treturn () => new SqlFloatCodec(this);\n\t}\n};\nconst sqlFloatDescriptor = new SqlFloatDescriptor();\nconst sqlFloatColumn = () => column(sqlFloatDescriptor.factory(), sqlFloatDescriptor.codecId, void 0, \"float\");\nvar SqlCharCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlCharEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlCharDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonString(this.id, json);\n\t}\n};\nvar SqlCharDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_CHAR_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\ttargetTypes = [\"char\"];\n\tparamsSchema = lengthParamsSchema;\n\trenderOutputType(params) {\n\t\treturn sqlCharRenderOutputType(params);\n\t}\n\tfactory(_params) {\n\t\treturn () => new SqlCharCodec(this);\n\t}\n};\nconst sqlCharDescriptor = new SqlCharDescriptor();\nconst sqlCharColumn = (params = {}) => column(sqlCharDescriptor.factory(params), sqlCharDescriptor.codecId, params, \"char\");\nvar SqlVarcharCodec = class extends CodecImpl {\n\tasync encode(value, _ctx) {\n\t\treturn sqlVarcharEncode(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn sqlVarcharDecode(wire);\n\t}\n\tencodeJson(value) {\n\t\treturn value;\n\t}\n\tdecodeJson(json) {\n\t\treturn decodeJsonString(this.id, json);\n\t}\n};\nvar SqlVarcharDescriptor = class extends CodecDescriptorTemplateImpl {\n\tcodecId = SQL_VARCHAR_CODEC_ID;\n\ttraits = [\n\t\t\"equality\",\n\t\t\"order\",\n\t\t\"textual\"\n\t];\n\ttargetTypes = [\"varchar\"];\n\tparamsSchema = lengthParamsSchema;\n\trenderOutputType(params) {\n\t\treturn sqlVarcharRenderOutputType(params);\n\t}\n\tfactory(_params) {\n\t\treturn () => new SqlVarcharCodec(this);\n\t}\n};\nconst sqlVarcharDescriptor = new SqlVarcharDescriptor();\nconst sqlVarcharColumn = (params = {}) => column(sqlVarcharDescriptor.factory(params), sqlVarcharDescriptor.codecId, params, \"varchar\");\n//#endregion\nexport { AggregateExpr, AndExpr, BinaryExpr, CaseExpr, CastExpr, CheckExpressionConstraint, CodecJsonValueProjection, ColumnRef, DdlColumn, DdlColumnDefault, DdlNode, DefaultValueExpr, DeleteAst, DerivedTableSource, DoNothingConflictAction, DoUpdateSetConflictAction, EqColJoinOn, ExistsExpr, ForeignKeyConstraint, FunctionCallExpr, FunctionColumnDefault, FunctionSource, IdentifierRef, InsertAst, InsertOnConflict, JoinAst, JsonArrayAggExpr, JsonDocumentProjection, JsonObjectExpr, ListExpression, LiteralColumnDefault, LiteralExpr, NativeJsonValueProjection, NotExpr, NullCheckExpr, OperationExpr, OrExpr, OrderByItem, ParamRef, PreparedParamRef, PrimaryKeyConstraint, ProjectionItem, RawExpr, RawQueryAst, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID, SelectAst, SqlCharCodec, SqlCharDescriptor, SqlFloatCodec, SqlFloatDescriptor, SqlIntCodec, SqlIntDescriptor, SqlTextCodec, SqlTextDescriptor, SqlVarcharCodec, SqlVarcharDescriptor, SubqueryExpr, TableSource, UniqueConstraint, UpdateAst, WindowFuncExpr, aggregateFnNames, canonicalDateTime, canonicalNumeralText, collectOrderedParamRefs, compact, createNumberClassifier, encodeListLiteralDefault, encodeLiteralDefault, escapePslString, frozenCodecRef, integerTextCanonicalForm, isAggregateFn, isDdlNode, isNumeralText, isOrderByDirection, isOrderByNulls, isQueryAst, isWhereExpr, numeralText, parseJsonBody, printJsonBody, queryAstKinds, signedRange, sqlCharColumn, sqlCharDecode, sqlCharDescriptor, sqlCharEncode, sqlCharRenderOutputType, sqlFloatColumn, sqlFloatDecode, sqlFloatDescriptor, sqlFloatEncode, sqlIntColumn, sqlIntDecode, sqlIntDescriptor, sqlIntEncode, sqlTextColumn, sqlTextDecode, sqlTextDescriptor, sqlTextEncode, sqlVarcharColumn, sqlVarcharDecode, sqlVarcharDescriptor, sqlVarcharEncode, sqlVarcharRenderOutputType, whereExprKinds };\n\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MAAM,OAAO,MAAM,MAAM;EACxB,OAAO,iBAAiB,IAAI;CAC7B;CACA,WAAW,OAAO;EACjB,OAAO;CACR;CACA,WAAW,MAAM;EAChB,OAAO,iBAAiB,KAAK,IAAI,IAAI;CACtC;AACD;AACA,IAAI,uBAAuB,cAAc,4BAA4B;CACpE,UAAU;CACV,SAAS;EACR;EACA;EACA;CACD;CACA,cAAc,CAAC,SAAS;CACxB,eAAe;CACf,iBAAiB,QAAQ;EACxB,OAAO,2BAA2B,MAAM;CACzC;CACA,QAAQ,SAAS;EAChB,aAAa,IAAI,gBAAgB,IAAI;CACtC;AACD;AACA,MAAM,uBAAuB,IAAI,qBAAqB;AACtD,MAAM,oBAAoB,SAAS,CAAC,MAAM,OAAO,qBAAqB,QAAQ,MAAM,GAAG,qBAAqB,SAAS,QAAQ,SAAS"}
@@ -1,8 +1,8 @@
1
- import { dt as LoweredStatement, h as AnyQueryAst, m as AnyParamRef } from "./types-Yui2yFf6-Dnc7RNUD.mjs";
1
+ import { E as CodecRef$1, dt as LoweredStatement, h as AnyQueryAst, m as AnyParamRef } from "./types-Yui2yFf6-DQkiEr9B.mjs";
2
2
  import { c as SqlQueryable } from "./driver-types-BQtRkOJ0-Bv2RPSfr.mjs";
3
- import "./ddl-types-DD-i-Uj9-BRqLNUDm.mjs";
4
- import { ContractMarkerRecord, JsonValue } from "@prisma/orm-framework/contract/types";
5
- import { CodecCallContext, CodecDescriptorTemplateImpl, CodecImpl, CodecInstanceContext, DataTypeId } from "@prisma/orm-framework/components/codec";
3
+ import "./ddl-types-B23QEzDx-ridB7leA.mjs";
4
+ import { ColumnDefaultLiteralInputValue, ContractMarkerRecord, JsonValue } from "@prisma/orm-framework/contract/types";
5
+ import { CodecCallContext, CodecDescriptorTemplateImpl, CodecImpl, CodecInstanceContext, CodecLookupWithDescriptors, DataTypeId, ToCanonicalForm } from "@prisma/orm-framework/components/codec";
6
6
  import { StandardSchemaV1 } from "@standard-schema/spec";
7
7
  //#region ../../../2-sql/4-lanes/relational-core/dist/exports/ast.d.mts
8
8
  //#region src/ast/adapter-types.d.ts
@@ -46,8 +46,6 @@ interface Adapter<Ast = unknown, TContract = unknown, TBody = LoweredStatement>
46
46
  //#region src/ast/data-type-support.d.ts
47
47
  /** Whether `text` is a whole number or a decimal as a contract source writes one. */
48
48
  declare function isNumeralText(text: string): boolean;
49
- /** Whether `text` is one of the three words a floating-point value is written as. */
50
- declare function isNonFiniteText(text: string): boolean;
51
49
  /**
52
50
  * A written numeral as the contract stores it. Leading zeros and the sign of zero never change a
53
51
  * number, so they go; trailing zeros stay, because a type without a scale keeps them.
@@ -58,6 +56,10 @@ declare function canonicalNumeralText(text: string): string;
58
56
  * so the decimal point moves to where the exponent puts it. A non-finite number is its own word.
59
57
  */
60
58
  declare function numeralText(value: number): string;
59
+ /**
60
+ * The canonical form of a 64-bit integer type: digit text. A database reads an integer default back as a number when it is a safe integer, so a safe integer reads as its digit text too; any other number may already have lost digits and is refused.
61
+ */
62
+ declare const integerTextCanonicalForm: ToCanonicalForm;
61
63
  /** A string as a contract source writes it, with the escapes its string reader resolves. */
62
64
  declare function escapePslString(value: string): string;
63
65
  /** Which data type a written number is, and whether that type stores it as a number or as text. */
@@ -133,13 +135,43 @@ interface CanonicalDateTimeOptions {
133
135
  */
134
136
  declare function canonicalDateTime(text: string, options: CanonicalDateTimeOptions, written?: string): string;
135
137
  //#endregion
138
+ //#region src/ast/ddl-default.d.ts
139
+ /** What a literal default renders as in DDL: SQL NULL, or the wire value the column's codec encoded. */
140
+ type EncodedLiteralDefault = {
141
+ readonly kind: 'sql-null';
142
+ } | {
143
+ readonly kind: 'wire';
144
+ readonly wire: unknown;
145
+ };
146
+ /** The column whose default is rendered, which a refusal names. */
147
+ interface LiteralDefaultColumn {
148
+ readonly table: string;
149
+ readonly column: string;
150
+ }
151
+ /**
152
+ * Reads a column's literal default with the column's codec, built with its type parameters, and encodes it for the DDL renderer to inline. `undefined` when no codec descriptor has the column's codec id, so the renderer inlines the value as written.
153
+ *
154
+ * A `Date` is the one authored value JSON has no notation for, so it is encoded as it is. A `null` the codec refuses is SQL NULL, because SQL NULL has no stored form of its own; a codec that reads `null` (a JSON codec) makes it the JSON value null. Any other value the codec refuses is a `CONTRACT.DEFAULT_INVALID` naming the column.
155
+ */
156
+ declare function encodeLiteralDefault(codecLookup: Pick<CodecLookupWithDescriptors, 'descriptorFor'>, codecRef: CodecRef$1, value: ColumnDefaultLiteralInputValue, where: LiteralDefaultColumn): Promise<EncodedLiteralDefault | undefined>;
157
+ /**
158
+ * Reads and encodes each element of a list column's literal default with the column's codec, as {@link encodeLiteralDefault} does a single value, so a `null` element the codec refuses is SQL NULL. `undefined` when no codec descriptor has the column's codec id. An element the codec refuses is a `CONTRACT.DEFAULT_INVALID` naming the column and the element's 1-based position.
159
+ */
160
+ declare function encodeListLiteralDefault(codecLookup: Pick<CodecLookupWithDescriptors, 'descriptorFor'>, codecRef: CodecRef$1, elements: readonly JsonValue[], where: LiteralDefaultColumn): Promise<readonly EncodedLiteralDefault[] | undefined>;
161
+ //#endregion
136
162
  //#region src/ast/sql-codec-helpers.d.ts
163
+ /**
164
+ * Shared encode/decode/render constants and codec id literals for the five SQL base codecs (`sql/char@1`, `sql/varchar@1`, `sql/int@1`, `sql/float@1`, `sql/text@1`).
165
+ *
166
+ * The codec implementations live in `sql-codecs.ts` (TML-2357). This module retains only the conversion helpers + emit-path renderers the codec methods compose with — keeping a single source of truth for non-trivial conversions while the codec methods provide the framework-required `Promise<…>` boundary.
167
+ */
137
168
  declare const SQL_CHAR_CODEC_ID: "sql/char@1";
138
169
  declare const SQL_VARCHAR_CODEC_ID: "sql/varchar@1";
139
170
  declare const SQL_INT_CODEC_ID: "sql/int@1";
140
171
  declare const SQL_FLOAT_CODEC_ID: "sql/float@1";
141
172
  declare const SQL_TEXT_CODEC_ID: "sql/text@1";
142
173
  declare const sqlCharEncode: (value: string) => string;
174
+ /** A `character` value as the database returns it, without the spaces that pad it to its length. Only spaces pad it, so a trailing tab or newline is part of the value. */
143
175
  declare const sqlCharDecode: (wire: string) => string;
144
176
  declare const sqlCharRenderOutputType: (typeParams: {
145
177
  readonly length?: number;
@@ -153,14 +185,6 @@ declare const sqlIntEncode: (value: number) => number;
153
185
  declare const sqlIntDecode: (wire: number) => number;
154
186
  declare const sqlFloatEncode: (value: number) => number;
155
187
  declare const sqlFloatDecode: (wire: number) => number;
156
- /**
157
- * JSON has no spelling for a non-finite number, and a database that holds one
158
- * emits it as a string — PostgreSQL writes `"NaN"` and `"Infinity"`. This
159
- * codec's application type is `number`, so both directions reject rather than
160
- * carry a value that type cannot hold.
161
- */
162
- declare const sqlFloatEncodeJson: (value: number) => JsonValue;
163
- declare const sqlFloatDecodeJson: (json: JsonValue) => number;
164
188
  declare const sqlTextEncode: (value: string) => string;
165
189
  declare const sqlTextDecode: (wire: string) => string;
166
190
  //#endregion
@@ -260,5 +284,5 @@ declare function compact<T extends Record<string, unknown>>(o: T): T;
260
284
  */
261
285
  declare function collectOrderedParamRefs(ast: AnyQueryAst): ReadonlyArray<AnyParamRef>;
262
286
  //#endregion
263
- export { sqlIntEncode as $, compact as A, sqlCharDecode as B, SqlTextCodec as C, canonicalDateTime as D, SqlVarcharDescriptor as E, numeralText as F, sqlFloatDecode as G, sqlCharEncode as H, parseJsonBody as I, sqlFloatEncode as J, sqlFloatDecodeJson as K, printJsonBody as L, escapePslString as M, isNonFiniteText as N, canonicalNumeralText as O, isNumeralText as P, sqlIntDescriptor as Q, signedRange as R, SqlIntDescriptor as S, SqlVarcharCodec as T, sqlCharRenderOutputType as U, sqlCharDescriptor as V, sqlFloatColumn as W, sqlIntColumn as X, sqlFloatEncodeJson as Y, sqlIntDecode as Z, SqlCharCodec as _, DateTimeShape as a, sqlVarcharDecode as at, SqlFloatDescriptor as b, LowererContext as c, sqlVarcharRenderOutputType as ct, NumberClassifierSpec as d, sqlTextColumn as et, SQL_CHAR_CODEC_ID as f, SQL_VARCHAR_CODEC_ID as g, SQL_TEXT_CODEC_ID as h, CanonicalDateTimeOptions as i, sqlVarcharColumn as it, createNumberClassifier as j, collectOrderedParamRefs as k, MarkerReadResult as l, SQL_INT_CODEC_ID as m, AdapterProfile as n, sqlTextDescriptor as nt, IntegerStep as o, sqlVarcharDescriptor as ot, SQL_FLOAT_CODEC_ID as p, sqlFloatDescriptor as q, AdapterTarget as r, sqlTextEncode as rt, Lowerer as s, sqlVarcharEncode as st, Adapter as t, sqlTextDecode as tt, NumberClassification as u, SqlCharDescriptor as v, SqlTextDescriptor as w, SqlIntCodec as x, SqlFloatCodec as y, sqlCharColumn as z };
264
- //# sourceMappingURL=ast-B53rACdv.d.mts.map
287
+ export { sqlIntDecode as $, canonicalNumeralText as A, parseJsonBody as B, SqlIntCodec as C, SqlVarcharCodec as D, SqlTextDescriptor as E, encodeLiteralDefault as F, sqlCharDescriptor as G, signedRange as H, escapePslString as I, sqlFloatColumn as J, sqlCharEncode as K, integerTextCanonicalForm as L, compact as M, createNumberClassifier as N, SqlVarcharDescriptor as O, encodeListLiteralDefault as P, sqlIntColumn as Q, isNumeralText as R, SqlFloatDescriptor as S, SqlTextCodec as T, sqlCharColumn as U, printJsonBody as V, sqlCharDecode as W, sqlFloatDescriptor as X, sqlFloatDecode as Y, sqlFloatEncode as Z, SQL_TEXT_CODEC_ID as _, DateTimeShape as a, sqlTextEncode as at, SqlCharDescriptor as b, LiteralDefaultColumn as c, sqlVarcharDescriptor as ct, MarkerReadResult as d, sqlIntDescriptor as et, NumberClassification as f, SQL_INT_CODEC_ID as g, SQL_FLOAT_CODEC_ID as h, CanonicalDateTimeOptions as i, sqlTextDescriptor as it, collectOrderedParamRefs as j, canonicalDateTime as k, Lowerer as l, sqlVarcharEncode as lt, SQL_CHAR_CODEC_ID as m, AdapterProfile as n, sqlTextColumn as nt, EncodedLiteralDefault as o, sqlVarcharColumn as ot, NumberClassifierSpec as p, sqlCharRenderOutputType as q, AdapterTarget as r, sqlTextDecode as rt, IntegerStep as s, sqlVarcharDecode as st, Adapter as t, sqlIntEncode as tt, LowererContext as u, sqlVarcharRenderOutputType as ut, SQL_VARCHAR_CODEC_ID as v, SqlIntDescriptor as w, SqlFloatCodec as x, SqlCharCodec as y, numeralText as z };
288
+ //# sourceMappingURL=ast-BQOF33Tw.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-BQOF33Tw.d.mts","names":[],"sources":["../../../../2-sql/4-lanes/relational-core/dist/exports/ast.d.mts"],"mappings":";;;;;;;;KAOK;;;;;;;KAOA;WACM;WACA,QAAQ;;WAER;;WAEA;;UAED,eAAe,gBAAgB,gBAAgB;WAC9C;WACA,QAAQ;WACR,cAAc;;;;EAIvB,WAAW,WAAW,eAAe,QAAQ;;UAErC,eAAe;WACd,UAAU;WACV;;KAEN,QAAQ,eAAe,qBAAqB,QAAQ,qBAAqB,KAAK,KAAK,SAAS,eAAe,eAAe;;;;UAIrH,QAAQ,eAAe,qBAAqB,QAAQ;WACnD,SAAS;EAClB,MAAM,KAAK,KAAK,SAAS,eAAe,aAAa;;;;;iBAKtC,cAAc;;;;;iBAKd,qBAAqB;;;;;iBAKrB,YAAY;;;;cAIf,0BAA0B;;iBAEvB,gBAAgB;;UAEvB;WACC,MAAM;WACN;;;UAGD,oBAAoB;WACnB;WACA;;;iBAGM,YAAY;WAClB;WACA;;UAED;;WAEC,mBAAmB;;WAEnB,cAAc;;WAEd,WAAW;;WAEX,QAAQ;;;;;;;iBAOF,uBAAuB,MAAM,wBAAwB;WAC3D,MAAM;WACN,OAAO;;;;;;;;;iBASD,cAAc,eAAe;;iBAE7B,cAAc,OAAO;;;;;;;;KAQjC;UACK;WACC,OAAO;;WAEP;;WAEA;;WAEA;;WAEA;aACE;aACA;;;;;;;;iBAQI,kBAAkB,cAAc,SAAS,0BAA0B;;;;KAI/E;WACM;;WAEA;WACA;;;UAGD;WACC;WACA;;;;;;;iBAOM,qBAAqB,aAAa,KAAK,8CAA8C,UAAU,YAAU,OAAO,gCAAgC,OAAO,uBAAuB,QAAQ;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AS,gBAAgB,KAAK,yBAAyB;;cAEnD,mBAAmB;cACnB,gBAAgB,SAAS,gEAAgE,WAAW,cAAc;cAClH,wBAAwB,iBAAiB;EACrD,OAAO,eAAe,MAAM,mBAAqB;EACjD,OAAO,cAAc,MAAM,mBAAqB;EAChD,WAAW,gBAAgB;EAC3B,WAAW,MAAM;;cAEL,6BAA6B,4BAA4B;WAC5D;WACA;WACA;WACA,cAAc,iBAAiB;EACxC,iBAAiB,QAAQ;EACzB,QAAQ,SAAS,gBAAgB,KAAK,yBAAyB;;cAEnD,sBAAsB;cACtB,mBAAmB,SAAS,gEAAgE,WAAW,iBAAiB;;;iBAGrH,QAAQ,UAAU,yBAAyB,GAAG,IAAI;;;;;;;;;;;iBAWlD,wBAAwB,KAAK,cAAc,cAAc"}
@@ -1,4 +1,4 @@
1
- import "./contract-builder-6ujqQuj-.mjs";
1
+ import "./contract-builder-ezejmfrY.mjs";
2
2
  import "@prisma/orm-framework/components/authoring";
3
3
  import "@prisma/orm-framework/psl-parser";
4
4
  //#region ../../../2-sql/9-family/dist/authoring-entity-types-CZ-vdwYS.d.mts
@@ -6,4 +6,4 @@ import "@prisma/orm-framework/psl-parser";
6
6
  declare function sqlFamilyEnumSpec(): import("@prisma/orm-framework/psl-parser").MapBlockSpec<Record<string, import("@prisma/orm-framework/contract/types").JsonValue | undefined>>;
7
7
  //#endregion
8
8
  export { sqlFamilyEnumSpec as t };
9
- //# sourceMappingURL=authoring-entity-types-CZ-vdwYS-D6R9QovE.d.mts.map
9
+ //# sourceMappingURL=authoring-entity-types-CZ-vdwYS-BCsVtN8A.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authoring-entity-types-CZ-vdwYS-D6R9QovE.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/authoring-entity-types-CZ-vdwYS.d.mts"],"mappings":";;;;;iBAIiB,oDAAoD,aAAa,kDAAkD"}
1
+ {"version":3,"file":"authoring-entity-types-CZ-vdwYS-BCsVtN8A.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/authoring-entity-types-CZ-vdwYS.d.mts"],"mappings":";;;;;iBAIiB,oDAAoD,aAAa,kDAAkD"}
@@ -1,7 +1,8 @@
1
- import { s as enumType } from "./contract-builder-vmb0E3SP.mjs";
1
+ import { s as enumType } from "./contract-builder-39dhpN_w.mjs";
2
2
  import { resolveEnumCodecId } from "@prisma/orm-framework/components/authoring";
3
+ import { isInternalError } from "@prisma/orm-framework/utils/internal-error";
3
4
  import { blockAttribute, jsonValue, mapBlock, str } from "@prisma/orm-framework/psl-parser";
4
- //#region ../../../2-sql/9-family/dist/authoring-type-constructors-DQZEX4Sb.mjs
5
+ //#region ../../../2-sql/9-family/dist/authoring-type-constructors-kt60uJ3j.mjs
5
6
  function sqlFamilyEnumSpec() {
6
7
  return mapBlock({
7
8
  value: {
@@ -48,7 +49,8 @@ const sqlFamilyEntityTypes = { enum: {
48
49
  let value;
49
50
  if (memberValue === void 0) try {
50
51
  value = codec.decodeJson(memberName);
51
- } catch {
52
+ } catch (error) {
53
+ if (isInternalError(error)) throw error;
52
54
  diagnostics?.push({
53
55
  code: "PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC",
54
56
  message: `enum "${block.name}" member "${memberName}" has no value and codec "${codecId}" does not accept a bare name as input`,
@@ -61,6 +63,7 @@ const sqlFamilyEntityTypes = { enum: {
61
63
  else try {
62
64
  value = codec.decodeJson(memberValue);
63
65
  } catch (err) {
66
+ if (isInternalError(err)) throw err;
64
67
  const reason = err instanceof Error ? err.message : String(err);
65
68
  diagnostics?.push({
66
69
  code: "PSL_EXTENSION_INVALID_VALUE",
@@ -318,4 +321,4 @@ const sqlFamilyAuthoringTypes = { sql: { String: {
318
321
  //#endregion
319
322
  export { sqlFamilyPslBlockDescriptors as i, sqlFamilyAuthoringTypes as n, sqlFamilyEntityTypes as r, sqlFamilyAuthoringFieldPresets as t };
320
323
 
321
- //# sourceMappingURL=authoring-type-constructors-DQZEX4Sb-D6uFhwhG.mjs.map
324
+ //# sourceMappingURL=authoring-type-constructors-kt60uJ3j-BpulZfmt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-type-constructors-kt60uJ3j-BpulZfmt.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/authoring-type-constructors-kt60uJ3j.mjs"],"sourcesContent":["import { resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { blockAttribute, jsonValue, mapBlock, str } from \"@internal/psl-parser\";\nimport { enumType } from \"@internal/sql-contract-ts/contract-builder\";\nimport { isInternalError } from \"@internal/utils/internal-error\";\n//#region src/core/authoring-entity-types.ts\nfunction sqlFamilyEnumSpec() {\n\treturn mapBlock({\n\t\tvalue: {\n\t\t\ttype: jsonValue(),\n\t\t\tdocumentation: \"The stored member value; a bare member stores its own name.\"\n\t\t},\n\t\tallowBare: true\n\t});\n}\nconst sqlFamilyEntityTypes = { enum: {\n\tkind: \"entity\",\n\tdiscriminator: \"enum\",\n\toutput: { factory: (block, ctx) => {\n\t\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\t\tconst diagnostics = ctx.diagnostics;\n\t\tconst resolved = resolveEnumCodecId(block, ctx);\n\t\tif (resolved === void 0) return;\n\t\tconst { codecId, codecSpan } = resolved;\n\t\tconst nativeType = ctx.codecLookup?.targetTypesFor(codecId)?.[0];\n\t\tif (nativeType === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst codec = ctx.codecLookup?.get(codecId);\n\t\tif (codec === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" resolves in targetTypesFor but is absent from codecLookup.get`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst seenValues = /* @__PURE__ */ new Set();\n\t\tconst members = [];\n\t\tlet memberError = false;\n\t\tfor (const [memberName, memberValue] of Object.entries(block.values)) {\n\t\t\tconst span = block.parameterSpans[memberName] ?? block.span;\n\t\t\tlet value;\n\t\t\tif (memberValue === void 0) try {\n\t\t\t\tvalue = codec.decodeJson(memberName);\n\t\t\t} catch (error) {\n\t\t\t\tif (isInternalError(error)) throw error;\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC\",\n\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" has no value and codec \"${codecId}\" does not accept a bare name as input`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse try {\n\t\t\t\tvalue = codec.decodeJson(memberValue);\n\t\t\t} catch (err) {\n\t\t\t\tif (isInternalError(err)) throw err;\n\t\t\t\tconst reason = err instanceof Error ? err.message : String(err);\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" was rejected by codec \"${codecId}\": ${reason}`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst valueKey = String(value);\n\t\t\tif (seenValues.has(valueKey)) {\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_ENUM_DUPLICATE_MEMBER_VALUE\",\n\t\t\t\t\tmessage: `enum \"${block.name}\": duplicate member value \"${valueKey}\"`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenValues.add(valueKey);\n\t\t\tmembers.push({\n\t\t\t\tname: memberName,\n\t\t\t\tvalue\n\t\t\t});\n\t\t}\n\t\tif (memberError) return void 0;\n\t\tif (members.length === 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_ENUM_MISSING_TYPE\",\n\t\t\t\tmessage: `enum \"${block.name}\" must have at least one member`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: block.span\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\treturn enumType(block.name, {\n\t\t\tcodecId,\n\t\t\tnativeType\n\t\t}, ...members.map((m) => ({\n\t\t\tname: m.name,\n\t\t\tvalue: m.value\n\t\t})));\n\t} }\n} };\nconst enumTypeBlockAttribute = blockAttribute(\"type\", {\n\tdocumentation: \"Selects the storage codec for this enum.\",\n\tpositional: [{\n\t\tkey: \"codecId\",\n\t\ttype: str(),\n\t\tdocumentation: \"The fully qualified codec identifier used to store enum values.\"\n\t}]\n});\nconst sqlFamilyPslBlockDescriptors = { enum: {\n\tkind: \"pslBlock\",\n\tkeyword: \"enum\",\n\tdocumentation: \"Defines an enum with named values and an inferred or explicitly selected storage codec.\",\n\tdiscriminator: \"enum\",\n\tname: { required: true },\n\tspec: sqlFamilyEnumSpec,\n\tattributes: { type: () => enumTypeBlockAttribute }\n} };\n//#endregion\n//#region src/core/authoring-field-presets.ts\n/**\n* Family-level SQL authoring field presets.\n*\n* Only presets whose codec IDs align with the ID generator metadata live here\n* (see `@internal/ids`). These presets are target-agnostic because the\n* generator metadata fixes their codec/native-type to `sql/char@1`\n* (`character`) regardless of target, and the PSL interpreter lets the\n* generator override the scalar descriptor.\n*\n* The `uuidString` / `id.uuidv4String` / `id.uuidv7String` presets store UUID\n* values as `character(36)` — portable across all SQL targets. For a native\n* Postgres `uuid` column use `uuidNative` / `id.uuidv4Native` /\n* `id.uuidv7Native` from `@internal/target-postgres`.\n*\n* Scalar presets that map to target-specific codecs (e.g. `text`, `int`,\n* `boolean`, `dateTime`) are contributed by the target pack (see\n* `postgresAuthoringFieldPresets` in `@internal/target-postgres`) so the\n* TS callback surface and the PSL scalar surface lower to byte-identical\n* contracts for the active target.\n*/\nconst CHARACTER_CODEC_ID = \"sql/char@1\";\nconst CHARACTER_NATIVE_TYPE = \"character\";\nconst nanoidOptionsArgument = {\n\tkind: \"object\",\n\toptional: true,\n\tproperties: { size: {\n\t\tkind: \"number\",\n\t\toptional: true,\n\t\tinteger: true,\n\t\tminimum: 2,\n\t\tmaximum: 255\n\t} }\n};\nconst sqlFamilyAuthoringFieldPresets = {\n\tuuidString: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: 36 }\n\t\t}\n\t},\n\tulid: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: 26 }\n\t\t}\n\t},\n\tnanoid: {\n\t\tkind: \"fieldPreset\",\n\t\targs: [nanoidOptionsArgument],\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0,\n\t\t\t\tpath: [\"size\"],\n\t\t\t\tdefault: 21\n\t\t\t} }\n\t\t}\n\t},\n\tcuid2: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: 24 }\n\t\t}\n\t},\n\tksuid: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\ttypeParams: { length: 27 }\n\t\t}\n\t},\n\tid: {\n\t\tuuidv4String: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 36 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"uuidv4\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tuuidv7String: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 36 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"uuidv7\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tulid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 26 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"ulid\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tnanoid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\targs: [nanoidOptionsArgument],\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0,\n\t\t\t\t\tpath: [\"size\"],\n\t\t\t\t\tdefault: 21\n\t\t\t\t} },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"nanoid\",\n\t\t\t\t\tparams: { size: {\n\t\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tpath: [\"size\"]\n\t\t\t\t\t} }\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tcuid2: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 24 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"cuid2\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tksuid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\tnativeType: CHARACTER_NATIVE_TYPE,\n\t\t\t\ttypeParams: { length: 27 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"ksuid\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\n//#region src/core/authoring-type-constructors.ts\nconst sqlFamilyAuthoringTypes = { sql: { String: {\n\tkind: \"typeConstructor\",\n\tdocumentation: \"Variable-length text with a required maximum character length.\",\n\targs: [{\n\t\tkind: \"number\",\n\t\tname: \"length\",\n\t\tinteger: true,\n\t\tminimum: 1,\n\t\tmaximum: 10485760\n\t}],\n\toutput: {\n\t\tcodecId: \"sql/varchar@1\",\n\t\tnativeType: \"character varying\",\n\t\ttypeParams: { length: {\n\t\t\tkind: \"arg\",\n\t\t\tindex: 0\n\t\t} }\n\t}\n} } };\n//#endregion\nexport { sqlFamilyPslBlockDescriptors as i, sqlFamilyAuthoringField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AAG;IACzB,mBAAmB,EAAE,UAAU;KAC9B,MAAM;KACN,IAAI;IACL,EAAE;IACF,IAAI;GACL;EACD;EACA,QAAQ;GACP,MAAM;GACN,MAAM,CAAC,qBAAqB;GAC5B,QAAQ;IACP,SAAS;IACT,YAAY;IACZ,YAAY,EAAE,QAAQ;KACrB,MAAM;KACN,OAAO;KACP,MAAM,CAAC,MAAM;KACb,SAAS;IACV,EAAE;IACF,mBAAmB,EAAE,UAAU;KAC9B,MAAM;KACN,IAAI;KACJ,QAAQ,EAAE,MAAM;MACf,MAAM;MACN,OAAO;MACP,MAAM,CAAC,MAAM;KACd,EAAE;IACH,EAAE;IACF,IAAI;GACL;EACD;EACA,OAAO;GACN,MAAM;GACN,QAAQ;IACP,SAAS;IACT,YAAY;IACZ,YAAY,EAAE,QAAQ,GAAG;IACzB,mBAAmB,EAAE,UAAU;KAC9B,MAAM;KACN,IAAI;IACL,EAAE;IACF,IAAI;GACL;EACD;EACA,OAAO;GACN,MAAM;GACN,QAAQ;IACP,SAAS;IACT,YAAY;IACZ,YAAY,EAAE,QAAQ,GAAG;IACzB,mBAAmB,EAAE,UAAU;KAC9B,MAAM;KACN,IAAI;IACL,EAAE;IACF,IAAI;GACL;EACD;CACD;AACD;AAGA,MAAM,0BAA0B,EAAE,KAAK,EAAE,QAAQ;CAChD,MAAM;CACN,eAAe;CACf,MAAM,CAAC;EACN,MAAM;EACN,MAAM;EACN,SAAS;EACT,SAAS;EACT,SAAS;CACV,CAAC;CACD,QAAQ;EACP,SAAS;EACT,YAAY;EACZ,YAAY,EAAE,QAAQ;GACrB,MAAM;GACN,OAAO;EACR,EAAE;CACH;AACD,EAAE,EAAE"}
@@ -1,3 +1,3 @@
1
- import { o as Expression, x as ScopeField } from "./expression-Dl5WvxCA.mjs";
2
- import { T as WhereFilter, _ as SelectQuery, a as DeleteQuery, c as GatedMethod, f as QueryContext, g as Scope, h as ResolveRow, i as Db, l as GroupedQuery, s as Functions, t as AggregateFunctions, u as InsertQuery, v as Subquery, w as UpdateQuery, x as TableProxy } from "./db-DLjWu9-f-COdzEg7b.mjs";
1
+ import { o as Expression, x as ScopeField } from "./expression-B95FOcDX.mjs";
2
+ import { T as WhereFilter, _ as SelectQuery, a as DeleteQuery, c as GatedMethod, f as QueryContext, g as Scope, h as ResolveRow, i as Db, l as GroupedQuery, s as Functions, t as AggregateFunctions, u as InsertQuery, v as Subquery, w as UpdateQuery, x as TableProxy } from "./db-DLjWu9-f-BWg-lrGV.mjs";
3
3
  export type { AggregateFunctions, Db, DeleteQuery, Expression, Functions, GatedMethod, GroupedQuery, InsertQuery, QueryContext, ResolveRow, Scope, ScopeField, SelectQuery, Subquery, TableProxy, UpdateQuery, WhereFilter };
@@ -1,12 +1,12 @@
1
- import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
2
- import "./types-C36_3E6_.mjs";
3
- import { i as SqlOperationEntry } from "./index-Cef8iy1o.mjs";
4
- import { c as AnyExpression } from "./types-Yui2yFf6-Dnc7RNUD.mjs";
5
- import "./ast-B53rACdv.mjs";
6
- import { l as RawCodecInferer, o as Expression, x as ScopeField } from "./expression-Dl5WvxCA.mjs";
7
- import { S as TableProxyContract, f as QueryContext, g as Scope, i as Db, o as FieldProxy, p as RawLane, s as Functions, t as AggregateFunctions } from "./db-DLjWu9-f-COdzEg7b.mjs";
8
- import { a as SqlAggregateDescriptorRegistry, n as ExecutionContext } from "./query-lane-context-D6o9YrEV-BxW3-5e8.mjs";
9
- import "./query-lane-context-D54z0tof.mjs";
1
+ import { c as SqlStorage } from "./sql-storage-BSxD7_vv-C4ugLH39.mjs";
2
+ import "./types-BoMDdzjD.mjs";
3
+ import { i as SqlOperationEntry } from "./index-DrUd8HwS.mjs";
4
+ import { c as AnyExpression } from "./types-Yui2yFf6-DQkiEr9B.mjs";
5
+ import "./ast-BQOF33Tw.mjs";
6
+ import { l as RawCodecInferer, o as Expression, x as ScopeField } from "./expression-B95FOcDX.mjs";
7
+ import { S as TableProxyContract, f as QueryContext, g as Scope, i as Db, o as FieldProxy, p as RawLane, s as Functions, t as AggregateFunctions } from "./db-DLjWu9-f-BWg-lrGV.mjs";
8
+ import { a as SqlAggregateDescriptorRegistry, n as ExecutionContext } from "./query-lane-context-BSmWfohZ-QAWw_dXQ.mjs";
9
+ import "./query-lane-context-B0R8L6W-.mjs";
10
10
  import { Contract } from "@prisma/orm-framework/contract/types";
11
11
  //#region ../../../2-sql/4-lanes/sql-builder/dist/runtime/index.d.mts
12
12
  //#region src/runtime/expression-impl.d.ts
@@ -1,7 +1,7 @@
1
1
  import { C as LiteralExpr, D as OrExpr, F as SubqueryExpr, H as isOrderByDirection, I as TableSource, L as UpdateAst, O as OrderByItem, P as SelectAst, S as ListExpression, T as NullCheckExpr, U as isOrderByNulls, V as isAggregateFn, _ as InsertAst, c as DeleteAst, g as IdentifierRef, j as ProjectionItem, k as ParamRef, l as DerivedTableSource, n as AndExpr, o as ColumnRef, p as ExistsExpr, r as BinaryExpr, t as AggregateExpr, y as JoinAst } from "./types-BPi4d3WI-D8PIEqBU.mjs";
2
2
  import { t as collectOrderedParamRefs } from "./util-DQQgv2j1-D6INZaRG.mjs";
3
3
  import { i as isExpression, n as codecOf, o as toExpr, r as createRawSql } from "./expression-vAEOvq7J.mjs";
4
- import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-Cj-tqpFL.mjs";
4
+ import { n as codecRefForStorageColumn } from "./codec-descriptor-registry-B1v3GEdK.mjs";
5
5
  import { assertAnnotationsApplicable } from "@prisma/orm-framework/components/runtime";
6
6
  //#region ../../../2-sql/4-lanes/sql-builder/dist/runtime/index.mjs
7
7
  /**
@@ -1,3 +1,3 @@
1
- import { o as Expression, x as ScopeField } from "./expression-Dl5WvxCA.mjs";
2
- import { C as UnboundTables, S as TableProxyContract, T as WhereFilter, _ as SelectQuery, a as DeleteQuery, b as TableNamesAcrossNamespaces, c as GatedMethod, d as Namespace, f as QueryContext, g as Scope, h as ResolveRow, i as Db, l as GroupedQuery, m as RawTagFor, n as BooleanCodecType, p as RawLane, r as ContractRawTag, s as Functions, t as AggregateFunctions, u as InsertQuery, v as Subquery, w as UpdateQuery, x as TableProxy, y as TableInAnyNamespace } from "./db-DLjWu9-f-COdzEg7b.mjs";
1
+ import { o as Expression, x as ScopeField } from "./expression-B95FOcDX.mjs";
2
+ import { C as UnboundTables, S as TableProxyContract, T as WhereFilter, _ as SelectQuery, a as DeleteQuery, b as TableNamesAcrossNamespaces, c as GatedMethod, d as Namespace, f as QueryContext, g as Scope, h as ResolveRow, i as Db, l as GroupedQuery, m as RawTagFor, n as BooleanCodecType, p as RawLane, r as ContractRawTag, s as Functions, t as AggregateFunctions, u as InsertQuery, v as Subquery, w as UpdateQuery, x as TableProxy, y as TableInAnyNamespace } from "./db-DLjWu9-f-BWg-lrGV.mjs";
3
3
  export type { AggregateFunctions, BooleanCodecType, ContractRawTag, Db, DeleteQuery, Expression, Functions, GatedMethod, GroupedQuery, InsertQuery, Namespace, QueryContext, RawLane, RawTagFor, ResolveRow, Scope, ScopeField, SelectQuery, Subquery, TableInAnyNamespace, TableNamesAcrossNamespaces, TableProxy, TableProxyContract, UnboundTables, UpdateQuery, WhereFilter };