@prisma/orm-framework 0.16.0

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 (332) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +27 -0
  3. package/dist/abortable-CQO6uG9F.mjs +39 -0
  4. package/dist/abortable-CQO6uG9F.mjs.map +1 -0
  5. package/dist/abortable-DBbAaT_4.d.mts +29 -0
  6. package/dist/abortable-DBbAaT_4.d.mts.map +1 -0
  7. package/dist/apply-specifier-default-control-policy-CAxiXxKg.d.mts +7 -0
  8. package/dist/apply-specifier-default-control-policy-CAxiXxKg.d.mts.map +1 -0
  9. package/dist/apply-specifier-default-control-policy-CsYHsfTF.mjs +12 -0
  10. package/dist/apply-specifier-default-control-policy-CsYHsfTF.mjs.map +1 -0
  11. package/dist/array-equal-28xupwIB.mjs +26 -0
  12. package/dist/array-equal-28xupwIB.mjs.map +1 -0
  13. package/dist/array-equal-dUd-VPlk.d.mts +22 -0
  14. package/dist/array-equal-dUd-VPlk.d.mts.map +1 -0
  15. package/dist/assertions-BEQnOIQd.d.mts +31 -0
  16. package/dist/assertions-BEQnOIQd.d.mts.map +1 -0
  17. package/dist/assertions-Cz-GWH8P.mjs +36 -0
  18. package/dist/assertions-Cz-GWH8P.mjs.map +1 -0
  19. package/dist/authoring-Dd7p6pTS.d.mts +1 -0
  20. package/dist/canonical-stringify-Bl6agy_g.d.mts +51 -0
  21. package/dist/canonical-stringify-Bl6agy_g.d.mts.map +1 -0
  22. package/dist/canonical-stringify-DY4NaAJi.mjs +104 -0
  23. package/dist/canonical-stringify-DY4NaAJi.mjs.map +1 -0
  24. package/dist/canonicalization-DFpB09nP-4OdB2nsy.d.mts +69 -0
  25. package/dist/canonicalization-DFpB09nP-4OdB2nsy.d.mts.map +1 -0
  26. package/dist/canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs +25 -0
  27. package/dist/canonicalization-path-match-CNgHuwM_-CCPBeUuk.mjs.map +1 -0
  28. package/dist/capabilities-CPj7MfXO-GRkp0Q_D.mjs +64 -0
  29. package/dist/capabilities-CPj7MfXO-GRkp0Q_D.mjs.map +1 -0
  30. package/dist/capabilities-Cupq4-1--C71ORI3N.d.mts +34 -0
  31. package/dist/capabilities-Cupq4-1--C71ORI3N.d.mts.map +1 -0
  32. package/dist/casts-D29CHGrr.d.mts +78 -0
  33. package/dist/casts-D29CHGrr.d.mts.map +1 -0
  34. package/dist/casts-DpaahrlC-Bd5n2coI.mjs +82 -0
  35. package/dist/casts-DpaahrlC-Bd5n2coI.mjs.map +1 -0
  36. package/dist/codec-Cly9VPoA.mjs +78 -0
  37. package/dist/codec-Cly9VPoA.mjs.map +1 -0
  38. package/dist/codec-D3GVAkR_.d.mts +116 -0
  39. package/dist/codec-D3GVAkR_.d.mts.map +1 -0
  40. package/dist/codec-types-XJO6eC9U-B_K2q0zm.d.mts +221 -0
  41. package/dist/codec-types-XJO6eC9U-B_K2q0zm.d.mts.map +1 -0
  42. package/dist/components-CawuxTia.d.mts +1 -0
  43. package/dist/components.d.mts +20 -0
  44. package/dist/components.mjs +15 -0
  45. package/dist/components__authoring.d.mts +3 -0
  46. package/dist/components__authoring.mjs +2 -0
  47. package/dist/components__codec.d.mts +3 -0
  48. package/dist/components__codec.mjs +3 -0
  49. package/dist/components__components.d.mts +4 -0
  50. package/dist/components__components.mjs +3 -0
  51. package/dist/components__control.d.mts +4 -0
  52. package/dist/components__control.mjs +2 -0
  53. package/dist/components__emission.d.mts +4 -0
  54. package/dist/components__emission.mjs +2 -0
  55. package/dist/components__execution.d.mts +2 -0
  56. package/dist/components__execution.mjs +2 -0
  57. package/dist/components__ir.d.mts +3 -0
  58. package/dist/components__ir.mjs +3 -0
  59. package/dist/components__psl-ast.d.mts +4 -0
  60. package/dist/components__psl-ast.mjs +2 -0
  61. package/dist/components__runtime.d.mts +2 -0
  62. package/dist/components__runtime.mjs +3 -0
  63. package/dist/components__utils.d.mts +2 -0
  64. package/dist/components__utils.mjs +2 -0
  65. package/dist/config-errors-CBdiX587-DwIyJIX9.mjs +9 -0
  66. package/dist/config-errors-CBdiX587-DwIyJIX9.mjs.map +1 -0
  67. package/dist/config-types-Cf9lVsHR.mjs +62 -0
  68. package/dist/config-types-Cf9lVsHR.mjs.map +1 -0
  69. package/dist/config-types-W-87vhZ4-BgYaH8YO.d.mts +162 -0
  70. package/dist/config-types-W-87vhZ4-BgYaH8YO.d.mts.map +1 -0
  71. package/dist/config-types-zrHI32Om.d.mts +1 -0
  72. package/dist/config-validation-ByGTw6zQ.mjs +99 -0
  73. package/dist/config-validation-ByGTw6zQ.mjs.map +1 -0
  74. package/dist/config-validation-DXggMTZf.d.mts +14 -0
  75. package/dist/config-validation-DXggMTZf.d.mts.map +1 -0
  76. package/dist/config.d.mts +4 -0
  77. package/dist/config.mjs +3 -0
  78. package/dist/config__config-types.d.mts +3 -0
  79. package/dist/config__config-types.mjs +2 -0
  80. package/dist/config__config-validation.d.mts +2 -0
  81. package/dist/config__config-validation.mjs +2 -0
  82. package/dist/contract-authoring.d.mts +213 -0
  83. package/dist/contract-authoring.d.mts.map +1 -0
  84. package/dist/contract-authoring.mjs +133 -0
  85. package/dist/contract-authoring.mjs.map +1 -0
  86. package/dist/contract-types-CkdMH7F7-9EHXSwbH.d.mts +77 -0
  87. package/dist/contract-types-CkdMH7F7-9EHXSwbH.d.mts.map +1 -0
  88. package/dist/contract-validation-error-DEiWp_EI-CRwtUgRw.mjs +14 -0
  89. package/dist/contract-validation-error-DEiWp_EI-CRwtUgRw.mjs.map +1 -0
  90. package/dist/contract-validation-error-R7cMoK04.d.mts +11 -0
  91. package/dist/contract-validation-error-R7cMoK04.d.mts.map +1 -0
  92. package/dist/contract.d.mts +14 -0
  93. package/dist/contract.mjs +13 -0
  94. package/dist/contract__apply-specifier-default-control-policy.d.mts +2 -0
  95. package/dist/contract__apply-specifier-default-control-policy.mjs +2 -0
  96. package/dist/contract__contract-validation-error.d.mts +2 -0
  97. package/dist/contract__contract-validation-error.mjs +2 -0
  98. package/dist/contract__default-namespace.d.mts +2 -0
  99. package/dist/contract__default-namespace.mjs +2 -0
  100. package/dist/contract__enum-accessor.d.mts +2 -0
  101. package/dist/contract__enum-accessor.mjs +2 -0
  102. package/dist/contract__hashing-utils.d.mts +2 -0
  103. package/dist/contract__hashing-utils.mjs +3 -0
  104. package/dist/contract__hashing.d.mts +3 -0
  105. package/dist/contract__hashing.mjs +2 -0
  106. package/dist/contract__is-plain-record.d.mts +2 -0
  107. package/dist/contract__is-plain-record.mjs +2 -0
  108. package/dist/contract__resolve-domain-model.d.mts +2 -0
  109. package/dist/contract__resolve-domain-model.mjs +2 -0
  110. package/dist/contract__types.d.mts +6 -0
  111. package/dist/contract__types.mjs +5 -0
  112. package/dist/contract__validate-domain.d.mts +2 -0
  113. package/dist/contract__validate-domain.mjs +2 -0
  114. package/dist/control-B87KWI_K-C_R8WfEr.d.mts +213 -0
  115. package/dist/control-B87KWI_K-C_R8WfEr.d.mts.map +1 -0
  116. package/dist/control-CBvTj7Ia.d.mts +1383 -0
  117. package/dist/control-CBvTj7Ia.d.mts.map +1 -0
  118. package/dist/control-DTouE89s.mjs +621 -0
  119. package/dist/control-DTouE89s.mjs.map +1 -0
  120. package/dist/control-Ftiau058-CCeJcAVQ.mjs +284 -0
  121. package/dist/control-Ftiau058-CCeJcAVQ.mjs.map +1 -0
  122. package/dist/declarations-DR6To8_k-BFwkCGeP.mjs +1046 -0
  123. package/dist/declarations-DR6To8_k-BFwkCGeP.mjs.map +1 -0
  124. package/dist/default-namespace-D4vCwkXg-BaiW8LNK.mjs +39 -0
  125. package/dist/default-namespace-D4vCwkXg-BaiW8LNK.mjs.map +1 -0
  126. package/dist/default-namespace-D5X_k6hJ-GH8P1ror.d.mts +26 -0
  127. package/dist/default-namespace-D5X_k6hJ-GH8P1ror.d.mts.map +1 -0
  128. package/dist/defined-BQWA85QH-BRSBMULx.mjs +31 -0
  129. package/dist/defined-BQWA85QH-BRSBMULx.mjs.map +1 -0
  130. package/dist/defined-BSXuxrnl.d.mts +28 -0
  131. package/dist/defined-BSXuxrnl.d.mts.map +1 -0
  132. package/dist/domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts +359 -0
  133. package/dist/domain-envelope-D6Wn9AmZ-BqZKTT9U.d.mts.map +1 -0
  134. package/dist/emission-CeoAV9mj.mjs +26 -0
  135. package/dist/emission-CeoAV9mj.mjs.map +1 -0
  136. package/dist/emission-DeoQufVd.d.mts +1 -0
  137. package/dist/emission-types-hfRVB_Yw-DpQ3hISB.d.mts +75 -0
  138. package/dist/emission-types-hfRVB_Yw-DpQ3hISB.d.mts.map +1 -0
  139. package/dist/enum-accessor-Db5DaTNX.mjs +35 -0
  140. package/dist/enum-accessor-Db5DaTNX.mjs.map +1 -0
  141. package/dist/enum-accessor-PH5vjghI.d.mts +85 -0
  142. package/dist/enum-accessor-PH5vjghI.d.mts.map +1 -0
  143. package/dist/errors.d.mts +4 -0
  144. package/dist/errors.mjs +4 -0
  145. package/dist/errors__control.d.mts +2 -0
  146. package/dist/errors__control.mjs +2 -0
  147. package/dist/errors__execution.d.mts +2 -0
  148. package/dist/errors__execution.mjs +2 -0
  149. package/dist/errors__migration.d.mts +2 -0
  150. package/dist/errors__migration.mjs +2 -0
  151. package/dist/execution-BNwBzmRd.mjs +40 -0
  152. package/dist/execution-BNwBzmRd.mjs.map +1 -0
  153. package/dist/execution-BbOD4GyR.mjs +164 -0
  154. package/dist/execution-BbOD4GyR.mjs.map +1 -0
  155. package/dist/execution-Bo5Bu2Ys.d.mts +79 -0
  156. package/dist/execution-Bo5Bu2Ys.d.mts.map +1 -0
  157. package/dist/execution-MOde1lmD.d.mts +98 -0
  158. package/dist/execution-MOde1lmD.d.mts.map +1 -0
  159. package/dist/framework-authoring-7YMP9TwM-C9P-N6_a.d.mts +777 -0
  160. package/dist/framework-authoring-7YMP9TwM-C9P-N6_a.d.mts.map +1 -0
  161. package/dist/framework-authoring-CDEvlouU-mlMWSksD.mjs +698 -0
  162. package/dist/framework-authoring-CDEvlouU-mlMWSksD.mjs.map +1 -0
  163. package/dist/framework-components-D6j4Y5K7-RW9H184y.mjs +27 -0
  164. package/dist/framework-components-D6j4Y5K7-RW9H184y.mjs.map +1 -0
  165. package/dist/framework-components-MFoo0sYx-G_6k9jt4.d.mts +388 -0
  166. package/dist/framework-components-MFoo0sYx-G_6k9jt4.d.mts.map +1 -0
  167. package/dist/hash-content-Bugg_nZn.mjs +63 -0
  168. package/dist/hash-content-Bugg_nZn.mjs.map +1 -0
  169. package/dist/hash-content-DwEUh-Rx.d.mts +59 -0
  170. package/dist/hash-content-DwEUh-Rx.d.mts.map +1 -0
  171. package/dist/hashing-BtIZVNYX.mjs +199 -0
  172. package/dist/hashing-BtIZVNYX.mjs.map +1 -0
  173. package/dist/hashing-CccSPELN.d.mts +25 -0
  174. package/dist/hashing-CccSPELN.d.mts.map +1 -0
  175. package/dist/hashing-utils-DQgS3nOe.mjs +48 -0
  176. package/dist/hashing-utils-DQgS3nOe.mjs.map +1 -0
  177. package/dist/hashing-utils-qKu59RSC.d.mts +19 -0
  178. package/dist/hashing-utils-qKu59RSC.d.mts.map +1 -0
  179. package/dist/ids.d.mts +44 -0
  180. package/dist/ids.d.mts.map +1 -0
  181. package/dist/ids.mjs +96 -0
  182. package/dist/ids.mjs.map +1 -0
  183. package/dist/ids__runtime.d.mts +7 -0
  184. package/dist/ids__runtime.d.mts.map +1 -0
  185. package/dist/ids__runtime.mjs +31 -0
  186. package/dist/ids__runtime.mjs.map +1 -0
  187. package/dist/index-GY2oGH9L.d.mts +120 -0
  188. package/dist/index-GY2oGH9L.d.mts.map +1 -0
  189. package/dist/internal-error-BIc-ehme-ouBQPoEL.mjs +24 -0
  190. package/dist/internal-error-BIc-ehme-ouBQPoEL.mjs.map +1 -0
  191. package/dist/internal-error-kK8QvlDE.d.mts +19 -0
  192. package/dist/internal-error-kK8QvlDE.d.mts.map +1 -0
  193. package/dist/ir-BvE7L9FK.d.mts +359 -0
  194. package/dist/ir-BvE7L9FK.d.mts.map +1 -0
  195. package/dist/ir-ChmSSAhX.mjs +200 -0
  196. package/dist/ir-ChmSSAhX.mjs.map +1 -0
  197. package/dist/is-plain-record-C9BWiqcw.d.mts +12 -0
  198. package/dist/is-plain-record-C9BWiqcw.d.mts.map +1 -0
  199. package/dist/is-plain-record-CUofyVQ7-DWEzdhIx.mjs +16 -0
  200. package/dist/is-plain-record-CUofyVQ7-DWEzdhIx.mjs.map +1 -0
  201. package/dist/json-Dkqr3say.d.mts +26 -0
  202. package/dist/json-Dkqr3say.d.mts.map +1 -0
  203. package/dist/migration-4VOHVEzx.mjs +118 -0
  204. package/dist/migration-4VOHVEzx.mjs.map +1 -0
  205. package/dist/migration-DKbDzBwy.d.mts +74 -0
  206. package/dist/migration-DKbDzBwy.d.mts.map +1 -0
  207. package/dist/namespace-id-asbWpwMw-3yxn-tRe.mjs +9 -0
  208. package/dist/namespace-id-asbWpwMw-3yxn-tRe.mjs.map +1 -0
  209. package/dist/operations.d.mts +46 -0
  210. package/dist/operations.d.mts.map +1 -0
  211. package/dist/operations.mjs +28 -0
  212. package/dist/operations.mjs.map +1 -0
  213. package/dist/parse-0ZJjj_2N-WZZ1nlrv.d.mts +427 -0
  214. package/dist/parse-0ZJjj_2N-WZZ1nlrv.d.mts.map +1 -0
  215. package/dist/parse-GbZGfMUj-BFSrD2AN.mjs +621 -0
  216. package/dist/parse-GbZGfMUj-BFSrD2AN.mjs.map +1 -0
  217. package/dist/promise-D8meygPf.mjs +13 -0
  218. package/dist/promise-D8meygPf.mjs.map +1 -0
  219. package/dist/promise-DHJWZv49.d.mts +11 -0
  220. package/dist/promise-DHJWZv49.d.mts.map +1 -0
  221. package/dist/psl-ast-BEwO80EH.d.mts +37 -0
  222. package/dist/psl-ast-BEwO80EH.d.mts.map +1 -0
  223. package/dist/psl-ast-Chgi8e4o-rSlBk1UV.d.mts +259 -0
  224. package/dist/psl-ast-Chgi8e4o-rSlBk1UV.d.mts.map +1 -0
  225. package/dist/psl-ast-DUCvVXbB.mjs +239 -0
  226. package/dist/psl-ast-DUCvVXbB.mjs.map +1 -0
  227. package/dist/psl-parser.d.mts +158 -0
  228. package/dist/psl-parser.d.mts.map +1 -0
  229. package/dist/psl-parser.mjs +804 -0
  230. package/dist/psl-parser.mjs.map +1 -0
  231. package/dist/psl-parser__format.d.mts +12 -0
  232. package/dist/psl-parser__format.d.mts.map +1 -0
  233. package/dist/psl-parser__format.mjs +464 -0
  234. package/dist/psl-parser__format.mjs.map +1 -0
  235. package/dist/psl-parser__interpret.d.mts +40 -0
  236. package/dist/psl-parser__interpret.d.mts.map +1 -0
  237. package/dist/psl-parser__interpret.mjs +25 -0
  238. package/dist/psl-parser__interpret.mjs.map +1 -0
  239. package/dist/psl-parser__syntax.d.mts +31 -0
  240. package/dist/psl-parser__syntax.d.mts.map +1 -0
  241. package/dist/psl-parser__syntax.mjs +43 -0
  242. package/dist/psl-parser__syntax.mjs.map +1 -0
  243. package/dist/psl-parser__tokenizer.d.mts +2 -0
  244. package/dist/psl-parser__tokenizer.mjs +2 -0
  245. package/dist/psl-printer.d.mts +37 -0
  246. package/dist/psl-printer.d.mts.map +1 -0
  247. package/dist/psl-printer.mjs +393 -0
  248. package/dist/psl-printer.mjs.map +1 -0
  249. package/dist/redact-db-url-BlaloOwt.d.mts +22 -0
  250. package/dist/redact-db-url-BlaloOwt.d.mts.map +1 -0
  251. package/dist/redact-db-url-CRWJWdB1.mjs +26 -0
  252. package/dist/redact-db-url-CRWJWdB1.mjs.map +1 -0
  253. package/dist/resolve-codec-BZF8TZh_-D-xORT9Q.mjs +59 -0
  254. package/dist/resolve-codec-BZF8TZh_-D-xORT9Q.mjs.map +1 -0
  255. package/dist/resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts +17 -0
  256. package/dist/resolve-domain-model-BVSb5wS5-C6Yq0dsD.d.mts.map +1 -0
  257. package/dist/resolve-domain-model-BovPAsW2-8rwyzjxp.mjs +20 -0
  258. package/dist/resolve-domain-model-BovPAsW2-8rwyzjxp.mjs.map +1 -0
  259. package/dist/result-Bpupv5vO.d.mts +54 -0
  260. package/dist/result-Bpupv5vO.d.mts.map +1 -0
  261. package/dist/result-CBZ8X9mU.mjs +92 -0
  262. package/dist/result-CBZ8X9mU.mjs.map +1 -0
  263. package/dist/runtime--RZXG1zP.d.mts +901 -0
  264. package/dist/runtime--RZXG1zP.d.mts.map +1 -0
  265. package/dist/runtime-DYTFHGwh.mjs +516 -0
  266. package/dist/runtime-DYTFHGwh.mjs.map +1 -0
  267. package/dist/runtime-error-BA9d7XjZ-BlT8t6LB.mjs +40 -0
  268. package/dist/runtime-error-BA9d7XjZ-BlT8t6LB.mjs.map +1 -0
  269. package/dist/simplify-deep-Dw9I_ZUl.d.mts +6 -0
  270. package/dist/simplify-deep-Dw9I_ZUl.d.mts.map +1 -0
  271. package/dist/structured-error-BVmv2aPB.d.mts +34 -0
  272. package/dist/structured-error-BVmv2aPB.d.mts.map +1 -0
  273. package/dist/structured-error-H6WU9Kjt.mjs +31 -0
  274. package/dist/structured-error-H6WU9Kjt.mjs.map +1 -0
  275. package/dist/symbol-table-CZ7EVCTL-oYQtrmzq.d.mts +125 -0
  276. package/dist/symbol-table-CZ7EVCTL-oYQtrmzq.d.mts.map +1 -0
  277. package/dist/tokenizer-1hAHZzmp-QGPORvmA.mjs +228 -0
  278. package/dist/tokenizer-1hAHZzmp-QGPORvmA.mjs.map +1 -0
  279. package/dist/tokenizer-DcYI0Xrq-C-nNE9mE.d.mts +16 -0
  280. package/dist/tokenizer-DcYI0Xrq-C-nNE9mE.d.mts.map +1 -0
  281. package/dist/ts-render.d.mts +2 -0
  282. package/dist/ts-render.mjs +240 -0
  283. package/dist/ts-render.mjs.map +1 -0
  284. package/dist/types-ByeQhU9p.d.mts +17 -0
  285. package/dist/types-ByeQhU9p.d.mts.map +1 -0
  286. package/dist/types-DGxlljKG.d.mts +7 -0
  287. package/dist/types-DGxlljKG.d.mts.map +1 -0
  288. package/dist/types-DgdgskBY.mjs +96 -0
  289. package/dist/types-DgdgskBY.mjs.map +1 -0
  290. package/dist/types-import-spec-DRKzrJ20-WYwyCtil.d.mts +14 -0
  291. package/dist/types-import-spec-DRKzrJ20-WYwyCtil.d.mts.map +1 -0
  292. package/dist/utils-DMAM0unR.mjs +20 -0
  293. package/dist/utils-DMAM0unR.mjs.map +1 -0
  294. package/dist/utils-DeWL_zD9.d.mts +11 -0
  295. package/dist/utils-DeWL_zD9.d.mts.map +1 -0
  296. package/dist/utils.d.mts +16 -0
  297. package/dist/utils.mjs +13 -0
  298. package/dist/utils__abortable.d.mts +2 -0
  299. package/dist/utils__abortable.mjs +2 -0
  300. package/dist/utils__array-equal.d.mts +2 -0
  301. package/dist/utils__array-equal.mjs +2 -0
  302. package/dist/utils__assertions.d.mts +2 -0
  303. package/dist/utils__assertions.mjs +2 -0
  304. package/dist/utils__canonical-stringify.d.mts +2 -0
  305. package/dist/utils__canonical-stringify.mjs +2 -0
  306. package/dist/utils__casts.d.mts +2 -0
  307. package/dist/utils__casts.mjs +2 -0
  308. package/dist/utils__defined.d.mts +2 -0
  309. package/dist/utils__defined.mjs +2 -0
  310. package/dist/utils__hash-content.d.mts +2 -0
  311. package/dist/utils__hash-content.mjs +2 -0
  312. package/dist/utils__internal-error.d.mts +2 -0
  313. package/dist/utils__internal-error.mjs +2 -0
  314. package/dist/utils__json.d.mts +2 -0
  315. package/dist/utils__json.mjs +1 -0
  316. package/dist/utils__promise.d.mts +2 -0
  317. package/dist/utils__promise.mjs +2 -0
  318. package/dist/utils__redact-db-url.d.mts +2 -0
  319. package/dist/utils__redact-db-url.mjs +2 -0
  320. package/dist/utils__result.d.mts +2 -0
  321. package/dist/utils__result.mjs +2 -0
  322. package/dist/utils__simplify-deep.d.mts +2 -0
  323. package/dist/utils__simplify-deep.mjs +1 -0
  324. package/dist/utils__structured-error.d.mts +2 -0
  325. package/dist/utils__structured-error.mjs +2 -0
  326. package/dist/utils__types.d.mts +2 -0
  327. package/dist/utils__types.mjs +1 -0
  328. package/dist/validate-domain-BNBs-TVv.d.mts +22 -0
  329. package/dist/validate-domain-BNBs-TVv.d.mts.map +1 -0
  330. package/dist/validate-domain-BkvFlY3B.mjs +143 -0
  331. package/dist/validate-domain-BkvFlY3B.mjs.map +1 -0
  332. package/package.json +109 -0
