@pilotiq/pilotiq 0.7.1 → 0.8.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 (367) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +154 -0
  3. package/CLAUDE.md +59 -3
  4. package/dist/Pilotiq.d.ts +83 -0
  5. package/dist/Pilotiq.d.ts.map +1 -1
  6. package/dist/Pilotiq.js +39 -0
  7. package/dist/Pilotiq.js.map +1 -1
  8. package/dist/actions/Action.d.ts +27 -99
  9. package/dist/actions/Action.d.ts.map +1 -1
  10. package/dist/actions/Action.js +52 -754
  11. package/dist/actions/Action.js.map +1 -1
  12. package/dist/actions/bulkFactories.d.ts +46 -0
  13. package/dist/actions/bulkFactories.d.ts.map +1 -0
  14. package/dist/actions/bulkFactories.js +144 -0
  15. package/dist/actions/bulkFactories.js.map +1 -0
  16. package/dist/actions/crudFactories.d.ts +94 -0
  17. package/dist/actions/crudFactories.d.ts.map +1 -0
  18. package/dist/actions/crudFactories.js +209 -0
  19. package/dist/actions/crudFactories.js.map +1 -0
  20. package/dist/actions/factoryHelpers.d.ts +108 -0
  21. package/dist/actions/factoryHelpers.d.ts.map +1 -0
  22. package/dist/actions/factoryHelpers.js +138 -0
  23. package/dist/actions/factoryHelpers.js.map +1 -0
  24. package/dist/actions/m2mFactories.d.ts +47 -0
  25. package/dist/actions/m2mFactories.d.ts.map +1 -0
  26. package/dist/actions/m2mFactories.js +173 -0
  27. package/dist/actions/m2mFactories.js.map +1 -0
  28. package/dist/actions/relationFactories.d.ts +93 -0
  29. package/dist/actions/relationFactories.d.ts.map +1 -0
  30. package/dist/actions/relationFactories.js +321 -0
  31. package/dist/actions/relationFactories.js.map +1 -0
  32. package/dist/elements/dispatchForm.js +1 -1
  33. package/dist/elements/dispatchForm.js.map +1 -1
  34. package/dist/elements/dispatchTable.js +1 -1
  35. package/dist/elements/dispatchTable.js.map +1 -1
  36. package/dist/fields/Field.d.ts +31 -0
  37. package/dist/fields/Field.d.ts.map +1 -1
  38. package/dist/fields/Field.js +25 -0
  39. package/dist/fields/Field.js.map +1 -1
  40. package/dist/pageData/breadcrumbs.d.ts +42 -0
  41. package/dist/pageData/breadcrumbs.d.ts.map +1 -0
  42. package/dist/pageData/breadcrumbs.js +172 -0
  43. package/dist/pageData/breadcrumbs.js.map +1 -0
  44. package/dist/pageData/forms.d.ts +137 -0
  45. package/dist/pageData/forms.d.ts.map +1 -0
  46. package/dist/pageData/forms.js +427 -0
  47. package/dist/pageData/forms.js.map +1 -0
  48. package/dist/pageData/helpers.d.ts +239 -0
  49. package/dist/pageData/helpers.d.ts.map +1 -0
  50. package/dist/pageData/helpers.js +703 -0
  51. package/dist/pageData/helpers.js.map +1 -0
  52. package/dist/pageData/misc.d.ts +76 -0
  53. package/dist/pageData/misc.d.ts.map +1 -0
  54. package/dist/pageData/misc.js +263 -0
  55. package/dist/pageData/misc.js.map +1 -0
  56. package/dist/pageData/navigation.d.ts +292 -0
  57. package/dist/pageData/navigation.d.ts.map +1 -0
  58. package/dist/pageData/navigation.js +591 -0
  59. package/dist/pageData/navigation.js.map +1 -0
  60. package/dist/pageData/relationPages.d.ts +172 -0
  61. package/dist/pageData/relationPages.d.ts.map +1 -0
  62. package/dist/pageData/relationPages.js +867 -0
  63. package/dist/pageData/relationPages.js.map +1 -0
  64. package/dist/pageData/relationTabs.d.ts +65 -0
  65. package/dist/pageData/relationTabs.d.ts.map +1 -0
  66. package/dist/pageData/relationTabs.js +258 -0
  67. package/dist/pageData/relationTabs.js.map +1 -0
  68. package/dist/pageData/resourcePages.d.ts +48 -0
  69. package/dist/pageData/resourcePages.d.ts.map +1 -0
  70. package/dist/pageData/resourcePages.js +504 -0
  71. package/dist/pageData/resourcePages.js.map +1 -0
  72. package/dist/pageData.d.ts +12 -792
  73. package/dist/pageData.d.ts.map +1 -1
  74. package/dist/pageData.js +24 -3797
  75. package/dist/pageData.js.map +1 -1
  76. package/dist/react/AppShell.d.ts +8 -0
  77. package/dist/react/AppShell.d.ts.map +1 -1
  78. package/dist/react/AppShell.js +11 -1
  79. package/dist/react/AppShell.js.map +1 -1
  80. package/dist/react/CollabExtensionFactoryRegistry.d.ts +47 -0
  81. package/dist/react/CollabExtensionFactoryRegistry.d.ts.map +1 -0
  82. package/dist/react/CollabExtensionFactoryRegistry.js +14 -0
  83. package/dist/react/CollabExtensionFactoryRegistry.js.map +1 -0
  84. package/dist/react/CollabRoomContext.d.ts +37 -0
  85. package/dist/react/CollabRoomContext.d.ts.map +1 -0
  86. package/dist/react/CollabRoomContext.js +12 -0
  87. package/dist/react/CollabRoomContext.js.map +1 -0
  88. package/dist/react/FormCollabBindingRegistry.d.ts +62 -0
  89. package/dist/react/FormCollabBindingRegistry.d.ts.map +1 -0
  90. package/dist/react/FormCollabBindingRegistry.js +14 -0
  91. package/dist/react/FormCollabBindingRegistry.js.map +1 -0
  92. package/dist/react/RecordWrapperGate.d.ts +25 -0
  93. package/dist/react/RecordWrapperGate.d.ts.map +1 -0
  94. package/dist/react/RecordWrapperGate.js +30 -0
  95. package/dist/react/RecordWrapperGate.js.map +1 -0
  96. package/dist/react/RecordWrapperRegistry.d.ts +31 -0
  97. package/dist/react/RecordWrapperRegistry.d.ts.map +1 -0
  98. package/dist/react/RecordWrapperRegistry.js +15 -0
  99. package/dist/react/RecordWrapperRegistry.js.map +1 -0
  100. package/dist/react/SchemaRenderer.d.ts +17 -23
  101. package/dist/react/SchemaRenderer.d.ts.map +1 -1
  102. package/dist/react/SchemaRenderer.js +71 -3647
  103. package/dist/react/SchemaRenderer.js.map +1 -1
  104. package/dist/react/component-slots.d.ts +103 -0
  105. package/dist/react/component-slots.d.ts.map +1 -0
  106. package/dist/react/component-slots.js +18 -0
  107. package/dist/react/component-slots.js.map +1 -0
  108. package/dist/react/fields/BuilderInput.d.ts.map +1 -1
  109. package/dist/react/fields/BuilderInput.js +21 -117
  110. package/dist/react/fields/BuilderInput.js.map +1 -1
  111. package/dist/react/fields/MarkdownInput.d.ts.map +1 -1
  112. package/dist/react/fields/MarkdownInput.js +1 -3
  113. package/dist/react/fields/MarkdownInput.js.map +1 -1
  114. package/dist/react/fields/RepeaterInput.d.ts.map +1 -1
  115. package/dist/react/fields/RepeaterInput.js +22 -127
  116. package/dist/react/fields/RepeaterInput.js.map +1 -1
  117. package/dist/react/fields/rowState.d.ts +40 -0
  118. package/dist/react/fields/rowState.d.ts.map +1 -0
  119. package/dist/react/fields/rowState.js +60 -0
  120. package/dist/react/fields/rowState.js.map +1 -0
  121. package/dist/react/fields/useRowReorderDnd.d.ts +28 -0
  122. package/dist/react/fields/useRowReorderDnd.d.ts.map +1 -0
  123. package/dist/react/fields/useRowReorderDnd.js +51 -0
  124. package/dist/react/fields/useRowReorderDnd.js.map +1 -0
  125. package/dist/react/index.d.ts +9 -0
  126. package/dist/react/index.d.ts.map +1 -1
  127. package/dist/react/index.js +8 -0
  128. package/dist/react/index.js.map +1 -1
  129. package/dist/react/layouts/SidebarLayout.d.ts +1 -1
  130. package/dist/react/layouts/SidebarLayout.d.ts.map +1 -1
  131. package/dist/react/layouts/SidebarLayout.js +10 -2
  132. package/dist/react/layouts/SidebarLayout.js.map +1 -1
  133. package/dist/react/layouts/TopbarLayout.d.ts +1 -1
  134. package/dist/react/layouts/TopbarLayout.d.ts.map +1 -1
  135. package/dist/react/layouts/TopbarLayout.js +19 -11
  136. package/dist/react/layouts/TopbarLayout.js.map +1 -1
  137. package/dist/react/parseRecordEditUrl.d.ts +29 -0
  138. package/dist/react/parseRecordEditUrl.d.ts.map +1 -0
  139. package/dist/react/parseRecordEditUrl.js +25 -0
  140. package/dist/react/parseRecordEditUrl.js.map +1 -0
  141. package/dist/react/persistedState.d.ts +19 -0
  142. package/dist/react/persistedState.d.ts.map +1 -0
  143. package/dist/react/persistedState.js +51 -0
  144. package/dist/react/persistedState.js.map +1 -0
  145. package/dist/react/schemaRenderer/AlertRenderer.d.ts +12 -0
  146. package/dist/react/schemaRenderer/AlertRenderer.d.ts.map +1 -0
  147. package/dist/react/schemaRenderer/AlertRenderer.js +61 -0
  148. package/dist/react/schemaRenderer/AlertRenderer.js.map +1 -0
  149. package/dist/react/schemaRenderer/EntryRenderer.d.ts +13 -0
  150. package/dist/react/schemaRenderer/EntryRenderer.d.ts.map +1 -0
  151. package/dist/react/schemaRenderer/EntryRenderer.js +277 -0
  152. package/dist/react/schemaRenderer/EntryRenderer.js.map +1 -0
  153. package/dist/react/schemaRenderer/SectionRenderer.d.ts +16 -0
  154. package/dist/react/schemaRenderer/SectionRenderer.d.ts.map +1 -0
  155. package/dist/react/schemaRenderer/SectionRenderer.js +62 -0
  156. package/dist/react/schemaRenderer/SectionRenderer.js.map +1 -0
  157. package/dist/react/schemaRenderer/SimpleElements.d.ts +25 -0
  158. package/dist/react/schemaRenderer/SimpleElements.d.ts.map +1 -0
  159. package/dist/react/schemaRenderer/SimpleElements.js +147 -0
  160. package/dist/react/schemaRenderer/SimpleElements.js.map +1 -0
  161. package/dist/react/schemaRenderer/TabsRenderer.d.ts +17 -0
  162. package/dist/react/schemaRenderer/TabsRenderer.d.ts.map +1 -0
  163. package/dist/react/schemaRenderer/TabsRenderer.js +31 -0
  164. package/dist/react/schemaRenderer/TabsRenderer.js.map +1 -0
  165. package/dist/react/schemaRenderer/WizardRenderer.d.ts +34 -0
  166. package/dist/react/schemaRenderer/WizardRenderer.d.ts.map +1 -0
  167. package/dist/react/schemaRenderer/WizardRenderer.js +208 -0
  168. package/dist/react/schemaRenderer/WizardRenderer.js.map +1 -0
  169. package/dist/react/schemaRenderer/action/ActionGroupTrigger.d.ts +21 -0
  170. package/dist/react/schemaRenderer/action/ActionGroupTrigger.d.ts.map +1 -0
  171. package/dist/react/schemaRenderer/action/ActionGroupTrigger.js +82 -0
  172. package/dist/react/schemaRenderer/action/ActionGroupTrigger.js.map +1 -0
  173. package/dist/react/schemaRenderer/action/ActionModalDialog.d.ts +30 -0
  174. package/dist/react/schemaRenderer/action/ActionModalDialog.d.ts.map +1 -0
  175. package/dist/react/schemaRenderer/action/ActionModalDialog.js +182 -0
  176. package/dist/react/schemaRenderer/action/ActionModalDialog.js.map +1 -0
  177. package/dist/react/schemaRenderer/action/ConfirmActionDialog.d.ts +17 -0
  178. package/dist/react/schemaRenderer/action/ConfirmActionDialog.d.ts.map +1 -0
  179. package/dist/react/schemaRenderer/action/ConfirmActionDialog.js +19 -0
  180. package/dist/react/schemaRenderer/action/ConfirmActionDialog.js.map +1 -0
  181. package/dist/react/schemaRenderer/action/HandlerActionButton.d.ts +16 -0
  182. package/dist/react/schemaRenderer/action/HandlerActionButton.d.ts.map +1 -0
  183. package/dist/react/schemaRenderer/action/HandlerActionButton.js +16 -0
  184. package/dist/react/schemaRenderer/action/HandlerActionButton.js.map +1 -0
  185. package/dist/react/schemaRenderer/action/MethodActionButton.d.ts +22 -0
  186. package/dist/react/schemaRenderer/action/MethodActionButton.d.ts.map +1 -0
  187. package/dist/react/schemaRenderer/action/MethodActionButton.js +26 -0
  188. package/dist/react/schemaRenderer/action/MethodActionButton.js.map +1 -0
  189. package/dist/react/schemaRenderer/action/buttons.d.ts +18 -0
  190. package/dist/react/schemaRenderer/action/buttons.d.ts.map +1 -0
  191. package/dist/react/schemaRenderer/action/buttons.js +74 -0
  192. package/dist/react/schemaRenderer/action/buttons.js.map +1 -0
  193. package/dist/react/schemaRenderer/action/helpers.d.ts +26 -0
  194. package/dist/react/schemaRenderer/action/helpers.d.ts.map +1 -0
  195. package/dist/react/schemaRenderer/action/helpers.js +126 -0
  196. package/dist/react/schemaRenderer/action/helpers.js.map +1 -0
  197. package/dist/react/schemaRenderer/action/renderAction.d.ts +21 -0
  198. package/dist/react/schemaRenderer/action/renderAction.d.ts.map +1 -0
  199. package/dist/react/schemaRenderer/action/renderAction.js +102 -0
  200. package/dist/react/schemaRenderer/action/renderAction.js.map +1 -0
  201. package/dist/react/schemaRenderer/columnFormat.d.ts +10 -0
  202. package/dist/react/schemaRenderer/columnFormat.d.ts.map +1 -0
  203. package/dist/react/schemaRenderer/columnFormat.js +76 -0
  204. package/dist/react/schemaRenderer/columnFormat.js.map +1 -0
  205. package/dist/react/schemaRenderer/constants.d.ts +8 -0
  206. package/dist/react/schemaRenderer/constants.d.ts.map +1 -0
  207. package/dist/react/schemaRenderer/constants.js +45 -0
  208. package/dist/react/schemaRenderer/constants.js.map +1 -0
  209. package/dist/react/schemaRenderer/form/FormRenderer.d.ts +29 -0
  210. package/dist/react/schemaRenderer/form/FormRenderer.d.ts.map +1 -0
  211. package/dist/react/schemaRenderer/form/FormRenderer.js +152 -0
  212. package/dist/react/schemaRenderer/form/FormRenderer.js.map +1 -0
  213. package/dist/react/schemaRenderer/form/renderField.d.ts +6 -0
  214. package/dist/react/schemaRenderer/form/renderField.d.ts.map +1 -0
  215. package/dist/react/schemaRenderer/form/renderField.js +239 -0
  216. package/dist/react/schemaRenderer/form/renderField.js.map +1 -0
  217. package/dist/react/schemaRenderer/helpers.d.ts +32 -0
  218. package/dist/react/schemaRenderer/helpers.d.ts.map +1 -0
  219. package/dist/react/schemaRenderer/helpers.js +52 -0
  220. package/dist/react/schemaRenderer/helpers.js.map +1 -0
  221. package/dist/react/schemaRenderer/table/CardsLayoutBody.d.ts +60 -0
  222. package/dist/react/schemaRenderer/table/CardsLayoutBody.d.ts.map +1 -0
  223. package/dist/react/schemaRenderer/table/CardsLayoutBody.js +189 -0
  224. package/dist/react/schemaRenderer/table/CardsLayoutBody.js.map +1 -0
  225. package/dist/react/schemaRenderer/table/TableRenderer.d.ts +29 -0
  226. package/dist/react/schemaRenderer/table/TableRenderer.d.ts.map +1 -0
  227. package/dist/react/schemaRenderer/table/TableRenderer.js +85 -0
  228. package/dist/react/schemaRenderer/table/TableRenderer.js.map +1 -0
  229. package/dist/react/schemaRenderer/table/TableRendererBody.d.ts +18 -0
  230. package/dist/react/schemaRenderer/table/TableRendererBody.d.ts.map +1 -0
  231. package/dist/react/schemaRenderer/table/TableRendererBody.js +555 -0
  232. package/dist/react/schemaRenderer/table/TableRendererBody.js.map +1 -0
  233. package/dist/react/schemaRenderer/table/filters.d.ts +263 -0
  234. package/dist/react/schemaRenderer/table/filters.d.ts.map +1 -0
  235. package/dist/react/schemaRenderer/table/filters.js +497 -0
  236. package/dist/react/schemaRenderer/table/filters.js.map +1 -0
  237. package/dist/react/schemaRenderer/table/formatCell.d.ts +11 -0
  238. package/dist/react/schemaRenderer/table/formatCell.d.ts.map +1 -0
  239. package/dist/react/schemaRenderer/table/formatCell.js +172 -0
  240. package/dist/react/schemaRenderer/table/formatCell.js.map +1 -0
  241. package/dist/react/schemaRenderer/table/links.d.ts +42 -0
  242. package/dist/react/schemaRenderer/table/links.d.ts.map +1 -0
  243. package/dist/react/schemaRenderer/table/links.js +55 -0
  244. package/dist/react/schemaRenderer/table/links.js.map +1 -0
  245. package/dist/react/schemaRenderer/table/renderRowActions.d.ts +13 -0
  246. package/dist/react/schemaRenderer/table/renderRowActions.d.ts.map +1 -0
  247. package/dist/react/schemaRenderer/table/renderRowActions.js +25 -0
  248. package/dist/react/schemaRenderer/table/renderRowActions.js.map +1 -0
  249. package/dist/react/schemaRenderer/table/url.d.ts +41 -0
  250. package/dist/react/schemaRenderer/table/url.d.ts.map +1 -0
  251. package/dist/react/schemaRenderer/table/url.js +114 -0
  252. package/dist/react/schemaRenderer/table/url.js.map +1 -0
  253. package/dist/routes/globals.d.ts +13 -0
  254. package/dist/routes/globals.d.ts.map +1 -0
  255. package/dist/routes/globals.js +131 -0
  256. package/dist/routes/globals.js.map +1 -0
  257. package/dist/routes/helpers.d.ts +217 -0
  258. package/dist/routes/helpers.d.ts.map +1 -0
  259. package/dist/routes/helpers.js +498 -0
  260. package/dist/routes/helpers.js.map +1 -0
  261. package/dist/routes/pages.d.ts +15 -0
  262. package/dist/routes/pages.d.ts.map +1 -0
  263. package/dist/routes/pages.js +145 -0
  264. package/dist/routes/pages.js.map +1 -0
  265. package/dist/routes/panel.d.ts +19 -0
  266. package/dist/routes/panel.d.ts.map +1 -0
  267. package/dist/routes/panel.js +191 -0
  268. package/dist/routes/panel.js.map +1 -0
  269. package/dist/routes/relations.d.ts +21 -0
  270. package/dist/routes/relations.d.ts.map +1 -0
  271. package/dist/routes/relations.js +1239 -0
  272. package/dist/routes/relations.js.map +1 -0
  273. package/dist/routes/resources.d.ts +28 -0
  274. package/dist/routes/resources.d.ts.map +1 -0
  275. package/dist/routes/resources.js +741 -0
  276. package/dist/routes/resources.js.map +1 -0
  277. package/dist/routes/theme.d.ts +12 -0
  278. package/dist/routes/theme.d.ts.map +1 -0
  279. package/dist/routes/theme.js +82 -0
  280. package/dist/routes/theme.js.map +1 -0
  281. package/dist/routes.d.ts.map +1 -1
  282. package/dist/routes.js +64 -3078
  283. package/dist/routes.js.map +1 -1
  284. package/dist/vite.d.ts +1 -0
  285. package/dist/vite.d.ts.map +1 -1
  286. package/dist/vite.js +31 -10
  287. package/dist/vite.js.map +1 -1
  288. package/package.json +2 -1
  289. package/src/Pilotiq.ts +95 -0
  290. package/src/actions/Action.ts +79 -723
  291. package/src/actions/bulkFactories.ts +168 -0
  292. package/src/actions/crudFactories.ts +220 -0
  293. package/src/actions/factoryHelpers.ts +177 -0
  294. package/src/actions/m2mFactories.ts +193 -0
  295. package/src/actions/relationFactories.ts +372 -0
  296. package/src/elements/dispatchForm.ts +1 -1
  297. package/src/elements/dispatchTable.ts +1 -1
  298. package/src/fields/Field.ts +39 -0
  299. package/src/pageData/breadcrumbs.ts +288 -0
  300. package/src/pageData/forms.ts +578 -0
  301. package/src/pageData/helpers.ts +764 -0
  302. package/src/pageData/misc.ts +347 -0
  303. package/src/pageData/navigation.ts +779 -0
  304. package/src/pageData/relationPages.ts +1246 -0
  305. package/src/pageData/relationTabs.ts +286 -0
  306. package/src/pageData/resourcePages.ts +593 -0
  307. package/src/pageData.ts +122 -4731
  308. package/src/react/AppShell.tsx +27 -1
  309. package/src/react/CollabExtensionFactoryRegistry.ts +55 -0
  310. package/src/react/CollabRoomContext.ts +42 -0
  311. package/src/react/FormCollabBindingRegistry.ts +72 -0
  312. package/src/react/RecordWrapperGate.tsx +40 -0
  313. package/src/react/RecordWrapperRegistry.ts +39 -0
  314. package/src/react/SchemaRenderer.tsx +230 -6479
  315. package/src/react/component-slots.test.ts +103 -0
  316. package/src/react/component-slots.ts +116 -0
  317. package/src/react/fields/BuilderInput.tsx +29 -117
  318. package/src/react/fields/MarkdownInput.tsx +0 -1
  319. package/src/react/fields/RepeaterInput.tsx +29 -130
  320. package/src/react/fields/rowState.ts +106 -0
  321. package/src/react/fields/useRowReorderDnd.ts +78 -0
  322. package/src/react/index.ts +38 -0
  323. package/src/react/layouts/SidebarLayout.tsx +39 -28
  324. package/src/react/layouts/TopbarLayout.tsx +70 -57
  325. package/src/react/parseRecordEditUrl.test.ts +75 -0
  326. package/src/react/parseRecordEditUrl.ts +55 -0
  327. package/src/react/persistedState.ts +40 -0
  328. package/src/react/schemaRenderer/AlertRenderer.tsx +112 -0
  329. package/src/react/schemaRenderer/EntryRenderer.tsx +501 -0
  330. package/src/react/schemaRenderer/SectionRenderer.tsx +120 -0
  331. package/src/react/schemaRenderer/SimpleElements.tsx +306 -0
  332. package/src/react/schemaRenderer/TabsRenderer.tsx +62 -0
  333. package/src/react/schemaRenderer/WizardRenderer.tsx +338 -0
  334. package/src/react/schemaRenderer/action/ActionGroupTrigger.tsx +177 -0
  335. package/src/react/schemaRenderer/action/ActionModalDialog.tsx +273 -0
  336. package/src/react/schemaRenderer/action/ConfirmActionDialog.tsx +61 -0
  337. package/src/react/schemaRenderer/action/HandlerActionButton.tsx +43 -0
  338. package/src/react/schemaRenderer/action/MethodActionButton.tsx +64 -0
  339. package/src/react/schemaRenderer/action/buttons.tsx +99 -0
  340. package/src/react/schemaRenderer/action/helpers.ts +140 -0
  341. package/src/react/schemaRenderer/action/renderAction.tsx +245 -0
  342. package/src/react/schemaRenderer/columnFormat.ts +65 -0
  343. package/src/react/schemaRenderer/constants.ts +50 -0
  344. package/src/react/schemaRenderer/form/FormRenderer.tsx +233 -0
  345. package/src/react/schemaRenderer/form/renderField.tsx +511 -0
  346. package/src/react/schemaRenderer/helpers.tsx +81 -0
  347. package/src/react/schemaRenderer/table/CardsLayoutBody.tsx +308 -0
  348. package/src/react/schemaRenderer/table/TableRenderer.tsx +123 -0
  349. package/src/react/schemaRenderer/table/TableRendererBody.tsx +974 -0
  350. package/src/react/schemaRenderer/table/filters.tsx +1233 -0
  351. package/src/react/schemaRenderer/table/formatCell.tsx +264 -0
  352. package/src/react/schemaRenderer/table/links.tsx +112 -0
  353. package/src/react/schemaRenderer/table/renderRowActions.tsx +52 -0
  354. package/src/react/schemaRenderer/table/url.tsx +143 -0
  355. package/src/routes/globals.ts +154 -0
  356. package/src/routes/helpers.ts +668 -0
  357. package/src/routes/pages.ts +173 -0
  358. package/src/routes/panel.ts +204 -0
  359. package/src/routes/relations.ts +1219 -0
  360. package/src/routes/resources.ts +786 -0
  361. package/src/routes/theme.ts +109 -0
  362. package/src/routes.test.ts +1 -1
  363. package/src/routes.ts +64 -3176
  364. package/src/schema/TableWidget.test.ts +2 -2
  365. package/src/theme/migrate.test.ts +178 -0
  366. package/src/vite.test.ts +184 -0
  367. package/src/vite.ts +31 -9
