@prisma/orm-framework 8.0.0-rc.2-dev.2 → 8.0.0-rc.20

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 (354) hide show
  1. package/README.md +1 -5
  2. package/dist/{apply-specifier-default-control-policy-CAxiXxKg.d.mts → apply-specifier-default-control-policy-Dlz0iwnK.d.mts} +2 -2
  3. package/dist/apply-specifier-default-control-policy-Dlz0iwnK.d.mts.map +1 -0
  4. package/dist/{assertions-Cz-GWH8P.mjs → assertions-Dw1lZz_Q.mjs} +2 -2
  5. package/dist/{assertions-Cz-GWH8P.mjs.map → assertions-Dw1lZz_Q.mjs.map} +1 -1
  6. package/dist/authoring-CNUti739.mjs +764 -0
  7. package/dist/authoring-CNUti739.mjs.map +1 -0
  8. package/dist/authoring-CjwinhU5.d.mts +206 -0
  9. package/dist/authoring-CjwinhU5.d.mts.map +1 -0
  10. package/dist/binder-D_4RBHbt-BJ6VKwEZ.d.mts +515 -0
  11. package/dist/binder-D_4RBHbt-BJ6VKwEZ.d.mts.map +1 -0
  12. package/dist/{canonicalization-DFpB09nP-4OdB2nsy.d.mts → canonicalization-CyrrXGmj-CeKUkht1.d.mts} +3 -3
  13. package/dist/{canonicalization-DFpB09nP-4OdB2nsy.d.mts.map → canonicalization-CyrrXGmj-CeKUkht1.d.mts.map} +1 -1
  14. package/dist/{hashing-utils-DQgS3nOe.mjs → canonicalization-path-match-D88xLEq6-BFQC39ZG.mjs} +23 -3
  15. package/dist/canonicalization-path-match-D88xLEq6-BFQC39ZG.mjs.map +1 -0
  16. package/dist/{utils-DMAM0unR.mjs → canonicalize-json-ZPawceQR-Dua1VNEB.mjs} +2 -2
  17. package/dist/canonicalize-json-ZPawceQR-Dua1VNEB.mjs.map +1 -0
  18. package/dist/codec-B4ypaota.d.mts +289 -0
  19. package/dist/codec-B4ypaota.d.mts.map +1 -0
  20. package/dist/codec-Do8tfXqk.mjs +457 -0
  21. package/dist/codec-Do8tfXqk.mjs.map +1 -0
  22. package/dist/codec-descriptor-D0oY-hgs-C5e11ola.mjs +93 -0
  23. package/dist/codec-descriptor-D0oY-hgs-C5e11ola.mjs.map +1 -0
  24. package/dist/codec-types-BXLUbk-Y-DpGfKGK0.mjs +22 -0
  25. package/dist/codec-types-BXLUbk-Y-DpGfKGK0.mjs.map +1 -0
  26. package/dist/codec-types-CPgEZoIq-BL9hisr8.d.mts +384 -0
  27. package/dist/codec-types-CPgEZoIq-BL9hisr8.d.mts.map +1 -0
  28. package/dist/{components-dZRz3T5y.mjs → components-BaV9iCkq.mjs} +34 -3
  29. package/dist/components-BaV9iCkq.mjs.map +1 -0
  30. package/dist/components-CRBcIta_.d.mts +86 -0
  31. package/dist/components-CRBcIta_.d.mts.map +1 -0
  32. package/dist/components.d.mts +19 -17
  33. package/dist/components.mjs +16 -12
  34. package/dist/components__authoring.d.mts +4 -3
  35. package/dist/components__authoring.mjs +3 -2
  36. package/dist/components__codec.d.mts +3 -3
  37. package/dist/components__codec.mjs +6 -4
  38. package/dist/components__components.d.mts +6 -4
  39. package/dist/components__components.mjs +4 -3
  40. package/dist/components__control.d.mts +5 -4
  41. package/dist/components__control.mjs +3 -2
  42. package/dist/components__emission.d.mts +4 -4
  43. package/dist/components__execution.d.mts +1 -1
  44. package/dist/components__ir.d.mts +1 -1
  45. package/dist/components__ir.mjs +2 -1
  46. package/dist/components__psl-ast.d.mts +4 -4
  47. package/dist/components__psl-ast.mjs +2 -2
  48. package/dist/components__runtime.d.mts +3 -2
  49. package/dist/components__runtime.mjs +2 -2
  50. package/dist/components__utils.mjs +1 -1
  51. package/dist/{config-types-CW4PDwMC.d.mts → config-types-BTFT7QfJ.d.mts} +73 -41
  52. package/dist/config-types-BTFT7QfJ.d.mts.map +1 -0
  53. package/dist/config-types-D0mYyP62.mjs +61 -0
  54. package/dist/config-types-D0mYyP62.mjs.map +1 -0
  55. package/dist/config.d.mts +2 -3
  56. package/dist/config.mjs +2 -3
  57. package/dist/config__config-types.d.mts +2 -2
  58. package/dist/config__config-types.mjs +2 -2
  59. package/dist/contract-authoring.d.mts +152 -17
  60. package/dist/contract-authoring.d.mts.map +1 -1
  61. package/dist/contract-authoring.mjs +190 -9
  62. package/dist/contract-authoring.mjs.map +1 -1
  63. package/dist/{contract-types-CkdMH7F7-9EHXSwbH.d.mts → contract-types-DEIEpzU_-DvAVuBr5.d.mts} +14 -8
  64. package/dist/contract-types-DEIEpzU_-DvAVuBr5.d.mts.map +1 -0
  65. package/dist/{contract-validation-error-DEiWp_EI-CRwtUgRw.mjs → contract-validation-error-CAnTGhkt-DSnujRaK.mjs} +6 -3
  66. package/dist/contract-validation-error-CAnTGhkt-DSnujRaK.mjs.map +1 -0
  67. package/dist/{contract-validation-error-R7cMoK04.d.mts → contract-validation-error-D1QAeOh5.d.mts} +4 -2
  68. package/dist/contract-validation-error-D1QAeOh5.d.mts.map +1 -0
  69. package/dist/contract.d.mts +13 -12
  70. package/dist/contract.mjs +9 -9
  71. package/dist/contract__apply-specifier-default-control-policy.d.mts +1 -1
  72. package/dist/contract__contract-validation-error.d.mts +1 -1
  73. package/dist/contract__contract-validation-error.mjs +1 -1
  74. package/dist/contract__default-namespace.mjs +1 -1
  75. package/dist/contract__enum-accessor.d.mts +2 -2
  76. package/dist/contract__enum-accessor.mjs +1 -1
  77. package/dist/contract__hashing-utils.d.mts +2 -2
  78. package/dist/contract__hashing-utils.mjs +2 -3
  79. package/dist/contract__hashing.d.mts +3 -3
  80. package/dist/contract__hashing.mjs +2 -2
  81. package/dist/contract__resolve-domain-model.d.mts +1 -1
  82. package/dist/contract__types.d.mts +5 -5
  83. package/dist/contract__types.mjs +3 -3
  84. package/dist/contract__validate-domain.d.mts +1 -1
  85. package/dist/contract__validate-domain.mjs +1 -1
  86. package/dist/contract__validate-once.d.mts +2 -0
  87. package/dist/contract__validate-once.mjs +2 -0
  88. package/dist/{control-ql9N9u4f-r3Vv41kZ.d.mts → control-B5ezUWD2-BIAYxeSk.d.mts} +34 -6
  89. package/dist/control-B5ezUWD2-BIAYxeSk.d.mts.map +1 -0
  90. package/dist/{control-DLEm6u5m.mjs → control-DMJqhnwU.mjs} +309 -36
  91. package/dist/control-DMJqhnwU.mjs.map +1 -0
  92. package/dist/control-DrDTlxCS.d.mts +1 -0
  93. package/dist/{control-BD96JZi8-NUhO5Kkw.mjs → control-KsXr4fYD-D2Ows0NI.mjs} +70 -24
  94. package/dist/control-KsXr4fYD-D2Ows0NI.mjs.map +1 -0
  95. package/dist/{control-BF8qzdnM.d.mts → control-s5ECUABR.d.mts} +635 -156
  96. package/dist/control-s5ECUABR.d.mts.map +1 -0
  97. package/dist/data-type-V6mcDhcG-DVQAPOQT.mjs +275 -0
  98. package/dist/data-type-V6mcDhcG-DVQAPOQT.mjs.map +1 -0
  99. package/dist/declarations-BgUAq1RG-Dz_-EI1Q.mjs +459 -0
  100. package/dist/declarations-BgUAq1RG-Dz_-EI1Q.mjs.map +1 -0
  101. package/dist/{default-namespace-D4vCwkXg-lzVN7gSc.mjs → default-namespace-D4vCwkXg-BEZbN38y.mjs} +2 -2
  102. package/dist/{default-namespace-D4vCwkXg-lzVN7gSc.mjs.map → default-namespace-D4vCwkXg-BEZbN38y.mjs.map} +1 -1
  103. package/dist/{dist-Dqbo77p7.mjs → dist-D1f6xr7F.mjs} +51 -24
  104. package/dist/dist-D1f6xr7F.mjs.map +1 -0
  105. package/dist/{domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts → domain-envelope-CN721GnP-4huRt7Wc.d.mts} +27 -13
  106. package/dist/domain-envelope-CN721GnP-4huRt7Wc.d.mts.map +1 -0
  107. package/dist/emission-BtJvV97M.d.mts +2 -0
  108. package/dist/{emission-types-DLXP34Ki-CFms3VrX.d.mts → emission-types-B-jKEbjI-D7BW8Gk1.d.mts} +17 -16
  109. package/dist/emission-types-B-jKEbjI-D7BW8Gk1.d.mts.map +1 -0
  110. package/dist/enum-accessor-2OZgavDX.d.mts +104 -0
  111. package/dist/enum-accessor-2OZgavDX.d.mts.map +1 -0
  112. package/dist/enum-accessor-B-A2wNok.mjs +122 -0
  113. package/dist/enum-accessor-B-A2wNok.mjs.map +1 -0
  114. package/dist/errors.d.mts +5 -4
  115. package/dist/errors.mjs +4 -4
  116. package/dist/errors__control.d.mts +3 -2
  117. package/dist/errors__control.mjs +2 -2
  118. package/dist/errors__execution.d.mts +2 -2
  119. package/dist/errors__execution.mjs +2 -2
  120. package/dist/errors__migration.d.mts +2 -2
  121. package/dist/errors__migration.mjs +2 -2
  122. package/dist/execution-CjX5CCTb.d.mts +76 -0
  123. package/dist/execution-CjX5CCTb.d.mts.map +1 -0
  124. package/dist/{execution-CSnQT8EX.d.mts → execution-lMPVFj5o.d.mts} +2 -2
  125. package/dist/{execution-CSnQT8EX.d.mts.map → execution-lMPVFj5o.d.mts.map} +1 -1
  126. package/dist/execution-vfY4d-SZ.mjs +138 -0
  127. package/dist/execution-vfY4d-SZ.mjs.map +1 -0
  128. package/dist/{declarations-DR6To8_k-BFwkCGeP.mjs → expressions-CMQzbnHk-BL2zN0Iv.mjs} +199 -350
  129. package/dist/expressions-CMQzbnHk-BL2zN0Iv.mjs.map +1 -0
  130. package/dist/framework-authoring-DDxddXZm-uZYdhoE0.d.mts +1096 -0
  131. package/dist/framework-authoring-DDxddXZm-uZYdhoE0.d.mts.map +1 -0
  132. package/dist/{framework-components-hZ2tO-KH-CdRXBOYd.d.mts → framework-components-DKoQnPdB-lax1COaf.d.mts} +28 -91
  133. package/dist/framework-components-DKoQnPdB-lax1COaf.d.mts.map +1 -0
  134. package/dist/generator-functions-CXbQfvYu-BIFU1Ryx.mjs +271 -0
  135. package/dist/generator-functions-CXbQfvYu-BIFU1Ryx.mjs.map +1 -0
  136. package/dist/{hash-content-DwEUh-Rx.d.mts → hash-content-Bde14N2-.d.mts} +2 -2
  137. package/dist/{hash-content-DwEUh-Rx.d.mts.map → hash-content-Bde14N2-.d.mts.map} +1 -1
  138. package/dist/{hash-content-Bugg_nZn.mjs → hash-content-Bdl-HSfq.mjs} +2 -2
  139. package/dist/hash-content-Bdl-HSfq.mjs.map +1 -0
  140. package/dist/{hashing-BtIZVNYX.mjs → hashing-CLRfNAxh.mjs} +28 -9
  141. package/dist/hashing-CLRfNAxh.mjs.map +1 -0
  142. package/dist/hashing-D-DHz0zl.d.mts +36 -0
  143. package/dist/hashing-D-DHz0zl.d.mts.map +1 -0
  144. package/dist/{hashing-utils-qKu59RSC.d.mts → hashing-utils-DiGHKd3b.d.mts} +4 -3
  145. package/dist/{hashing-utils-qKu59RSC.d.mts.map → hashing-utils-DiGHKd3b.d.mts.map} +1 -1
  146. package/dist/ids.d.mts +90 -13
  147. package/dist/ids.d.mts.map +1 -1
  148. package/dist/ids.mjs +45 -59
  149. package/dist/ids.mjs.map +1 -1
  150. package/dist/ids__runtime.d.mts +1 -1
  151. package/dist/ids__runtime.mjs +1 -1
  152. package/dist/{index-CDk9yEbw.d.mts → index-MU-ksXsh.d.mts} +23 -6
  153. package/dist/index-MU-ksXsh.d.mts.map +1 -0
  154. package/dist/{internal-error-kK8QvlDE.d.mts → internal-error-2fJ9fcZX.d.mts} +2 -2
  155. package/dist/{internal-error-kK8QvlDE.d.mts.map → internal-error-2fJ9fcZX.d.mts.map} +1 -1
  156. package/dist/{internal-error-BIc-ehme-ouBQPoEL.mjs → internal-error-ChGYPVpq-DhUD05u0.mjs} +3 -3
  157. package/dist/internal-error-ChGYPVpq-DhUD05u0.mjs.map +1 -0
  158. package/dist/{ir-BvE7L9FK.d.mts → ir-LV4tXsw3.d.mts} +6 -5
  159. package/dist/{ir-BvE7L9FK.d.mts.map → ir-LV4tXsw3.d.mts.map} +1 -1
  160. package/dist/{ir-ChmSSAhX.mjs → ir-uDGU9vaj.mjs} +7 -53
  161. package/dist/ir-uDGU9vaj.mjs.map +1 -0
  162. package/dist/{migration-BvrgDZXw.d.mts → migration-Dluwnqe9.d.mts} +20 -3
  163. package/dist/migration-Dluwnqe9.d.mts.map +1 -0
  164. package/dist/{migration-C57VKLUY.mjs → migration-uC-bSKA4.mjs} +30 -4
  165. package/dist/migration-uC-bSKA4.mjs.map +1 -0
  166. package/dist/namespace-VUH2dgnS-By5y75h9.mjs +53 -0
  167. package/dist/namespace-VUH2dgnS-By5y75h9.mjs.map +1 -0
  168. package/dist/operations.mjs +1 -1
  169. package/dist/{parse-GbZGfMUj-BFSrD2AN.mjs → parse-bZgfjovA-BNgYhylT.mjs} +311 -55
  170. package/dist/parse-bZgfjovA-BNgYhylT.mjs.map +1 -0
  171. package/dist/{parse-0ZJjj_2N-DhQpSVmQ.d.mts → parse-djL5wker-B610mXG4.d.mts} +181 -52
  172. package/dist/parse-djL5wker-B610mXG4.d.mts.map +1 -0
  173. package/dist/psl-ast-COcYtLlz.d.mts +2 -0
  174. package/dist/psl-ast-CyvE6CR-.mjs +116 -0
  175. package/dist/psl-ast-CyvE6CR-.mjs.map +1 -0
  176. package/dist/{psl-ast-CWJQF8LA-Vr5JNPdn.d.mts → psl-ast-rY25o3Ze-ClLY3CYt.d.mts} +10 -40
  177. package/dist/psl-ast-rY25o3Ze-ClLY3CYt.d.mts.map +1 -0
  178. package/dist/psl-parser.d.mts +415 -101
  179. package/dist/psl-parser.d.mts.map +1 -1
  180. package/dist/psl-parser.mjs +2451 -537
  181. package/dist/psl-parser.mjs.map +1 -1
  182. package/dist/psl-parser__format.d.mts +8 -2
  183. package/dist/psl-parser__format.d.mts.map +1 -1
  184. package/dist/psl-parser__format.mjs +65 -34
  185. package/dist/psl-parser__format.mjs.map +1 -1
  186. package/dist/psl-parser__interpret.d.mts +98 -10
  187. package/dist/psl-parser__interpret.d.mts.map +1 -1
  188. package/dist/psl-parser__interpret.mjs +393 -2
  189. package/dist/psl-parser__interpret.mjs.map +1 -1
  190. package/dist/psl-parser__syntax.d.mts +3 -3
  191. package/dist/psl-parser__syntax.mjs +4 -43
  192. package/dist/psl-parser__tokenizer.d.mts +1 -1
  193. package/dist/psl-parser__tokenizer.mjs +1 -1
  194. package/dist/psl-printer.d.mts +7 -17
  195. package/dist/psl-printer.d.mts.map +1 -1
  196. package/dist/psl-printer.mjs +35 -104
  197. package/dist/psl-printer.mjs.map +1 -1
  198. package/dist/resolve-codec-qqMjZrmn-Cok8elAo.mjs +74 -0
  199. package/dist/resolve-codec-qqMjZrmn-Cok8elAo.mjs.map +1 -0
  200. package/dist/{resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts → resolve-domain-model-BNr1glea-BLuR-phK.d.mts} +3 -3
  201. package/dist/resolve-domain-model-BNr1glea-BLuR-phK.d.mts.map +1 -0
  202. package/dist/{result-CBZ8X9mU.mjs → result-8OXF26MN.mjs} +14 -3
  203. package/dist/{result-CBZ8X9mU.mjs.map → result-8OXF26MN.mjs.map} +1 -1
  204. package/dist/{result-Bpupv5vO.d.mts → result-BYCOANWy.d.mts} +4 -2
  205. package/dist/result-BYCOANWy.d.mts.map +1 -0
  206. package/dist/runtime-B-YYuWy2.d.mts +899 -0
  207. package/dist/runtime-B-YYuWy2.d.mts.map +1 -0
  208. package/dist/runtime-DSYSc98Y.mjs +1059 -0
  209. package/dist/runtime-DSYSc98Y.mjs.map +1 -0
  210. package/dist/runtime-error-CO4MA3Px-YW5SCUcH.d.mts +19 -0
  211. package/dist/runtime-error-CO4MA3Px-YW5SCUcH.d.mts.map +1 -0
  212. package/dist/{structured-error-CgiSMpdU.mjs → structured-error-BXbihKQ-.mjs} +3 -3
  213. package/dist/{structured-error-CgiSMpdU.mjs.map → structured-error-BXbihKQ-.mjs.map} +1 -1
  214. package/dist/{structured-error-BsNT4Hun.d.mts → structured-error-Cc7AIRsp.d.mts} +19 -5
  215. package/dist/structured-error-Cc7AIRsp.d.mts.map +1 -0
  216. package/dist/suppress-idle-connection-errors-CKrTbp5P.d.mts +18 -0
  217. package/dist/suppress-idle-connection-errors-CKrTbp5P.d.mts.map +1 -0
  218. package/dist/suppress-idle-connection-errors-DzApeUb3.mjs +22 -0
  219. package/dist/suppress-idle-connection-errors-DzApeUb3.mjs.map +1 -0
  220. package/dist/temporal-presets-5TK1pTYJ-DmhrnMP1.mjs +1276 -0
  221. package/dist/temporal-presets-5TK1pTYJ-DmhrnMP1.mjs.map +1 -0
  222. package/dist/temporal-presets-BuMqk7h8-DZSuu4Z_.d.mts +258 -0
  223. package/dist/temporal-presets-BuMqk7h8-DZSuu4Z_.d.mts.map +1 -0
  224. package/dist/text-C3TTEtgd.mjs +35 -0
  225. package/dist/text-C3TTEtgd.mjs.map +1 -0
  226. package/dist/text-C8_-rheN.d.mts +15 -0
  227. package/dist/text-C8_-rheN.d.mts.map +1 -0
  228. package/dist/{tokenizer-1hAHZzmp-QGPORvmA.mjs → tokenizer-C-GTKKjR-B1vOzJy0.mjs} +54 -10
  229. package/dist/tokenizer-C-GTKKjR-B1vOzJy0.mjs.map +1 -0
  230. package/dist/{tokenizer-DcYI0Xrq-C-nNE9mE.d.mts → tokenizer-i8RaVWVa-7fRwlCPP.d.mts} +9 -4
  231. package/dist/tokenizer-i8RaVWVa-7fRwlCPP.d.mts.map +1 -0
  232. package/dist/ts-render.d.mts +2 -2
  233. package/dist/ts-render.mjs +2 -2
  234. package/dist/type-constructor-calls-BLf-HsFy-D_jbIqj8.mjs +261 -0
  235. package/dist/type-constructor-calls-BLf-HsFy-D_jbIqj8.mjs.map +1 -0
  236. package/dist/{types-BnH4zYvN.mjs → types-B8ULzMAX.mjs} +36 -3
  237. package/dist/types-B8ULzMAX.mjs.map +1 -0
  238. package/dist/types-GNXJ7xW2.d.mts +131 -0
  239. package/dist/types-GNXJ7xW2.d.mts.map +1 -0
  240. package/dist/{types-import-spec-3mjbVBhI-DQI6BvKU.d.mts → types-import-spec-DQjfX-gM-zVncuzs0.d.mts} +6 -6
  241. package/dist/types-import-spec-DQjfX-gM-zVncuzs0.d.mts.map +1 -0
  242. package/dist/utils.d.mts +7 -5
  243. package/dist/utils.mjs +9 -7
  244. package/dist/utils__assertions.mjs +1 -1
  245. package/dist/utils__hash-content.d.mts +1 -1
  246. package/dist/utils__hash-content.mjs +1 -1
  247. package/dist/utils__internal-error.d.mts +1 -1
  248. package/dist/utils__internal-error.mjs +1 -1
  249. package/dist/utils__result.d.mts +2 -2
  250. package/dist/utils__result.mjs +2 -2
  251. package/dist/utils__structured-error.d.mts +2 -2
  252. package/dist/utils__structured-error.mjs +1 -1
  253. package/dist/utils__suppress-idle-connection-errors.d.mts +2 -0
  254. package/dist/utils__suppress-idle-connection-errors.mjs +2 -0
  255. package/dist/utils__text.d.mts +2 -0
  256. package/dist/utils__text.mjs +2 -0
  257. package/dist/{validate-domain-BNBs-TVv.d.mts → validate-domain-B5kmlBFB.d.mts} +10 -6
  258. package/dist/validate-domain-B5kmlBFB.d.mts.map +1 -0
  259. package/dist/{validate-domain-BkvFlY3B.mjs → validate-domain-CbXHDYpF.mjs} +43 -22
  260. package/dist/validate-domain-CbXHDYpF.mjs.map +1 -0
  261. package/dist/validate-once-D-IwXHYP.mjs +42 -0
  262. package/dist/validate-once-D-IwXHYP.mjs.map +1 -0
  263. package/dist/validate-once-gfCOHsDh.d.mts +16 -0
  264. package/dist/validate-once-gfCOHsDh.d.mts.map +1 -0
  265. package/package.json +24 -20
  266. package/dist/apply-specifier-default-control-policy-CAxiXxKg.d.mts.map +0 -1
  267. package/dist/authoring-B2H-9qCv.d.mts +0 -1
  268. package/dist/canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs +0 -25
  269. package/dist/canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs.map +0 -1
  270. package/dist/capabilities-BCEONw9w-C-lo3rF8.mjs +0 -120
  271. package/dist/capabilities-BCEONw9w-C-lo3rF8.mjs.map +0 -1
  272. package/dist/codec-Cd0QcxAx.mjs +0 -63
  273. package/dist/codec-Cd0QcxAx.mjs.map +0 -1
  274. package/dist/codec-Ce07W3Mz.d.mts +0 -112
  275. package/dist/codec-Ce07W3Mz.d.mts.map +0 -1
  276. package/dist/codec-types-D6VRj2RE-BLElXc-O.d.mts +0 -223
  277. package/dist/codec-types-D6VRj2RE-BLElXc-O.d.mts.map +0 -1
  278. package/dist/codec-types-DcNvNeY1-BO6kUiH0.mjs +0 -30
  279. package/dist/codec-types-DcNvNeY1-BO6kUiH0.mjs.map +0 -1
  280. package/dist/components-CGA_WwEG.d.mts +0 -50
  281. package/dist/components-CGA_WwEG.d.mts.map +0 -1
  282. package/dist/components-dZRz3T5y.mjs.map +0 -1
  283. package/dist/config-types-BqhNxw0z.mjs +0 -67
  284. package/dist/config-types-BqhNxw0z.mjs.map +0 -1
  285. package/dist/config-types-CW4PDwMC.d.mts.map +0 -1
  286. package/dist/config-validation-DPt5hwQx.mjs +0 -168
  287. package/dist/config-validation-DPt5hwQx.mjs.map +0 -1
  288. package/dist/config-validation-Wiqew2J9.d.mts +0 -21
  289. package/dist/config-validation-Wiqew2J9.d.mts.map +0 -1
  290. package/dist/config__config-validation.d.mts +0 -2
  291. package/dist/config__config-validation.mjs +0 -2
  292. package/dist/contract-types-CkdMH7F7-9EHXSwbH.d.mts.map +0 -1
  293. package/dist/contract-validation-error-DEiWp_EI-CRwtUgRw.mjs.map +0 -1
  294. package/dist/contract-validation-error-R7cMoK04.d.mts.map +0 -1
  295. package/dist/control-BD96JZi8-NUhO5Kkw.mjs.map +0 -1
  296. package/dist/control-BF8qzdnM.d.mts.map +0 -1
  297. package/dist/control-DLEm6u5m.mjs.map +0 -1
  298. package/dist/control-ql9N9u4f-r3Vv41kZ.d.mts.map +0 -1
  299. package/dist/declarations-DR6To8_k-BFwkCGeP.mjs.map +0 -1
  300. package/dist/dist-Dqbo77p7.mjs.map +0 -1
  301. package/dist/domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts.map +0 -1
  302. package/dist/emission-CmUO03gQ.d.mts +0 -2
  303. package/dist/emission-types-DLXP34Ki-CFms3VrX.d.mts.map +0 -1
  304. package/dist/enum-accessor-Db5DaTNX.mjs +0 -35
  305. package/dist/enum-accessor-Db5DaTNX.mjs.map +0 -1
  306. package/dist/enum-accessor-PH5vjghI.d.mts +0 -85
  307. package/dist/enum-accessor-PH5vjghI.d.mts.map +0 -1
  308. package/dist/execution-Crk6IfTs.mjs +0 -218
  309. package/dist/execution-Crk6IfTs.mjs.map +0 -1
  310. package/dist/execution-Cyl2dXxX.d.mts +0 -115
  311. package/dist/execution-Cyl2dXxX.d.mts.map +0 -1
  312. package/dist/framework-authoring-BhctBwih-DQ_6noDM.d.mts +0 -777
  313. package/dist/framework-authoring-BhctBwih-DQ_6noDM.d.mts.map +0 -1
  314. package/dist/framework-authoring-CDEvlouU-DKklu-fL.mjs +0 -698
  315. package/dist/framework-authoring-CDEvlouU-DKklu-fL.mjs.map +0 -1
  316. package/dist/framework-components-hZ2tO-KH-CdRXBOYd.d.mts.map +0 -1
  317. package/dist/hash-content-Bugg_nZn.mjs.map +0 -1
  318. package/dist/hashing-BtIZVNYX.mjs.map +0 -1
  319. package/dist/hashing-CccSPELN.d.mts +0 -25
  320. package/dist/hashing-CccSPELN.d.mts.map +0 -1
  321. package/dist/hashing-utils-DQgS3nOe.mjs.map +0 -1
  322. package/dist/index-CDk9yEbw.d.mts.map +0 -1
  323. package/dist/internal-error-BIc-ehme-ouBQPoEL.mjs.map +0 -1
  324. package/dist/ir-ChmSSAhX.mjs.map +0 -1
  325. package/dist/migration-BvrgDZXw.d.mts.map +0 -1
  326. package/dist/migration-C57VKLUY.mjs.map +0 -1
  327. package/dist/parse-0ZJjj_2N-DhQpSVmQ.d.mts.map +0 -1
  328. package/dist/parse-GbZGfMUj-BFSrD2AN.mjs.map +0 -1
  329. package/dist/psl-ast-BXZoFQBk.d.mts +0 -37
  330. package/dist/psl-ast-BXZoFQBk.d.mts.map +0 -1
  331. package/dist/psl-ast-CWJQF8LA-Vr5JNPdn.d.mts.map +0 -1
  332. package/dist/psl-ast-DUCvVXbB.mjs +0 -239
  333. package/dist/psl-ast-DUCvVXbB.mjs.map +0 -1
  334. package/dist/psl-parser__syntax.mjs.map +0 -1
  335. package/dist/resolve-codec-BZF8TZh_-D-xORT9Q.mjs +0 -59
  336. package/dist/resolve-codec-BZF8TZh_-D-xORT9Q.mjs.map +0 -1
  337. package/dist/resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts.map +0 -1
  338. package/dist/result-Bpupv5vO.d.mts.map +0 -1
  339. package/dist/runtime-BqzioOmU.mjs +0 -670
  340. package/dist/runtime-BqzioOmU.mjs.map +0 -1
  341. package/dist/runtime-Cuxw8obj.d.mts +0 -1038
  342. package/dist/runtime-Cuxw8obj.d.mts.map +0 -1
  343. package/dist/structured-error-BsNT4Hun.d.mts.map +0 -1
  344. package/dist/symbol-table-CZ7EVCTL-CR-ncCpD.d.mts +0 -125
  345. package/dist/symbol-table-CZ7EVCTL-CR-ncCpD.d.mts.map +0 -1
  346. package/dist/tokenizer-1hAHZzmp-QGPORvmA.mjs.map +0 -1
  347. package/dist/tokenizer-DcYI0Xrq-C-nNE9mE.d.mts.map +0 -1
  348. package/dist/types-BnH4zYvN.mjs.map +0 -1
  349. package/dist/types-ByeQhU9p.d.mts +0 -17
  350. package/dist/types-ByeQhU9p.d.mts.map +0 -1
  351. package/dist/types-import-spec-3mjbVBhI-DQI6BvKU.d.mts.map +0 -1
  352. package/dist/utils-DMAM0unR.mjs.map +0 -1
  353. package/dist/validate-domain-BNBs-TVv.d.mts.map +0 -1
  354. package/dist/validate-domain-BkvFlY3B.mjs.map +0 -1
@@ -0,0 +1,764 @@
1
+ import { t as canonicalStringify } from "./canonical-stringify-DY4NaAJi.mjs";
2
+ import { r as isInternalError, t as InternalError } from "./internal-error-ChGYPVpq-DhUD05u0.mjs";
3
+ import { n as notOk, r as ok } from "./result-8OXF26MN.mjs";
4
+ import { t as canonicalizeJson } from "./canonicalize-json-ZPawceQR-Dua1VNEB.mjs";
5
+ import { d as dataTypeParams, u as dataTypeId } from "./data-type-V6mcDhcG-DVQAPOQT.mjs";
6
+ import { r as codecForRef } from "./resolve-codec-qqMjZrmn-Cok8elAo.mjs";
7
+ import { A as isAuthoringTypeAliasDescriptor, E as isAuthoringFieldPresetDescriptor, F as printTaggedLiteral, I as printedTaggedLiteralReadsBack, S as instantiateAuthoringTypeConstructor, j as isAuthoringTypeConstructorDescriptor, w as isAuthoringArgRef } from "./temporal-presets-5TK1pTYJ-DmhrnMP1.mjs";
8
+ import { a as numeralText, i as enumRefusalOf, o as readContractValue } from "./codec-descriptor-D0oY-hgs-C5e11ola.mjs";
9
+ //#region ../../../1-framework/1-core/framework-components/dist/authoring.mjs
10
+ /** Every type constructor of `namespace`, with its path, in namespace order. */
11
+ function* authoringTypeConstructors(namespace, path = []) {
12
+ for (const [name, value] of Object.entries(namespace)) if (isAuthoringTypeConstructorDescriptor(value)) yield {
13
+ path: [...path, name],
14
+ descriptor: value
15
+ };
16
+ else if (!isAuthoringTypeAliasDescriptor(value)) yield* authoringTypeConstructors(value, [...path, name]);
17
+ }
18
+ function produces(produced, wanted) {
19
+ const wantedFields = {
20
+ ...wanted,
21
+ typeParams: wanted.typeParams ?? {}
22
+ };
23
+ return Object.entries({
24
+ ...produced,
25
+ typeParams: produced.typeParams ?? {}
26
+ }).every(([key, value]) => canonicalizeJson(value) === canonicalizeJson(wantedFields[key]));
27
+ }
28
+ /**
29
+ * The arguments that make `descriptor` produce exactly `output`, when each of its type parameters
30
+ * comes straight from one argument; `undefined` when it cannot produce `output`, including when
31
+ * `output` has no value for an argument the constructor requires.
32
+ */
33
+ function authoringTypeConstructorArguments(descriptor, output) {
34
+ if (descriptor.entityRefArg !== void 0 || descriptor.output.codecId !== output.codecId) return;
35
+ const args = [];
36
+ for (const [key, template] of Object.entries(descriptor.output.typeParams ?? {})) {
37
+ const value = output.typeParams?.[key];
38
+ if (value !== void 0 && isAuthoringArgRef(template) && template.path === void 0) args[template.index] = value;
39
+ }
40
+ const requiredArgs = (descriptor.args ?? []).filter((arg) => arg.optional !== true).length;
41
+ if (args.length < requiredArgs || Array.from(args).includes(void 0)) return void 0;
42
+ try {
43
+ return produces(instantiateAuthoringTypeConstructor(descriptor, args), output) ? args : void 0;
44
+ } catch {
45
+ return;
46
+ }
47
+ }
48
+ /**
49
+ * The first call, in namespace order, to a type constructor in `namespace` that produces exactly
50
+ * `output`. The inverse of {@link instantiateAuthoringTypeConstructor} for constructors whose type
51
+ * parameters each come straight from one argument. A constructor whose argument names another
52
+ * entity is never chosen. `undefined` when no call produces `output`.
53
+ */
54
+ function findAuthoringTypeConstructorCall(namespace, output) {
55
+ for (const { path, descriptor } of authoringTypeConstructors(namespace)) {
56
+ const args = authoringTypeConstructorArguments(descriptor, output);
57
+ if (args !== void 0) return {
58
+ path,
59
+ args
60
+ };
61
+ }
62
+ }
63
+ function storedFormOf(stored) {
64
+ return canonicalStringify(JSON.parse(JSON.stringify(stored)));
65
+ }
66
+ /** The key two stored values are equal by: the data type's `equalityKey` when it declares one, else the stored form as `contract.json` holds it, compared by `canonicalStringify`. */
67
+ function storedValueKey(stored, equalityKey) {
68
+ return equalityKey?.(stored) ?? storedFormOf(stored);
69
+ }
70
+ /**
71
+ * Each enum member whose stored form equals an earlier member's, paired with the first such member. Stored forms are compared as `contract.json` holds them, so negative zero is zero, and by `canonicalStringify`, so two objects with the same entries in a different order are equal; or, when the enum's data type declares an `equalityKey`, by that key, so `0.5` and `0.50` are one `numeric` value. Every enum authoring surface refuses the members this returns.
72
+ */
73
+ function duplicateStoredMembers(members, equalityKey) {
74
+ const memberByKey = /* @__PURE__ */ new Map();
75
+ const duplicates = [];
76
+ for (const member of members) {
77
+ const { name, stored } = member;
78
+ const key = storedValueKey(stored, equalityKey);
79
+ const earlier = memberByKey.get(key);
80
+ if (earlier === void 0) memberByKey.set(key, member);
81
+ else if (storedFormOf(earlier.stored) === storedFormOf(stored)) duplicates.push({
82
+ earlier: earlier.name,
83
+ later: name,
84
+ stored
85
+ });
86
+ else duplicates.push({
87
+ earlier: earlier.name,
88
+ later: name,
89
+ stored,
90
+ earlierStored: earlier.stored
91
+ });
92
+ }
93
+ return duplicates;
94
+ }
95
+ /**
96
+ * Words a refusal of the cast rule. The message leads with what to write; the types are named only when the value has a form the position admits and its type is still refused, such as a number too large for the receiving type.
97
+ */
98
+ function describeRefusal(refusal, support, guidance) {
99
+ switch (refusal.kind) {
100
+ case "unknown-tag": return {
101
+ code: "PSL_UNKNOWN_LITERAL_TAG",
102
+ message: `Unknown literal tag "${refusal.tag}". Known tags: ${refusal.known.join(", ")}.`
103
+ };
104
+ case "unwritable": return {
105
+ code: "PSL_VALUE_TYPE_INCOMPATIBLE",
106
+ message: `${describeExpected(guidance.forms)}; this target has no data type for a ${refusal.syntax} value`
107
+ };
108
+ case "unreadable":
109
+ case "refused-by-type": return {
110
+ code: "PSL_INVALID_LITERAL",
111
+ message: refusal.message
112
+ };
113
+ case "no-cast": return {
114
+ code: "PSL_VALUE_TYPE_INCOMPATIBLE",
115
+ message: describeRefusedValueType(refusal, support, guidance)
116
+ };
117
+ }
118
+ }
119
+ /** `Expected <forms>`, the forms joined with `or`: the start of every refusal that says what to write. */
120
+ function describeExpected(forms) {
121
+ return `Expected ${joinForms(forms)}`;
122
+ }
123
+ /**
124
+ * Words a value of type `valueType` that `receivingType` refuses, where `guidance.forms` may be written. The types are named only when the value has one of those forms.
125
+ */
126
+ function describeRefusedValueType(refused, support, guidance) {
127
+ const expected = describeExpected(guidance.forms);
128
+ const valueForm = writtenForm(support, refused.valueType);
129
+ if (valueForm !== void 0 && guidance.forms.some((form) => isSameForm(form, valueForm))) return `${expected} that ${refused.receivingType} can hold; got ${refused.valueType}`;
130
+ return guidance.rewrite === void 0 ? expected : `${expected}; write ${guidance.rewrite}`;
131
+ }
132
+ function isSameForm(a, b) {
133
+ return a.kind === "tag" && b.kind === "tag" ? a.tag === b.tag : a.kind === b.kind;
134
+ }
135
+ /** Text a contract source reads as a number literal. */
136
+ const NUMBER_TEXT = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$|^[+-]?(?:NaN|Infinity)$/;
137
+ const DECIMAL_TEXT = /^([+-]?)0*(\d*?)(?:\.(\d*?))?0*$/;
138
+ /** A decimal numeral in one form: no plus sign, no leading or trailing zeros, the sign of zero kept. Other text is itself. */
139
+ function canonicalNumber(text) {
140
+ const match = text.includes(".") ? DECIMAL_TEXT.exec(text) : /^([+-]?)0*(\d*)$/.exec(text);
141
+ if (match === null) return text;
142
+ const [, sign = "", whole = "", fraction = ""] = match;
143
+ return `${sign === "-" ? "-" : ""}${whole === "" ? "0" : whole}${fraction === "" ? "" : `.${fraction}`}`;
144
+ }
145
+ /** Whether a stored value is the number `text` writes, digit for digit and with its sign, so writing the text unquoted stores what it says. */
146
+ function sameNumber(text, stored) {
147
+ const storedText = typeof stored === "number" ? Object.is(stored, -0) ? "-0" : numeralText(stored) : typeof stored === "string" ? stored : void 0;
148
+ return storedText !== void 0 && canonicalNumber(storedText) === canonicalNumber(text);
149
+ }
150
+ /**
151
+ * The literal to write in place of a quoted string that `receivingType` refuses under `receivingParams`: the string as a literal of the first tag the type admits, or else the string's text unquoted, as a number or a boolean. `undefined` when the value is not a quoted string, no such literal reads back as the same text, the type would refuse each of them too, or the number the text writes would be stored as another number, as `-0` is stored without its sign or `9007199254740993` as the nearest double.
152
+ */
153
+ function exactRewrite(support, receiving, written) {
154
+ if (written.kind !== "string") return void 0;
155
+ const castOf = (candidate) => {
156
+ const read = readWrittenValue(support, candidate);
157
+ if (!read.ok) return void 0;
158
+ const cast = castTypedValue(support, receiving.receivingType, receiving.receivingParams, read.value);
159
+ return cast.ok ? cast.value : void 0;
160
+ };
161
+ const admits = (candidate) => castOf(candidate) !== void 0;
162
+ const [tag] = admittedTags(support, receiving.receivingType);
163
+ if (tag !== void 0 && printedTaggedLiteralReadsBack(written.text) && admits({
164
+ kind: "tag",
165
+ tag,
166
+ text: written.text
167
+ })) return printTaggedLiteral(tag, written.text);
168
+ if (NUMBER_TEXT.test(written.text)) {
169
+ const stored = castOf({
170
+ kind: "number",
171
+ text: written.text
172
+ });
173
+ if (stored !== void 0 && sameNumber(written.text, stored.value)) return written.text;
174
+ }
175
+ if ((written.text === "true" || written.text === "false") && admits({
176
+ kind: "boolean",
177
+ value: written.text === "true"
178
+ })) return written.text;
179
+ }
180
+ function findEntry(support, matches) {
181
+ for (const [key, entry] of Object.entries(support.entries)) if (matches(entry)) return {
182
+ key,
183
+ entry
184
+ };
185
+ }
186
+ /** The entry a tag names, or `undefined` when no pack registered that tag. */
187
+ function entryForTag(support, tag) {
188
+ return findEntry(support, ({ written }) => written.kind === "tag" && written.tag === tag);
189
+ }
190
+ /** The entry that reads a plain string, boolean or number, or `undefined` when none does. */
191
+ function entryForPlain(support, syntax) {
192
+ return findEntry(support, ({ written }) => written.kind === "plain" && written.syntax === syntax);
193
+ }
194
+ /** Every tag a stack registers, in the order the entries were merged. */
195
+ function knownTags(support) {
196
+ return Object.values(support.entries).flatMap((entry) => entry.written.kind === "tag" ? [entry.written.tag] : []);
197
+ }
198
+ function textOf(written) {
199
+ return written.kind === "boolean" ? String(written.value) : written.text;
200
+ }
201
+ function messageOf(error) {
202
+ return error instanceof Error ? error.message : String(error);
203
+ }
204
+ /** The value of `type` that `json` gives under `params`, constructed by that type; a refusal is worded for a diagnostic. */
205
+ function valueOfType(support, type, json, params, refuse) {
206
+ const declaration = support.lookup.get(type);
207
+ if (declaration === void 0) throw new InternalError(`A value of "${type}" was written, and this stack does not register it.`);
208
+ try {
209
+ return ok(declaration.valueFrom(json(), params));
210
+ } catch (error) {
211
+ if (isInternalError(error)) throw error;
212
+ return notOk(refuse(messageOf(error)));
213
+ }
214
+ }
215
+ /** Read one written value through the authoring entry for its syntax, as a value its type constructs. */
216
+ function readWrittenValue(support, written) {
217
+ const found = written.kind === "tag" ? entryForTag(support, written.tag) : entryForPlain(support, written.kind);
218
+ if (found === void 0) return written.kind === "tag" ? notOk({
219
+ kind: "unknown-tag",
220
+ tag: written.tag,
221
+ known: knownTags(support)
222
+ }) : notOk({
223
+ kind: "unwritable",
224
+ syntax: written.kind
225
+ });
226
+ const text = textOf(written);
227
+ const form = found.entry.written;
228
+ const unreadable = (message) => ({
229
+ kind: "unreadable",
230
+ message
231
+ });
232
+ if (form.kind === "plain" && form.syntax === "number") {
233
+ const classified = form.classify(text);
234
+ return classified === void 0 ? notOk(unreadable(`no data type of this target holds the number ${text}`)) : valueOfType(support, classified.type, () => classified.value, {}, unreadable);
235
+ }
236
+ return valueOfType(support, dataTypeId(found.key), () => form.parse(text), {}, unreadable);
237
+ }
238
+ /** Take a value into the receiving type, directly or through the cast that type declares; the receiving type constructs the result under `receivingParams`, the parameters of the position that receives it. */
239
+ function castTypedValue(support, receivingType, receivingParams, value) {
240
+ const refusedByType = (message) => ({
241
+ kind: "refused-by-type",
242
+ receivingType,
243
+ message
244
+ });
245
+ if (value.type === receivingType) return valueOfType(support, receivingType, () => value.value, receivingParams, refusedByType);
246
+ const declaration = support.lookup.get(receivingType);
247
+ const cast = declaration?.casts[value.type];
248
+ if (cast === void 0) return notOk({
249
+ kind: "no-cast",
250
+ receivingType,
251
+ receivingParams,
252
+ valueType: value.type,
253
+ casts: Object.keys(declaration?.casts ?? {})
254
+ });
255
+ const source = support.lookup.get(value.type);
256
+ if (source === void 0) throw new InternalError(`A value of "${value.type}" was cast, and this stack does not register it.`);
257
+ let json;
258
+ try {
259
+ json = cast(source.toContract(value));
260
+ } catch (error) {
261
+ if (isInternalError(error)) throw error;
262
+ return notOk({
263
+ kind: "unreadable",
264
+ message: messageOf(error)
265
+ });
266
+ }
267
+ return valueOfType(support, receivingType, () => json, receivingParams, refusedByType);
268
+ }
269
+ /**
270
+ * Reads `written` as a value of `receivingType`: through the authoring entry for its syntax, then into `receivingType` directly or through a cast it declares. A refusal is worded for a diagnostic at the written value. The read every value of a fixed receiving type takes: an attribute argument, a type-constructor argument, and its TypeScript counterpart. ADR 254.
271
+ */
272
+ function readWrittenValueAs(support, receivingType, written) {
273
+ const forms = admittedForms(support, [receivingType]);
274
+ const read = readWrittenValue(support, written);
275
+ if (!read.ok) return notOk(describeRefusal(read.failure, support, {
276
+ forms,
277
+ rewrite: void 0
278
+ }));
279
+ const cast = castTypedValue(support, receivingType, {}, read.value);
280
+ if (cast.ok) return cast;
281
+ const rewrite = exactRewrite(support, {
282
+ receivingType,
283
+ receivingParams: {}
284
+ }, written);
285
+ return notOk(describeRefusal(cast.failure, support, {
286
+ forms,
287
+ rewrite
288
+ }));
289
+ }
290
+ /**
291
+ * Reads `written` into the codec `ref` names, built with `ref`'s type parameters: the authoring entry for its syntax reads it, the codec's data type takes it directly or through a cast, the data type constructs it under the type parameters, and the codec checks it. Returns the value as the data type stores it. A written list is read element by element into the element types of the data type's list cast, then through the list cast.
292
+ *
293
+ * A refusal is worded for a diagnostic, after `subject` and the element it is about, as in `enum "Ratio" member "Half" at element 2: Expected a number`: syntax no entry reads or a cast refuses is `PSL_INVALID_LITERAL`, a value of a type the data type neither is nor casts from is `PSL_VALUE_TYPE_INCOMPATIBLE`, and a value the data type under the type parameters or the codec refuses is `PSL_VALUE_REFUSED`. ADR 254.
294
+ */
295
+ function readWrittenValueIntoCodec(input) {
296
+ const { support, ref, written, subject } = input;
297
+ const codec = codecForRef(input.codecLookup, ref);
298
+ if (codec === void 0) throw new InternalError(`${subject}: no codec descriptor is registered for "${ref.codecId}", but the value was read for it.`);
299
+ const receivingType = codec.dataType.id;
300
+ const receivingParams = dataTypeParams(codec.dataType, ref.typeParams);
301
+ const refused = (elementIndex, { code, message }) => notOk({
302
+ code,
303
+ message: `${elementIndex === void 0 ? subject : `${subject} at element ${elementIndex + 1}`}: ${message}`
304
+ });
305
+ const stored = (json) => {
306
+ try {
307
+ const value = codec.dataType.valueFrom(json, receivingParams);
308
+ codec.fromDataTypeValue(value);
309
+ return ok(codec.dataType.toContract(value));
310
+ } catch (error) {
311
+ if (isInternalError(error)) throw error;
312
+ return refused(void 0, {
313
+ code: "PSL_VALUE_REFUSED",
314
+ message: messageOf(error)
315
+ });
316
+ }
317
+ };
318
+ const forms = admittedForms(support, [receivingType]);
319
+ if (written.kind === "list") {
320
+ const listCast = support.lookup.get(receivingType)?.listCast;
321
+ if (listCast === void 0) return refused(void 0, {
322
+ code: "PSL_VALUE_TYPE_INCOMPATIBLE",
323
+ message: `${describeExpected(forms)}; got a list`
324
+ });
325
+ const elementGuidance = {
326
+ forms: admittedForms(support, listCast.of),
327
+ rewrite: void 0
328
+ };
329
+ const elements = [];
330
+ for (const [index, element] of written.elements.entries()) {
331
+ if (element.kind === "list") return refused(index, {
332
+ code: "PSL_INVALID_LITERAL",
333
+ message: "a list holds values, not other lists"
334
+ });
335
+ const read = readWrittenValue(support, element);
336
+ if (!read.ok) return refused(index, describeRefusal(read.failure, support, elementGuidance));
337
+ if (!listCast.of.includes(read.value.type)) return refused(index, {
338
+ code: "PSL_VALUE_TYPE_INCOMPATIBLE",
339
+ message: describeRefusedValueType({
340
+ receivingType,
341
+ valueType: read.value.type
342
+ }, support, elementGuidance)
343
+ });
344
+ elements.push(read.value.value);
345
+ }
346
+ let json;
347
+ try {
348
+ json = listCast.cast(elements);
349
+ } catch (error) {
350
+ if (isInternalError(error)) throw error;
351
+ return refused(void 0, {
352
+ code: "PSL_INVALID_LITERAL",
353
+ message: messageOf(error)
354
+ });
355
+ }
356
+ return stored(json);
357
+ }
358
+ const read = readWrittenValue(support, written);
359
+ if (!read.ok) return refused(void 0, describeRefusal(read.failure, support, {
360
+ forms,
361
+ rewrite: void 0
362
+ }));
363
+ const cast = castTypedValue(support, receivingType, receivingParams, read.value);
364
+ if (cast.ok) return stored(cast.value.value);
365
+ const { failure } = cast;
366
+ if (failure.kind === "refused-by-type") return refused(void 0, {
367
+ code: "PSL_VALUE_REFUSED",
368
+ message: failure.message
369
+ });
370
+ return refused(void 0, describeRefusal(failure, support, {
371
+ forms,
372
+ rewrite: failure.kind === "no-cast" ? exactRewrite(support, failure, written) : void 0
373
+ }));
374
+ }
375
+ /** The type itself, then each type it casts from, in key order. */
376
+ function admittedTypes(support, dataType) {
377
+ return [dataType, ...Object.keys(support.lookup.get(dataType)?.casts ?? {})];
378
+ }
379
+ /** The tags a position of `dataType` admits: its own tag, then the tags of the types it casts from. */
380
+ function admittedTags(support, dataType) {
381
+ const tags = admittedTypes(support, dataType).flatMap((type) => {
382
+ const written = support.entries[type]?.written;
383
+ return written?.kind === "tag" ? [written.tag] : [];
384
+ });
385
+ return [...new Set(tags)];
386
+ }
387
+ /** The form a value of a tagged literal's type is written in. */
388
+ function tagForm(tag) {
389
+ return {
390
+ kind: "tag",
391
+ tag,
392
+ phrase: `${tag}\`...\``
393
+ };
394
+ }
395
+ const PLAIN_PHRASES = {
396
+ string: "a quoted string",
397
+ boolean: "true or false",
398
+ number: "a number"
399
+ };
400
+ function writtenForm(support, type) {
401
+ const written = support.entries[type]?.written;
402
+ if (written?.kind === "tag") return tagForm(written.tag);
403
+ if (written?.kind === "plain" && written.syntax !== "number") return {
404
+ kind: written.syntax,
405
+ phrase: PLAIN_PHRASES[written.syntax]
406
+ };
407
+ return Object.entries(support.entries).some(([key, entry]) => entry.written.kind === "plain" && entry.written.syntax === "number" && (key === type || entry.written.types.some((listed) => listed === type))) ? {
408
+ kind: "number",
409
+ phrase: PLAIN_PHRASES.number
410
+ } : void 0;
411
+ }
412
+ /** What {@link describeAdmittedForms} returns for a type that nothing writes. */
413
+ const NO_WRITTEN_FORM = "no written form";
414
+ /** Each form a position receiving every one of `receivingTypes` admits, once, in order: ``sql`...` ``, `true or false`. */
415
+ function admittedForms(support, receivingTypes) {
416
+ const forms = [];
417
+ for (const type of receivingTypes.flatMap((receiving) => admittedTypes(support, receiving))) {
418
+ const form = writtenForm(support, type);
419
+ if (form !== void 0 && !forms.some((listed) => isSameForm(listed, form))) forms.push(form);
420
+ }
421
+ return forms;
422
+ }
423
+ function joinForms(forms) {
424
+ return forms.length === 0 ? NO_WRITTEN_FORM : forms.map((form) => form.phrase).join(" or ");
425
+ }
426
+ /** How a position of `dataType` can be written, for a diagnostic: ``sql`...` ``, `true or false`. */
427
+ function describeAdmittedForms(support, dataType) {
428
+ return joinForms(admittedForms(support, [dataType]));
429
+ }
430
+ /**
431
+ * The refusals of a discriminator: the field must be required, hold one value, and have one of the stack's text data types; and when an enum types it, each variant's value, as the field stores it, must be one of the enum's members, compared by the field's data type's equality. Returns no refusals for a discriminator that is valid.
432
+ */
433
+ function discriminatorRefusals(input) {
434
+ const { field } = input;
435
+ const textDataTypes = input.dataTypes.textDataTypes ?? [];
436
+ if (textDataTypes.length === 0) throw new InternalError("The stack names no text data types, so no field can be a discriminator; the target names its text types in its authoring contributions.");
437
+ const refusals = [];
438
+ if (field.nullable) refusals.push({ kind: "optional" });
439
+ if (field.many) refusals.push({ kind: "list" });
440
+ const dataType = field.ref === void 0 ? void 0 : input.codecLookup.descriptorFor(field.ref.codecId)?.dataType;
441
+ if (dataType === void 0 || !textDataTypes.includes(dataType)) refusals.push({
442
+ kind: "not-text",
443
+ dataType,
444
+ textDataTypes
445
+ });
446
+ const members = field.enumMembers;
447
+ if (members !== void 0) {
448
+ const equalityKey = dataType === void 0 ? void 0 : input.dataTypes.lookup.get(dataType)?.equalityKey;
449
+ const memberKeys = new Set(members.map((member) => storedValueKey(member, equalityKey)));
450
+ for (const { key, stored } of input.variantValues) if (!memberKeys.has(storedValueKey(stored, equalityKey))) refusals.push({
451
+ kind: "not-a-member",
452
+ key,
453
+ stored,
454
+ members
455
+ });
456
+ }
457
+ return refusals;
458
+ }
459
+ /**
460
+ * A discriminator refusal worded as a PSL diagnostic: a refusal of the field at its `@@discriminator`, and a value that is not a member at its `@@base`. The wording names PSL syntax, so PSL sources word the refusals with this; a TypeScript source words them in its own terms.
461
+ */
462
+ function describeDiscriminatorRefusal(refusal, subject) {
463
+ const field = `Discriminator field "${subject.fieldName}" on model "${subject.modelName}"`;
464
+ switch (refusal.kind) {
465
+ case "optional": return `${field} must be required, but it is optional. Remove the "?"`;
466
+ case "list": return `${field} must hold one value, but it is a list. Remove the "[]"`;
467
+ case "not-text": return `${field} must be text, such as String, but is "${subject.typeName}"`;
468
+ case "not-a-member": return `Model "${subject.variantName(refusal.key)}" declares @@base value ${JSON.stringify(refusal.stored)}, which is not a member of enum "${subject.enumName}", the type of discriminator field "${subject.modelName}.${subject.fieldName}". Write one of: ${refusal.members.map((member) => JSON.stringify(member)).join(", ")}`;
469
+ }
470
+ }
471
+ /**
472
+ * Applies the discriminator rule to one discriminator and its variants: reads each variant's written value into the field's codec with {@link readWrittenValueIntoCodec}, worded after `subject`, then decides with {@link discriminatorRefusals}. A refused field refuses the whole discriminator, so its variants' values are neither read nor refused. A discriminator is text, so a stored value that is not a string is a bug in a text data type.
473
+ */
474
+ function applyDiscriminatorRule(input) {
475
+ const { field, codecLookup, dataTypes } = input;
476
+ const fieldOnly = discriminatorRefusals({
477
+ field,
478
+ variantValues: [],
479
+ codecLookup,
480
+ dataTypes
481
+ }).filter(isFieldRefusal);
482
+ if (fieldOnly.length > 0) return {
483
+ fieldRefusals: fieldOnly,
484
+ variantRefusals: [],
485
+ values: /* @__PURE__ */ new Map()
486
+ };
487
+ const ref = field.ref;
488
+ if (ref === void 0) throw new InternalError("A discriminator field the rule accepts has a codec.");
489
+ const reads = input.variants.map(({ key, written }) => ({
490
+ key,
491
+ reading: readWrittenValueIntoCodec({
492
+ support: dataTypes,
493
+ codecLookup,
494
+ ref,
495
+ written,
496
+ subject: input.subject
497
+ })
498
+ }));
499
+ const notMembers = new Map(discriminatorRefusals({
500
+ field,
501
+ variantValues: reads.flatMap(({ key, reading }) => reading.ok ? [{
502
+ key,
503
+ stored: reading.value
504
+ }] : []),
505
+ codecLookup,
506
+ dataTypes
507
+ }).flatMap((refusal) => refusal.kind === "not-a-member" ? [[refusal.key, refusal]] : []));
508
+ const variantRefusals = [];
509
+ const values = /* @__PURE__ */ new Map();
510
+ for (const { key, reading } of reads) {
511
+ if (!reading.ok) {
512
+ variantRefusals.push({
513
+ kind: "unreadable",
514
+ key,
515
+ refusal: reading.failure
516
+ });
517
+ continue;
518
+ }
519
+ const notMember = notMembers.get(key);
520
+ if (notMember !== void 0) {
521
+ variantRefusals.push(notMember);
522
+ continue;
523
+ }
524
+ if (typeof reading.value !== "string") throw new InternalError(`Discriminator field codec "${ref.codecId}" stores a text value as ${typeof reading.value}.`);
525
+ values.set(key, reading.value);
526
+ }
527
+ return {
528
+ fieldRefusals: [],
529
+ variantRefusals,
530
+ values
531
+ };
532
+ }
533
+ function isFieldRefusal(refusal) {
534
+ return refusal.kind !== "not-a-member";
535
+ }
536
+ /**
537
+ * A problem with an enum's members as a diagnostic at the member, or at the block when the problem is the enum's codec.
538
+ */
539
+ function enumMemberProblemDiagnostic(problem, site) {
540
+ const { enumName, codecId, sourceId } = site;
541
+ const at = (member) => ({
542
+ sourceId,
543
+ span: site.memberSpans[member] ?? site.span
544
+ });
545
+ switch (problem.kind) {
546
+ case "codec-not-for-enums": return {
547
+ code: "PSL_EXTENSION_INVALID_VALUE",
548
+ message: `enum "${enumName}" cannot use the codec "${codecId}". ${problem.refusal}`,
549
+ sourceId,
550
+ span: site.span
551
+ };
552
+ case "codec-missing": return {
553
+ code: "PSL_EXTENSION_INVALID_VALUE",
554
+ message: `enum "${enumName}" uses codec "${codecId}", which no pack in the contract provides`,
555
+ sourceId,
556
+ span: site.span
557
+ };
558
+ case "codec-refused-member": return {
559
+ code: "PSL_EXTENSION_INVALID_VALUE",
560
+ message: `enum "${enumName}" member "${problem.member}" was rejected by codec "${codecId}": ${problem.reason}`,
561
+ ...at(problem.member)
562
+ };
563
+ case "member-not-stored-as-written": return {
564
+ code: "PSL_EXTENSION_INVALID_VALUE",
565
+ message: `enum "${enumName}" member "${problem.member}" is written ${problem.written}, but its codec stores ${JSON.stringify(problem.stored)}. Write the member as ${problem.writeAs}.`,
566
+ ...at(problem.member)
567
+ };
568
+ case "duplicate-member-value": return {
569
+ code: "PSL_ENUM_DUPLICATE_MEMBER_VALUE",
570
+ message: problem.earlierStored === void 0 ? `enum "${enumName}": members "${problem.earlier}" and "${problem.later}" both store ${JSON.stringify(problem.stored)}` : `enum "${enumName}": members "${problem.earlier}" and "${problem.later}" store ${JSON.stringify(problem.earlierStored)} and ${JSON.stringify(problem.stored)}, which the database holds equal`,
571
+ ...at(problem.later)
572
+ };
573
+ }
574
+ }
575
+ /** A member as it is written: its recorded written value, or a bare member's name, as text. */
576
+ function writtenMember(block, memberName, memberValue) {
577
+ const written = block.writtenValues?.[memberName];
578
+ if (written !== void 0) return written;
579
+ if (memberValue === void 0) return {
580
+ kind: "string",
581
+ text: memberName
582
+ };
583
+ throw new InternalError(`enum "${block.name}" member "${memberName}" has a value, but the block holds no written value for it.`);
584
+ }
585
+ /**
586
+ * Reads the members of an `enum` block through its codec with {@link readWrittenValueIntoCodec}: each member's syntax gives it a data type, the codec's data type takes it directly or through a cast, and the codec checks it, so a number keeps every digit and a quoted value is text. A bare member is read from its own name, as text.
587
+ * Pushes a diagnostic and returns `undefined` when a member is refused, when two members
588
+ * store the same value, or when the block has no members. Shared by every family's enum factory.
589
+ */
590
+ function readEnumBlockMembers(block, codecId, codec, ctx) {
591
+ const sourceId = ctx.sourceId ?? "unknown";
592
+ const diagnostics = ctx.diagnostics;
593
+ const site = {
594
+ enumName: block.name,
595
+ codecId,
596
+ sourceId,
597
+ span: block.span,
598
+ memberSpans: block.parameterSpans
599
+ };
600
+ const members = [];
601
+ const storedMembers = [];
602
+ let memberError = false;
603
+ for (const [memberName, memberValue] of Object.entries(block.values)) {
604
+ const span = block.parameterSpans[memberName] ?? block.span;
605
+ const reading = readWrittenValueIntoCodec({
606
+ support: ctx.dataTypes,
607
+ codecLookup: ctx.codecLookup,
608
+ ref: { codecId },
609
+ written: writtenMember(block, memberName, memberValue),
610
+ subject: `enum "${block.name}" member "${memberName}"`
611
+ });
612
+ if (!reading.ok) {
613
+ diagnostics?.push(memberValue === void 0 ? {
614
+ code: "PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC",
615
+ message: `enum "${block.name}" member "${memberName}" has no value and codec "${codecId}" does not accept a bare name as input`,
616
+ sourceId,
617
+ span
618
+ } : {
619
+ ...reading.failure,
620
+ sourceId,
621
+ span
622
+ });
623
+ memberError = true;
624
+ continue;
625
+ }
626
+ const read = readContractValue(codec, reading.value, void 0);
627
+ members.push({
628
+ name: memberName,
629
+ value: read
630
+ });
631
+ storedMembers.push({
632
+ name: memberName,
633
+ stored: codec.dataType.toContract(codec.toDataTypeValue(read))
634
+ });
635
+ }
636
+ for (const duplicate of duplicateStoredMembers(storedMembers, codec.dataType.equalityKey)) {
637
+ diagnostics?.push(enumMemberProblemDiagnostic({
638
+ kind: "duplicate-member-value",
639
+ ...duplicate
640
+ }, site));
641
+ memberError = true;
642
+ }
643
+ if (memberError) return void 0;
644
+ if (members.length === 0) {
645
+ diagnostics?.push({
646
+ code: "PSL_ENUM_MISSING_TYPE",
647
+ message: `enum "${block.name}" must have at least one member`,
648
+ sourceId,
649
+ span: block.span
650
+ });
651
+ return;
652
+ }
653
+ return members;
654
+ }
655
+ /** Whether TypeScript gives the value a literal type: a primitive, or an array or plain object of them. */
656
+ function hasLiteralType(value) {
657
+ if ([
658
+ "string",
659
+ "number",
660
+ "boolean",
661
+ "bigint"
662
+ ].includes(typeof value)) return true;
663
+ if (Array.isArray(value)) return value.every(hasLiteralType);
664
+ if (typeof value !== "object" || value === null) return false;
665
+ const prototype = Object.getPrototypeOf(value);
666
+ return (prototype === Object.prototype || prototype === null) && Object.values(value).every(hasLiteralType);
667
+ }
668
+ /**
669
+ * A member's value in the form its codec stores it, and that form read back by the codec. A codec that throws on either is a refusal naming the member; an internal error is not the member's fault and propagates.
670
+ */
671
+ function encodeEnumMember(member, codec) {
672
+ try {
673
+ const stored = codec.dataType.toContract(codec.toDataTypeValue(member.value));
674
+ return ok({
675
+ stored,
676
+ readBack: readContractValue(codec, stored, void 0)
677
+ });
678
+ } catch (cause) {
679
+ if (isInternalError(cause)) throw cause;
680
+ return notOk({
681
+ kind: "codec-refused-member",
682
+ member: member.name,
683
+ reason: cause instanceof Error ? cause.message : String(cause),
684
+ cause
685
+ });
686
+ }
687
+ }
688
+ /**
689
+ * Refuses a member its codec reads back as a different value from the one written. A member with no literal type has nothing to compare.
690
+ */
691
+ function notStoredAsWritten(member, stored, readBack) {
692
+ if (!hasLiteralType(member.value)) return void 0;
693
+ if (hasLiteralType(readBack) && canonicalStringify(readBack) === canonicalStringify(member.value)) return void 0;
694
+ return {
695
+ kind: "member-not-stored-as-written",
696
+ member: member.name,
697
+ written: canonicalStringify(member.value),
698
+ stored,
699
+ writeAs: hasLiteralType(readBack) ? canonicalStringify(readBack) : JSON.stringify(stored)
700
+ };
701
+ }
702
+ /**
703
+ * Each member of an enum in the form its codec stores it. Refuses a codec an enum cannot use, a codec the lookup does not have, a member the codec refuses, a member the codec reads back as another value, and two members stored as the same value. Every family's contract build calls this, and reports the problems in its own terms.
704
+ */
705
+ function encodeEnumMembers(decodedEnum, codecLookup) {
706
+ const descriptor = codecLookup.descriptorFor(decodedEnum.codecId);
707
+ const refusal = descriptor === void 0 ? void 0 : enumRefusalOf(descriptor);
708
+ if (refusal !== void 0) return notOk([{
709
+ kind: "codec-not-for-enums",
710
+ refusal
711
+ }]);
712
+ const codec = codecLookup.get(decodedEnum.codecId);
713
+ if (codec === void 0) return notOk([{ kind: "codec-missing" }]);
714
+ const problems = [];
715
+ const members = [];
716
+ for (const member of decodedEnum.enumMembers) {
717
+ const encoded = encodeEnumMember(member, codec);
718
+ if (!encoded.ok) {
719
+ problems.push(encoded.failure);
720
+ continue;
721
+ }
722
+ const { stored, readBack } = encoded.value;
723
+ const mismatch = notStoredAsWritten(member, stored, readBack);
724
+ if (mismatch !== void 0) problems.push(mismatch);
725
+ members.push({
726
+ name: member.name,
727
+ value: stored
728
+ });
729
+ }
730
+ for (const duplicate of duplicateStoredMembers(members.map(({ name, value }) => ({
731
+ name,
732
+ stored: value
733
+ })), codec.dataType.equalityKey)) problems.push({
734
+ kind: "duplicate-member-value",
735
+ ...duplicate
736
+ });
737
+ return problems.length > 0 ? notOk(problems) : ok(members);
738
+ }
739
+ function presetSpellingsUnder(members, prefix) {
740
+ return Object.entries(members).flatMap(([name, member]) => isAuthoringFieldPresetDescriptor(member) ? [`${prefix}.${name}(${(member.args ?? []).map((arg, index) => arg.name ?? `argument${index + 1}`).join(", ")})`] : presetSpellingsUnder(member, `${prefix}.${name}`));
741
+ }
742
+ /**
743
+ * How each field preset registered under `namespace`, at any depth, is written, with the names of its arguments: `temporal.timestamp(onCreate, onUpdate)`.
744
+ */
745
+ function fieldPresetSpellings(contributions, namespace) {
746
+ const members = contributions?.field?.[namespace];
747
+ if (members === void 0 || isAuthoringFieldPresetDescriptor(members)) return [];
748
+ return presetSpellingsUnder(members, namespace);
749
+ }
750
+ /**
751
+ * Walks `authoringContributions.field` segment by segment and returns the field-preset descriptor at the path, or `undefined` when none is registered there.
752
+ */
753
+ function getAuthoringFieldPreset(contributions, path) {
754
+ let current = contributions?.field;
755
+ for (const segment of path) {
756
+ if (typeof current !== "object" || current === null || "kind" in current) return;
757
+ current = current[segment];
758
+ }
759
+ return current !== void 0 && isAuthoringFieldPresetDescriptor(current) ? current : void 0;
760
+ }
761
+ //#endregion
762
+ export { readWrittenValue as C, tagForm as E, readEnumBlockMembers as S, readWrittenValueIntoCodec as T, exactRewrite as _, authoringTypeConstructors as a, getAuthoringFieldPreset as b, describeDiscriminatorRefusal as c, describeRefusedValueType as d, duplicateStoredMembers as f, enumMemberProblemDiagnostic as g, entryForTag as h, authoringTypeConstructorArguments as i, describeExpected as l, entryForPlain as m, admittedTags as n, castTypedValue as o, encodeEnumMembers as p, applyDiscriminatorRule as r, describeAdmittedForms as s, admittedForms as t, describeRefusal as u, fieldPresetSpellings as v, readWrittenValueAs as w, knownTags as x, findAuthoringTypeConstructorCall as y };
763
+
764
+ //# sourceMappingURL=authoring-CNUti739.mjs.map