@schema-engine/forms 0.0.0-stage → 0.5.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 (609) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +69 -2
  3. package/dist/actions/index.d.ts +3 -0
  4. package/dist/actions/index.js +50 -0
  5. package/dist/actions/index.js.map +7 -0
  6. package/dist/actions/plugins/auto-save.plugin.d.ts +39 -0
  7. package/dist/actions/plugins/auto-save.plugin.js +10 -0
  8. package/dist/actions/plugins/auto-save.plugin.js.map +7 -0
  9. package/dist/actions/plugins/form-reset.plugin.d.ts +23 -0
  10. package/dist/actions/plugins/form-reset.plugin.js +9 -0
  11. package/dist/actions/plugins/form-reset.plugin.js.map +7 -0
  12. package/dist/actions/plugins/form-submit.plugin.d.ts +31 -0
  13. package/dist/actions/plugins/form-submit.plugin.js +9 -0
  14. package/dist/actions/plugins/form-submit.plugin.js.map +7 -0
  15. package/dist/actions/plugins/form-submit.registration.d.ts +22 -0
  16. package/dist/actions/plugins/form-submit.registration.js +8 -0
  17. package/dist/actions/plugins/form-submit.registration.js.map +7 -0
  18. package/dist/actions/plugins/gtm.plugin.d.ts +30 -0
  19. package/dist/actions/plugins/gtm.plugin.js +8 -0
  20. package/dist/actions/plugins/gtm.plugin.js.map +7 -0
  21. package/dist/actions/plugins/index.d.ts +16 -0
  22. package/dist/actions/plugins/index.js +45 -0
  23. package/dist/actions/plugins/index.js.map +7 -0
  24. package/dist/actions/plugins/notification.plugin.d.ts +32 -0
  25. package/dist/actions/plugins/notification.plugin.js +9 -0
  26. package/dist/actions/plugins/notification.plugin.js.map +7 -0
  27. package/dist/actions/plugins/notification.registration.d.ts +22 -0
  28. package/dist/actions/plugins/notification.registration.js +8 -0
  29. package/dist/actions/plugins/notification.registration.js.map +7 -0
  30. package/dist/actions/plugins/registrations.d.ts +17 -0
  31. package/dist/actions/plugins/registrations.js +14 -0
  32. package/dist/actions/plugins/registrations.js.map +7 -0
  33. package/dist/actions/triggers.d.ts +42 -0
  34. package/dist/actions/triggers.js +6 -0
  35. package/dist/actions/triggers.js.map +7 -0
  36. package/dist/actions/types.d.ts +16 -0
  37. package/dist/actions/types.js +1 -0
  38. package/dist/actions/types.js.map +7 -0
  39. package/dist/agent-tool/index.d.ts +54 -0
  40. package/dist/agent-tool/index.js +128 -0
  41. package/dist/agent-tool/index.js.map +7 -0
  42. package/dist/browser/action-registrations.d.ts +46 -0
  43. package/dist/browser/action-registrations.js +19 -0
  44. package/dist/browser/action-registrations.js.map +7 -0
  45. package/dist/browser/index.d.ts +4 -0
  46. package/dist/browser/index.js +36 -0
  47. package/dist/browser/index.js.map +7 -0
  48. package/dist/browser/tools/auto-save-storage.d.ts +20 -0
  49. package/dist/browser/tools/auto-save-storage.js +12 -0
  50. package/dist/browser/tools/auto-save-storage.js.map +7 -0
  51. package/dist/browser/tools/gdpr-consent.d.ts +32 -0
  52. package/dist/browser/tools/gdpr-consent.js +11 -0
  53. package/dist/browser/tools/gdpr-consent.js.map +7 -0
  54. package/dist/browser/tools/gtm-tracker.d.ts +7 -0
  55. package/dist/browser/tools/gtm-tracker.js +7 -0
  56. package/dist/browser/tools/gtm-tracker.js.map +7 -0
  57. package/dist/builder/form-authoring.d.ts +159 -0
  58. package/dist/builder/form-authoring.js +1 -0
  59. package/dist/builder/form-authoring.js.map +7 -0
  60. package/dist/builder/form-values.d.ts +158 -0
  61. package/dist/builder/form-values.js +0 -0
  62. package/dist/builder/form-values.js.map +7 -0
  63. package/dist/builder/index.d.ts +5 -0
  64. package/dist/builder/index.js +2 -0
  65. package/dist/builder/index.js.map +7 -0
  66. package/dist/builder/types.utils.d.ts +137 -0
  67. package/dist/builder/types.utils.js +1 -0
  68. package/dist/builder/types.utils.js.map +7 -0
  69. package/dist/chunk-237BHPDH.js +88 -0
  70. package/dist/chunk-237BHPDH.js.map +7 -0
  71. package/dist/chunk-25PLQDKN.js +45 -0
  72. package/dist/chunk-25PLQDKN.js.map +7 -0
  73. package/dist/chunk-2PTM54FQ.js +51 -0
  74. package/dist/chunk-2PTM54FQ.js.map +7 -0
  75. package/dist/chunk-2VKEOE2L.js +907 -0
  76. package/dist/chunk-2VKEOE2L.js.map +7 -0
  77. package/dist/chunk-2XWISGGM.js +8 -0
  78. package/dist/chunk-2XWISGGM.js.map +7 -0
  79. package/dist/chunk-2YKQAVI2.js +8 -0
  80. package/dist/chunk-2YKQAVI2.js.map +7 -0
  81. package/dist/chunk-3B7CJOF6.js +18 -0
  82. package/dist/chunk-3B7CJOF6.js.map +7 -0
  83. package/dist/chunk-3YLRJVVN.js +17 -0
  84. package/dist/chunk-3YLRJVVN.js.map +7 -0
  85. package/dist/chunk-4CUGHU36.js +58 -0
  86. package/dist/chunk-4CUGHU36.js.map +7 -0
  87. package/dist/chunk-4FELFUCD.js +0 -0
  88. package/dist/chunk-4FELFUCD.js.map +7 -0
  89. package/dist/chunk-4XPLSYTK.js +82 -0
  90. package/dist/chunk-4XPLSYTK.js.map +7 -0
  91. package/dist/chunk-56CJ2UZ7.js +55 -0
  92. package/dist/chunk-56CJ2UZ7.js.map +7 -0
  93. package/dist/chunk-5QXT7YAJ.js +87 -0
  94. package/dist/chunk-5QXT7YAJ.js.map +7 -0
  95. package/dist/chunk-5Y6U3MR3.js +54 -0
  96. package/dist/chunk-5Y6U3MR3.js.map +7 -0
  97. package/dist/chunk-6BAJHAGL.js +29 -0
  98. package/dist/chunk-6BAJHAGL.js.map +7 -0
  99. package/dist/chunk-6FUGK5HQ.js +26 -0
  100. package/dist/chunk-6FUGK5HQ.js.map +7 -0
  101. package/dist/chunk-6IZYNHZ3.js +118 -0
  102. package/dist/chunk-6IZYNHZ3.js.map +7 -0
  103. package/dist/chunk-6NV2JDGI.js +8 -0
  104. package/dist/chunk-6NV2JDGI.js.map +7 -0
  105. package/dist/chunk-6R2MBQPL.js +19 -0
  106. package/dist/chunk-6R2MBQPL.js.map +7 -0
  107. package/dist/chunk-7EQJUI5N.js +40 -0
  108. package/dist/chunk-7EQJUI5N.js.map +7 -0
  109. package/dist/chunk-AUZ45XPE.js +27 -0
  110. package/dist/chunk-AUZ45XPE.js.map +7 -0
  111. package/dist/chunk-BIHEIJG3.js +0 -0
  112. package/dist/chunk-BIHEIJG3.js.map +7 -0
  113. package/dist/chunk-BKNWW4PK.js +0 -0
  114. package/dist/chunk-BKNWW4PK.js.map +7 -0
  115. package/dist/chunk-BLFLCSG3.js +71 -0
  116. package/dist/chunk-BLFLCSG3.js.map +7 -0
  117. package/dist/chunk-BYYGAGNH.js +0 -0
  118. package/dist/chunk-BYYGAGNH.js.map +7 -0
  119. package/dist/chunk-CAZPWBQ4.js +18 -0
  120. package/dist/chunk-CAZPWBQ4.js.map +7 -0
  121. package/dist/chunk-CMPOBBRV.js +10 -0
  122. package/dist/chunk-CMPOBBRV.js.map +7 -0
  123. package/dist/chunk-CRQWKC67.js +118 -0
  124. package/dist/chunk-CRQWKC67.js.map +7 -0
  125. package/dist/chunk-CRVXBWSY.js +70 -0
  126. package/dist/chunk-CRVXBWSY.js.map +7 -0
  127. package/dist/chunk-D6ZHV6AT.js +0 -0
  128. package/dist/chunk-D6ZHV6AT.js.map +7 -0
  129. package/dist/chunk-DVDKPY2A.js +12 -0
  130. package/dist/chunk-DVDKPY2A.js.map +7 -0
  131. package/dist/chunk-E4VONSLO.js +15 -0
  132. package/dist/chunk-E4VONSLO.js.map +7 -0
  133. package/dist/chunk-EEYGPPLU.js +185 -0
  134. package/dist/chunk-EEYGPPLU.js.map +7 -0
  135. package/dist/chunk-EI5TMJDC.js +56 -0
  136. package/dist/chunk-EI5TMJDC.js.map +7 -0
  137. package/dist/chunk-EQ5AIF3T.js +117 -0
  138. package/dist/chunk-EQ5AIF3T.js.map +7 -0
  139. package/dist/chunk-EZZHO6DQ.js +26 -0
  140. package/dist/chunk-EZZHO6DQ.js.map +7 -0
  141. package/dist/chunk-FUHLRG3M.js +130 -0
  142. package/dist/chunk-FUHLRG3M.js.map +7 -0
  143. package/dist/chunk-FVOL3ZOJ.js +101 -0
  144. package/dist/chunk-FVOL3ZOJ.js.map +7 -0
  145. package/dist/chunk-G33EUV7N.js +288 -0
  146. package/dist/chunk-G33EUV7N.js.map +7 -0
  147. package/dist/chunk-GH34XFCC.js +56 -0
  148. package/dist/chunk-GH34XFCC.js.map +7 -0
  149. package/dist/chunk-GKWRJ6H4.js +27 -0
  150. package/dist/chunk-GKWRJ6H4.js.map +7 -0
  151. package/dist/chunk-GRZU6F7Q.js +80 -0
  152. package/dist/chunk-GRZU6F7Q.js.map +7 -0
  153. package/dist/chunk-GT2LARKT.js +107 -0
  154. package/dist/chunk-GT2LARKT.js.map +7 -0
  155. package/dist/chunk-GY657L56.js +206 -0
  156. package/dist/chunk-GY657L56.js.map +7 -0
  157. package/dist/chunk-H4ABGAAG.js +60 -0
  158. package/dist/chunk-H4ABGAAG.js.map +7 -0
  159. package/dist/chunk-H63UHX42.js +93 -0
  160. package/dist/chunk-H63UHX42.js.map +7 -0
  161. package/dist/chunk-HEAKWS27.js +2730 -0
  162. package/dist/chunk-HEAKWS27.js.map +7 -0
  163. package/dist/chunk-HIS4MGIR.js +8 -0
  164. package/dist/chunk-HIS4MGIR.js.map +7 -0
  165. package/dist/chunk-HPPFSWIV.js +213 -0
  166. package/dist/chunk-HPPFSWIV.js.map +7 -0
  167. package/dist/chunk-J2FC5K4B.js +87 -0
  168. package/dist/chunk-J2FC5K4B.js.map +7 -0
  169. package/dist/chunk-J5BSFDVK.js +123 -0
  170. package/dist/chunk-J5BSFDVK.js.map +7 -0
  171. package/dist/chunk-J7GSNWXT.js +151 -0
  172. package/dist/chunk-J7GSNWXT.js.map +7 -0
  173. package/dist/chunk-K22S7IZR.js +12 -0
  174. package/dist/chunk-K22S7IZR.js.map +7 -0
  175. package/dist/chunk-K5TMXCMY.js +139 -0
  176. package/dist/chunk-K5TMXCMY.js.map +7 -0
  177. package/dist/chunk-KE53GN4Q.js +246 -0
  178. package/dist/chunk-KE53GN4Q.js.map +7 -0
  179. package/dist/chunk-KFQEDSYI.js +24 -0
  180. package/dist/chunk-KFQEDSYI.js.map +7 -0
  181. package/dist/chunk-KLATKWUA.js +116 -0
  182. package/dist/chunk-KLATKWUA.js.map +7 -0
  183. package/dist/chunk-KSKWSUOB.js +17 -0
  184. package/dist/chunk-KSKWSUOB.js.map +7 -0
  185. package/dist/chunk-LFWEJXWE.js +68 -0
  186. package/dist/chunk-LFWEJXWE.js.map +7 -0
  187. package/dist/chunk-LMWJAD3B.js +24 -0
  188. package/dist/chunk-LMWJAD3B.js.map +7 -0
  189. package/dist/chunk-MD23VADH.js +92 -0
  190. package/dist/chunk-MD23VADH.js.map +7 -0
  191. package/dist/chunk-MKMJT3XR.js +0 -0
  192. package/dist/chunk-MKMJT3XR.js.map +7 -0
  193. package/dist/chunk-NJTLBSTR.js +82 -0
  194. package/dist/chunk-NJTLBSTR.js.map +7 -0
  195. package/dist/chunk-NJXKMF67.js +182 -0
  196. package/dist/chunk-NJXKMF67.js.map +7 -0
  197. package/dist/chunk-OBQBIOGN.js +16 -0
  198. package/dist/chunk-OBQBIOGN.js.map +7 -0
  199. package/dist/chunk-OLYHNFKC.js +82 -0
  200. package/dist/chunk-OLYHNFKC.js.map +7 -0
  201. package/dist/chunk-OR2L7EKO.js +33 -0
  202. package/dist/chunk-OR2L7EKO.js.map +7 -0
  203. package/dist/chunk-OUF57UZ7.js +28 -0
  204. package/dist/chunk-OUF57UZ7.js.map +7 -0
  205. package/dist/chunk-PBMM2N77.js +56 -0
  206. package/dist/chunk-PBMM2N77.js.map +7 -0
  207. package/dist/chunk-PH3LWLYN.js +49 -0
  208. package/dist/chunk-PH3LWLYN.js.map +7 -0
  209. package/dist/chunk-PHNMDWSK.js +9 -0
  210. package/dist/chunk-PHNMDWSK.js.map +7 -0
  211. package/dist/chunk-PN5EH6DM.js +36 -0
  212. package/dist/chunk-PN5EH6DM.js.map +7 -0
  213. package/dist/chunk-POCAINUE.js +42 -0
  214. package/dist/chunk-POCAINUE.js.map +7 -0
  215. package/dist/chunk-PXWVKJGF.js +6 -0
  216. package/dist/chunk-PXWVKJGF.js.map +7 -0
  217. package/dist/chunk-Q5LEK7CI.js +64 -0
  218. package/dist/chunk-Q5LEK7CI.js.map +7 -0
  219. package/dist/chunk-QH7VW7IY.js +0 -0
  220. package/dist/chunk-QH7VW7IY.js.map +7 -0
  221. package/dist/chunk-QLGM2AZW.js +173 -0
  222. package/dist/chunk-QLGM2AZW.js.map +7 -0
  223. package/dist/chunk-QT3EYUL5.js +85 -0
  224. package/dist/chunk-QT3EYUL5.js.map +7 -0
  225. package/dist/chunk-QYHOFLRX.js +43 -0
  226. package/dist/chunk-QYHOFLRX.js.map +7 -0
  227. package/dist/chunk-R3MBVWVI.js +127 -0
  228. package/dist/chunk-R3MBVWVI.js.map +7 -0
  229. package/dist/chunk-R6V3LH7F.js +67 -0
  230. package/dist/chunk-R6V3LH7F.js.map +7 -0
  231. package/dist/chunk-RB22U6HI.js +64 -0
  232. package/dist/chunk-RB22U6HI.js.map +7 -0
  233. package/dist/chunk-RQRQYYTB.js +34 -0
  234. package/dist/chunk-RQRQYYTB.js.map +7 -0
  235. package/dist/chunk-S5D2QE4G.js +53 -0
  236. package/dist/chunk-S5D2QE4G.js.map +7 -0
  237. package/dist/chunk-S7I76ISM.js +245 -0
  238. package/dist/chunk-S7I76ISM.js.map +7 -0
  239. package/dist/chunk-TBDZOQ2C.js +66 -0
  240. package/dist/chunk-TBDZOQ2C.js.map +7 -0
  241. package/dist/chunk-U2X3IYSD.js +23 -0
  242. package/dist/chunk-U2X3IYSD.js.map +7 -0
  243. package/dist/chunk-UGL3KNOT.js +42 -0
  244. package/dist/chunk-UGL3KNOT.js.map +7 -0
  245. package/dist/chunk-UN3DARLG.js +35 -0
  246. package/dist/chunk-UN3DARLG.js.map +7 -0
  247. package/dist/chunk-VGGERKV2.js +7 -0
  248. package/dist/chunk-VGGERKV2.js.map +7 -0
  249. package/dist/chunk-VVFXYY65.js +0 -0
  250. package/dist/chunk-VVFXYY65.js.map +7 -0
  251. package/dist/chunk-WLDCYUN6.js +161 -0
  252. package/dist/chunk-WLDCYUN6.js.map +7 -0
  253. package/dist/chunk-WMDTQS36.js +0 -0
  254. package/dist/chunk-WMDTQS36.js.map +7 -0
  255. package/dist/chunk-WS7SLVXL.js +550 -0
  256. package/dist/chunk-WS7SLVXL.js.map +7 -0
  257. package/dist/chunk-WUTGZYP4.js +290 -0
  258. package/dist/chunk-WUTGZYP4.js.map +7 -0
  259. package/dist/chunk-XKN3WWK3.js +0 -0
  260. package/dist/chunk-XKN3WWK3.js.map +7 -0
  261. package/dist/chunk-XPQRHO5E.js +587 -0
  262. package/dist/chunk-XPQRHO5E.js.map +7 -0
  263. package/dist/chunk-XQ5VJ4QO.js +62 -0
  264. package/dist/chunk-XQ5VJ4QO.js.map +7 -0
  265. package/dist/chunk-XQVKX47O.js +174 -0
  266. package/dist/chunk-XQVKX47O.js.map +7 -0
  267. package/dist/chunk-Y5CNB57V.js +22 -0
  268. package/dist/chunk-Y5CNB57V.js.map +7 -0
  269. package/dist/chunk-YDGH7DTL.js +18 -0
  270. package/dist/chunk-YDGH7DTL.js.map +7 -0
  271. package/dist/chunk-YIFUBPJ3.js +0 -0
  272. package/dist/chunk-YIFUBPJ3.js.map +7 -0
  273. package/dist/chunk-YUUDXRBW.js +212 -0
  274. package/dist/chunk-YUUDXRBW.js.map +7 -0
  275. package/dist/chunk-Z6DQLJS2.js +23 -0
  276. package/dist/chunk-Z6DQLJS2.js.map +7 -0
  277. package/dist/chunk-ZDEZ2FOC.js +81 -0
  278. package/dist/chunk-ZDEZ2FOC.js.map +7 -0
  279. package/dist/chunk-ZUYSGCEH.js +65 -0
  280. package/dist/chunk-ZUYSGCEH.js.map +7 -0
  281. package/dist/chunk-ZYP3MIH3.js +115 -0
  282. package/dist/chunk-ZYP3MIH3.js.map +7 -0
  283. package/dist/constraints/constraint-evaluator.d.ts +57 -0
  284. package/dist/constraints/constraint-evaluator.js +17 -0
  285. package/dist/constraints/constraint-evaluator.js.map +7 -0
  286. package/dist/constraints/index.d.ts +1 -0
  287. package/dist/constraints/index.js +17 -0
  288. package/dist/constraints/index.js.map +7 -0
  289. package/dist/csrf/index.d.ts +43 -0
  290. package/dist/csrf/index.js +43 -0
  291. package/dist/csrf/index.js.map +7 -0
  292. package/dist/engine/build-form-engine.d.ts +27 -0
  293. package/dist/engine/build-form-engine.js +58 -0
  294. package/dist/engine/build-form-engine.js.map +7 -0
  295. package/dist/engine/component-type.d.ts +19 -0
  296. package/dist/engine/component-type.js +6 -0
  297. package/dist/engine/component-type.js.map +7 -0
  298. package/dist/engine/create-form-engine.d.ts +100 -0
  299. package/dist/engine/create-form-engine.js +59 -0
  300. package/dist/engine/create-form-engine.js.map +7 -0
  301. package/dist/engine/form-action-context.d.ts +70 -0
  302. package/dist/engine/form-action-context.js +10 -0
  303. package/dist/engine/form-action-context.js.map +7 -0
  304. package/dist/engine/form-engine.d.ts +236 -0
  305. package/dist/engine/form-engine.js +61 -0
  306. package/dist/engine/form-engine.js.map +7 -0
  307. package/dist/engine/index.d.ts +12 -0
  308. package/dist/engine/index.js +124 -0
  309. package/dist/engine/index.js.map +7 -0
  310. package/dist/engine/schema-artifacts.d.ts +87 -0
  311. package/dist/engine/schema-artifacts.js +14 -0
  312. package/dist/engine/schema-artifacts.js.map +7 -0
  313. package/dist/engine/schema-metadata-catalog.d.ts +41 -0
  314. package/dist/engine/schema-metadata-catalog.js +6 -0
  315. package/dist/engine/schema-metadata-catalog.js.map +7 -0
  316. package/dist/engine/step-machine.d.ts +59 -0
  317. package/dist/engine/step-machine.js +32 -0
  318. package/dist/engine/step-machine.js.map +7 -0
  319. package/dist/engine/submission-schema.d.ts +53 -0
  320. package/dist/engine/submission-schema.js +22 -0
  321. package/dist/engine/submission-schema.js.map +7 -0
  322. package/dist/engine/value-validation.d.ts +237 -0
  323. package/dist/engine/value-validation.js +39 -0
  324. package/dist/engine/value-validation.js.map +7 -0
  325. package/dist/index.d.ts +76 -0
  326. package/dist/index.js +283 -0
  327. package/dist/index.js.map +7 -0
  328. package/dist/lib/authoring-catalog.d.ts +5 -0
  329. package/dist/lib/authoring-catalog.js +11 -0
  330. package/dist/lib/authoring-catalog.js.map +7 -0
  331. package/dist/lib/container-kind-of.d.ts +5 -0
  332. package/dist/lib/container-kind-of.js +6 -0
  333. package/dist/lib/container-kind-of.js.map +7 -0
  334. package/dist/lib/debounce.d.ts +19 -0
  335. package/dist/lib/debounce.js +6 -0
  336. package/dist/lib/debounce.js.map +7 -0
  337. package/dist/lib/deep-readonly.d.ts +12 -0
  338. package/dist/lib/deep-readonly.js +0 -0
  339. package/dist/lib/deep-readonly.js.map +7 -0
  340. package/dist/lib/element-children.d.ts +35 -0
  341. package/dist/lib/element-children.js +16 -0
  342. package/dist/lib/element-children.js.map +7 -0
  343. package/dist/lib/exported-action-envelope.d.ts +11 -0
  344. package/dist/lib/exported-action-envelope.js +7 -0
  345. package/dist/lib/exported-action-envelope.js.map +7 -0
  346. package/dist/lib/exported-rules.d.ts +14 -0
  347. package/dist/lib/exported-rules.js +6 -0
  348. package/dist/lib/exported-rules.js.map +7 -0
  349. package/dist/lib/field-ref.d.ts +13 -0
  350. package/dist/lib/field-ref.js +6 -0
  351. package/dist/lib/field-ref.js.map +7 -0
  352. package/dist/lib/field-scope.d.ts +121 -0
  353. package/dist/lib/field-scope.js +41 -0
  354. package/dist/lib/field-scope.js.map +7 -0
  355. package/dist/lib/form-fetch.d.ts +36 -0
  356. package/dist/lib/form-fetch.js +10 -0
  357. package/dist/lib/form-fetch.js.map +7 -0
  358. package/dist/lib/form-view.d.ts +33 -0
  359. package/dist/lib/form-view.js +12 -0
  360. package/dist/lib/form-view.js.map +7 -0
  361. package/dist/lib/frozen-copy.d.ts +9 -0
  362. package/dist/lib/frozen-copy.js +7 -0
  363. package/dist/lib/frozen-copy.js.map +7 -0
  364. package/dist/lib/is-plain-object.d.ts +2 -0
  365. package/dist/lib/is-plain-object.js +6 -0
  366. package/dist/lib/is-plain-object.js.map +7 -0
  367. package/dist/lib/logger.d.ts +2 -0
  368. package/dist/lib/logger.js +6 -0
  369. package/dist/lib/logger.js.map +7 -0
  370. package/dist/lib/normalized-form-config.d.ts +106 -0
  371. package/dist/lib/normalized-form-config.js +19 -0
  372. package/dist/lib/normalized-form-config.js.map +7 -0
  373. package/dist/lib/omit-paths.d.ts +11 -0
  374. package/dist/lib/omit-paths.js +7 -0
  375. package/dist/lib/omit-paths.js.map +7 -0
  376. package/dist/lib/path-values.d.ts +47 -0
  377. package/dist/lib/path-values.js +22 -0
  378. package/dist/lib/path-values.js.map +7 -0
  379. package/dist/lib/renderer-data-attributes.d.ts +10 -0
  380. package/dist/lib/renderer-data-attributes.js +6 -0
  381. package/dist/lib/renderer-data-attributes.js.map +7 -0
  382. package/dist/lib/reserved-path-keys.d.ts +10 -0
  383. package/dist/lib/reserved-path-keys.js +10 -0
  384. package/dist/lib/reserved-path-keys.js.map +7 -0
  385. package/dist/lib/resolve-appearance.d.ts +48 -0
  386. package/dist/lib/resolve-appearance.js +10 -0
  387. package/dist/lib/resolve-appearance.js.map +7 -0
  388. package/dist/lib/standard-json-schema.d.ts +27 -0
  389. package/dist/lib/standard-json-schema.js +8 -0
  390. package/dist/lib/standard-json-schema.js.map +7 -0
  391. package/dist/lib/standard-schema.d.ts +19 -0
  392. package/dist/lib/standard-schema.js +8 -0
  393. package/dist/lib/standard-schema.js.map +7 -0
  394. package/dist/lib/submission-shape.d.ts +60 -0
  395. package/dist/lib/submission-shape.js +14 -0
  396. package/dist/lib/submission-shape.js.map +7 -0
  397. package/dist/lib/validate-form/grid-checks.d.ts +57 -0
  398. package/dist/lib/validate-form/grid-checks.js +16 -0
  399. package/dist/lib/validate-form/grid-checks.js.map +7 -0
  400. package/dist/lib/validate-form/issues.d.ts +43 -0
  401. package/dist/lib/validate-form/issues.js +13 -0
  402. package/dist/lib/validate-form/issues.js.map +7 -0
  403. package/dist/lib/validate-form/options.d.ts +22 -0
  404. package/dist/lib/validate-form/options.js +0 -0
  405. package/dist/lib/validate-form/options.js.map +7 -0
  406. package/dist/lib/validate-form/parse-elements.d.ts +23 -0
  407. package/dist/lib/validate-form/parse-elements.js +21 -0
  408. package/dist/lib/validate-form/parse-elements.js.map +7 -0
  409. package/dist/lib/validate-form/parse-owner-actions.d.ts +14 -0
  410. package/dist/lib/validate-form/parse-owner-actions.js +10 -0
  411. package/dist/lib/validate-form/parse-owner-actions.js.map +7 -0
  412. package/dist/lib/validate-form/parse-view.d.ts +11 -0
  413. package/dist/lib/validate-form/parse-view.js +11 -0
  414. package/dist/lib/validate-form/parse-view.js.map +7 -0
  415. package/dist/lib/validate-form/schema-issues.d.ts +16 -0
  416. package/dist/lib/validate-form/schema-issues.js +8 -0
  417. package/dist/lib/validate-form/schema-issues.js.map +7 -0
  418. package/dist/lib/validate-form/step-checks.d.ts +18 -0
  419. package/dist/lib/validate-form/step-checks.js +15 -0
  420. package/dist/lib/validate-form/step-checks.js.map +7 -0
  421. package/dist/lib/validate-form/validation-error.d.ts +26 -0
  422. package/dist/lib/validate-form/validation-error.js +8 -0
  423. package/dist/lib/validate-form/validation-error.js.map +7 -0
  424. package/dist/lib/validate-form.d.ts +34 -0
  425. package/dist/lib/validate-form.js +62 -0
  426. package/dist/lib/validate-form.js.map +7 -0
  427. package/dist/lib/zod-json-schema.d.ts +33 -0
  428. package/dist/lib/zod-json-schema.js +10 -0
  429. package/dist/lib/zod-json-schema.js.map +7 -0
  430. package/dist/recipes/built-in-specs.d.ts +1832 -0
  431. package/dist/recipes/built-in-specs.js +28 -0
  432. package/dist/recipes/built-in-specs.js.map +7 -0
  433. package/dist/recipes/built-in.d.ts +2 -0
  434. package/dist/recipes/built-in.js +49 -0
  435. package/dist/recipes/built-in.js.map +7 -0
  436. package/dist/recipes/define-form-recipe.d.ts +10 -0
  437. package/dist/recipes/define-form-recipe.js +6 -0
  438. package/dist/recipes/define-form-recipe.js.map +7 -0
  439. package/dist/recipes/define-recipe-spec.d.ts +13 -0
  440. package/dist/recipes/define-recipe-spec.js +8 -0
  441. package/dist/recipes/define-recipe-spec.js.map +7 -0
  442. package/dist/recipes/index.d.ts +6 -0
  443. package/dist/recipes/index.js +43 -0
  444. package/dist/recipes/index.js.map +7 -0
  445. package/dist/recipes/protocol.d.ts +24 -0
  446. package/dist/recipes/protocol.js +11 -0
  447. package/dist/recipes/protocol.js.map +7 -0
  448. package/dist/recipes/slot-schemas.d.ts +128 -0
  449. package/dist/recipes/slot-schemas.js +24 -0
  450. package/dist/recipes/slot-schemas.js.map +7 -0
  451. package/dist/recipes/types.d.ts +55 -0
  452. package/dist/recipes/types.js +1 -0
  453. package/dist/recipes/types.js.map +7 -0
  454. package/dist/recipes/view-model.d.ts +93 -0
  455. package/dist/recipes/view-model.js +29 -0
  456. package/dist/recipes/view-model.js.map +7 -0
  457. package/dist/registries/index.d.ts +8 -0
  458. package/dist/registries/index.js +0 -0
  459. package/dist/registries/index.js.map +7 -0
  460. package/dist/runtime/create-form-runtime.d.ts +43 -0
  461. package/dist/runtime/create-form-runtime.js +41 -0
  462. package/dist/runtime/create-form-runtime.js.map +7 -0
  463. package/dist/runtime/index.d.ts +3 -0
  464. package/dist/runtime/index.js +44 -0
  465. package/dist/runtime/index.js.map +7 -0
  466. package/dist/runtime/submission-lifecycle.d.ts +65 -0
  467. package/dist/runtime/submission-lifecycle.js +6 -0
  468. package/dist/runtime/submission-lifecycle.js.map +7 -0
  469. package/dist/runtime/types.d.ts +172 -0
  470. package/dist/runtime/types.js +6 -0
  471. package/dist/runtime/types.js.map +7 -0
  472. package/dist/schemas/base-field.d.ts +450 -0
  473. package/dist/schemas/base-field.js +36 -0
  474. package/dist/schemas/base-field.js.map +7 -0
  475. package/dist/schemas/field-config.d.ts +36 -0
  476. package/dist/schemas/field-config.js +1 -0
  477. package/dist/schemas/field-config.js.map +7 -0
  478. package/dist/schemas/form-config-shape.d.ts +763 -0
  479. package/dist/schemas/form-config-shape.js +35 -0
  480. package/dist/schemas/form-config-shape.js.map +7 -0
  481. package/dist/schemas/form-config.d.ts +1288 -0
  482. package/dist/schemas/form-config.js +41 -0
  483. package/dist/schemas/form-config.js.map +7 -0
  484. package/dist/schemas/html-attributes.d.ts +12 -0
  485. package/dist/schemas/html-attributes.js +12 -0
  486. package/dist/schemas/html-attributes.js.map +7 -0
  487. package/dist/schemas/index.d.ts +5 -0
  488. package/dist/schemas/index.js +165 -0
  489. package/dist/schemas/index.js.map +7 -0
  490. package/dist/schemas/validation/async/cache.d.ts +39 -0
  491. package/dist/schemas/validation/async/cache.js +6 -0
  492. package/dist/schemas/validation/async/cache.js.map +7 -0
  493. package/dist/schemas/validation/async/handler.d.ts +21 -0
  494. package/dist/schemas/validation/async/handler.js +11 -0
  495. package/dist/schemas/validation/async/handler.js.map +7 -0
  496. package/dist/schemas/validation/async/index.d.ts +8 -0
  497. package/dist/schemas/validation/async/index.js +14 -0
  498. package/dist/schemas/validation/async/index.js.map +7 -0
  499. package/dist/schemas/validation/defaults.d.ts +6 -0
  500. package/dist/schemas/validation/defaults.js +12 -0
  501. package/dist/schemas/validation/defaults.js.map +7 -0
  502. package/dist/schemas/validation/dependencies.d.ts +52 -0
  503. package/dist/schemas/validation/dependencies.js +17 -0
  504. package/dist/schemas/validation/dependencies.js.map +7 -0
  505. package/dist/schemas/validation/empty.d.ts +1 -0
  506. package/dist/schemas/validation/empty.js +6 -0
  507. package/dist/schemas/validation/empty.js.map +7 -0
  508. package/dist/schemas/validation/errors.d.ts +44 -0
  509. package/dist/schemas/validation/errors.js +12 -0
  510. package/dist/schemas/validation/errors.js.map +7 -0
  511. package/dist/schemas/validation/index.d.ts +9 -0
  512. package/dist/schemas/validation/index.js +130 -0
  513. package/dist/schemas/validation/index.js.map +7 -0
  514. package/dist/schemas/validation/presets.d.ts +66 -0
  515. package/dist/schemas/validation/presets.js +6 -0
  516. package/dist/schemas/validation/presets.js.map +7 -0
  517. package/dist/schemas/validation/relations.d.ts +12 -0
  518. package/dist/schemas/validation/relations.js +8 -0
  519. package/dist/schemas/validation/relations.js.map +7 -0
  520. package/dist/schemas/validation/types.d.ts +817 -0
  521. package/dist/schemas/validation/types.js +64 -0
  522. package/dist/schemas/validation/types.js.map +7 -0
  523. package/dist/schemas/validation/utils.d.ts +76 -0
  524. package/dist/schemas/validation/utils.js +24 -0
  525. package/dist/schemas/validation/utils.js.map +7 -0
  526. package/dist/schemas/validation/validation-registry.d.ts +124 -0
  527. package/dist/schemas/validation/validation-registry.js +27 -0
  528. package/dist/schemas/validation/validation-registry.js.map +7 -0
  529. package/dist/server-errors/from-json-api-errors.d.ts +13 -0
  530. package/dist/server-errors/from-json-api-errors.js +10 -0
  531. package/dist/server-errors/from-json-api-errors.js.map +7 -0
  532. package/dist/server-errors/from-problem-details.d.ts +15 -0
  533. package/dist/server-errors/from-problem-details.js +10 -0
  534. package/dist/server-errors/from-problem-details.js.map +7 -0
  535. package/dist/server-errors/index.d.ts +8 -0
  536. package/dist/server-errors/index.js +17 -0
  537. package/dist/server-errors/index.js.map +7 -0
  538. package/dist/server-errors/shared.d.ts +34 -0
  539. package/dist/server-errors/shared.js +23 -0
  540. package/dist/server-errors/shared.js.map +7 -0
  541. package/dist/state-container/create-form-state-container.d.ts +17 -0
  542. package/dist/state-container/create-form-state-container.js +31 -0
  543. package/dist/state-container/create-form-state-container.js.map +7 -0
  544. package/dist/state-container/dirty.d.ts +11 -0
  545. package/dist/state-container/dirty.js +9 -0
  546. package/dist/state-container/dirty.js.map +7 -0
  547. package/dist/state-container/field-array.d.ts +41 -0
  548. package/dist/state-container/field-array.js +8 -0
  549. package/dist/state-container/field-array.js.map +7 -0
  550. package/dist/state-container/hydration.d.ts +21 -0
  551. package/dist/state-container/hydration.js +11 -0
  552. package/dist/state-container/hydration.js.map +7 -0
  553. package/dist/state-container/index.d.ts +16 -0
  554. package/dist/state-container/index.js +51 -0
  555. package/dist/state-container/index.js.map +7 -0
  556. package/dist/state-container/issue-text.d.ts +11 -0
  557. package/dist/state-container/issue-text.js +6 -0
  558. package/dist/state-container/issue-text.js.map +7 -0
  559. package/dist/state-container/row-ids.d.ts +34 -0
  560. package/dist/state-container/row-ids.js +19 -0
  561. package/dist/state-container/row-ids.js.map +7 -0
  562. package/dist/state-container/selectors.d.ts +33 -0
  563. package/dist/state-container/selectors.js +22 -0
  564. package/dist/state-container/selectors.js.map +7 -0
  565. package/dist/state-container/stale-results.d.ts +28 -0
  566. package/dist/state-container/stale-results.js +9 -0
  567. package/dist/state-container/stale-results.js.map +7 -0
  568. package/dist/state-container/state-tree.d.ts +56 -0
  569. package/dist/state-container/state-tree.js +33 -0
  570. package/dist/state-container/state-tree.js.map +7 -0
  571. package/dist/state-container/submission.d.ts +45 -0
  572. package/dist/state-container/submission.js +26 -0
  573. package/dist/state-container/submission.js.map +7 -0
  574. package/dist/state-container/types.d.ts +404 -0
  575. package/dist/state-container/types.js +6 -0
  576. package/dist/state-container/types.js.map +7 -0
  577. package/dist/state-container/value-tree.d.ts +56 -0
  578. package/dist/state-container/value-tree.js +34 -0
  579. package/dist/state-container/value-tree.js.map +7 -0
  580. package/dist/testing/form-state-container-conformance.d.ts +51 -0
  581. package/dist/testing/form-state-container-conformance.js +43 -0
  582. package/dist/testing/form-state-container-conformance.js.map +7 -0
  583. package/dist/testing/index.d.ts +7 -0
  584. package/dist/testing/index.js +35 -0
  585. package/dist/testing/index.js.map +7 -0
  586. package/dist/types/actions.d.ts +75 -0
  587. package/dist/types/actions.js +1 -0
  588. package/dist/types/actions.js.map +7 -0
  589. package/dist/types/categories.d.ts +21 -0
  590. package/dist/types/categories.js +8 -0
  591. package/dist/types/categories.js.map +7 -0
  592. package/dist/types/define-element.d.ts +73 -0
  593. package/dist/types/define-element.js +8 -0
  594. package/dist/types/define-element.js.map +7 -0
  595. package/dist/types/index.d.ts +10 -0
  596. package/dist/types/index.js +17 -0
  597. package/dist/types/index.js.map +7 -0
  598. package/dist/types/metadata.d.ts +14 -0
  599. package/dist/types/metadata.js +1 -0
  600. package/dist/types/metadata.js.map +7 -0
  601. package/dist/types/registration.d.ts +142 -0
  602. package/dist/types/registration.js +1 -0
  603. package/dist/types/registration.js.map +7 -0
  604. package/package.json +119 -3
  605. package/skill/SKILL.md +79 -0
  606. package/skill/reference/forms-actions.md +51 -0
  607. package/skill/reference/forms-submission.md +44 -0
  608. package/skill/reference/forms-validation.md +91 -0
  609. package/skill/reference/forms.md +179 -0