@@ -1,794 +1,15 @@
1
- /**
2
- * Per-page-role data builders. The framework's GET route handlers and
3
- * Vike's auto-generated `+data.ts` hooks both call these to produce the
4
- * exact props the page renderer needs.
5
- *
6
- * Why this exists: SSR runs through the rudder router (which calls
7
- * `view(...)` and populates `pageContext.viewProps`). SPA navigation only
8
- * triggers Vike's `+data` hook the rudder handler doesn't run, so the
9
- * data needs to come from the same builder. Routing both paths through a
10
- * single builder keeps them in sync.
11
- */
12
- import type { Pilotiq } from './Pilotiq.js';
13
- import type { Page } from './Page.js';
14
- import type { ResourceClass, NavigationBadgeColor } from './Resource.js';
15
- import type { GlobalClass } from './Global.js';
16
- import { Element, type ElementMeta } from './schema/Element.js';
17
- import { type RenderContext, type SchemaContext } from './schema/resolveSchema.js';
18
- import { Form } from './elements/Form.js';
19
- import { type GlobalSearchResult } from './search.js';
20
- import type { ThemeMeta } from './theme/types.js';
21
- import { type SerializedIcon } from './icons/types.js';
22
- import type { UserMenuItemMeta } from './UserMenuItem.js';
23
- import { RelationManager, safeManagerPolicy as safeManagerPolicyImpl, type ManagerCanMethod as ManagerCanMethodType } from './RelationManager.js';
24
- import { type RenderHookMap, type RenderHookName } from './RenderHook.js';
25
- import { type PageRole } from './applyPageHooks.js';
26
- import { type ModelLike } from './orm/modelDefaults.js';
27
- import { type RelationMode } from './RelationManager.js';
28
- /**
29
- * Top-right user dropdown shipped to the renderer in `viewProps.panel`.
30
- * `null` when no `Pilotiq.user(req => …)` resolver is configured or the
31
- * resolver returns `null` (no logged-in user) — the renderer suppresses
32
- * the dropdown entirely in that case.
33
- *
34
- * `user.name / user.email / user.avatar` are duck-typed off the
35
- * resolver's return value; whichever fields are present round-trip into
36
- * the dropdown trigger (initials fall back to the first two letters of
37
- * `name` when no avatar URL is set).
38
- */
39
- export interface UserMenuMeta {
40
- user: {
41
- name?: string;
42
- email?: string;
43
- avatar?: string;
44
- };
45
- items: UserMenuItemMeta[];
46
- signOut?: {
47
- url: string;
48
- label: string;
49
- method: 'POST' | 'GET';
50
- };
51
- }
52
- /**
53
- * Bell-icon dropdown configuration shipped under `viewProps.panel`. Sparse —
54
- * absent when `Pilotiq.databaseNotifications()` wasn't called OR when no
55
- * user resolves (anonymous request → no inbox to surface). Renderer mounts
56
- * the bell only when this is set.
57
- *
58
- * Routes are absolute URLs (panel `basePath` already applied). Client
59
- * substitutes `:id` per row when calling read / unread; `_widget`-style
60
- * params aren't used here because the bell only ever issues these four
61
- * fetch shapes.
62
- *
63
- * `polling` mirrors `DatabaseNotificationsConfig.polling` — `null` ships
64
- * over the wire to disable client-side polling. The bell still fetches on
65
- * mount + after every mark-read mutation.
66
- */
67
- export interface DatabaseNotificationsMeta {
68
- position: 'topbar' | 'sidebar';
69
- polling: number | null;
70
- pageSize: number;
71
- badgeColor: NavigationBadgeColor;
72
- trigger?: {
73
- icon?: string;
74
- label?: string;
75
- };
76
- listUrl: string;
77
- readAllUrl: string;
78
- /** Template URL with literal `:id` placeholder. Client replaces. */
79
- readUrl: string;
80
- /** Template URL with literal `:id` placeholder. Client replaces. */
81
- unreadUrl: string;
82
- /**
83
- * Template URL for the notification-action dispatch endpoint with
84
- * literal `:id` and `:actionName` placeholders. Bell client builds
85
- * per-action URLs by substituting both at render time. Used only by
86
- * `handler`-mode actions; `url` / `post` actions ride their own URL
87
- * verbatim.
88
- */
89
- actionUrl: string;
90
- /**
91
- * Phase 2 — broadcast hint. Sparse — absent when
92
- * `databaseNotifications({ broadcast: true })` wasn't set OR when no
93
- * resolved user has an `id` to scope the channel to.
94
- *
95
- * Client connects to `wsUrl` via `@rudderjs/broadcast`'s
96
- * `RudderSocket`, subscribes to the `channel` (already includes the
97
- * `private-` prefix), and listens for `event` to trigger refetches.
98
- */
99
- broadcast?: {
100
- wsUrl: string;
101
- channel: string;
102
- event: string;
103
- };
104
- }
105
- /**
106
- * Right-sidebar shipped under `viewProps.panel.rightSidebar`. Sparse —
107
- * absent from `panelInfo()` when no contributions are registered, every
108
- * registered contribution failed `canAccess(user)`, or every visible
109
- * contribution is `hidden: true`. Renderer mounts the chrome only when
110
- * this is set.
111
- *
112
- * The React component reference for each contribution does NOT travel
113
- * here — only its tab-strip metadata. The actual body component is
114
- * resolved client-side from the Vite plugin's `_components.ts` manifest
115
- * keyed by contribution `id`, mirroring the icon-class round-trip.
116
- *
117
- * `defaultWidth` rolls up: contribution-level value when one
118
- * contribution was registered with one, otherwise the panel-level
119
- * baseline (`RIGHT_PANEL_DEFAULT_WIDTH`). Client also clamps
120
- * localStorage values to `[minWidth, maxWidth]`.
121
- */
122
- export interface RightPanelMeta {
123
- id: string;
124
- label: string;
125
- icon?: SerializedIcon;
126
- defaultWidth: number;
127
- }
128
- export interface RightSidebarMeta {
129
- panels: RightPanelMeta[];
130
- defaultWidth: number;
131
- minWidth: number;
132
- maxWidth: number;
133
- }
134
- /**
135
- * Single nav-tree entry. `name` is the JS class name (`R.name` /
136
- * `G.name` / `P.name`) — also the lookup key into the build-time
137
- * `_components.ts` manifest the Vite plugin emits, so component-typed
138
- * icons resolve from the same identifier.
139
- */
140
- export interface NavItem {
141
- name: string;
142
- label: string;
143
- url: string;
144
- icon?: SerializedIcon;
145
- group?: string;
146
- sort?: number;
147
- badge?: string;
148
- badgeColor?: NavigationBadgeColor;
149
- children?: NavItem[];
150
- }
151
- /**
152
- * Build the panel header summary + the unified navigation tree.
153
- *
154
- * Pipeline:
155
- * 1. flatten resources + globals + pages into raw NavItem records
156
- * 2. drop items whose `canAccess(user)` (Plan #10) returns false
157
- * 3. resolve `navigationParentItem` references → nest under parents
158
- * (cycles broken with a console warn; dangling parents render at top level)
159
- * 4. sort within each grouping (top-level *and* every parent's children)
160
- * by `navigationSort` ascending → registration order
161
- * 5. resolve every `navigationBadge()` in parallel via `Promise.all`;
162
- * handler errors are swallowed (badge omitted) so a flaky count
163
- * never blanks the page
164
- *
165
- * `req` is the active request; pilotiq calls `pilotiq.resolveUser(req)`
166
- * once and threads the user into every Resource/Global/Page `canAccess`
167
- * check. When `Pilotiq.user(fn)` isn't configured, user is `null` and the
168
- * default `canAccess` returns true → no items dropped.
169
- */
170
- /**
171
- * Optional route-context for `panelInfo()`. When set, render-hook
172
- * `scope: { resource | page | global }` filters fire correctly for the
173
- * active route. Missing keys mean the slot has no scope-able identifier
174
- * (chrome-only routes); scope-less hooks still fire either way.
175
- *
176
- * `url` defaults to `cfg.path` when unset. `recordId` rides through to
177
- * `RenderHookContext.recordId` for hooks that need it.
178
- */
179
- export interface PanelInfoRoute {
180
- resource?: ResourceClass;
181
- page?: typeof Page;
182
- global?: GlobalClass;
183
- recordId?: string;
184
- url?: string;
185
- }
186
- export declare function panelInfo(pilotiq: Pilotiq, req?: unknown, route?: PanelInfoRoute): Promise<{
187
- aiSuggestionsMode?: "review";
188
- renderHooks?: Partial<Record<RenderHookName, ElementMeta[]>>;
189
- rightSidebar?: RightSidebarMeta;
190
- databaseNotifications?: DatabaseNotificationsMeta;
191
- userMenu?: UserMenuMeta;
192
- name: string;
193
- branding: {
194
- title?: string;
195
- logo?: string;
196
- };
197
- navigation: NavItem[];
198
- theme: ThemeMeta | undefined;
199
- themeEditor: boolean;
200
- }>;
201
- /**
202
- * Resolve a subset of page-role render hooks (e.g. `panels::page.start`
203
- * + the list-records / create-record / view-record / edit-record /
204
- * global-search slot families). Per-page-role data builders call this
205
- * after schema resolution and stamp the result on `viewProps.renderHooks`.
206
- *
207
- * `names` lets each builder declare exactly which slots it serves so a
208
- * list-page builder doesn't ship slots that only fire on the edit page.
209
- */
210
- /**
211
- * Per-builder one-shot — resolve the role's slot set + splice the
212
- * results into the resolved schema. Wraps the two steps a per-builder
213
- * data fn always does in lockstep:
214
- *
215
- * 1. `resolvePageHooks(pilotiq, user, pageHooksFor(role), route)`
216
- * 2. `applyPageHooks(schemaData, hooks, role)`
217
- *
218
- * Returns the wrapped `ElementMeta[]`. No-op when the panel has no
219
- * registered hooks. Pass through what you'd pass to `panelInfo()`'s
220
- * route arg — same shape.
221
- */
222
- export declare function applyRoleHooks(pilotiq: Pilotiq, user: unknown, role: PageRole, schemaData: ElementMeta[], route?: PanelInfoRoute): Promise<ElementMeta[]>;
223
- export declare function resolvePageHooks(pilotiq: Pilotiq, user: unknown, names: readonly RenderHookName[], route: PanelInfoRoute): Promise<RenderHookMap>;
224
- export declare function callPageSchema(PageClass: typeof Page, ctx: SchemaContext): Promise<Element[]>;
225
- /** Mark every Form on the page with its action URL so the rendered <form> posts to itself. */
226
- export declare function tagFormActions(elements: ReadonlyArray<Element>, action: string): void;
227
- /**
228
- * Plan #5 — stamp the partial-resolve endpoint URL on every form whose
229
- * descendants include at least one `live()` field. The client uses
230
- * `FormMeta.stateUrl` to flip into controlled-state mode; forms without
231
- * any live fields stay uncontrolled (zero-cost legacy path).
232
- *
233
- * `urlBuilder(formId)` lets the caller compose a per-form URL — the
234
- * endpoint shape is `${base}/${slug}/_form/${formId}/state` so each
235
- * form on a multi-form page gets its own route segment.
236
- */
237
- export declare function tagFormStateUrls(elements: ReadonlyArray<Element>, urlBuilder: (formId: string) => string): void;
238
- /**
239
- * Reorderable rows — stamp the POST-reorder URL on every `Table` that
240
- * has `Table.reorderable()` set. The renderer reads `TableMeta.reorderUrl`
241
- * to wire the drop handler; tables that aren't reorderable skip wiring
242
- * entirely. Same shape as `tagFormStateUrls` so the call site stays
243
- * consistent.
244
- */
245
- export declare function tagTableReorderUrls(elements: ReadonlyArray<Element>, url: string): void;
246
- export declare function tagTableDeferred(elements: ReadonlyArray<Element>, url: string): void;
247
- /**
248
- * Editable cell columns — walk every table on the page and stamp
249
- * `_cellEditUrls[colName]` per row, but only on rows that already
250
- * carry a `_cellEditable[colName]` marker (set by `loadTableRecords`
251
- * after `R.canEdit(user, row)` passed). The dispatcher stays
252
- * URL-shape-agnostic; URL building lives here parallel to
253
- * `tagFormStateUrls / tagTableReorderUrls`.
254
- *
255
- * `idOf` extracts the per-row primary key. Defaults to reading `id` —
256
- * works for the rudder ORM convention. Resources with a different
257
- * primary-key column should pass an override (none in v1).
258
- */
259
- export declare function tagCellEditUrls(elements: ReadonlyArray<Element>, resourceUrl: string, idOf?: (row: Record<string, unknown>) => unknown): void;
260
- /**
261
- * Plan #8 — stamp the wizard step-validate endpoint URL on every form
262
- * whose descendants include a `Wizard` element. `FormMeta.wizardUrl` is
263
- * what the client posts to on Next-button clicks; forms without a wizard
264
- * descendant skip wiring.
265
- */
266
- export declare function tagFormWizardUrls(elements: ReadonlyArray<Element>, urlBuilder: (formId: string) => string): void;
267
- /**
268
- * Stamp `_agentRunBase` on every field element in the resolved
269
- * `ElementMeta[]` tree that carries `aiActions`. Operates on the
270
- * post-`resolveSchema` wire shape (plain objects) rather than on
271
- * `Element` instances — `aiActions` is added by the `field-ai.ts`
272
- * wrapper during `toMeta()`, so it isn't visible to pre-resolve walkers.
273
- *
274
- * Only called on edit pages where a `recordId` is known. Create pages
275
- * deliberately skip it — field AI actions target existing content.
276
- */
277
- export declare function tagFieldAiUrls(elements: ReadonlyArray<Record<string, unknown>>, agentBase: string): void;
278
- /**
279
- * Audit row 2026-05-07 cont'd⁸ — stamp the inline-create-option endpoint
280
- * URL on every `SelectField` that has called `createOptionForm()`. Walks
281
- * every form on the page so the URL carries the parent form's id; URL
282
- * shape `${formScopeUrl}/_form/${formId}/create-option/${fieldName}` so
283
- * the route handler can pick the form by id and the field by name.
284
- *
285
- * Mirrors `tagFormStateUrls / tagFormWizardUrls` — operates on the
286
- * un-resolved Element tree, mutates field-instance state via
287
- * `field.withCreateOptionUrl(url)`, and the field's `toMeta()` reads it
288
- * back to emit `createOption.url`.
289
- *
290
- * Stops at Repeater / Builder boundaries (parallel to the form-state /
291
- * wizard walkers): inside-row schemas are dispatched per-row and the
292
- * createOption shape doesn't compose with row body coercion in v1.
293
- */
294
- export declare function tagSelectCreateOptionUrls(elements: ReadonlyArray<Element>, urlBuilder: (formId: string, fieldName: string) => string): void;
295
- export declare function tagRichTextMentionUrls(elements: ReadonlyArray<Element>, urlBuilder: (formId: string) => string): void;
296
- /**
297
- * Run the edit-mode fill pipeline on a loaded record:
298
- * mutateFormDataBeforeFill → fillFromRecord → mutateFormDataAfterFill
299
- *
300
- * `fillFromRecord` defaults to `{ ...record }` when not configured. Both
301
- * mutators are optional and may be async. `ctx.record` is the loaded
302
- * record so mutators can read from fields the form doesn't surface.
303
- */
304
- export declare function applyFillPipeline<R>(form: Form<R>, record: R): Promise<Record<string, unknown>>;
305
- /**
306
- * Walk the form's top-level Repeaters and replace `values[fieldName]`
307
- * with rows fetched from `parent.related(name)` for any
308
- * relationship-backed Repeater. Each loaded row stamps `__id` to the
309
- * child's primary key so the renderer can round-trip identity through
310
- * a hidden input and the save-side diff can match submitted rows back
311
- * to existing records.
312
- *
313
- * No-op when the parent record is null (create mode), when no
314
- * relationship-backed Repeaters exist on the form, or when the
315
- * resource has no `R.model` (relation queries need it).
316
- *
317
- * Mutates and returns a fresh values object — never the input.
318
- */
319
- export declare function applyRelationshipRepeaterFill(form: Form, values: Record<string, unknown>, record: unknown, parentModel: ModelLike | undefined): Promise<Record<string, unknown>>;
320
- /**
321
- * Walk the form's top-level Builders and replace `values[fieldName]` with
322
- * rows fetched from `parent.related(name)` for any relationship-backed
323
- * Builder. Each loaded row stamps `__id` (child PK) + `type` (block
324
- * discriminator) + `data` (per-block JSON payload) so the renderer can
325
- * round-trip the heterogeneous envelope.
326
- *
327
- * Mirrors `applyRelationshipRepeaterFill`. No-op when the parent record
328
- * is null (create mode), the resource has no `R.model`, or no
329
- * relationship-backed Builders exist on the form.
330
- */
331
- export declare function applyRelationshipBuilderFill(form: Form, values: Record<string, unknown>, record: unknown, parentModel: ModelLike | undefined): Promise<Record<string, unknown>>;
332
- /** Wire-shape of the per-widget data map shipped to the client.
333
- * Lazy elements stamp `null` (renderer paints skeleton + fetches);
334
- * eager elements stamp their resolved payload. Errors stamp
335
- * `{ error: '<message>' }` so the renderer can surface a per-widget
336
- * failure without blanking the page. */
337
- export type ServerDataMap = Record<string, unknown>;
338
- /**
339
- * Plan #15 — collect every `ServerDataElement` in the schema tree and
340
- * resolve their `getServerData(ctx)` payloads in parallel. Returns a
341
- * map keyed by element id, ready to ship as `viewProps._widgetData`.
342
- *
343
- * Lazy elements (default — `lazy(false)` opts out) skip the hook and
344
- * stamp `null` so the renderer paints a skeleton and fetches the
345
- * payload via `POST {base}/_widget/:id` on mount. Eager elements
346
- * resolve synchronously and ship the data with the page.
347
- *
348
- * Per-widget errors are caught and surfaced as `{ error: '...' }` —
349
- * one flaky `getStats()` shouldn't 500 the entire dashboard.
350
- *
351
- * Visibility is **not** re-evaluated here. The schema resolver
352
- * (`resolveSchema → evaluateVisibility`) drops hidden layout elements
353
- * before any widget code runs. Widgets inside still-rendered branches
354
- * always resolve (or stamp lazy null).
355
- */
356
- export declare function resolveServerDataElements(elements: ReadonlyArray<Element>, ctx: RenderContext): Promise<ServerDataMap>;
357
- /**
358
- * Plan #15 — stamp the polling-endpoint URL on every `ServerDataElement`
359
- * in the tree. Mirrors `tagFormStateUrls / tagTableReorderUrls`. Walks
360
- * with the same boundaries as `collectServerDataElements` so the wire
361
- * stays in sync (no orphan widgets without URLs and vice versa).
362
- *
363
- * `urlBuilder(id)` typically produces `${base}/_widget/${id}` for
364
- * dashboard widgets and `${base}/${pageSlug}/_widget/${id}` for
365
- * custom-page widgets — the route handlers for both shapes are wired up
366
- * in `routes.ts` (see Phase A.4).
367
- */
368
- export declare function tagWidgetUrls(elements: ReadonlyArray<Element>, urlBuilder: (id: string) => string): void;
369
- /** Stamp dispatchUrl on every handler-style Action so the client knows where to POST. */
370
- export declare function tagActionDispatch(elements: ReadonlyArray<Element>, baseUrl: string): void;
371
- export declare function dashboardData(pilotiq: Pilotiq, req?: unknown): Promise<Record<string, unknown>>;
372
- export declare function resourceIndexData(pilotiq: Pilotiq, slug: string, query?: Record<string, string>, req?: unknown): Promise<Record<string, unknown> | null>;
373
- export declare function resourceTableData(pilotiq: Pilotiq, slug: string, query?: Record<string, string>, req?: unknown): Promise<{
374
- tables: Record<string, unknown>[];
375
- } | null>;
376
- /**
377
- * Walk the schema for `ListTabs` containers, pick the active tab from
378
- * `?tab=…` (defaulting to the tab marked `.default()` or the first one),
379
- * stamp render-time state (`active` flag, per-tab `?tab=` URL, and
380
- * resolved badge counts) onto each tab. The active tab's query/context
381
- * modifier is NOT applied here — `loadTableRecords` walks for the active
382
- * tab and splices in its modifier when it builds the records-handler
383
- * `TableContext`.
384
- *
385
- * No-op when the page has no `ListTabs`.
386
- */
387
- export declare function resolveActiveTab(elements: ReadonlyArray<Element>, query: Record<string, string>, currentPath: string): Promise<void>;
388
- export declare function resourceCreateData(pilotiq: Pilotiq, slug: string, prefill?: {
389
- values?: Record<string, unknown>;
390
- errors?: Record<string, string[]>;
391
- }, req?: unknown): Promise<Record<string, unknown> | null>;
392
- export declare function resourceEditData(pilotiq: Pilotiq, slug: string, recordId: string, prefill?: {
393
- values?: Record<string, unknown>;
394
- errors?: Record<string, string[]>;
395
- }, req?: unknown): Promise<Record<string, unknown> | null>;
396
- /**
397
- * Plan #11 — three scopes a single relation-manager URL space resolves to:
398
- *
399
- * list: GET {base}/{slug}/:id/{rel}
400
- * create: GET {base}/{slug}/:id/{rel}/create
401
- * edit: GET {base}/{slug}/:id/{rel}/{childId}/edit
402
- *
403
- * Each carries enough state for `relationManagerData` to load the right
404
- * parent + (for edit) child + form/table context. Submit-side handlers
405
- * live in `routes.ts` and reuse `dispatchFormSubmit`.
406
- */
407
- export type RelationManagerScope = {
408
- kind: 'relation-list';
409
- slug: string;
410
- recordId: string;
411
- relationship: string;
412
- query?: Record<string, string>;
413
- } | {
414
- kind: 'relation-create';
415
- slug: string;
416
- recordId: string;
417
- relationship: string;
418
- prefill?: {
419
- values?: Record<string, unknown>;
420
- errors?: Record<string, string[]>;
421
- };
422
- } | {
423
- kind: 'relation-view';
424
- slug: string;
425
- recordId: string;
426
- relationship: string;
427
- childId: string;
428
- } | {
429
- kind: 'relation-edit';
430
- slug: string;
431
- recordId: string;
432
- relationship: string;
433
- childId: string;
434
- prefill?: {
435
- values?: Record<string, unknown>;
436
- errors?: Record<string, string[]>;
437
- };
438
- } | {
439
- kind: 'nested-relation-list';
440
- slug: string;
441
- chain: [RelationChainStep, RelationChainStep];
442
- query?: Record<string, string>;
443
- } | {
444
- kind: 'nested-relation-create';
445
- slug: string;
446
- chain: [RelationChainStep, RelationChainStep];
447
- prefill?: {
448
- values?: Record<string, unknown>;
449
- errors?: Record<string, string[]>;
450
- };
451
- } | {
452
- kind: 'nested-relation-view';
453
- slug: string;
454
- chain: [RelationChainStep, RelationChainStep];
455
- childId: string;
456
- } | {
457
- kind: 'nested-relation-edit';
458
- slug: string;
459
- chain: [RelationChainStep, RelationChainStep];
460
- childId: string;
461
- prefill?: {
462
- values?: Record<string, unknown>;
463
- errors?: Record<string, string[]>;
464
- };
465
- };
466
- /** Phase B — one parent layer in a nested-resources URL chain. The list
467
- * of these identifies a path through the manager tree:
468
- * `[ { recordId: '123', relationship: 'comments' } ]` picks comment
469
- * "456 under post 123" when paired with `childId: '456'`. */
470
- export interface RelationChainStep {
471
- recordId: string;
472
- relationship: string;
473
- }
474
- /**
475
- * Failure outcomes the data builder discriminates back to the route
476
- * handler, which decides between 403 / 404 / HTML / JSON shapes.
477
- *
478
- * `null` — unknown panel / parent / manager / child;
479
- * route returns 404
480
- * `{ ok: false, status: 403 }` — policy denied; route returns 403
481
- *
482
- * Success returns the schemaData payload directly (a record, not
483
- * tagged) for parity with `resourceIndexData / resourceCreateData`.
484
- */
485
- export type RelationManagerResult = Record<string, unknown> | {
486
- ok: false;
487
- status: 403;
488
- } | null;
489
- /**
490
- * Discover the related Resource for a manager. Order:
491
- * 1. `M.relatedResource` explicit override (skip discovery).
492
- * 2. Rudder ORM convention: walk
493
- * `R.model.relations[manager.relationship].model()` and find
494
- * `cfg.resources[i].model === relatedModel`.
495
- * 3. Otherwise undefined — caller must error or fall back.
496
- *
497
- * A returned Resource is the one whose `model` backs the related
498
- * table. Callers use it for `Related.model.find(childId)`,
499
- * `Related.canEdit(user, child)`, and the auto-wired form save handler.
500
- */
501
- export declare function findRelatedResource(M: typeof RelationManager, R: ResourceClass, cfg: ReturnType<Pilotiq['getConfig']>): ResourceClass | undefined;
502
- /** Plan #11 — authorization predicate names a `RelationManager` carries.
503
- * Re-exported from `RelationManager.ts`. */
504
- export type ManagerCanMethod = ManagerCanMethodType;
505
- /** Plan #11 — authorize a relation-manager action with sensible defaults.
506
- * Re-exported from `RelationManager.ts` so external callers (route
507
- * handlers, third-party plugins) keep their existing import path. */
508
- export declare const safeManagerPolicy: typeof safeManagerPolicyImpl;
509
- /**
510
- * Plan #11 — render data for the three relation-manager URL scopes.
511
- * Mirrors the resource* builders' shape so routes and Vike +data hooks
512
- * consume identical props. Authorization runs inline (parent
513
- * `canAccess + canEdit(parent)` then manager-scoped predicate); IDOR
514
- * check on `relation-edit` runs against the parent's relation query.
515
- *
516
- * Returns:
517
- * - `null` when panel / parent / manager / child don't exist.
518
- * - `{ ok: false, status: 403 }` when authorization denies.
519
- * - the props record on success (route picks SSR view / SPA prop
520
- * downstream).
521
- */
522
- export declare function relationManagerData(pilotiq: Pilotiq, scope: RelationManagerScope, req?: unknown): Promise<RelationManagerResult>;
523
- /**
524
- * Phase B — narrow `scope` discriminator for nested-relation-*. Lets
525
- * the helpers below avoid restating the union for every parameter.
526
- */
527
- type NestedRelationScope = Extract<RelationManagerScope, {
528
- kind: `nested-relation-${string}`;
529
- }>;
530
- /**
531
- * Phase B — chain walk result. Resolved layer-by-layer in
532
- * `resolveRelationChain`; nested builders consume it. Failures bubble
533
- * up as the same `{ ok: false, status: 403 }` / `null` shape the
534
- * depth-1 path uses.
535
- */
536
- export interface ResolvedChain {
537
- R: ResourceClass;
538
- parentRecord: unknown;
539
- M1: typeof RelationManager;
540
- Related1: ResourceClass;
541
- child1: unknown;
542
- child1Mode: RelationMode;
543
- M2: typeof RelationManager;
544
- Related2: ResourceClass | undefined;
545
- child2Mode: RelationMode;
546
- }
547
- /**
548
- * Phase B — resolve a depth-2 chain, running every auth + IDOR layer:
549
- * Layer 0 — top-level Resource: cluster gate, R.canAccess.
550
- * Layer 1 — parent record: R.canEdit(parent) (Phase A gate to manage relations).
551
- * Layer 2 — first manager M1: relationship discovered, related resource discovered.
552
- * IDOR #1 — child1 (the leaf parent) must belong to parentRecord under chain[0].relationship.
553
- * Layer 3 — M1.canView(child1, parent) (Filament-style: must be allowed
554
- * to view the child to drill into its sub-relations).
555
- * Layer 4 — second manager M2 lookup; relation type read off Related1.model.
556
- *
557
- * The leaf manager's per-scope predicate (canViewAny / canCreate /
558
- * canView / canEdit) runs inside the per-scope builders below, since
559
- * each predicate has different arguments.
560
- */
561
- export declare function resolveRelationChain(pilotiq: Pilotiq, scope: NestedRelationScope, user: unknown): Promise<ResolvedChain | {
562
- ok: false;
563
- status: 403;
564
- } | null>;
565
- export type FormStateScope = {
566
- kind: 'resource-create';
567
- slug: string;
568
- } | {
569
- kind: 'resource-edit';
570
- slug: string;
571
- recordId: string;
572
- } | {
573
- kind: 'global-edit';
574
- slug: string;
575
- } | {
576
- kind: 'page';
577
- pageSlug: string;
578
- };
579
- export interface FormStateRequest {
580
- formId: string;
581
- changed: string;
582
- values: Record<string, unknown>;
583
- }
584
- export interface FormStateResult {
585
- ok: true;
586
- form: Record<string, unknown>;
587
- dirty: string[];
588
- }
589
- export interface FormStateError {
590
- ok: false;
591
- status: 404 | 422;
592
- error: string;
593
- }
594
- /**
595
- * Plan #5 — handle a partial-resolve roundtrip from a `live()` field.
596
- *
597
- * Locates the page's schema, finds the targeted form by `formId`, runs
598
- * `applyStateUpdate` to apply the changed value + run
599
- * `afterStateUpdated`, then re-resolves the form's children with the
600
- * mutated values + bound `$get / $set` so dependent options /
601
- * conditional visibility re-evaluate. Returns the resolved FormMeta the
602
- * client uses to replace its rendered form.
603
- *
604
- * Returns `null` when the route prefix doesn't resolve to a real
605
- * resource/global/page — the route handler turns this into a 404. The
606
- * inner `{ status: 422 }` failure is for "form found but `changed`
607
- * field doesn't exist on it" — also a client-side bug.
608
- */
609
- export declare function formStateData(pilotiq: Pilotiq, scope: FormStateScope, body: FormStateRequest, req?: unknown): Promise<FormStateResult | FormStateError | null>;
610
- export interface FormWizardRequest {
611
- formId: string;
612
- step: number;
613
- values: Record<string, unknown>;
614
- }
615
- export interface FormWizardSuccess {
616
- ok: true;
617
- }
618
- export interface FormWizardFailure {
619
- ok: false;
620
- status: 404 | 422;
621
- error?: string;
622
- errors?: Record<string, string[]>;
623
- }
624
- /**
625
- * Plan #8 — handle a Wizard step-validate POST. Locates the form by id,
626
- * walks to the Wizard descendant, validates only the fields inside step
627
- * `step` against `values`. Returns `{ ok: true }` on success or
628
- * `{ ok: false, status: 422, errors }` when fields fail validation.
629
- *
630
- * Errors are keyed by field name, same shape as the form-submit 422 path,
631
- * so the client (`FormStateApi.applyErrors`) can surface them in-place.
632
- */
633
- export declare function formWizardData(pilotiq: Pilotiq, scope: FormStateScope, body: FormWizardRequest, req?: unknown): Promise<FormWizardSuccess | FormWizardFailure | null>;
634
- export interface FormCreateOptionRequest {
635
- formId: string;
636
- fieldName: string;
637
- values: Record<string, unknown>;
638
- }
639
- export interface FormCreateOptionSuccess {
640
- ok: true;
641
- option: {
642
- value: string;
643
- label: string;
644
- };
645
- }
646
- export interface FormCreateOptionFailure {
647
- ok: false;
648
- status: 403 | 404 | 422 | 500;
649
- error?: string;
650
- errors?: Record<string, string[]>;
651
- }
652
- /**
653
- * Audit row 2026-05-07 cont'd⁸ — handle a `SelectField.createOptionForm()`
654
- * modal submit. Locates the parent form by `formId`, finds the SelectField
655
- * by `fieldName`, re-evaluates the `createOptionAuthorize` rule (so a
656
- * tampered URL can't bypass), coerces + validates the body against the
657
- * sub-form's fields, then calls `createOptionUsing(handler)` and returns
658
- * `{ option }` for the client to append + select.
659
- *
660
- * Returns `null` when the route prefix doesn't resolve to a real
661
- * resource/global/page (route handler turns into 404).
662
- */
663
- export declare function formCreateOptionData(pilotiq: Pilotiq, scope: FormStateScope, body: FormCreateOptionRequest, req?: unknown): Promise<FormCreateOptionSuccess | FormCreateOptionFailure | null>;
664
- export interface MentionResolveRequest {
665
- formId: string;
666
- field: string;
667
- trigger: string;
668
- query: string;
669
- }
670
- /** Wire-side shape for a single resolved item — mirrors `MentionItem` from
671
- * `@pilotiq/tiptap`. Pilotiq core doesn't import that package, so the
672
- * duck-typed shape lives here. */
673
- export interface MentionResolveItem {
674
- id: string;
675
- label: string;
676
- group?: string;
677
- }
678
- export interface MentionResolveSuccess {
679
- ok: true;
680
- items: MentionResolveItem[];
681
- }
682
- export interface MentionResolveError {
683
- ok: false;
684
- status: 404 | 422;
685
- error: string;
686
- }
687
- /**
688
- * Resolve one async-mention round-trip. Locates the page's schema, finds
689
- * the form by `formId` and the RichTextField by `field`, calls its
690
- * `resolveMention(trigger, query, ctx)`. Returns `{ ok, items }`, a 404
691
- * when the form / field / trigger isn't present, or `null` for a missing
692
- * page (the route handler turns `null` into a 404 too).
693
- *
694
- * The dispatcher is duck-typed against the contract in `@pilotiq/tiptap`'s
695
- * `RichTextField` — pilotiq core never imports the adapter. Any future
696
- * field-type that ships an async-resolve trigger can implement the same
697
- * shape and pick up routing for free.
698
- */
699
- export declare function mentionResolveData(pilotiq: Pilotiq, scope: FormStateScope, body: MentionResolveRequest, req?: unknown): Promise<MentionResolveSuccess | MentionResolveError | null>;
700
- export declare function resourceViewData(pilotiq: Pilotiq, slug: string, recordId: string, req?: unknown): Promise<Record<string, unknown> | null>;
701
- /**
702
- * Custom record sub-page data builder. Mounted at
703
- * `${resourceBase}/${slug}/:id/${subPageSlug}` for each entry in
704
- * `Resource.pages().record`. Mirrors `resourceViewData`'s shape: load
705
- * the record, run R.canAccess + R.canView (parent-resource gates),
706
- * then SubPage.canAccess(user, record) (sub-page-specific gate),
707
- * then render the sub-page's schema with `ctx.record` set. Tab strip
708
- * carries the sub-page slug as the active key so the matching record
709
- * sub-page tab highlights.
710
- *
711
- * Returns:
712
- * - `null` — resource / sub-page slug not found (404 upstream).
713
- * - `{ ok: false, status: 403 }` — any gate fails or throws.
714
- * - resolved page data — on success.
715
- */
716
- export declare function resourceRecordPageData(pilotiq: Pilotiq, slug: string, recordId: string, subPageSlug: string, req?: unknown): Promise<Record<string, unknown> | null | {
717
- ok: false;
718
- status: 403;
719
- }>;
720
- export declare function globalEditData(pilotiq: Pilotiq, slug: string, prefill?: {
721
- values?: Record<string, unknown>;
722
- errors?: Record<string, string[]>;
723
- }, req?: unknown): Promise<Record<string, unknown> | null>;
724
- export declare function globalViewData(pilotiq: Pilotiq, slug: string, req?: unknown): Promise<Record<string, unknown> | null>;
725
- export declare function customPageData(pilotiq: Pilotiq, pageSlug: string, req?: unknown): Promise<Record<string, unknown> | null>;
726
- /**
727
- * Scopes the polling endpoint resolves against. Mirrors the
728
- * form-state / wizard scope discriminator.
729
- *
730
- * panel: dashboard page (`POST {base}/_widget/:id`)
731
- * page: custom page (`POST {base}/{pageSlug}/_widget/:id`)
732
- * resource: list page (`POST {base}/{slug}/_widget/:id`) —
733
- * resolves the resource's index `Page.schema()` so widgets
734
- * from `Resource.headerSchema()` / `footerSchema()` are
735
- * reachable. Auth runs `R.canAccess + R.canViewAny` in
736
- * front of the per-widget visibility check.
737
- */
738
- export type WidgetScope = {
739
- kind: 'panel';
740
- } | {
741
- kind: 'page';
742
- pageSlug: string;
743
- } | {
744
- kind: 'resource';
745
- slug: string;
746
- };
747
- export interface WidgetRequest {
748
- id: string;
749
- filter?: string;
750
- }
751
- export interface WidgetSuccess {
752
- ok: true;
753
- data: unknown;
754
- timestamp: number;
755
- }
756
- export interface WidgetFailure {
757
- ok: false;
758
- status: 403 | 404 | 500;
759
- error: string;
760
- }
761
- /**
762
- * Plan #15 — re-resolve the active page's schema, find the widget by
763
- * id, fail-closed via `evaluateVisibility`, then run
764
- * `resolveServerData(ctx)` and return the payload.
765
- *
766
- * - 404 when the page or widget id doesn't exist.
767
- * - 403 when the layout-level `visible(rule)` says the widget is
768
- * hidden (server doesn't show data for hidden surfaces).
769
- * - 500 when the hook itself throws.
770
- *
771
- * `body.filter` rides along on `RenderContext.filter` so per-chart
772
- * filter dropdowns can re-fetch with the new filter value. Treated as
773
- * an opaque string — widget hooks decode it however they want.
774
- */
775
- export declare function widgetData(pilotiq: Pilotiq, scope: WidgetScope, body: WidgetRequest, req?: unknown): Promise<WidgetSuccess | WidgetFailure>;
776
- /**
777
- * Resolve the user via `pilotiq.resolveUser(req)` and run the
778
- * panel-wide search. Mirrors the formStateData/formWizardData
779
- * shape so the `/_search` route handler stays a thin wrapper.
780
- *
781
- * Also resolves the `panels::global-search.results.before/.after`
782
- * render hooks when the panel registered any — sparse, absent when
783
- * neither slot has registered fns. Sent as a `RenderHookMap` so the
784
- * client `<CommandPalette>` can mount `<RenderHookSlot>` above and
785
- * below the result list (same pattern chrome slots use).
786
- */
787
- export declare function searchData(pilotiq: Pilotiq, query: string, req?: unknown): Promise<{
788
- ok: true;
789
- results: GlobalSearchResult[];
790
- renderHooks?: RenderHookMap;
791
- }>;
1
+ export type { RelationChainStep } from './pageData/breadcrumbs.js';
2
+ export type { ServerDataMap } from './pageData/helpers.js';
3
+ export { applyFillPipeline, applyRelationshipBuilderFill, applyRelationshipRepeaterFill, callPageSchema, resolveServerDataElements, tagActionDispatch, tagCellEditUrls, tagFieldAiUrls, tagFormActions, tagFormStateUrls, tagFormWizardUrls, tagRichTextMentionUrls, tagSelectCreateOptionUrls, tagTableDeferred, tagTableReorderUrls, tagWidgetUrls, } from './pageData/helpers.js';
4
+ export type { DatabaseNotificationsMeta, NavItem, PanelInfoRoute, RightPanelMeta, RightSidebarMeta, UserMenuMeta, } from './pageData/navigation.js';
5
+ export { applyRoleHooks, panelInfo, resolvePageHooks, } from './pageData/navigation.js';
6
+ export { dashboardData, resolveActiveTab, resourceCreateData, resourceEditData, resourceIndexData, resourceRecordPageData, resourceTableData, resourceViewData, } from './pageData/resourcePages.js';
7
+ export type { RelationManagerResult, RelationManagerScope, ResolvedChain, } from './pageData/relationPages.js';
8
+ export { findRelatedResource, relationManagerData, resolveRelationChain, safeManagerPolicy, } from './pageData/relationPages.js';
9
+ export type { FormCreateOptionFailure, FormCreateOptionRequest, FormCreateOptionSuccess, FormStateError, FormStateRequest, FormStateResult, FormStateScope, FormWizardFailure, FormWizardRequest, FormWizardSuccess, } from './pageData/forms.js';
10
+ export { formCreateOptionData, formStateData, formWizardData, mentionResolveData, } from './pageData/forms.js';
11
+ export { customPageData, globalEditData, globalViewData, searchData, widgetData, } from './pageData/misc.js';
12
+ export type { WidgetFailure, WidgetRequest, WidgetScope, WidgetSuccess, } from './pageData/misc.js';
792
13
  export interface PageContextLike {
793
14
  urlPathname?: string;
794
15
  urlOriginal?: string;
@@ -805,5 +26,4 @@ export interface PageContextLike {
805
26
  * the matching builder. Returns the same shape SSR's `viewProps` carries.
806
27
  */
807
28
  export declare function dispatchPageData(pageContext: PageContextLike): Promise<unknown | null>;
808
- export {};
809
29
  //# sourceMappingURL=pageData.d.ts.map