@@ -0,0 +1,804 @@
1
+ import { t as blindCast } from "./casts-DpaahrlC-Bd5n2coI.mjs";
2
+ import { n as ok, t as notOk } from "./result-CBZ8X9mU.mjs";
3
+ import { h as isAuthoringPslBlockDescriptor } from "./framework-authoring-CDEvlouU-mlMWSksD.mjs";
4
+ import { a as makePslNamespace, c as validateExtensionBlock, i as flatPslModels, n as UNSPECIFIED_PSL_NAMESPACE_ID, o as makePslNamespaceEntries, s as namespacePslExtensionBlocks } from "./psl-ast-DUCvVXbB.mjs";
5
+ import { E as TypesBlockAst, N as printSyntax, _ as NumberLiteralExprAst, a as CompositeTypeDeclarationAst, d as IdentifierAst, g as NamespaceDeclarationAst, i as BooleanLiteralExprAst, l as FunctionCallAst, m as ModelDeclarationAst, t as ArrayLiteralAst, u as GenericBlockDeclarationAst, x as StringLiteralExprAst, y as ObjectLiteralExprAst } from "./declarations-DR6To8_k-BFwkCGeP.mjs";
6
+ //#region ../../../1-framework/2-authoring/psl-parser/dist/index.mjs
7
+ function getPositionalArgument(attribute, index = 0) {
8
+ return attribute.args.filter((arg) => arg.kind === "positional")[index]?.value;
9
+ }
10
+ function parseQuotedStringLiteral(value) {
11
+ const match = value.trim().match(/^(['"])(.*)\1$/);
12
+ if (!match) return void 0;
13
+ return match[2] ?? "";
14
+ }
15
+ function readResolvedAttribute(attribute, sourceFile) {
16
+ return {
17
+ name: attributeName(attribute.name()),
18
+ args: readResolvedArgList(attribute.argList(), sourceFile),
19
+ span: nodePslSpan(attribute.syntax, sourceFile)
20
+ };
21
+ }
22
+ function readResolvedAttributes(attributes, sourceFile) {
23
+ return Array.from(attributes, (attribute) => readResolvedAttribute(attribute, sourceFile));
24
+ }
25
+ function readResolvedConstructorCall(annotation, sourceFile) {
26
+ const argList = annotation?.argList();
27
+ if (annotation === void 0 || argList === void 0) return void 0;
28
+ return {
29
+ path: annotation.name()?.path() ?? [],
30
+ args: readResolvedArgList(argList, sourceFile),
31
+ span: nodePslSpan(annotation.syntax, sourceFile)
32
+ };
33
+ }
34
+ function readResolvedArgList(argList, sourceFile) {
35
+ if (argList === void 0) return [];
36
+ const args = [];
37
+ for (const arg of argList.args()) {
38
+ const name = arg.name()?.name();
39
+ const expression = arg.value();
40
+ args.push({
41
+ kind: name !== void 0 ? "named" : "positional",
42
+ ...name !== void 0 ? { name } : {},
43
+ value: renderExpression(expression),
44
+ ...expression !== void 0 ? { expression } : {},
45
+ span: nodePslSpan(arg.syntax, sourceFile)
46
+ });
47
+ }
48
+ return args;
49
+ }
50
+ function attributeName(name) {
51
+ return name?.path().join(".") ?? "";
52
+ }
53
+ function renderExpression(expression) {
54
+ if (expression === void 0) return "";
55
+ return printSyntax(expression.syntax).trim();
56
+ }
57
+ function nodePslSpan(node, sourceFile) {
58
+ const start = node.offset;
59
+ const end = start + node.green.textLength;
60
+ return {
61
+ start: offsetToPslPosition(start, sourceFile),
62
+ end: offsetToPslPosition(end, sourceFile)
63
+ };
64
+ }
65
+ /** Unsupported-top-level-block diagnostics are anchored to the keyword token. */
66
+ function keywordPslSpan(node, keyword, sourceFile) {
67
+ const start = node.offset;
68
+ const end = start + keyword.length;
69
+ return {
70
+ start: offsetToPslPosition(start, sourceFile),
71
+ end: offsetToPslPosition(end, sourceFile)
72
+ };
73
+ }
74
+ function rangeToPslSpan(range, sourceFile) {
75
+ return {
76
+ start: offsetToPslPosition(sourceFile.offsetAt(range.start), sourceFile),
77
+ end: offsetToPslPosition(sourceFile.offsetAt(range.end), sourceFile)
78
+ };
79
+ }
80
+ function offsetToPslPosition(offset, sourceFile) {
81
+ const position = sourceFile.positionAt(offset);
82
+ return {
83
+ offset,
84
+ line: position.line + 1,
85
+ column: position.character + 1
86
+ };
87
+ }
88
+ const ATTRIBUTE_DIAGNOSTIC_CODE = "PSL_INVALID_ATTRIBUTE_SYNTAX";
89
+ function leafDiagnostic(ctx, node, message, code = ATTRIBUTE_DIAGNOSTIC_CODE) {
90
+ return {
91
+ code,
92
+ message,
93
+ sourceId: ctx.sourceId,
94
+ span: nodePslSpan(node.syntax, ctx.sourceFile)
95
+ };
96
+ }
97
+ function bool() {
98
+ return {
99
+ kind: "bool",
100
+ label: "boolean",
101
+ parse: (arg, ctx) => {
102
+ if (arg instanceof BooleanLiteralExprAst) {
103
+ const value = arg.value();
104
+ if (value !== void 0) return ok(value);
105
+ }
106
+ return notOk([leafDiagnostic(ctx, arg, "Expected a boolean literal")]);
107
+ }
108
+ };
109
+ }
110
+ function entityRef() {
111
+ return {
112
+ kind: "entityRef",
113
+ label: "model name",
114
+ parse: (arg, ctx) => {
115
+ if (!(arg instanceof IdentifierAst)) return notOk([leafDiagnostic(ctx, arg, "Expected a model name")]);
116
+ const name = arg.name();
117
+ if (name === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a model name")]);
118
+ return ok(name);
119
+ }
120
+ };
121
+ }
122
+ function fieldRef(scope) {
123
+ return {
124
+ kind: "fieldRef",
125
+ label: "field name",
126
+ scope,
127
+ parse: (arg, ctx) => {
128
+ if (!(arg instanceof IdentifierAst)) return notOk([leafDiagnostic(ctx, arg, "Expected a field name")]);
129
+ const name = arg.name();
130
+ if (name === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a field name")]);
131
+ const model = scope === "self" ? ctx.selfModel : ctx.resolveReferencedModel();
132
+ if (model !== void 0 && !Object.hasOwn(model.fields, name)) return notOk([leafDiagnostic(ctx, arg, `Field "${name}" does not exist on model "${model.name}"`)]);
133
+ return ok(name);
134
+ }
135
+ };
136
+ }
137
+ function interpretArgs(args, spec, ctx, span) {
138
+ const diagnostics = [];
139
+ const output = {};
140
+ const seen = /* @__PURE__ */ new Set();
141
+ let positionalSlot = 0;
142
+ let reportedExcess = false;
143
+ for (const arg of args) {
144
+ const name = arg.name()?.name();
145
+ let key;
146
+ let param;
147
+ if (name === void 0) {
148
+ const posParam = spec.positional[positionalSlot];
149
+ if (posParam === void 0) {
150
+ if (!reportedExcess) {
151
+ diagnostics.push(diagnostic(`Attribute "${spec.name}" received too many positional arguments`, ctx, span));
152
+ reportedExcess = true;
153
+ }
154
+ continue;
155
+ }
156
+ positionalSlot += 1;
157
+ key = posParam.key;
158
+ param = posParam.type;
159
+ } else {
160
+ const namedParam = Object.hasOwn(spec.named, name) ? spec.named[name] : void 0;
161
+ if (namedParam === void 0) {
162
+ diagnostics.push(diagnostic(`Attribute "${spec.name}" received unknown argument "${name}"`, ctx, nodePslSpan(arg.syntax, ctx.sourceFile)));
163
+ continue;
164
+ }
165
+ key = name;
166
+ param = namedParam;
167
+ }
168
+ if (seen.has(key)) {
169
+ diagnostics.push(diagnostic(`Attribute "${spec.name}" received duplicate argument "${key}"`, ctx, nodePslSpan(arg.syntax, ctx.sourceFile)));
170
+ continue;
171
+ }
172
+ seen.add(key);
173
+ const result = parseArgValue(arg, param, ctx, diagnostics);
174
+ if (result.ok) output[key] = result.value;
175
+ }
176
+ const finalized = /* @__PURE__ */ new Set();
177
+ const finalizeAbsentKey = (key, positionalParam, namedParam) => {
178
+ if (finalized.has(key) || seen.has(key)) return;
179
+ finalized.add(key);
180
+ const effective = namedParam ?? positionalParam;
181
+ if (effective === void 0) return;
182
+ if (isOptionalArgType(effective)) {
183
+ if (effective.hasDefault) output[key] = effective.defaultValue;
184
+ return;
185
+ }
186
+ diagnostics.push(diagnostic(`Attribute "${spec.name}" is missing required argument "${key}"`, ctx, span));
187
+ };
188
+ for (const param of spec.positional) {
189
+ const namedParam = Object.hasOwn(spec.named, param.key) ? spec.named[param.key] : void 0;
190
+ finalizeAbsentKey(param.key, param.type, namedParam);
191
+ }
192
+ for (const key of Object.keys(spec.named)) finalizeAbsentKey(key, void 0, spec.named[key]);
193
+ if (diagnostics.length > 0) return notOk(diagnostics);
194
+ return ok(output);
195
+ }
196
+ function interpretAttribute(attrNode, spec, ctx) {
197
+ const attributeSpan = nodePslSpan(attrNode.syntax, ctx.sourceFile);
198
+ const bound = interpretArgs(attrNode.argList()?.args() ?? [], spec, ctx, attributeSpan);
199
+ if (!bound.ok) return notOk(bound.failure);
200
+ const value = blindCast(bound.value);
201
+ if (spec.refine !== void 0) {
202
+ const refineDiagnostics = spec.refine(value, ctx, attrNode);
203
+ if (refineDiagnostics.length > 0) return notOk(refineDiagnostics);
204
+ }
205
+ return ok(value);
206
+ }
207
+ function parseArgValue(arg, argType, ctx, diagnostics) {
208
+ const value = arg.value();
209
+ if (value === void 0) {
210
+ const missing = diagnostic("Attribute argument is missing a value", ctx, nodePslSpan(arg.syntax, ctx.sourceFile));
211
+ diagnostics.push(missing);
212
+ return notOk([missing]);
213
+ }
214
+ const result = argType.parse(value, ctx);
215
+ if (!result.ok) for (const failure of result.failure) diagnostics.push(failure);
216
+ return result;
217
+ }
218
+ function isOptionalArgType(param) {
219
+ return "optional" in param && param.optional === true;
220
+ }
221
+ function diagnostic(message, ctx, span) {
222
+ return {
223
+ code: ATTRIBUTE_DIAGNOSTIC_CODE,
224
+ message,
225
+ sourceId: ctx.sourceId,
226
+ span
227
+ };
228
+ }
229
+ function funcCall(name, sig) {
230
+ return {
231
+ kind: "funcCall",
232
+ label: "function call",
233
+ parse: (arg, ctx) => {
234
+ const guard = matchCallee(arg, name, ctx);
235
+ if (!guard.ok) return guard;
236
+ const span = nodePslSpan(guard.value.syntax, ctx.sourceFile);
237
+ const bound = interpretArgs(guard.value.args(), {
238
+ name,
239
+ positional: sig.positional ?? [],
240
+ named: sig.named ?? {}
241
+ }, ctx, span);
242
+ if (!bound.ok) return notOk(bound.failure);
243
+ return ok({
244
+ fn: name,
245
+ span,
246
+ args: bound.value
247
+ });
248
+ }
249
+ };
250
+ }
251
+ function matchCallee(arg, name, ctx) {
252
+ if (!(arg instanceof FunctionCallAst)) return notOk([leafDiagnostic(ctx, arg, "Expected a function call")]);
253
+ const qname = arg.name();
254
+ if (qname === void 0 || qname.dot() !== void 0 || qname.colon() !== void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a function call")]);
255
+ const calleeName = qname.identifier()?.token()?.text;
256
+ if (calleeName === void 0) return notOk([leafDiagnostic(ctx, arg, "Expected a function call")]);
257
+ if (calleeName !== name) return notOk([leafDiagnostic(ctx, arg, `Expected ${name}()`)]);
258
+ return ok(arg);
259
+ }
260
+ function identifier(name) {
261
+ return {
262
+ kind: "identifier",
263
+ label: name,
264
+ parse: (arg, ctx) => {
265
+ if (arg instanceof IdentifierAst && arg.name() === name) return ok(name);
266
+ return notOk([leafDiagnostic(ctx, arg, `Expected ${name}`)]);
267
+ }
268
+ };
269
+ }
270
+ function int(opts) {
271
+ const min = opts?.min;
272
+ const max = opts?.max;
273
+ return {
274
+ kind: "int",
275
+ label: "integer",
276
+ parse: (arg, ctx) => {
277
+ if (arg instanceof NumberLiteralExprAst) {
278
+ const value = arg.value();
279
+ if (value !== void 0 && Number.isInteger(value)) {
280
+ if ((min === void 0 || value >= min) && (max === void 0 || value <= max)) return ok(value);
281
+ return notOk([leafDiagnostic(ctx, arg, rangeMessage(min, max))]);
282
+ }
283
+ }
284
+ return notOk([leafDiagnostic(ctx, arg, "Expected an integer literal")]);
285
+ }
286
+ };
287
+ }
288
+ function rangeMessage(min, max) {
289
+ if (min !== void 0 && max !== void 0) return `Expected an integer between ${min} and ${max}`;
290
+ if (min !== void 0) return `Expected an integer greater than or equal to ${min}`;
291
+ return `Expected an integer less than or equal to ${max}`;
292
+ }
293
+ function list(of, opts) {
294
+ return {
295
+ kind: "list",
296
+ label: `${of.label}[]`,
297
+ parse: (arg, ctx) => {
298
+ if (!(arg instanceof ArrayLiteralAst)) return notOk([leafDiagnostic(ctx, arg, `Expected a list of ${of.label}`)]);
299
+ const diagnostics = [];
300
+ const parsed = [];
301
+ let count = 0;
302
+ for (const element of arg.elements()) {
303
+ count += 1;
304
+ const result = of.parse(element, ctx);
305
+ if (result.ok) parsed.push({
306
+ node: element,
307
+ value: result.value
308
+ });
309
+ else diagnostics.push(...result.failure);
310
+ }
311
+ if (opts?.nonEmpty === true && count === 0) diagnostics.push(leafDiagnostic(ctx, arg, "Expected a non-empty list"));
312
+ if (opts?.unique === true) {
313
+ const seen = /* @__PURE__ */ new Set();
314
+ for (const { node, value } of parsed) if (seen.has(value)) diagnostics.push(leafDiagnostic(ctx, node, "Duplicate list entry"));
315
+ else seen.add(value);
316
+ }
317
+ if (diagnostics.length > 0) return notOk(diagnostics);
318
+ return ok(parsed.map((entry) => entry.value));
319
+ }
320
+ };
321
+ }
322
+ function num(value) {
323
+ return {
324
+ kind: "num",
325
+ label: value === void 0 ? "number" : String(value),
326
+ parse: (arg, ctx) => {
327
+ if (arg instanceof NumberLiteralExprAst) {
328
+ const parsed = arg.value();
329
+ if (parsed !== void 0 && (value === void 0 || parsed === value)) return ok(parsed);
330
+ }
331
+ return notOk([leafDiagnostic(ctx, arg, value === void 0 ? "Expected a number literal" : `Expected ${value}`)]);
332
+ }
333
+ };
334
+ }
335
+ function oneOf(...alts) {
336
+ const label = alts.map((alt) => alt.label).join(" | ");
337
+ return {
338
+ kind: "oneOf",
339
+ label,
340
+ parse: (arg, ctx) => {
341
+ for (const alt of alts) {
342
+ const result = alt.parse(arg, ctx);
343
+ if (result.ok) return ok(blindCast(result.value));
344
+ }
345
+ return notOk([leafDiagnostic(ctx, arg, `Expected one of: ${label}`)]);
346
+ }
347
+ };
348
+ }
349
+ function record(of) {
350
+ return {
351
+ kind: "record",
352
+ label: `{ [key]: ${of.label} }`,
353
+ parse: (arg, ctx) => {
354
+ if (!(arg instanceof ObjectLiteralExprAst)) return notOk([leafDiagnostic(ctx, arg, "Expected an object literal")]);
355
+ const diagnostics = [];
356
+ const result = {};
357
+ for (const field of arg.fields()) {
358
+ const key = field.keyName();
359
+ if (key === void 0) {
360
+ diagnostics.push(leafDiagnostic(ctx, field, "Expected a key"));
361
+ continue;
362
+ }
363
+ const value = field.value();
364
+ if (value === void 0) {
365
+ diagnostics.push(leafDiagnostic(ctx, field, `Expected a value for key "${key}"`));
366
+ continue;
367
+ }
368
+ const parsed = of.parse(value, ctx);
369
+ if (!parsed.ok) {
370
+ diagnostics.push(...parsed.failure);
371
+ continue;
372
+ }
373
+ if (Object.hasOwn(result, key)) {
374
+ diagnostics.push(leafDiagnostic(ctx, field, `Duplicate key "${key}"`));
375
+ continue;
376
+ }
377
+ result[key] = parsed.value;
378
+ }
379
+ if (diagnostics.length > 0) return notOk(diagnostics);
380
+ return ok(result);
381
+ }
382
+ };
383
+ }
384
+ function str() {
385
+ return {
386
+ kind: "str",
387
+ label: "string",
388
+ parse: (arg, ctx) => {
389
+ if (arg instanceof StringLiteralExprAst) {
390
+ const value = arg.value();
391
+ if (value !== void 0) return ok(value);
392
+ }
393
+ return notOk([leafDiagnostic(ctx, arg, "Expected a string literal")]);
394
+ }
395
+ };
396
+ }
397
+ function fieldAttribute(name, config) {
398
+ return {
399
+ level: "field",
400
+ name,
401
+ positional: config.positional ?? [],
402
+ named: config.named ?? {},
403
+ ...config.refine !== void 0 ? { refine: config.refine } : {}
404
+ };
405
+ }
406
+ function modelAttribute(name, config) {
407
+ return {
408
+ level: "model",
409
+ name,
410
+ positional: config.positional ?? [],
411
+ named: config.named ?? {},
412
+ ...config.refine !== void 0 ? { refine: config.refine } : {}
413
+ };
414
+ }
415
+ function optional(type, ...rest) {
416
+ if (rest.length === 0) return {
417
+ ...type,
418
+ optional: true,
419
+ hasDefault: false
420
+ };
421
+ return {
422
+ ...type,
423
+ optional: true,
424
+ hasDefault: true,
425
+ defaultValue: rest[0]
426
+ };
427
+ }
428
+ function findBlockDescriptor(descriptors, keyword) {
429
+ if (descriptors === void 0) return void 0;
430
+ for (const value of Object.values(descriptors)) {
431
+ if (value === void 0) continue;
432
+ if (isAuthoringPslBlockDescriptor(value)) {
433
+ if (value.keyword === keyword) return value;
434
+ continue;
435
+ }
436
+ const nested = findBlockDescriptor(value, keyword);
437
+ if (nested !== void 0) return nested;
438
+ }
439
+ }
440
+ function validateExtensionBlockFromSymbol(input) {
441
+ const refCtx = buildRefResolutionContext(input.symbolTable, input.block);
442
+ return validateExtensionBlock(input.block.block, input.descriptor, input.sourceId, input.codecLookup, refCtx);
443
+ }
444
+ const ZERO_SPAN = {
445
+ start: {
446
+ offset: 0,
447
+ line: 1,
448
+ column: 1
449
+ },
450
+ end: {
451
+ offset: 0,
452
+ line: 1,
453
+ column: 1
454
+ }
455
+ };
456
+ function buildRefResolutionContext(symbolTable, block) {
457
+ const unspecifiedNamespace = makeNamespace(UNSPECIFIED_PSL_NAMESPACE_ID, Object.values(symbolTable.topLevel.models));
458
+ const allNamespaces = [unspecifiedNamespace, ...Object.values(symbolTable.topLevel.namespaces).map((namespace) => makeNamespace(namespace.name, Object.values(namespace.models)))];
459
+ const ownerNamespaceName = findOwnerNamespaceName(symbolTable, block);
460
+ return {
461
+ ownerNamespace: allNamespaces.find((namespace) => namespace.name === ownerNamespaceName) ?? unspecifiedNamespace,
462
+ allNamespaces
463
+ };
464
+ }
465
+ function makeNamespace(name, models) {
466
+ return makePslNamespace({
467
+ kind: "namespace",
468
+ name,
469
+ entries: makePslNamespaceEntries(models.map((model) => ({
470
+ kind: "model",
471
+ name: model.name,
472
+ fields: [],
473
+ attributes: [],
474
+ span: ZERO_SPAN
475
+ })), [], []),
476
+ span: ZERO_SPAN
477
+ });
478
+ }
479
+ function findOwnerNamespaceName(symbolTable, block) {
480
+ for (const namespace of Object.values(symbolTable.topLevel.namespaces)) if (Object.values(namespace.blocks).some((candidate) => candidate === block)) return namespace.name;
481
+ return UNSPECIFIED_PSL_NAMESPACE_ID;
482
+ }
483
+ /**
484
+ * Descriptor-free and unknown parameters become `value` stubs so validation can
485
+ * report them via key-set comparison. Duplicate member names are first-wins.
486
+ */
487
+ function reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics) {
488
+ const keyword = node.keyword()?.text ?? "";
489
+ const blockName = node.name()?.name() ?? "";
490
+ const blockAttributes = [];
491
+ for (const attribute of node.attributes()) {
492
+ const name = attribute.name()?.path().join(".") ?? "";
493
+ const args = Array.from(attribute.argList()?.args() ?? [], (arg) => {
494
+ const value = arg.value();
495
+ return {
496
+ kind: "positional",
497
+ value: value === void 0 ? "" : printSyntax(value.syntax).trim(),
498
+ span: nodePslSpan(arg.syntax, sourceFile)
499
+ };
500
+ });
501
+ blockAttributes.push({
502
+ name,
503
+ args,
504
+ span: nodePslSpan(attribute.syntax, sourceFile)
505
+ });
506
+ }
507
+ const parameters = {};
508
+ for (const entry of node.entries()) {
509
+ const key = entry.key()?.name();
510
+ if (key === void 0) continue;
511
+ const span = nodePslSpan(entry.syntax, sourceFile);
512
+ if (Object.hasOwn(parameters, key)) {
513
+ diagnostics.push({
514
+ code: "PSL_EXTENSION_DUPLICATE_PARAMETER",
515
+ message: `Duplicate parameter "${key}" in "${keyword}" block "${blockName}"; first occurrence wins`,
516
+ range: {
517
+ start: sourceFile.positionAt(entry.syntax.offset),
518
+ end: sourceFile.positionAt(entry.syntax.offset + entry.syntax.green.textLength)
519
+ }
520
+ });
521
+ continue;
522
+ }
523
+ parameters[key] = reconstructParamValue(entry, descriptor?.parameters[key], span, sourceFile, diagnostics);
524
+ }
525
+ return {
526
+ kind: descriptor?.discriminator ?? keyword,
527
+ keyword,
528
+ name: blockName,
529
+ parameters,
530
+ blockAttributes,
531
+ span: nodePslSpan(node.syntax, sourceFile)
532
+ };
533
+ }
534
+ function reconstructParamValue(entry, param, span, sourceFile, diagnostics) {
535
+ const value = entry.value();
536
+ if (value === void 0) return {
537
+ kind: "bare",
538
+ span
539
+ };
540
+ return reconstructFromExpression(value, param, span, sourceFile, diagnostics);
541
+ }
542
+ function reconstructFromExpression(value, param, span, sourceFile, diagnostics) {
543
+ const raw = printSyntax(value.syntax).trim();
544
+ if (param?.kind === "list") {
545
+ const array = ArrayLiteralAst.cast(value.syntax);
546
+ if (!array) {
547
+ diagnostics?.push({
548
+ code: "PSL_EXTENSION_INVALID_VALUE",
549
+ message: `List parameter expects an array literal, got ${raw}`,
550
+ range: {
551
+ start: sourceFile.positionAt(value.syntax.offset),
552
+ end: sourceFile.positionAt(value.syntax.offset + value.syntax.green.textLength)
553
+ }
554
+ });
555
+ return {
556
+ kind: "value",
557
+ raw,
558
+ span
559
+ };
560
+ }
561
+ const items = [];
562
+ for (const element of array.elements()) items.push(reconstructFromExpression(element, param.of, nodePslSpan(element.syntax, sourceFile), sourceFile, diagnostics));
563
+ return {
564
+ kind: "list",
565
+ items,
566
+ span
567
+ };
568
+ }
569
+ switch (param?.kind) {
570
+ case "ref": return {
571
+ kind: "ref",
572
+ identifier: raw,
573
+ span
574
+ };
575
+ case "option": return {
576
+ kind: "option",
577
+ token: raw,
578
+ span
579
+ };
580
+ default: return {
581
+ kind: "value",
582
+ raw,
583
+ span
584
+ };
585
+ }
586
+ }
587
+ /**
588
+ * Owns duplicate-declaration detection for all PSL scopes; downstream consumers
589
+ * should consume first-wins symbols rather than re-emitting duplicate diagnostics.
590
+ */
591
+ function buildSymbolTable(options) {
592
+ const { document, sourceFile, pslBlockDescriptors } = options;
593
+ const diagnostics = [];
594
+ const namespaces = {};
595
+ const namedTypes = {};
596
+ const blocks = {};
597
+ const models = {};
598
+ const compositeTypes = {};
599
+ const topLevelNames = /* @__PURE__ */ new Set();
600
+ const claim = (taken, name) => {
601
+ const text = name?.name();
602
+ if (text === void 0) return void 0;
603
+ if (taken.has(text)) {
604
+ const range = nameRange(name, sourceFile);
605
+ if (range) diagnostics.push({
606
+ code: "PSL_DUPLICATE_DECLARATION",
607
+ message: `Duplicate declaration of "${text}"`,
608
+ range
609
+ });
610
+ return;
611
+ }
612
+ taken.add(text);
613
+ return text;
614
+ };
615
+ for (const declaration of document.declarations()) if (declaration instanceof ModelDeclarationAst) {
616
+ const name = claim(topLevelNames, declaration.name());
617
+ if (name !== void 0) models[name] = buildModel(name, declaration, sourceFile, diagnostics);
618
+ } else if (declaration instanceof CompositeTypeDeclarationAst) {
619
+ const name = claim(topLevelNames, declaration.name());
620
+ if (name !== void 0) compositeTypes[name] = buildCompositeType(name, declaration, sourceFile, diagnostics);
621
+ } else if (declaration instanceof GenericBlockDeclarationAst) {
622
+ const name = claim(topLevelNames, declaration.name());
623
+ if (name !== void 0) blocks[name] = buildBlock(name, declaration, sourceFile, pslBlockDescriptors, diagnostics);
624
+ } else if (declaration instanceof NamespaceDeclarationAst) {
625
+ const name = claim(topLevelNames, declaration.name());
626
+ if (name !== void 0) namespaces[name] = buildNamespace(name, declaration, diagnostics, sourceFile, pslBlockDescriptors);
627
+ } else if (declaration instanceof TypesBlockAst) for (const binding of declaration.declarations()) {
628
+ const name = claim(topLevelNames, binding.name());
629
+ if (name === void 0) continue;
630
+ const resolved = resolveNamedTypeBinding(binding, sourceFile);
631
+ namedTypes[name] = {
632
+ kind: "namedType",
633
+ name,
634
+ node: binding,
635
+ span: nodePslSpan(binding.syntax, sourceFile),
636
+ ...resolved
637
+ };
638
+ }
639
+ return {
640
+ table: { topLevel: {
641
+ namespaces,
642
+ namedTypes,
643
+ blocks,
644
+ models,
645
+ compositeTypes
646
+ } },
647
+ diagnostics
648
+ };
649
+ }
650
+ function buildModel(name, node, sourceFile, diagnostics) {
651
+ return {
652
+ kind: "model",
653
+ name,
654
+ node,
655
+ span: nodePslSpan(node.syntax, sourceFile),
656
+ fields: buildFields(name, node.fields(), sourceFile, diagnostics),
657
+ attributes: readResolvedAttributes(node.attributes(), sourceFile)
658
+ };
659
+ }
660
+ function buildCompositeType(name, node, sourceFile, diagnostics) {
661
+ return {
662
+ kind: "compositeType",
663
+ name,
664
+ node,
665
+ span: nodePslSpan(node.syntax, sourceFile),
666
+ fields: buildFields(name, node.fields(), sourceFile, diagnostics),
667
+ attributes: readResolvedAttributes(node.attributes(), sourceFile)
668
+ };
669
+ }
670
+ function buildBlock(name, node, sourceFile, pslBlockDescriptors, diagnostics) {
671
+ const keyword = node.keyword()?.text ?? "";
672
+ const descriptor = findBlockDescriptor(pslBlockDescriptors, keyword);
673
+ return {
674
+ kind: "block",
675
+ name,
676
+ keyword,
677
+ node,
678
+ span: nodePslSpan(node.syntax, sourceFile),
679
+ block: reconstructExtensionBlock(node, descriptor, sourceFile, diagnostics)
680
+ };
681
+ }
682
+ function buildNamespace(name, node, diagnostics, sourceFile, pslBlockDescriptors) {
683
+ const models = {};
684
+ const compositeTypes = {};
685
+ const blocks = {};
686
+ const taken = /* @__PURE__ */ new Set();
687
+ for (const member of node.declarations()) {
688
+ const memberName = member.name()?.name();
689
+ if (memberName === void 0) continue;
690
+ if (taken.has(memberName)) {
691
+ const range = nameRange(member.name(), sourceFile);
692
+ if (range) diagnostics.push({
693
+ code: "PSL_DUPLICATE_DECLARATION",
694
+ message: `Duplicate declaration of "${memberName}"`,
695
+ range
696
+ });
697
+ continue;
698
+ }
699
+ taken.add(memberName);
700
+ if (member instanceof ModelDeclarationAst) models[memberName] = buildModel(memberName, member, sourceFile, diagnostics);
701
+ else if (member instanceof CompositeTypeDeclarationAst) compositeTypes[memberName] = buildCompositeType(memberName, member, sourceFile, diagnostics);
702
+ else if (member instanceof GenericBlockDeclarationAst) blocks[memberName] = buildBlock(memberName, member, sourceFile, pslBlockDescriptors, diagnostics);
703
+ }
704
+ return {
705
+ kind: "namespace",
706
+ name,
707
+ node,
708
+ span: nodePslSpan(node.syntax, sourceFile),
709
+ models,
710
+ compositeTypes,
711
+ blocks
712
+ };
713
+ }
714
+ function buildFields(ownerName, fields, sourceFile, diagnostics) {
715
+ const result = {};
716
+ for (const field of fields) {
717
+ const nameNode = field.name();
718
+ const name = nameNode?.name();
719
+ if (name === void 0) continue;
720
+ if (Object.hasOwn(result, name)) {
721
+ const range = nameRange(nameNode, sourceFile);
722
+ if (range) diagnostics.push({
723
+ code: "PSL_DUPLICATE_DECLARATION",
724
+ message: `Duplicate declaration of "${name}"`,
725
+ range
726
+ });
727
+ continue;
728
+ }
729
+ result[name] = buildField(ownerName, name, field, sourceFile, diagnostics);
730
+ }
731
+ return result;
732
+ }
733
+ function buildField(ownerName, name, node, sourceFile, diagnostics) {
734
+ const attributes = readResolvedAttributes(node.attributes(), sourceFile);
735
+ const span = nodePslSpan(node.syntax, sourceFile);
736
+ const annotation = node.typeAnnotation();
737
+ const typeName = annotation?.name();
738
+ if (typeName?.isOverQualified()) {
739
+ const path = typeName.path();
740
+ diagnostics.push({
741
+ code: "PSL_INVALID_QUALIFIED_TYPE",
742
+ message: `Field "${ownerName}.${name}" has an invalid qualified type "${path.join(".")}"; use at most one namespace qualifier (e.g. "ns.TypeName")`,
743
+ range: nodeRange(typeName.syntax, sourceFile)
744
+ });
745
+ return {
746
+ kind: "field",
747
+ name,
748
+ node,
749
+ span,
750
+ typeName: path[path.length - 1] ?? "",
751
+ optional: false,
752
+ list: false,
753
+ malformedType: true,
754
+ attributes
755
+ };
756
+ }
757
+ const typeConstructor = annotation?.isConstructor() ? readResolvedConstructorCall(annotation, sourceFile) : void 0;
758
+ const typeNamespaceId = typeName?.namespace()?.name();
759
+ const typeContractSpaceId = typeName?.space()?.name();
760
+ return {
761
+ kind: "field",
762
+ name,
763
+ node,
764
+ span,
765
+ typeName: typeName?.identifier()?.name() ?? "",
766
+ ...typeNamespaceId !== void 0 ? { typeNamespaceId } : {},
767
+ ...typeContractSpaceId !== void 0 ? { typeContractSpaceId } : {},
768
+ optional: annotation?.isOptional() ?? false,
769
+ list: annotation?.isList() ?? false,
770
+ ...typeConstructor !== void 0 ? { typeConstructor } : {},
771
+ attributes
772
+ };
773
+ }
774
+ function resolveNamedTypeBinding(node, sourceFile) {
775
+ const annotation = node.typeAnnotation();
776
+ const isConstructor = annotation?.isConstructor() ?? false;
777
+ const baseType = annotation?.name()?.identifier()?.name();
778
+ const typeConstructor = readResolvedConstructorCall(annotation, sourceFile);
779
+ return {
780
+ isConstructor,
781
+ ...!isConstructor && baseType !== void 0 ? { baseType } : {},
782
+ ...typeConstructor !== void 0 ? { typeConstructor } : {},
783
+ attributes: readResolvedAttributes(node.attributes(), sourceFile)
784
+ };
785
+ }
786
+ function nameRange(name, sourceFile) {
787
+ if (name === void 0) return void 0;
788
+ for (const token of name.syntax.tokens()) if (token.kind === "Ident") return {
789
+ start: sourceFile.positionAt(token.offset),
790
+ end: sourceFile.positionAt(token.offset + token.text.length)
791
+ };
792
+ }
793
+ function nodeRange(node, sourceFile) {
794
+ const start = node.offset;
795
+ const end = start + node.green.textLength;
796
+ return {
797
+ start: sourceFile.positionAt(start),
798
+ end: sourceFile.positionAt(end)
799
+ };
800
+ }
801
+ //#endregion
802
+ export { bool, buildSymbolTable, entityRef, fieldAttribute, fieldRef, findBlockDescriptor, flatPslModels, funcCall, getPositionalArgument, identifier, int, interpretArgs, interpretAttribute, keywordPslSpan, leafDiagnostic, list, modelAttribute, namespacePslExtensionBlocks, nodePslSpan, num, oneOf, optional, parseQuotedStringLiteral, rangeToPslSpan, readResolvedAttribute, readResolvedAttributes, readResolvedConstructorCall, record, str, validateExtensionBlockFromSymbol };
803
+
804
+ //# sourceMappingURL=psl-parser.mjs.map