@@ -0,0 +1,87 @@
1
+ import {
2
+ FORM_ROOT
3
+ } from "./chunk-PXWVKJGF.js";
4
+ import {
5
+ isReservedPathKey
6
+ } from "./chunk-3YLRJVVN.js";
7
+ import {
8
+ isPlainObject
9
+ } from "./chunk-CMPOBBRV.js";
10
+
11
+ // src/server-errors/shared.ts
12
+ var ServerErrorsInputError = class extends Error {
13
+ name = "ServerErrorsInputError";
14
+ };
15
+ var isRecord = isPlainObject;
16
+ function isSerializable(value) {
17
+ if (value === null || typeof value === "string" || typeof value === "boolean") return true;
18
+ if (typeof value === "number") return Number.isFinite(value);
19
+ if (Array.isArray(value)) return value.every(isSerializable);
20
+ return isPlainObject(value) && Object.values(value).every(isSerializable);
21
+ }
22
+ function serializableParams(source, omit) {
23
+ const kept = Object.entries(source).filter(([key, value]) => !omit.has(key) && isSerializable(value));
24
+ return kept.length === 0 ? void 0 : Object.fromEntries(kept);
25
+ }
26
+ var textOf = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
27
+ function pointerToPath(pointer, skip = []) {
28
+ const raw = pointer.startsWith("#") ? decodeFragment(pointer.slice(1)) : pointer;
29
+ if (raw === "") return FORM_ROOT;
30
+ if (!raw.startsWith("/")) throw new ServerErrorsInputError(`'${pointer}' is not a JSON Pointer.`);
31
+ const segments = raw.slice(1).split("/").map((segment) => segment.replaceAll("~1", "/").replaceAll("~0", "~"));
32
+ const own = segments.every((segment, index) => segment === skip[index]) ? [] : skip.every((name, index) => segments[index] === name) ? segments.slice(skip.length) : segments;
33
+ for (const segment of own) {
34
+ if (segment === "") throw new ServerErrorsInputError(`'${pointer}' has an empty segment.`);
35
+ if (segment.includes("."))
36
+ throw new ServerErrorsInputError(
37
+ `'${pointer}' has the segment '${segment}', which a dotted path cannot hold.`
38
+ );
39
+ if (isReservedPathKey(segment)) {
40
+ throw new ServerErrorsInputError(
41
+ `'${pointer}' has the reserved segment '${segment}'; a segment cannot start with '__' or be constructor, prototype or __proto__.`
42
+ );
43
+ }
44
+ }
45
+ return own.length === 0 ? FORM_ROOT : own.join(".");
46
+ }
47
+ function decodeFragment(fragment) {
48
+ try {
49
+ return decodeURIComponent(fragment);
50
+ } catch {
51
+ throw new ServerErrorsInputError(`'#${fragment}' is not a valid URI fragment.`);
52
+ }
53
+ }
54
+ function groupByPath(found) {
55
+ const grouped = /* @__PURE__ */ new Map();
56
+ for (const [path, issue] of found) grouped.set(path, [...grouped.get(path) ?? [], issue]);
57
+ return Object.fromEntries(
58
+ [...grouped].map(([path, issues]) => [path, issues.length === 1 ? issues[0] : issues])
59
+ );
60
+ }
61
+ function issueOf(parts) {
62
+ return {
63
+ ...parts.type === void 0 ? {} : { type: parts.type },
64
+ ...parts.message === void 0 ? {} : { message: parts.message },
65
+ ...parts.params === void 0 ? {} : { params: parts.params }
66
+ };
67
+ }
68
+ function recordsAt(source, key, what) {
69
+ const list = source[key];
70
+ if (list === void 0) return void 0;
71
+ if (!Array.isArray(list)) throw new ServerErrorsInputError(`${what} '${key}' must be an array.`);
72
+ return list.map((entry, index) => {
73
+ if (!isRecord(entry)) throw new ServerErrorsInputError(`${what} '${key}[${index}]' must be an object.`);
74
+ return entry;
75
+ });
76
+ }
77
+
78
+ export {
79
+ ServerErrorsInputError,
80
+ isRecord,
81
+ serializableParams,
82
+ textOf,
83
+ pointerToPath,
84
+ groupByPath,
85
+ issueOf,
86
+ recordsAt
87
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/server-errors/shared.ts"],
4
+ "sourcesContent": ["import { isPlainObject } from '@/lib/is-plain-object';\nimport { isReservedPathKey } from '@/lib/reserved-path-keys';\nimport { FORM_ROOT, type FormStateErrorInput, type FormStateErrorsInput } from '@/state-container/types';\n\n/**\n * Thrown by the server error helpers for input whose shape they do not recognise, or that names a path no field can have.\n *\n * @remarks The helpers never guess: a response they cannot read is an outage for the host to handle, not a field error.\n */\nexport class ServerErrorsInputError extends Error {\n\toverride readonly name = 'ServerErrorsInputError';\n}\n\nexport const isRecord = isPlainObject;\n\n/** The members of `value` that `JSON.stringify` keeps as they are, which is what an issue's `params` may hold. */\nfunction isSerializable(value: unknown): boolean {\n\tif (value === null || typeof value === 'string' || typeof value === 'boolean') return true;\n\tif (typeof value === 'number') return Number.isFinite(value);\n\tif (Array.isArray(value)) return value.every(isSerializable);\n\treturn isPlainObject(value) && Object.values(value).every(isSerializable);\n}\n\n/** The members of `source` outside `omit` that are plain serializable values, or `undefined` when none are. */\nexport function serializableParams(\n\tsource: Readonly<Record<string, unknown>>,\n\tomit: ReadonlySet<string>,\n): Readonly<Record<string, unknown>> | undefined {\n\tconst kept = Object.entries(source).filter(([key, value]) => !omit.has(key) && isSerializable(value));\n\treturn kept.length === 0 ? undefined : Object.fromEntries(kept);\n}\n\n/** The text of `value` when it is a non-empty string. */\nexport const textOf = (value: unknown): string | undefined =>\n\ttypeof value === 'string' && value.length > 0 ? value : undefined;\n\n/**\n * The dotted path of a JSON Pointer (RFC 6901), in its plain or URI fragment form (`#/a/0/b`).\n *\n * @remarks\n * An empty pointer names the whole document, so the form. A segment is unescaped (`~1` is `/`, `~0` is `~`),\n * and one that holds a `.` cannot be a field name in a dotted path. `skip` lists leading segments that are not\n * part of the path, such as `data` and `attributes` of a JSON:API document.\n */\nexport function pointerToPath(pointer: string, skip: readonly string[] = []): string {\n\tconst raw = pointer.startsWith('#') ? decodeFragment(pointer.slice(1)) : pointer;\n\tif (raw === '') return FORM_ROOT;\n\tif (!raw.startsWith('/')) throw new ServerErrorsInputError(`'${pointer}' is not a JSON Pointer.`);\n\tconst segments = raw\n\t\t.slice(1)\n\t\t.split('/')\n\t\t.map((segment) => segment.replaceAll('~1', '/').replaceAll('~0', '~'));\n\tconst own = segments.every((segment, index) => segment === skip[index])\n\t\t? []\n\t\t: skip.every((name, index) => segments[index] === name)\n\t\t\t? segments.slice(skip.length)\n\t\t\t: segments;\n\tfor (const segment of own) {\n\t\tif (segment === '') throw new ServerErrorsInputError(`'${pointer}' has an empty segment.`);\n\t\tif (segment.includes('.'))\n\t\t\tthrow new ServerErrorsInputError(\n\t\t\t\t`'${pointer}' has the segment '${segment}', which a dotted path cannot hold.`,\n\t\t\t);\n\t\tif (isReservedPathKey(segment)) {\n\t\t\tthrow new ServerErrorsInputError(\n\t\t\t\t`'${pointer}' has the reserved segment '${segment}'; a segment cannot start with '__' or be constructor, prototype or __proto__.`,\n\t\t\t);\n\t\t}\n\t}\n\treturn own.length === 0 ? FORM_ROOT : own.join('.');\n}\n\nfunction decodeFragment(fragment: string): string {\n\ttry {\n\t\treturn decodeURIComponent(fragment);\n\t} catch {\n\t\tthrow new ServerErrorsInputError(`'#${fragment}' is not a valid URI fragment.`);\n\t}\n}\n\n/** Collects issues by path: one stays an issue, several become a list in the order they came. */\nexport function groupByPath(found: ReadonlyArray<readonly [string, FormStateErrorInput]>): FormStateErrorsInput {\n\tconst grouped = new Map<string, FormStateErrorInput[]>();\n\tfor (const [path, issue] of found) grouped.set(path, [...(grouped.get(path) ?? []), issue]);\n\treturn Object.fromEntries(\n\t\t[...grouped].map(([path, issues]) => [path, issues.length === 1 ? issues[0] : issues] as const),\n\t);\n}\n\n/** An issue with only the parts that are there. */\nexport function issueOf(parts: {\n\treadonly type?: string;\n\treadonly message?: string;\n\treadonly params?: Readonly<Record<string, unknown>>;\n}): FormStateErrorInput {\n\treturn {\n\t\t...(parts.type === undefined ? {} : { type: parts.type }),\n\t\t...(parts.message === undefined ? {} : { message: parts.message }),\n\t\t...(parts.params === undefined ? {} : { params: parts.params }),\n\t};\n}\n\n/** The list at `key` of `source`, which must be an array of records when it is there. */\nexport function recordsAt(\n\tsource: Readonly<Record<string, unknown>>,\n\tkey: string,\n\twhat: string,\n): ReadonlyArray<Readonly<Record<string, unknown>>> | undefined {\n\tconst list: unknown = source[key];\n\tif (list === undefined) return undefined;\n\tif (!Array.isArray(list)) throw new ServerErrorsInputError(`${what} '${key}' must be an array.`);\n\treturn list.map((entry: unknown, index) => {\n\t\tif (!isRecord(entry)) throw new ServerErrorsInputError(`${what} '${key}[${index}]' must be an object.`);\n\t\treturn entry;\n\t});\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,54 @@
1
+ // src/engine/form-action-context.ts
2
+ var stepTimings = /* @__PURE__ */ new WeakMap();
3
+ var countTouched = (touched) => Object.values(touched).filter((isTouched) => isTouched === true).length;
4
+ function getStepStartTime(form, stepId, mountedAt, now) {
5
+ const timing = stepTimings.get(form);
6
+ if (!timing || timing.mountedAt !== mountedAt) {
7
+ stepTimings.set(form, { mountedAt, stepId, stepStartTime: mountedAt });
8
+ return mountedAt;
9
+ }
10
+ if (timing.stepId !== stepId) {
11
+ timing.stepId = stepId;
12
+ timing.stepStartTime = now;
13
+ }
14
+ return timing.stepStartTime;
15
+ }
16
+ function buildFormActionContext({
17
+ config,
18
+ values,
19
+ formState,
20
+ step,
21
+ mountedAt,
22
+ form,
23
+ fetch
24
+ }) {
25
+ const now = Date.now();
26
+ return {
27
+ formId: config.id || "unnamed-form",
28
+ formData: values,
29
+ stepId: step.id,
30
+ currentStep: step.position,
31
+ totalSteps: step.total,
32
+ isValid: formState.isValid,
33
+ errors: formState.errors,
34
+ metadata: {
35
+ stepStartTime: getStepStartTime(form, step.id, mountedAt, now),
36
+ totalFormTime: now - mountedAt,
37
+ userInteractions: countTouched(formState.touched) + formState.submitCount
38
+ },
39
+ form,
40
+ fetch
41
+ };
42
+ }
43
+ function collectStepActions(config, stepId) {
44
+ return [...config.actions ?? [], ...config.steps.find((step) => step.id === stepId)?.actions ?? []];
45
+ }
46
+ function hasConfiguredActions(config) {
47
+ return Boolean(config.actions?.length) || config.steps.some((step) => Boolean(step.actions?.length));
48
+ }
49
+
50
+ export {
51
+ buildFormActionContext,
52
+ collectStepActions,
53
+ hasConfiguredActions
54
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/engine/form-action-context.ts"],
4
+ "sourcesContent": ["import type { FormFetch } from '../lib/form-fetch';\nimport type { BuilderActionBaseContext } from '@/types';\nimport type { FormStateError } from '@/state-container/types';\n\n/**\n * Renderer form state in the engine's shape.\n *\n * @remarks\n * `errors` is flat, one entry per dotted field path, so `address.street` is read as\n * `errors['address.street']` in every renderer and a container and a row inside it\n * can both fail, and `touched` is flat the same way. A renderer that keeps them in another shape\n * converts them before building the context.\n *\n * `isValid` is the snapshot's: true when no error is recorded, in every renderer. It says\n * nothing about fields no validation has reached; `context.form.checkValidity()` answers for\n * the current values.\n */\nexport interface FormActionContextFormState {\n\t/** Whether no error is recorded for a path that takes part, as `snapshot.isValid` says. */\n\tisValid: boolean;\n\t/** Errors by dotted field path, as `validateFormValues` returns them. */\n\terrors: Readonly<Record<string, FormStateError>>;\n\t/** Touched fields by dotted path, `true` at each field the user has touched. */\n\ttouched: Readonly<Partial<Record<string, boolean>>>;\n\tsubmitCount: number;\n}\n\ninterface StepTiming {\n\tmountedAt: number;\n\tstepId: string;\n\tstepStartTime: number;\n}\n\ninterface BuildFormActionContextOptions<TForm extends BuilderActionBaseContext['form']> {\n\tconfig: { id?: string };\n\tvalues: Record<string, unknown>;\n\tformState: FormActionContextFormState;\n\t/** The current step: its id, its position among the steps that are not skipped and how many there are. */\n\tstep: { id: string; position: number; total: number };\n\tmountedAt: number;\n\tform: TForm;\n\t/** The engine's `fetch`, which the context hands to actions. */\n\tfetch: FormFetch;\n}\n\nconst stepTimings = new WeakMap<object, StepTiming>();\n\nconst countTouched = (touched: Readonly<Partial<Record<string, boolean>>>): number =>\n\tObject.values(touched).filter((isTouched) => isTouched === true).length;\n\nfunction getStepStartTime(form: object, stepId: string, mountedAt: number, now: number): number {\n\tconst timing = stepTimings.get(form);\n\tif (!timing || timing.mountedAt !== mountedAt) {\n\t\tstepTimings.set(form, { mountedAt, stepId, stepStartTime: mountedAt });\n\t\treturn mountedAt;\n\t}\n\n\tif (timing.stepId !== stepId) {\n\t\ttiming.stepId = stepId;\n\t\ttiming.stepStartTime = now;\n\t}\n\n\treturn timing.stepStartTime;\n}\n\n/**\n * Builds the framework-neutral action context used by form action dispatch.\n *\n * @remarks\n * Step start times are kept per form instance and reset when its current step changes.\n * `userInteractions` counts touched fields plus submissions.\n */\nexport function buildFormActionContext<TForm extends BuilderActionBaseContext['form']>({\n\tconfig,\n\tvalues,\n\tformState,\n\tstep,\n\tmountedAt,\n\tform,\n\tfetch,\n}: BuildFormActionContextOptions<TForm>): BuilderActionBaseContext {\n\tconst now = Date.now();\n\n\treturn {\n\t\tformId: config.id || 'unnamed-form',\n\t\tformData: values,\n\t\tstepId: step.id,\n\t\tcurrentStep: step.position,\n\t\ttotalSteps: step.total,\n\t\tisValid: formState.isValid,\n\t\terrors: formState.errors,\n\t\tmetadata: {\n\t\t\tstepStartTime: getStepStartTime(form, step.id, mountedAt, now),\n\t\t\ttotalFormTime: now - mountedAt,\n\t\t\tuserInteractions: countTouched(formState.touched) + formState.submitCount,\n\t\t},\n\t\tform,\n\t\tfetch,\n\t};\n}\n\ninterface ActionScopes<TAction> {\n\tactions?: readonly TAction[];\n\tsteps: readonly { id: string; actions?: readonly TAction[] }[];\n}\n\n/**\n * Lists the actions a trigger dispatches while the step `stepId` is current: the form's `actions`,\n * then that step's.\n *\n * @remarks\n * The runtime dispatches `step_leave` while the step being left is current and `step_change` and\n * `step_enter` once the entered step is, so a step's actions see the step triggers of navigation\n * into and out of that step, plus every other trigger fired while it is current.\n */\nexport function collectStepActions<TAction>(config: ActionScopes<TAction>, stepId: string): TAction[] {\n\treturn [...(config.actions ?? []), ...(config.steps.find((step) => step.id === stepId)?.actions ?? [])];\n}\n\n/** Whether the form or any of its steps configures an action. */\nexport function hasConfiguredActions(config: ActionScopes<unknown>): boolean {\n\treturn Boolean(config.actions?.length) || config.steps.some((step) => Boolean(step.actions?.length));\n}\n"],
5
+ "mappings": ";AA6CA,IAAM,cAAc,oBAAI,QAA4B;AAEpD,IAAM,eAAe,CAAC,YACrB,OAAO,OAAO,OAAO,EAAE,OAAO,CAAC,cAAc,cAAc,IAAI,EAAE;AAElE,SAAS,iBAAiB,MAAc,QAAgB,WAAmB,KAAqB;AAC/F,QAAM,SAAS,YAAY,IAAI,IAAI;AACnC,MAAI,CAAC,UAAU,OAAO,cAAc,WAAW;AAC9C,gBAAY,IAAI,MAAM,EAAE,WAAW,QAAQ,eAAe,UAAU,CAAC;AACrE,WAAO;AAAA,EACR;AAEA,MAAI,OAAO,WAAW,QAAQ;AAC7B,WAAO,SAAS;AAChB,WAAO,gBAAgB;AAAA,EACxB;AAEA,SAAO,OAAO;AACf;AASO,SAAS,uBAAuE;AAAA,EACtF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAmE;AAClE,QAAM,MAAM,KAAK,IAAI;AAErB,SAAO;AAAA,IACN,QAAQ,OAAO,MAAM;AAAA,IACrB,UAAU;AAAA,IACV,QAAQ,KAAK;AAAA,IACb,aAAa,KAAK;AAAA,IAClB,YAAY,KAAK;AAAA,IACjB,SAAS,UAAU;AAAA,IACnB,QAAQ,UAAU;AAAA,IAClB,UAAU;AAAA,MACT,eAAe,iBAAiB,MAAM,KAAK,IAAI,WAAW,GAAG;AAAA,MAC7D,eAAe,MAAM;AAAA,MACrB,kBAAkB,aAAa,UAAU,OAAO,IAAI,UAAU;AAAA,IAC/D;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAgBO,SAAS,mBAA4B,QAA+B,QAA2B;AACrG,SAAO,CAAC,GAAI,OAAO,WAAW,CAAC,GAAI,GAAI,OAAO,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,MAAM,GAAG,WAAW,CAAC,CAAE;AACvG;AAGO,SAAS,qBAAqB,QAAwC;AAC5E,SAAO,QAAQ,OAAO,SAAS,MAAM,KAAK,OAAO,MAAM,KAAK,CAAC,SAAS,QAAQ,KAAK,SAAS,MAAM,CAAC;AACpG;",
6
+ "names": []
7
+ }
@@ -0,0 +1,29 @@
1
+ // src/schemas/validation/errors.ts
2
+ var ValidationRuleError = class extends Error {
3
+ ruleType;
4
+ constructor(ruleType, message, options) {
5
+ super(message, options);
6
+ this.name = "ValidationRuleError";
7
+ this.ruleType = ruleType;
8
+ }
9
+ };
10
+ var ValidationSuperseded = class extends Error {
11
+ constructor() {
12
+ super("The validation was replaced by a later one before it ran.");
13
+ this.name = "ValidationSuperseded";
14
+ }
15
+ };
16
+ var ValidationUnavailable = class extends Error {
17
+ constructor(options) {
18
+ super("The service that validates the value could not answer.", options);
19
+ this.name = "ValidationUnavailable";
20
+ }
21
+ };
22
+ var REPORTED_TEXT = "schemaEngineReportedText";
23
+
24
+ export {
25
+ ValidationRuleError,
26
+ ValidationSuperseded,
27
+ ValidationUnavailable,
28
+ REPORTED_TEXT
29
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/schemas/validation/errors.ts"],
4
+ "sourcesContent": ["/**\n * A validation rule that cannot be turned into a schema.\n *\n * @remarks\n * Thrown by `ValidationRegistry.createSchema` for a type nobody registered or a handler that throws on\n * the rule it was given. `cause` is the handler's own error.\n */\nexport class ValidationRuleError extends Error {\n\treadonly ruleType: string;\n\n\tconstructor(ruleType: string, message: string, options?: { cause?: unknown }) {\n\t\tsuper(message, options);\n\t\tthis.name = 'ValidationRuleError';\n\t\tthis.ruleType = ruleType;\n\t}\n}\n\n/**\n * Thrown by a rule's schema when the check it started was replaced before it ran, so it has no result.\n *\n * @remarks\n * Distinct from a pass and from a failure: the value was never checked, and a later check owns the answer.\n * It is state, never an issue. `validateFieldValue` reports it as `superseded`, and a caller must not take\n * the field for valid.\n */\nexport class ValidationSuperseded extends Error {\n\tconstructor() {\n\t\tsuper('The validation was replaced by a later one before it ran.');\n\t\tthis.name = 'ValidationSuperseded';\n\t}\n}\n\n/**\n * Thrown by a rule's schema when the service it asks cannot answer: a non-ok response, a network failure or a body that is not an answer.\n *\n * @remarks\n * Operational, not a field error and never cached: the value was not judged, and asking again may succeed.\n * `validateFieldValue` reports it as a `FormValidationFailure`, keeping this as its cause.\n */\nexport class ValidationUnavailable extends Error {\n\tconstructor(options?: { cause?: unknown }) {\n\t\tsuper('The service that validates the value could not answer.', options);\n\t\tthis.name = 'ValidationUnavailable';\n\t}\n}\n\n/**\n * The key of an issue's `params` under which a schema reports text that comes from outside the engine.\n *\n * @remarks\n * The library's own text for an issue (such as 'Invalid input') is never read. Text a service answered with is\n * put here by the schema, and only this reaches a registration's `message` hook.\n */\nexport const REPORTED_TEXT = 'schemaEngineReportedText';\n"],
5
+ "mappings": ";AAOO,IAAM,sBAAN,cAAkC,MAAM;AAAA,EACrC;AAAA,EAET,YAAY,UAAkB,SAAiB,SAA+B;AAC7E,UAAM,SAAS,OAAO;AACtB,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EACjB;AACD;AAUO,IAAM,uBAAN,cAAmC,MAAM;AAAA,EAC/C,cAAc;AACb,UAAM,2DAA2D;AACjE,SAAK,OAAO;AAAA,EACb;AACD;AASO,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAChD,YAAY,SAA+B;AAC1C,UAAM,0DAA0D,OAAO;AACvE,SAAK,OAAO;AAAA,EACb;AACD;AASO,IAAM,gBAAgB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,26 @@
1
+ import {
2
+ notificationPlugin
3
+ } from "./chunk-QT3EYUL5.js";
4
+ import {
5
+ logger
6
+ } from "./chunk-VGGERKV2.js";
7
+
8
+ // src/actions/plugins/notification.registration.ts
9
+ var NotificationActionRegistration = notificationPlugin({
10
+ onSuccess: (message, context) => {
11
+ logger.info(`[Success] ${message}`, { formId: context.formId });
12
+ },
13
+ onError: (message, context) => {
14
+ logger.error(`[Error] ${message}`, { formId: context.formId });
15
+ },
16
+ onWarning: (message, context) => {
17
+ logger.warn(`[Warning] ${message}`, { formId: context.formId });
18
+ },
19
+ onInfo: (message, context) => {
20
+ logger.info(`[Info] ${message}`, { formId: context.formId });
21
+ }
22
+ });
23
+
24
+ export {
25
+ NotificationActionRegistration
26
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/actions/plugins/notification.registration.ts"],
4
+ "sourcesContent": ["/**\n * Notification Action Registration\n *\n * Pre-configured notification action.\n * Register this declaration on your engine to enable the notification action type and get a default configuration.\n *\n * @example\n * ```typescript\n * import { createFormEngine, NotificationActionRegistration } from '@schema-engine/forms';\n *\n * const engine = createFormEngine({\n * actions: [NotificationActionRegistration],\n * });\n * ```\n */\n\nimport { notificationPlugin, NotificationActionSchema } from './notification.plugin';\nimport { logger } from '@/lib/logger';\nimport type { BuilderActionRegistration } from '@/types';\n\n/**\n * Default Notification Action Registration\n * Logs notifications via logger (override with toast library in your app)\n */\nexport const NotificationActionRegistration: BuilderActionRegistration<\n\t'show_notification',\n\ttypeof NotificationActionSchema\n> = notificationPlugin({\n\tonSuccess: (message, context) => {\n\t\tlogger.info(`[Success] ${message}`, { formId: context.formId });\n\t},\n\tonError: (message, context) => {\n\t\tlogger.error(`[Error] ${message}`, { formId: context.formId });\n\t},\n\tonWarning: (message, context) => {\n\t\tlogger.warn(`[Warning] ${message}`, { formId: context.formId });\n\t},\n\tonInfo: (message, context) => {\n\t\tlogger.info(`[Info] ${message}`, { formId: context.formId });\n\t},\n});\n"],
5
+ "mappings": ";;;;;;;;AAwBO,IAAM,iCAGT,mBAAmB;AAAA,EACtB,WAAW,CAAC,SAAS,YAAY;AAChC,WAAO,KAAK,aAAa,OAAO,IAAI,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAAA,EAC/D;AAAA,EACA,SAAS,CAAC,SAAS,YAAY;AAC9B,WAAO,MAAM,WAAW,OAAO,IAAI,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAAA,EAC9D;AAAA,EACA,WAAW,CAAC,SAAS,YAAY;AAChC,WAAO,KAAK,aAAa,OAAO,IAAI,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAAA,EAC/D;AAAA,EACA,QAAQ,CAAC,SAAS,YAAY;AAC7B,WAAO,KAAK,UAAU,OAAO,IAAI,EAAE,QAAQ,QAAQ,OAAO,CAAC;AAAA,EAC5D;AACD,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,118 @@
1
+ import {
2
+ fromSchemaIssues
3
+ } from "./chunk-FVOL3ZOJ.js";
4
+ import {
5
+ issueAt
6
+ } from "./chunk-LMWJAD3B.js";
7
+ import {
8
+ globalFetch
9
+ } from "./chunk-OUF57UZ7.js";
10
+ import {
11
+ defaultValidations
12
+ } from "./chunk-G33EUV7N.js";
13
+ import {
14
+ BaseValidationRuleSchema
15
+ } from "./chunk-KE53GN4Q.js";
16
+ import {
17
+ createValidationContext
18
+ } from "./chunk-KLATKWUA.js";
19
+ import {
20
+ ValidationRuleError
21
+ } from "./chunk-6BAJHAGL.js";
22
+
23
+ // src/schemas/validation/validation-registry.ts
24
+ import "zod/mini";
25
+ import { createRegistry, safeParseStandardSchema } from "@schema-engine/registry";
26
+ function deriveDefaultRules(registrations) {
27
+ const byFieldType = /* @__PURE__ */ new Map();
28
+ for (const registration of registrations) {
29
+ for (const fieldType of registration.defaultFor ?? []) {
30
+ const rules = byFieldType.get(fieldType) ?? [];
31
+ rules.push(Object.freeze({ $type: registration.$type }));
32
+ byFieldType.set(fieldType, rules);
33
+ }
34
+ }
35
+ for (const rules of byFieldType.values()) {
36
+ Object.freeze(rules);
37
+ }
38
+ return byFieldType;
39
+ }
40
+ var NO_DEFAULT_RULES = Object.freeze([]);
41
+ var COMMON_RULE_KEYS = Object.keys(BaseValidationRuleSchema.shape);
42
+ function withCommonFields(parsed, common) {
43
+ const kept = Object.fromEntries(
44
+ COMMON_RULE_KEYS.flatMap((key) => key in common && common[key] !== void 0 ? [[key, common[key]]] : [])
45
+ );
46
+ return { ...parsed, ...kept };
47
+ }
48
+ function unknownRuleMessage(type, registrations) {
49
+ const registered = registrations.map((registration) => registration.$type).join(", ");
50
+ return `Unknown validation rule '${type}'. Register it with createFormEngine({ validations: [...] }). Registered rules: ${registered}.`;
51
+ }
52
+ function createValidationRegistry(registrations, options = {}) {
53
+ const { fetch = globalFetch } = options;
54
+ const registry = createRegistry(
55
+ "Validation",
56
+ registrations
57
+ );
58
+ const defaultRulesByFieldType = deriveDefaultRules(registry.all());
59
+ const api = {
60
+ ...registry,
61
+ getDefaultRulesForFieldType: (fieldType) => defaultRulesByFieldType.get(fieldType) ?? NO_DEFAULT_RULES,
62
+ getRuleDependencies: (rule) => registry.get(rule.$type)?.dependsOn?.(rule) ?? [],
63
+ getRuleMessage: (rule, reported) => {
64
+ const registration = registry.get(rule.$type);
65
+ return registration?.message ? registration.message(rule, reported) : rule.message;
66
+ },
67
+ getRuleParams: (rule) => registry.get(rule.$type)?.params?.(rule),
68
+ getByCategory: (category) => registry.all().filter((registration) => registration.category === category),
69
+ fetch,
70
+ createSchema: (rule, context) => {
71
+ const registration = registry.get(rule.$type);
72
+ if (!registration) {
73
+ throw new ValidationRuleError(rule.$type, unknownRuleMessage(rule.$type, registry.all()));
74
+ }
75
+ try {
76
+ return registration.handler(rule, { ...context, fetch });
77
+ } catch (cause) {
78
+ throw new ValidationRuleError(rule.$type, `Validation rule '${rule.$type}' could not be built.`, {
79
+ cause
80
+ });
81
+ }
82
+ },
83
+ check: (rule) => {
84
+ const registration = registry.get(rule.$type);
85
+ if (!registration) {
86
+ return { ok: false, issues: [issueAt(["$type"], unknownRuleMessage(rule.$type, registry.all()))] };
87
+ }
88
+ const common = safeParseStandardSchema(BaseValidationRuleSchema, rule);
89
+ if (!common.success) {
90
+ return { ok: false, issues: fromSchemaIssues(common.error.issues, []) };
91
+ }
92
+ const parsed = safeParseStandardSchema(registration.schema, rule);
93
+ if (!parsed.success) {
94
+ return { ok: false, issues: fromSchemaIssues(parsed.error.issues, []) };
95
+ }
96
+ const parsedRule = withCommonFields(parsed.data, common.data);
97
+ try {
98
+ registration.handler(parsedRule, { ...createValidationContext(), fetch });
99
+ } catch (error) {
100
+ const reason = error instanceof Error ? error.message : String(error);
101
+ return {
102
+ ok: false,
103
+ issues: [issueAt(["$type"], `Validation rule '${rule.$type}' could not be built: ${reason}`)]
104
+ };
105
+ }
106
+ return { ok: true, rule: parsedRule };
107
+ }
108
+ };
109
+ return Object.freeze(api);
110
+ }
111
+ function createDefaultValidationRegistry(extra = [], options = {}) {
112
+ return createValidationRegistry([...defaultValidations, ...extra], options);
113
+ }
114
+
115
+ export {
116
+ createValidationRegistry,
117
+ createDefaultValidationRegistry
118
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/schemas/validation/validation-registry.ts"],
4
+ "sourcesContent": ["import * as z from 'zod/mini';\nimport { createRegistry, safeParseStandardSchema, type ReadOnlyRegistry } from '@schema-engine/registry';\nimport type {\n\tAnyValidationRegistration,\n\tBaseValidationRule,\n\tValidationScope,\n\tValidationRegistration,\n\tValidationRegistrationConstraint,\n} from './types.js';\nimport { defaultValidations } from './defaults.js';\nimport { BaseValidationRuleSchema } from './types.js';\nimport { ValidationRuleError } from './errors.js';\nimport { globalFetch, type FormFetch } from '@/lib/form-fetch';\nimport { issueAt, type FormValidationIssue } from '@/lib/validate-form/issues';\nimport { fromSchemaIssues } from '@/lib/validate-form/schema-issues';\nimport { createValidationContext } from './utils.js';\n\n/** @remarks Rule-specific handlers are checked where a registration is defined, then stored together by rule type. */\ntype StoredValidationRegistration = ValidationRegistration<any>;\n\n/**\n * Read-only store of validation registrations, with the lookups the renderers and the engine need.\n *\n * @remarks\n * Built by {@link createValidationRegistry}, so it has no `register`, `unregister` or `clear`: to\n * change the rules, build another registry from a new list. The per-field-type default rules are\n * derived from the registrations once, at build.\n */\nexport interface ValidationRegistry extends ReadOnlyRegistry<AnyValidationRegistration> {\n\t/**\n\t * Default rules injected for a field `$type` when the author omitted them.\n\t *\n\t * @remarks\n\t * Frozen, and shared between calls. When a registration is replaced, its default rules keep the\n\t * position the first registration of that `$type` had among the field type's defaults.\n\t */\n\tgetDefaultRulesForFieldType(fieldType: string): readonly BaseValidationRule[];\n\n\t/**\n\t * Field references a rule reads besides the value under test.\n\t *\n\t * @remarks\n\t * Lives on the registry because the answer comes from the registration, and a\n\t * consumer-registered type is a plain string that `get` would otherwise need\n\t * a cast to reach at every call site.\n\t */\n\tgetRuleDependencies(rule: { $type: string }): readonly string[];\n\n\t/** The options of a rule its registration exposes to messages (`{ minLength: 8 }`), or `undefined` when it exposes none. */\n\tgetRuleParams(rule: { $type: string }): Readonly<Record<string, unknown>> | undefined;\n\n\t/** The fallback text of an issue of a rule: its author's `message`, or what its registration takes from the schema's `reported` text. */\n\tgetRuleMessage(rule: { $type: string; message?: string }, reported: string | undefined): string | undefined;\n\n\t/** Registrations of one category. */\n\tgetByCategory(category: string): AnyValidationRegistration[];\n\n\t/**\n\t * The request function of the rules that make requests: the engine's `fetch`, or the global one for a standalone registry.\n\t *\n\t * @remarks `createSchema` hands it to every handler as `context.fetch`, whatever context the caller built.\n\t */\n\treadonly fetch: FormFetch;\n\n\t/**\n\t * Create a Zod Mini schema from a validation rule.\n\t *\n\t * @param rule - The validation rule\n\t * @param context - Form context for rules that read other fields\n\t * @throws {ValidationRuleError} When the rule type is not registered or its handler throws\n\t *\n\t * @remarks\n\t * A rule that cannot be built is never skipped: a form that silently skipped it would accept values\n\t * the author meant to reject. A config is checked with {@link ValidationRegistry.check} when it is\n\t * validated, so reaching this error at run time means the registry changed after that.\n\t *\n\t * `context` is required rather than optional so a caller cannot silently omit\n\t * it: a renderer that did exactly that is why cross-field rules were inert on\n\t * one of the two renderers. Build it with `createValidationContext`.\n\t *\n\t * The rule type is generic, not `{ $type: string }`, so a rule literal with extra properties such as\n\t * `{ $type: 'min', value: 10 }` is not rejected as an excess-property error.\n\t */\n\tcreateSchema<T extends { $type: string }>(rule: T, context: ValidationScope): z.ZodMiniType;\n\n\t/**\n\t * Whether a rule can be used, and the rule as its registration parses it.\n\t *\n\t * @remarks\n\t * The one check of a rule written in a form config: its `$type` is registered, its options satisfy the\n\t * registration's `schema`, and the handler builds a schema for it, so a rule that throws is found when\n\t * the form config is validated and not when a user first types. The registration owns the shape, so a\n\t * registration that replaces a built-in decides its options. The rule that comes back is the parsed\n\t * one, which is what the handler runs on: the schema's defaults applied, and `$type`, `message`, `id` and\n\t * `severity` kept from the authored rule even when the schema is a plain object that strips them.\n\t *\n\t * Issue paths are relative to the rule: an option the schema refuses is reported at its key, and a\n\t * `$type` nothing registers or a handler that throws at `$type`.\n\t */\n\tcheck(rule: { $type: string }): RuleCheck;\n}\n\n/** What {@link ValidationRegistry.check} found: the rule as its registration parses it, or the issues that make it unusable. */\nexport type RuleCheck =\n\t| { readonly ok: true; readonly rule: BaseValidationRule }\n\t| { readonly ok: false; readonly issues: readonly FormValidationIssue[] };\n\n/** What a validation registry is built with besides its registrations. */\nexport interface ValidationRegistryOptions {\n\t/** The request function of rules that make requests; the global `fetch` by default. */\n\treadonly fetch?: FormFetch;\n}\n\nfunction deriveDefaultRules(\n\tregistrations: readonly AnyValidationRegistration[],\n): ReadonlyMap<string, readonly BaseValidationRule[]> {\n\tconst byFieldType = new Map<string, BaseValidationRule[]>();\n\tfor (const registration of registrations) {\n\t\tfor (const fieldType of registration.defaultFor ?? []) {\n\t\t\tconst rules = byFieldType.get(fieldType) ?? [];\n\t\t\trules.push(Object.freeze({ $type: registration.$type }));\n\t\t\tbyFieldType.set(fieldType, rules);\n\t\t}\n\t}\n\tfor (const rules of byFieldType.values()) {\n\t\tObject.freeze(rules);\n\t}\n\treturn byFieldType;\n}\n\nconst NO_DEFAULT_RULES: readonly BaseValidationRule[] = Object.freeze([]);\n\nconst COMMON_RULE_KEYS = Object.keys(BaseValidationRuleSchema.shape);\n\n/**\n * The rule as its registration parsed it, with the fields every rule has put back from the authored rule.\n *\n * @remarks\n * The engine owns `$type`, `message`, `id` and `severity`: a registration whose schema is a plain object\n * strips them, which would turn a `warning` into a blocking error and lose the author's text and `id`.\n * Options and defaults stay the registration's.\n */\nfunction withCommonFields(parsed: BaseValidationRule, common: BaseValidationRule): BaseValidationRule {\n\tconst kept = Object.fromEntries(\n\t\tCOMMON_RULE_KEYS.flatMap((key) => (key in common && common[key] !== undefined ? [[key, common[key]]] : [])),\n\t);\n\treturn { ...parsed, ...kept };\n}\n\n/** Names the rule type nothing registers and the types that are, so a typo is easy to see. */\nfunction unknownRuleMessage(type: string, registrations: readonly AnyValidationRegistration[]): string {\n\tconst registered = registrations.map((registration) => registration.$type).join(', ');\n\treturn `Unknown validation rule '${type}'. Register it with createFormEngine({ validations: [...] }). Registered rules: ${registered}.`;\n}\n\n/**\n * Build a read-only validation registry from a list of registrations.\n *\n * @param registrations - Validation registrations, keyed by `$type`\n * @throws {Error} Naming the `$type` when a winning registration's schema is not a Standard Schema\n *\n * @remarks\n * Stored by `createRegistry` from `@schema-engine/registry`: a later registration with the same\n * `$type` replaces the earlier one without a warning, so `[...defaults, custom]` overrides a rule.\n * The built-in rules are not added; use {@link createDefaultValidationRegistry} for those.\n *\n * Takes {@link ValidationRegistrationConstraint}, which erases each rule type so a\n * `ValidationRegistration<PostcodeRule>` is accepted; the registrations are stored as\n * {@link AnyValidationRegistration} after that single cast.\n */\nexport function createValidationRegistry(\n\tregistrations: readonly ValidationRegistrationConstraint[],\n\toptions: ValidationRegistryOptions = {},\n): ValidationRegistry {\n\tconst { fetch = globalFetch } = options;\n\tconst registry = createRegistry<AnyValidationRegistration>(\n\t\t'Validation',\n\t\tregistrations as readonly AnyValidationRegistration[],\n\t);\n\tconst defaultRulesByFieldType = deriveDefaultRules(registry.all());\n\n\tconst api: ValidationRegistry = {\n\t\t...registry,\n\t\tgetDefaultRulesForFieldType: (fieldType) => defaultRulesByFieldType.get(fieldType) ?? NO_DEFAULT_RULES,\n\t\tgetRuleDependencies: (rule) =>\n\t\t\t(registry.get(rule.$type) as StoredValidationRegistration | undefined)?.dependsOn?.(rule) ?? [],\n\t\tgetRuleMessage: (rule, reported) => {\n\t\t\tconst registration = registry.get(rule.$type) as StoredValidationRegistration | undefined;\n\t\t\treturn registration?.message ? registration.message(rule, reported) : rule.message;\n\t\t},\n\t\tgetRuleParams: (rule) => (registry.get(rule.$type) as StoredValidationRegistration | undefined)?.params?.(rule),\n\t\tgetByCategory: (category) => registry.all().filter((registration) => registration.category === category),\n\t\tfetch,\n\t\tcreateSchema: (rule, context) => {\n\t\t\tconst registration = registry.get(rule.$type) as StoredValidationRegistration | undefined;\n\t\t\tif (!registration) {\n\t\t\t\tthrow new ValidationRuleError(rule.$type, unknownRuleMessage(rule.$type, registry.all()));\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\treturn registration.handler(rule, { ...context, fetch });\n\t\t\t} catch (cause) {\n\t\t\t\tthrow new ValidationRuleError(rule.$type, `Validation rule '${rule.$type}' could not be built.`, {\n\t\t\t\t\tcause,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcheck: (rule) => {\n\t\t\tconst registration = registry.get(rule.$type) as StoredValidationRegistration | undefined;\n\t\t\tif (!registration) {\n\t\t\t\treturn { ok: false, issues: [issueAt(['$type'], unknownRuleMessage(rule.$type, registry.all()))] };\n\t\t\t}\n\t\t\tconst common = safeParseStandardSchema(BaseValidationRuleSchema, rule);\n\t\t\tif (!common.success) {\n\t\t\t\treturn { ok: false, issues: fromSchemaIssues(common.error.issues, []) };\n\t\t\t}\n\t\t\tconst parsed = safeParseStandardSchema(registration.schema, rule);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn { ok: false, issues: fromSchemaIssues(parsed.error.issues, []) };\n\t\t\t}\n\t\t\tconst parsedRule = withCommonFields(parsed.data as BaseValidationRule, common.data);\n\t\t\ttry {\n\t\t\t\tregistration.handler(parsedRule, { ...createValidationContext(), fetch });\n\t\t\t} catch (error) {\n\t\t\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tissues: [issueAt(['$type'], `Validation rule '${rule.$type}' could not be built: ${reason}`)],\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { ok: true, rule: parsedRule };\n\t\t},\n\t};\n\treturn Object.freeze(api);\n}\n\n/**\n * The built-in rules followed by any extra registrations, so an extra registration with a built-in\n * `$type` overrides it.\n */\nexport function createDefaultValidationRegistry(\n\textra: readonly ValidationRegistrationConstraint[] = [],\n\toptions: ValidationRegistryOptions = {},\n): ValidationRegistry {\n\treturn createValidationRegistry([...defaultValidations, ...extra], options);\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ // src/schemas/validation/empty.ts
2
+ function isEmpty(value) {
3
+ return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
4
+ }
5
+
6
+ export {
7
+ isEmpty
8
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/schemas/validation/empty.ts"],
4
+ "sourcesContent": ["export function isEmpty(value: unknown): boolean {\n\treturn value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0);\n}\n"],
5
+ "mappings": ";AAAO,SAAS,QAAQ,OAAyB;AAChD,SAAO,UAAU,UAAa,UAAU,QAAQ,UAAU,MAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW;AAC3G;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ import {
2
+ FormActionTriggerSchema
3
+ } from "./chunk-CAZPWBQ4.js";
4
+ import {
5
+ fromSchemaIssues
6
+ } from "./chunk-FVOL3ZOJ.js";
7
+
8
+ // src/lib/validate-form/parse-owner-actions.ts
9
+ import { parseActions } from "@schema-engine/actions";
10
+ function parseOwnerActions(items, options, ownerPath) {
11
+ if (!items) return { issues: [] };
12
+ const result = parseActions(options, items, { triggers: FormActionTriggerSchema.options });
13
+ if (!result.success) return { issues: fromSchemaIssues(result.issues, [...ownerPath, "actions"]) };
14
+ return { issues: [], items: result.data };
15
+ }
16
+
17
+ export {
18
+ parseOwnerActions
19
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/validate-form/parse-owner-actions.ts"],
4
+ "sourcesContent": ["import { parseActions, type ParsedActionSequence } from '@schema-engine/actions';\nimport { FormActionTriggerSchema } from '@/actions/triggers';\nimport type { FormTaggedConfig } from '@/schemas/form-config';\nimport type { FormValidationIssue, Path } from './issues';\nimport type { ValidateFormOptions } from './options';\nimport { fromSchemaIssues } from './schema-issues';\n\n/**\n * Parses the `actions` of the form or of a step with {@link parseActions}, and lays the issues under `actions` at the owner.\n *\n * @remarks\n * A nested array is a group of actions that run together; its members sit one level deeper in the path.\n */\nexport function parseOwnerActions(\n\titems: Array<FormTaggedConfig | FormTaggedConfig[]> | undefined,\n\toptions: Pick<ValidateFormOptions, 'getAction'>,\n\townerPath: Path,\n): { issues: FormValidationIssue[]; items?: ParsedActionSequence } {\n\tif (!items) return { issues: [] };\n\tconst result = parseActions(options, items, { triggers: FormActionTriggerSchema.options });\n\tif (!result.success) return { issues: fromSchemaIssues(result.issues, [...ownerPath, 'actions']) };\n\treturn { issues: [], items: result.data };\n}\n"],
5
+ "mappings": ";;;;;;;;AAAA,SAAS,oBAA+C;AAajD,SAAS,kBACf,OACA,SACA,WACkE;AAClE,MAAI,CAAC,MAAO,QAAO,EAAE,QAAQ,CAAC,EAAE;AAChC,QAAM,SAAS,aAAa,SAAS,OAAO,EAAE,UAAU,wBAAwB,QAAQ,CAAC;AACzF,MAAI,CAAC,OAAO,QAAS,QAAO,EAAE,QAAQ,iBAAiB,OAAO,QAAQ,CAAC,GAAG,WAAW,SAAS,CAAC,EAAE;AACjG,SAAO,EAAE,QAAQ,CAAC,GAAG,OAAO,OAAO,KAAK;AACzC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,40 @@
1
+ import {
2
+ TypedConfigEnvelopeSchema,
3
+ createFormConfigShape,
4
+ createFormStepSchema
5
+ } from "./chunk-XQ5VJ4QO.js";
6
+
7
+ // src/schemas/form-config.ts
8
+ import * as z from "zod/mini";
9
+ var FormViewConfigSchema = z.looseObject({
10
+ $type: z.string()
11
+ });
12
+ var FormStepSchema = createFormStepSchema({
13
+ /**
14
+ * Element payloads are an existential boundary.
15
+ * @remarks The owning engine selects and validates their types by `$type`.
16
+ */
17
+ elements: z.any(),
18
+ actions: TypedConfigEnvelopeSchema
19
+ });
20
+ var FormConfigSchema = createFormConfigShape({
21
+ /**
22
+ * Element payloads are an existential boundary.
23
+ * @remarks The owning engine selects and validates their types by `$type`.
24
+ */
25
+ elements: z.any(),
26
+ view: FormViewConfigSchema,
27
+ actions: TypedConfigEnvelopeSchema
28
+ });
29
+ var formConfigEnvelopeSchema = createFormConfigShape({
30
+ elements: TypedConfigEnvelopeSchema,
31
+ view: FormViewConfigSchema,
32
+ actions: TypedConfigEnvelopeSchema
33
+ });
34
+
35
+ export {
36
+ FormViewConfigSchema,
37
+ FormStepSchema,
38
+ FormConfigSchema,
39
+ formConfigEnvelopeSchema
40
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/schemas/form-config.ts"],
4
+ "sourcesContent": ["import * as z from 'zod/mini';\nimport type { FormActionConfig } from '../actions/types';\nimport { createFormConfigShape, createFormStepSchema, TypedConfigEnvelopeSchema } from './form-config-shape';\nimport type { ElementConfig } from './field-config';\n\nexport type { FormActionConfig } from '../actions/types';\nexport { TypedConfigEnvelopeSchema } from './form-config-shape';\n\n/** Form view config for an engine's recipe map. */\nexport type FormViewConfig<TRecipes extends Record<string, unknown> = Record<string, unknown>> =\n\tstring extends keyof TRecipes\n\t\t? z.infer<typeof FormViewConfigSchema>\n\t\t: [keyof TRecipes] extends [never]\n\t\t\t? never\n\t\t\t: {\n\t\t\t\t\t[K in keyof TRecipes & string]: { readonly $type: K } & TRecipes[K] & {\n\t\t\t\t\t\t\t[key: string]: unknown;\n\t\t\t\t\t\t};\n\t\t\t\t}[keyof TRecipes & string];\n\n/**\n * Form view configuration schema.\n *\n * Recipe registrations extend this with slot-specific keys (shell, header,\n * progress, actions).\n */\nexport const FormViewConfigSchema = z.looseObject({\n\t$type: z.string(),\n});\n\n/** Form step schema for multi-step forms - now contains fields directly. */\nexport const FormStepSchema = createFormStepSchema({\n\t/**\n\t * Element payloads are an existential boundary.\n\t * @remarks The owning engine selects and validates their types by `$type`.\n\t */\n\telements: z.any(),\n\tactions: TypedConfigEnvelopeSchema,\n});\n\n/** Complete form configuration schema. */\nexport const FormConfigSchema = createFormConfigShape({\n\t/**\n\t * Element payloads are an existential boundary.\n\t * @remarks The owning engine selects and validates their types by `$type`.\n\t */\n\telements: z.any(),\n\tview: FormViewConfigSchema,\n\tactions: TypedConfigEnvelopeSchema,\n});\n\n/**\n * Envelope used by runtime validation: identity and `$type` tags only.\n * Element, recipe, and action payloads are validated separately via Standard Schema.\n */\nexport const formConfigEnvelopeSchema = createFormConfigShape({\n\telements: TypedConfigEnvelopeSchema,\n\tview: FormViewConfigSchema,\n\tactions: TypedConfigEnvelopeSchema,\n});\n\n/** Inferred view config from the runtime schema. */\nexport type FormViewConfigSchemaOutput = z.infer<typeof FormViewConfigSchema>;\n\n/** Runtime tagged config used inside the validation pipeline before narrowing. */\nexport type FormTaggedConfig = { $type: string } & Record<string, unknown>;\n\ntype InferredStep = z.infer<typeof FormStepSchema>;\ntype InferredForm = z.infer<typeof FormConfigSchema>;\n\nexport type FormConfigEnvelope = Omit<InferredForm, 'steps' | 'view' | 'actions'> & {\n\tsteps: Array<\n\t\tOmit<InferredStep, 'elements' | 'actions'> & {\n\t\t\telements: FormTaggedConfig[];\n\t\t\tactions?: Array<FormTaggedConfig | FormTaggedConfig[]>;\n\t\t}\n\t>;\n\tview?: FormViewConfig;\n\tactions?: Array<FormTaggedConfig | FormTaggedConfig[]>;\n};\n\n/** Form step config narrowed to the element and action maps of one engine. */\nexport type FormStep<\n\tTElements extends Record<string, unknown> = Record<string, unknown>,\n\tTActions extends Record<string, unknown> = Record<string, unknown>,\n> = Omit<InferredStep, 'elements' | 'actions'> & {\n\telements: Array<ElementConfig<TElements>>;\n\t/** Actions dispatched after the form's actions on every trigger while this step is current. */\n\tactions?: Array<FormActionConfig<TActions> | FormActionConfig<TActions>[]>;\n};\n\n/**\n * The settings a form config carries with defaults: authors may leave them out, and normalization fills\n * `validationMode` with `'onSubmit'`, `reValidateMode` with `'onChange'` and `navigation` with `'linear'`,\n * so a normalized config always has all three.\n */\nexport type FormValidationModes = Pick<InferredForm, 'validationMode' | 'reValidateMode' | 'navigation'>;\n\n/** Form config narrowed to one engine's registered elements, recipes, and actions. */\nexport type FormConfig<\n\tTElements extends Record<string, unknown> = Record<string, unknown>,\n\tTRecipes extends Record<string, unknown> = Record<string, unknown>,\n\tTActions extends Record<string, unknown> = Record<string, unknown>,\n> = Omit<InferredForm, 'steps' | 'view' | 'actions' | keyof FormValidationModes> &\n\tPartial<FormValidationModes> & {\n\t\tsteps: Array<FormStep<TElements, TActions>>;\n\t\tview?: FormViewConfig<TRecipes>;\n\t\tactions?: Array<FormActionConfig<TActions> | FormActionConfig<TActions>[]>;\n\t};\n"],
5
+ "mappings": ";;;;;;;AAAA,YAAY,OAAO;AA0BZ,IAAM,uBAAyB,cAAY;AAAA,EACjD,OAAS,SAAO;AACjB,CAAC;AAGM,IAAM,iBAAiB,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlD,UAAY,MAAI;AAAA,EAChB,SAAS;AACV,CAAC;AAGM,IAAM,mBAAmB,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrD,UAAY,MAAI;AAAA,EAChB,MAAM;AAAA,EACN,SAAS;AACV,CAAC;AAMM,IAAM,2BAA2B,sBAAsB;AAAA,EAC7D,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AACV,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,27 @@
1
+ import {
2
+ FormActionTriggerSchema
3
+ } from "./chunk-CAZPWBQ4.js";
4
+
5
+ // src/lib/exported-action-envelope.ts
6
+ import * as z from "zod/mini";
7
+ function withActionEnvelope(schema, type) {
8
+ const envelope = {
9
+ id: z.string().check(z.minLength(1), z.describe("Unique identifier for this action within the form.")),
10
+ $type: z.literal(type),
11
+ enabled: z.optional(z.boolean()).check(z.describe("Whether this action runs. Defaults to true.")),
12
+ triggers: z.optional(z.array(FormActionTriggerSchema)).check(z.describe("Triggers that replace the action's default triggers for this entry."))
13
+ };
14
+ if (schema._zod.def.type === "object") {
15
+ const object2 = schema;
16
+ return z.core.clone(
17
+ object2,
18
+ { ...object2._zod.def, shape: { ...envelope, ...object2._zod.def.shape } },
19
+ { parent: true }
20
+ );
21
+ }
22
+ return z.intersection(z.object(envelope), schema);
23
+ }
24
+
25
+ export {
26
+ withActionEnvelope
27
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lib/exported-action-envelope.ts"],
4
+ "sourcesContent": ["import * as z from 'zod/mini';\nimport { FormActionTriggerSchema } from '@/actions/triggers';\n\n/**\n * Adds the keys the engine owns to an action schema for a JSON Schema export.\n *\n * @remarks\n * A registration's schema lists the action's own arguments only, because `parseActions` checks `id`, `$type`,\n * `enabled` and `triggers` itself. The export is what an editor reads, so it lists them too. The result is for\n * export only: parse with the original. An object schema is cloned with the original as its parent, so the title and\n * description registered for it still apply; any other schema is intersected with the envelope.\n */\nexport function withActionEnvelope(schema: z.ZodMiniType, type: string): z.ZodMiniType {\n\tconst envelope = {\n\t\tid: z.string().check(z.minLength(1), z.describe('Unique identifier for this action within the form.')),\n\t\t$type: z.literal(type),\n\t\tenabled: z.optional(z.boolean()).check(z.describe('Whether this action runs. Defaults to true.')),\n\t\ttriggers: z\n\t\t\t.optional(z.array(FormActionTriggerSchema))\n\t\t\t.check(z.describe(\"Triggers that replace the action's default triggers for this entry.\")),\n\t};\n\tif (schema._zod.def.type === 'object') {\n\t\tconst object = schema as z.ZodMiniObject;\n\t\treturn z.core.clone(\n\t\t\tobject,\n\t\t\t{ ...object._zod.def, shape: { ...envelope, ...object._zod.def.shape } },\n\t\t\t{ parent: true },\n\t\t);\n\t}\n\treturn z.intersection(z.object(envelope), schema);\n}\n"],
5
+ "mappings": ";;;;;AAAA,YAAY,OAAO;AAYZ,SAAS,mBAAmB,QAAuB,MAA6B;AACtF,QAAM,WAAW;AAAA,IAChB,IAAM,SAAO,EAAE,MAAQ,YAAU,CAAC,GAAK,WAAS,oDAAoD,CAAC;AAAA,IACrG,OAAS,UAAQ,IAAI;AAAA,IACrB,SAAW,WAAW,UAAQ,CAAC,EAAE,MAAQ,WAAS,6CAA6C,CAAC;AAAA,IAChG,UACE,WAAW,QAAM,uBAAuB,CAAC,EACzC,MAAQ,WAAS,qEAAqE,CAAC;AAAA,EAC1F;AACA,MAAI,OAAO,KAAK,IAAI,SAAS,UAAU;AACtC,UAAMA,UAAS;AACf,WAAS,OAAK;AAAA,MACbA;AAAA,MACA,EAAE,GAAGA,QAAO,KAAK,KAAK,OAAO,EAAE,GAAG,UAAU,GAAGA,QAAO,KAAK,IAAI,MAAM,EAAE;AAAA,MACvE,EAAE,QAAQ,KAAK;AAAA,IAChB;AAAA,EACD;AACA,SAAS,eAAe,SAAO,QAAQ,GAAG,MAAM;AACjD;",
6
+ "names": ["object"]
7
+ }
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
File without changes
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }