@jini-ai/admin 0.3.10 → 0.4.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 (399) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +71 -37
  3. package/dist/agent-plugins/adapters/http.d.ts +7 -0
  4. package/dist/agent-plugins/adapters/http.js +15 -0
  5. package/dist/agent-plugins/adapters/memory.d.ts +8 -0
  6. package/dist/agent-plugins/adapters/memory.js +25 -0
  7. package/dist/agent-plugins/agent-plugins.module.d.ts +51 -0
  8. package/dist/agent-plugins/agent-plugins.module.js +6 -0
  9. package/dist/agent-plugins/conformance/agent-plugins-api.conformance.d.ts +12 -0
  10. package/dist/agent-plugins/conformance/agent-plugins-api.conformance.js +47 -0
  11. package/dist/agent-plugins/controllers/agent-plugin-files.controller.d.ts +20 -0
  12. package/dist/agent-plugins/controllers/agent-plugin-files.controller.js +43 -0
  13. package/dist/agent-plugins/controllers/agent-plugins.controller.d.ts +25 -0
  14. package/dist/agent-plugins/controllers/agent-plugins.controller.js +91 -0
  15. package/dist/agent-plugins/index.d.ts +9 -0
  16. package/dist/agent-plugins/index.js +9 -0
  17. package/dist/agent-plugins/messages.en.d.ts +23 -0
  18. package/dist/agent-plugins/messages.en.js +14 -0
  19. package/dist/agent-plugins/models.d.ts +57 -0
  20. package/dist/agent-plugins/models.js +2 -0
  21. package/dist/agent-plugins/package-file-tree.d.ts +111 -0
  22. package/dist/agent-plugins/package-file-tree.js +188 -0
  23. package/dist/agent-plugins/ports.d.ts +18 -0
  24. package/dist/agent-plugins/ports.js +3 -0
  25. package/dist/agent-plugins/react/components/AgentPluginFileContent.d.ts +5 -0
  26. package/dist/agent-plugins/react/components/AgentPluginFileContent.js +9 -0
  27. package/dist/agent-plugins/react/components/AgentPluginFileTree.d.ts +9 -0
  28. package/dist/agent-plugins/react/components/AgentPluginFileTree.js +7 -0
  29. package/dist/agent-plugins/react/components/AgentPluginInspector.d.ts +3 -0
  30. package/dist/agent-plugins/react/components/AgentPluginInspector.js +11 -0
  31. package/dist/agent-plugins/react/components/AgentPluginListPanel.d.ts +6 -0
  32. package/dist/agent-plugins/react/components/AgentPluginListPanel.js +10 -0
  33. package/dist/agent-plugins/react/components/AgentPluginRow.d.ts +5 -0
  34. package/dist/agent-plugins/react/components/AgentPluginRow.js +8 -0
  35. package/dist/agent-plugins/react/hooks/AgentPluginInspector.hooks.d.ts +90 -0
  36. package/dist/agent-plugins/react/hooks/AgentPluginInspector.hooks.js +74 -0
  37. package/dist/agent-plugins/react/hooks/AgentPluginPanel.hooks.d.ts +67 -0
  38. package/dist/agent-plugins/react/hooks/AgentPluginPanel.hooks.js +50 -0
  39. package/dist/agent-plugins/react/hooks/AgentPluginRow.hooks.d.ts +55 -0
  40. package/dist/agent-plugins/react/hooks/AgentPluginRow.hooks.js +6 -0
  41. package/dist/agent-plugins/react/hooks/AgentPluginsPage.hooks.d.ts +64 -0
  42. package/dist/agent-plugins/react/hooks/AgentPluginsPage.hooks.js +39 -0
  43. package/dist/agent-plugins/react/hooks/AgentPluginsPorts.hooks.d.ts +7 -0
  44. package/dist/agent-plugins/react/hooks/AgentPluginsPorts.hooks.js +10 -0
  45. package/dist/agent-plugins/react/hooks/MarketplaceTab.hooks.d.ts +6 -0
  46. package/dist/agent-plugins/react/hooks/MarketplaceTab.hooks.js +3 -0
  47. package/dist/agent-plugins/react/index.d.ts +245 -0
  48. package/dist/agent-plugins/react/index.js +13 -0
  49. package/dist/agent-plugins/react/pages/AgentPluginsPage.d.ts +4 -0
  50. package/dist/agent-plugins/react/pages/AgentPluginsPage.js +12 -0
  51. package/dist/agent-plugins/react/tabs/DownloadedTab.d.ts +4 -0
  52. package/dist/agent-plugins/react/tabs/DownloadedTab.js +5 -0
  53. package/dist/agent-plugins/react/tabs/InstalledTab.d.ts +4 -0
  54. package/dist/agent-plugins/react/tabs/InstalledTab.js +5 -0
  55. package/dist/agent-plugins/react/tabs/MarketplaceTab.d.ts +4 -0
  56. package/dist/agent-plugins/react/tabs/MarketplaceTab.js +10 -0
  57. package/dist/agent-plugins/rules.d.ts +33 -0
  58. package/dist/agent-plugins/rules.js +51 -0
  59. package/dist/browser/index.d.ts +1 -0
  60. package/dist/browser/index.js +1 -0
  61. package/dist/browser/navigation.d.ts +19 -4
  62. package/dist/browser/navigation.js +8 -8
  63. package/dist/browser/shell-navigation.d.ts +12 -0
  64. package/dist/browser/shell-navigation.js +16 -0
  65. package/dist/contracts/credential-management.d.ts +8 -0
  66. package/dist/contracts/credential-management.js +3 -0
  67. package/dist/contracts/media-picker.d.ts +17 -0
  68. package/dist/contracts/media-picker.js +5 -0
  69. package/dist/contracts/playground-render-target.d.ts +18 -0
  70. package/dist/contracts/playground-render-target.js +3 -0
  71. package/dist/core/entities/rules.d.ts +138 -0
  72. package/dist/core/entities/rules.js +344 -0
  73. package/dist/core/gated/types.d.ts +8 -4
  74. package/dist/core/index.d.ts +4 -0
  75. package/dist/core/index.js +1 -0
  76. package/dist/core/manifest/rules.d.ts +24 -6
  77. package/dist/core/manifest/rules.js +12 -11
  78. package/dist/core/module/controller-store.d.ts +22 -0
  79. package/dist/core/module/controller-store.js +32 -0
  80. package/dist/core/module/create-admin.d.ts +41 -0
  81. package/dist/core/module/create-admin.js +187 -0
  82. package/dist/core/module/define-admin-module.d.ts +4 -0
  83. package/dist/core/module/define-admin-module.js +5 -0
  84. package/dist/core/module/index.d.ts +7 -0
  85. package/dist/core/module/index.js +4 -0
  86. package/dist/core/module/token.d.ts +19 -0
  87. package/dist/core/module/token.js +4 -0
  88. package/dist/core/module/types.d.ts +79 -0
  89. package/dist/core/module/types.js +2 -0
  90. package/dist/core/permissions/rules.d.ts +4 -1
  91. package/dist/core/permissions/rules.js +1 -1
  92. package/dist/core/ports/analytics.d.ts +1 -1
  93. package/dist/core/ports/auth.d.ts +2 -2
  94. package/dist/core/ports/comments.d.ts +9 -6
  95. package/dist/core/ports/database.d.ts +13 -10
  96. package/dist/core/ports/entities.d.ts +302 -0
  97. package/dist/core/ports/entities.js +47 -0
  98. package/dist/core/ports/forms.d.ts +19 -7
  99. package/dist/core/ports/identity.d.ts +42 -17
  100. package/dist/core/ports/index.d.ts +2 -0
  101. package/dist/core/ports/integrations.d.ts +9 -4
  102. package/dist/core/ports/media.d.ts +16 -7
  103. package/dist/core/ports/members.d.ts +7 -3
  104. package/dist/core/ports/menus.d.ts +43 -0
  105. package/dist/core/ports/menus.js +43 -0
  106. package/dist/core/ports/plugins.d.ts +3 -2
  107. package/dist/core/ports/recovery.d.ts +10 -6
  108. package/dist/core/ports/redirects.d.ts +17 -7
  109. package/dist/core/ports/seo.d.ts +12 -6
  110. package/dist/core/ports/shell.d.ts +41 -0
  111. package/dist/core/ports/shell.js +2 -0
  112. package/dist/core/ports/workspace.d.ts +3 -3
  113. package/dist/core/routing/rules.d.ts +17 -4
  114. package/dist/core/routing/rules.js +4 -4
  115. package/dist/core/transport/errors.d.ts +13 -4
  116. package/dist/core/transport/errors.js +4 -4
  117. package/dist/core/transport/http.d.ts +26 -16
  118. package/dist/core/transport/http.js +59 -21
  119. package/dist/core/transport/types.d.ts +26 -14
  120. package/dist/core/transport/types.js +9 -7
  121. package/dist/media/adapters/http.d.ts +27 -0
  122. package/dist/media/adapters/http.js +44 -0
  123. package/dist/media/adapters/memory.d.ts +11 -0
  124. package/dist/media/adapters/memory.js +139 -0
  125. package/dist/media/conformance/media-api.conformance.d.ts +7 -0
  126. package/dist/media/conformance/media-api.conformance.js +69 -0
  127. package/dist/media/controllers/edit-media.controller.d.ts +24 -0
  128. package/dist/media/controllers/edit-media.controller.js +69 -0
  129. package/dist/media/controllers/library.controller.d.ts +47 -0
  130. package/dist/media/controllers/library.controller.js +173 -0
  131. package/dist/media/controllers/providers.controller.d.ts +30 -0
  132. package/dist/media/controllers/providers.controller.js +76 -0
  133. package/dist/media/html-attributes.d.ts +82 -0
  134. package/dist/media/html-attributes.js +204 -0
  135. package/dist/media/index.d.ts +12 -0
  136. package/dist/media/index.js +9 -0
  137. package/dist/media/media.module.d.ts +83 -0
  138. package/dist/media/media.module.js +43 -0
  139. package/dist/media/messages.en.d.ts +24 -0
  140. package/dist/media/messages.en.js +24 -0
  141. package/dist/media/models.d.ts +72 -0
  142. package/dist/media/models.js +2 -0
  143. package/dist/media/ports.d.ts +75 -0
  144. package/dist/media/ports.js +7 -0
  145. package/dist/media/react/components/EditMediaPanel.d.ts +3 -0
  146. package/dist/media/react/components/EditMediaPanel.js +10 -0
  147. package/dist/media/react/components/MediaCard.d.ts +5 -0
  148. package/dist/media/react/components/MediaCard.js +17 -0
  149. package/dist/media/react/components/MediaDialog.d.ts +3 -0
  150. package/dist/media/react/components/MediaDialog.js +8 -0
  151. package/dist/media/react/components/MediaGrid.d.ts +4 -0
  152. package/dist/media/react/components/MediaGrid.js +8 -0
  153. package/dist/media/react/components/MediaIcons.d.ts +14 -0
  154. package/dist/media/react/components/MediaIcons.js +39 -0
  155. package/dist/media/react/components/MediaLightbox.d.ts +5 -0
  156. package/dist/media/react/components/MediaLightbox.js +12 -0
  157. package/dist/media/react/components/MediaPicker.d.ts +3 -0
  158. package/dist/media/react/components/MediaPicker.js +10 -0
  159. package/dist/media/react/components/MediaPurgeDialog.d.ts +4 -0
  160. package/dist/media/react/components/MediaPurgeDialog.js +9 -0
  161. package/dist/media/react/components/UploadButton.d.ts +3 -0
  162. package/dist/media/react/components/UploadButton.js +8 -0
  163. package/dist/media/react/hooks/EditMediaPanel.hooks.d.ts +84 -0
  164. package/dist/media/react/hooks/EditMediaPanel.hooks.js +105 -0
  165. package/dist/media/react/hooks/LibraryTab.hooks.d.ts +103 -0
  166. package/dist/media/react/hooks/LibraryTab.hooks.js +164 -0
  167. package/dist/media/react/hooks/MediaCard.hooks.d.ts +79 -0
  168. package/dist/media/react/hooks/MediaCard.hooks.js +63 -0
  169. package/dist/media/react/hooks/MediaDialog.hooks.d.ts +10 -0
  170. package/dist/media/react/hooks/MediaDialog.hooks.js +20 -0
  171. package/dist/media/react/hooks/MediaGrid.hooks.d.ts +28 -0
  172. package/dist/media/react/hooks/MediaGrid.hooks.js +6 -0
  173. package/dist/media/react/hooks/MediaLightbox.hooks.d.ts +27 -0
  174. package/dist/media/react/hooks/MediaLightbox.hooks.js +64 -0
  175. package/dist/media/react/hooks/MediaPage.hooks.d.ts +68 -0
  176. package/dist/media/react/hooks/MediaPage.hooks.js +68 -0
  177. package/dist/media/react/hooks/MediaPicker.hooks.d.ts +26 -0
  178. package/dist/media/react/hooks/MediaPicker.hooks.js +25 -0
  179. package/dist/media/react/hooks/MediaPorts.hooks.d.ts +9 -0
  180. package/dist/media/react/hooks/MediaPorts.hooks.js +10 -0
  181. package/dist/media/react/hooks/MediaPurgeDialog.hooks.d.ts +22 -0
  182. package/dist/media/react/hooks/MediaPurgeDialog.hooks.js +6 -0
  183. package/dist/media/react/hooks/ProvidersTab.hooks.d.ts +55 -0
  184. package/dist/media/react/hooks/ProvidersTab.hooks.js +124 -0
  185. package/dist/media/react/hooks/UploadButton.hooks.d.ts +48 -0
  186. package/dist/media/react/hooks/UploadButton.hooks.js +118 -0
  187. package/dist/media/react/index.d.ts +373 -0
  188. package/dist/media/react/index.js +73 -0
  189. package/dist/media/react/pages/MediaPage.d.ts +4 -0
  190. package/dist/media/react/pages/MediaPage.js +9 -0
  191. package/dist/media/react/tabs/LibraryTab.d.ts +4 -0
  192. package/dist/media/react/tabs/LibraryTab.js +14 -0
  193. package/dist/media/react/tabs/ProvidersTab.d.ts +4 -0
  194. package/dist/media/react/tabs/ProvidersTab.js +10 -0
  195. package/dist/media/rules.d.ts +80 -0
  196. package/dist/media/rules.js +127 -0
  197. package/dist/media/styles.d.ts +4 -0
  198. package/dist/media/styles.js +5 -0
  199. package/dist/playground/adapters/http.d.ts +8 -0
  200. package/dist/playground/adapters/http.js +4 -0
  201. package/dist/playground/adapters/memory.d.ts +10 -0
  202. package/dist/playground/adapters/memory.js +30 -0
  203. package/dist/playground/conformance/playground-api.conformance.d.ts +6 -0
  204. package/dist/playground/conformance/playground-api.conformance.js +37 -0
  205. package/dist/playground/controllers/playground.controller.d.ts +16 -0
  206. package/dist/playground/controllers/playground.controller.js +21 -0
  207. package/dist/playground/index.d.ts +7 -0
  208. package/dist/playground/index.js +5 -0
  209. package/dist/playground/messages.en.d.ts +9 -0
  210. package/dist/playground/messages.en.js +2 -0
  211. package/dist/playground/models.d.ts +4 -0
  212. package/dist/playground/models.js +2 -0
  213. package/dist/playground/playground.module.d.ts +31 -0
  214. package/dist/playground/playground.module.js +5 -0
  215. package/dist/playground/ports.d.ts +5 -0
  216. package/dist/playground/ports.js +2 -0
  217. package/dist/playground/react/components/Canvas.d.ts +3 -0
  218. package/dist/playground/react/components/Canvas.js +9 -0
  219. package/dist/playground/react/hooks/Canvas.hooks.d.ts +7 -0
  220. package/dist/playground/react/hooks/Canvas.hooks.js +18 -0
  221. package/dist/playground/react/hooks/PlaygroundPage.hooks.d.ts +8 -0
  222. package/dist/playground/react/hooks/PlaygroundPage.hooks.js +2 -0
  223. package/dist/playground/react/hooks/PlaygroundPorts.hooks.d.ts +4 -0
  224. package/dist/playground/react/hooks/PlaygroundPorts.hooks.js +6 -0
  225. package/dist/playground/react/index.d.ts +136 -0
  226. package/dist/playground/react/index.js +10 -0
  227. package/dist/playground/react/pages/PlaygroundPage.d.ts +4 -0
  228. package/dist/playground/react/pages/PlaygroundPage.js +11 -0
  229. package/dist/playground/react/tabs/CanvasTab.d.ts +4 -0
  230. package/dist/playground/react/tabs/CanvasTab.js +5 -0
  231. package/dist/playground/rules.d.ts +4 -0
  232. package/dist/playground/rules.js +2 -0
  233. package/dist/react/OverlayHost.d.ts +3 -0
  234. package/dist/react/OverlayHost.hooks.d.ts +9 -0
  235. package/dist/react/OverlayHost.hooks.js +9 -0
  236. package/dist/react/OverlayHost.js +7 -0
  237. package/dist/react/bind-react.d.ts +46 -0
  238. package/dist/react/bind-react.js +28 -0
  239. package/dist/react/components/ConfirmButton/ConfirmButton.hooks.d.ts +7 -1
  240. package/dist/react/components/ConfirmButton/ConfirmButton.hooks.js +2 -2
  241. package/dist/react/components/ConfirmButton/ConfirmButton.js +1 -1
  242. package/dist/react/components/ConfirmDialog/ConfirmDialog.hooks.d.ts +17 -3
  243. package/dist/react/components/ConfirmDialog/ConfirmDialog.hooks.js +3 -3
  244. package/dist/react/components/ConfirmDialog/ConfirmDialog.js +5 -5
  245. package/dist/react/components/InteractiveHtmlEditor/InteractiveHtmlEditor.d.ts +6 -2
  246. package/dist/react/components/InteractiveHtmlEditor/InteractiveHtmlEditor.js +7 -8
  247. package/dist/react/components/RowMenu/RowMenu.d.ts +5 -1
  248. package/dist/react/components/RowMenu/RowMenu.hooks.d.ts +8 -2
  249. package/dist/react/components/RowMenu/RowMenu.hooks.js +4 -4
  250. package/dist/react/components/RowMenu/RowMenu.js +6 -6
  251. package/dist/react/components/Sidebar.d.ts +1 -1
  252. package/dist/react/components/Sidebar.js +103 -7
  253. package/dist/react/entities/EntityCell.d.ts +10 -0
  254. package/dist/react/entities/EntityCell.js +18 -0
  255. package/dist/react/entities/EntityDetail.d.ts +3 -0
  256. package/dist/react/entities/EntityDetail.js +21 -0
  257. package/dist/react/entities/EntityEdit.d.ts +13 -0
  258. package/dist/react/entities/EntityEdit.js +45 -0
  259. package/dist/react/entities/EntityField.d.ts +20 -0
  260. package/dist/react/entities/EntityField.js +31 -0
  261. package/dist/react/entities/EntityIndex.d.ts +3 -0
  262. package/dist/react/entities/EntityIndex.js +10 -0
  263. package/dist/react/entities/EntityList.d.ts +7 -0
  264. package/dist/react/entities/EntityList.js +52 -0
  265. package/dist/react/entities/contribution.d.ts +26 -0
  266. package/dist/react/entities/contribution.js +78 -0
  267. package/dist/react/entities/index.d.ts +10 -0
  268. package/dist/react/entities/index.js +7 -0
  269. package/dist/react/entities/rules.d.ts +179 -0
  270. package/dist/react/entities/rules.js +224 -0
  271. package/dist/react/entities/types.d.ts +45 -0
  272. package/dist/react/entities/types.js +5 -0
  273. package/dist/react/entities/use-entity-edit.d.ts +35 -0
  274. package/dist/react/entities/use-entity-edit.js +98 -0
  275. package/dist/react/entities/use-entity-read.d.ts +22 -0
  276. package/dist/react/entities/use-entity-read.js +27 -0
  277. package/dist/react/hooks/use-nav-sections.d.ts +12 -3
  278. package/dist/react/hooks/use-nav-sections.js +14 -14
  279. package/dist/react/hooks/use-sidebar-rail.d.ts +7 -1
  280. package/dist/react/hooks/use-sidebar-rail.js +11 -11
  281. package/dist/react/index.d.ts +3 -1
  282. package/dist/react/index.js +5 -2
  283. package/dist/react/kit/Kit.hooks.d.ts +13 -0
  284. package/dist/react/kit/Kit.hooks.js +10 -0
  285. package/dist/react/kit/Native.hooks.d.ts +38 -0
  286. package/dist/react/kit/Native.hooks.js +65 -0
  287. package/dist/react/kit/index.d.ts +12 -0
  288. package/dist/react/kit/index.js +21 -0
  289. package/dist/react/kit/native.d.ts +3 -0
  290. package/dist/react/kit/native.js +21 -0
  291. package/dist/react/kit/types.d.ts +40 -0
  292. package/dist/react/kit/types.js +2 -0
  293. package/dist/react/overlay.d.ts +36 -0
  294. package/dist/react/overlay.js +35 -0
  295. package/dist/react/overlays.d.ts +38 -0
  296. package/dist/react/overlays.js +46 -0
  297. package/dist/react/shell/AdminShell.d.ts +9 -0
  298. package/dist/react/shell/AdminShell.hooks.d.ts +15 -0
  299. package/dist/react/shell/AdminShell.hooks.js +27 -0
  300. package/dist/react/shell/AdminShell.js +46 -0
  301. package/dist/react/shell/index.d.ts +7 -0
  302. package/dist/react/shell/index.js +5 -0
  303. package/dist/react/shell/model.d.ts +25 -0
  304. package/dist/react/shell/model.js +29 -0
  305. package/dist/react/shell/theme-ports.d.ts +28 -0
  306. package/dist/react/shell/theme-ports.js +2 -0
  307. package/dist/react/shell/types.d.ts +99 -0
  308. package/dist/react/shell/types.js +2 -0
  309. package/dist/react/shell/use-admin-shell-session.d.ts +13 -0
  310. package/dist/react/shell/use-admin-shell-session.js +81 -0
  311. package/dist/react/shell/use-admin-theme.d.ts +16 -0
  312. package/dist/react/shell/use-admin-theme.js +57 -0
  313. package/dist/react/types.d.ts +6 -4
  314. package/dist/react/types.js +2 -2
  315. package/dist/react/use-controller.d.ts +16 -0
  316. package/dist/react/use-controller.js +18 -0
  317. package/dist/security/adapters/http.d.ts +16 -0
  318. package/dist/security/adapters/http.js +94 -0
  319. package/dist/security/adapters/memory.d.ts +15 -0
  320. package/dist/security/adapters/memory.js +60 -0
  321. package/dist/security/conformance/security-api.conformance.d.ts +10 -0
  322. package/dist/security/conformance/security-api.conformance.js +48 -0
  323. package/dist/security/controllers/access-tokens.controller.d.ts +44 -0
  324. package/dist/security/controllers/access-tokens.controller.js +112 -0
  325. package/dist/security/controllers/other-credentials.controller.d.ts +30 -0
  326. package/dist/security/controllers/other-credentials.controller.js +74 -0
  327. package/dist/security/controllers/root-key.controller.d.ts +35 -0
  328. package/dist/security/controllers/root-key.controller.js +90 -0
  329. package/dist/security/index.d.ts +9 -0
  330. package/dist/security/index.js +9 -0
  331. package/dist/security/messages.en.d.ts +12 -0
  332. package/dist/security/messages.en.js +2 -0
  333. package/dist/security/models.d.ts +112 -0
  334. package/dist/security/models.js +2 -0
  335. package/dist/security/ports.d.ts +58 -0
  336. package/dist/security/ports.js +5 -0
  337. package/dist/security/react/components/CredentialEditor.d.ts +3 -0
  338. package/dist/security/react/components/CredentialEditor.js +8 -0
  339. package/dist/security/react/hooks/AccessTokensTab.hooks.d.ts +94 -0
  340. package/dist/security/react/hooks/AccessTokensTab.hooks.js +36 -0
  341. package/dist/security/react/hooks/CredentialEditor.hooks.d.ts +49 -0
  342. package/dist/security/react/hooks/CredentialEditor.hooks.js +14 -0
  343. package/dist/security/react/hooks/RootKeyTab.hooks.d.ts +29 -0
  344. package/dist/security/react/hooks/RootKeyTab.hooks.js +19 -0
  345. package/dist/security/react/hooks/SecurityPage.hooks.d.ts +17 -0
  346. package/dist/security/react/hooks/SecurityPage.hooks.js +12 -0
  347. package/dist/security/react/hooks/SecurityPorts.hooks.d.ts +9 -0
  348. package/dist/security/react/hooks/SecurityPorts.hooks.js +6 -0
  349. package/dist/security/react/index.d.ts +215 -0
  350. package/dist/security/react/index.js +10 -0
  351. package/dist/security/react/pages/SecurityPage.d.ts +4 -0
  352. package/dist/security/react/pages/SecurityPage.js +10 -0
  353. package/dist/security/react/tabs/AccessTokensTab.d.ts +4 -0
  354. package/dist/security/react/tabs/AccessTokensTab.js +10 -0
  355. package/dist/security/react/tabs/RootKeyTab.d.ts +4 -0
  356. package/dist/security/react/tabs/RootKeyTab.js +9 -0
  357. package/dist/security/rules.d.ts +57 -0
  358. package/dist/security/rules.js +63 -0
  359. package/dist/security/security.module.d.ts +45 -0
  360. package/dist/security/security.module.js +5 -0
  361. package/dist/source-control/adapters/http.d.ts +6 -0
  362. package/dist/source-control/adapters/http.js +13 -0
  363. package/dist/source-control/adapters/memory.d.ts +9 -0
  364. package/dist/source-control/adapters/memory.js +35 -0
  365. package/dist/source-control/conformance/source-control-api.conformance.d.ts +10 -0
  366. package/dist/source-control/conformance/source-control-api.conformance.js +48 -0
  367. package/dist/source-control/controllers/source-control.controller.d.ts +26 -0
  368. package/dist/source-control/controllers/source-control.controller.js +70 -0
  369. package/dist/source-control/index.d.ts +8 -0
  370. package/dist/source-control/index.js +6 -0
  371. package/dist/source-control/messages.en.d.ts +11 -0
  372. package/dist/source-control/messages.en.js +2 -0
  373. package/dist/source-control/models.d.ts +70 -0
  374. package/dist/source-control/models.js +2 -0
  375. package/dist/source-control/ports.d.ts +23 -0
  376. package/dist/source-control/ports.js +3 -0
  377. package/dist/source-control/react/components/SourceControlCredentialFields.d.ts +5 -0
  378. package/dist/source-control/react/components/SourceControlCredentialFields.js +8 -0
  379. package/dist/source-control/react/components/SourceControlProviderRow.d.ts +5 -0
  380. package/dist/source-control/react/components/SourceControlProviderRow.js +7 -0
  381. package/dist/source-control/react/hooks/ProvidersTab.hooks.d.ts +45 -0
  382. package/dist/source-control/react/hooks/ProvidersTab.hooks.js +20 -0
  383. package/dist/source-control/react/hooks/SourceControlCredentialFields.hooks.d.ts +43 -0
  384. package/dist/source-control/react/hooks/SourceControlCredentialFields.hooks.js +9 -0
  385. package/dist/source-control/react/hooks/SourceControlPage.hooks.d.ts +17 -0
  386. package/dist/source-control/react/hooks/SourceControlPage.hooks.js +5 -0
  387. package/dist/source-control/react/hooks/SourceControlPorts.hooks.d.ts +9 -0
  388. package/dist/source-control/react/hooks/SourceControlPorts.hooks.js +6 -0
  389. package/dist/source-control/react/index.d.ts +156 -0
  390. package/dist/source-control/react/index.js +10 -0
  391. package/dist/source-control/react/pages/SourceControlPage.d.ts +4 -0
  392. package/dist/source-control/react/pages/SourceControlPage.js +11 -0
  393. package/dist/source-control/react/tabs/ProvidersTab.d.ts +4 -0
  394. package/dist/source-control/react/tabs/ProvidersTab.js +10 -0
  395. package/dist/source-control/rules.d.ts +32 -0
  396. package/dist/source-control/rules.js +35 -0
  397. package/dist/source-control/source-control.module.d.ts +36 -0
  398. package/dist/source-control/source-control.module.js +6 -0
  399. package/package.json +207 -4
@@ -0,0 +1,344 @@
1
+ /**
2
+ * @file The runtime half of `AdminEntityPort`: registration, descriptor validation, and the one
3
+ * erasure a screen generic over all entities needs.
4
+ *
5
+ * `core/ports/entities.ts` is types only, like every other port. Everything here is the code those
6
+ * types cannot be: checks that a descriptor is internally consistent, and the single cast that
7
+ * turns a descriptor-generic port into the shape a screen can hold.
8
+ *
9
+ * ## Why any of this is runtime rather than type-level
10
+ *
11
+ * Two of the descriptor's own promises are not expressible in the type system:
12
+ *
13
+ * - `titleField` names a `text` field on this same descriptor. Encoding that needs a conditional
14
+ * type heavy enough to make every descriptor's error message unreadable — and a typo here is not
15
+ * cosmetic: it makes every relation picker pointing at this entity render `undefined` for every
16
+ * row, which looks like missing data rather than a typo.
17
+ * - `relation.target` names another *registered* entity. A descriptor cannot know what it will be
18
+ * registered beside, so this can only be checked once the registry is assembled.
19
+ *
20
+ * Both are therefore checked at composition time, where they fail once, at startup, naming the
21
+ * problem — rather than at render time, silently, as blank cells.
22
+ */
23
+ /** Row keys are never declared as fields — every row carries one implicitly. */
24
+ const IMPLICIT_ROW_KEY = 'id';
25
+ /** Bounds on the `json` conformance walk. Sized like `MAX_FIELD_DEFS` in `@jini-ai/cms`: large
26
+ * enough that no honest payload hits them, small enough that a cyclic or adversarial value fails
27
+ * fast instead of hanging a render. */
28
+ const MAX_JSON_DEPTH = 32;
29
+ const MAX_JSON_NODES = 10_000;
30
+ /**
31
+ * Whether `value` is a JSON value: `null`, a boolean, a *finite* number, a string, an array of
32
+ * them, or a plain object of them.
33
+ *
34
+ * Bounded by {@link MAX_JSON_DEPTH}/{@link MAX_JSON_NODES}, which also makes it terminate on a
35
+ * cyclic value rather than recursing forever. "Storage-only" means not indexed — it does not mean
36
+ * not checked: a validator that returns true for everything is not a validator, and the values it
37
+ * would wave through (functions, `BigInt`, `undefined`, `NaN`, cycles) are exactly the ones that
38
+ * throw or silently vanish at the `JSON.stringify` boundary downstream of it.
39
+ *
40
+ * @returns `null` when the value conforms, otherwise a one-phrase reason.
41
+ * @complexity Time O(nodes) bounded by {@link MAX_JSON_NODES}; space O(depth) bounded by
42
+ * {@link MAX_JSON_DEPTH}.
43
+ * @overallScore 100
44
+ */
45
+ function describeNonJsonValue(value, depth = 0, budget = { nodes: 0 }) {
46
+ if (depth > MAX_JSON_DEPTH)
47
+ return `nests deeper than ${MAX_JSON_DEPTH} levels`;
48
+ if (++budget.nodes > MAX_JSON_NODES)
49
+ return `holds more than ${MAX_JSON_NODES} values`;
50
+ if (value === null)
51
+ return null;
52
+ const type = typeof value;
53
+ if (type === 'string' || type === 'boolean')
54
+ return null;
55
+ if (type === 'number')
56
+ return Number.isFinite(value) ? null : 'is a non-finite number';
57
+ if (type !== 'object')
58
+ return `is a ${type}`;
59
+ if (Array.isArray(value)) {
60
+ for (const item of value) {
61
+ const reason = describeNonJsonValue(item, depth + 1, budget);
62
+ if (reason !== null)
63
+ return reason;
64
+ }
65
+ return null;
66
+ }
67
+ // Rejects class instances, `Map`, `Date`, and anything else that survives `typeof === 'object'`
68
+ // but does not round-trip through JSON as itself.
69
+ const proto = Object.getPrototypeOf(value);
70
+ if (proto !== Object.prototype && proto !== null)
71
+ return 'is a non-plain object';
72
+ for (const item of Object.values(value)) {
73
+ const reason = describeNonJsonValue(item, depth + 1, budget);
74
+ if (reason !== null)
75
+ return reason;
76
+ }
77
+ return null;
78
+ }
79
+ /**
80
+ * Whether `value` is a legal runtime value for `field`.
81
+ *
82
+ * Exported because an EDITOR needs exactly this judgement and must not re-derive it. A generic form
83
+ * that decides for itself what an `integer` accepts will drift from what the conformance walk
84
+ * below rejects, and the two disagreeing is worse than either being wrong alone: the form saves a
85
+ * value the port then reports as a violation, so the write succeeds and the diagnostic blames the
86
+ * adapter. `1.5` in an `integer` and `Infinity` in a `real` are both reachable from a plain
87
+ * `<input type="number">` — `step` constrains the spinner, not the parsed value — so this is not a
88
+ * theoretical seam. One function, both callers.
89
+ *
90
+ * @param field The declared field the value is destined for.
91
+ * @param value The candidate value, typically a form draft entry or an adapter-returned cell.
92
+ * @returns `null` when it conforms, otherwise a one-phrase reason naming what arrived instead.
93
+ * Phrased to complete the sentence "declared `<kind>`; ...".
94
+ * @complexity Time O(1) for every kind but `json`; see {@link describeNonJsonValue} for that one.
95
+ * @overallScore 100
96
+ */
97
+ export function describeAdminEntityFieldMismatch(field, value) {
98
+ switch (field.kind) {
99
+ case 'text':
100
+ case 'relation':
101
+ return typeof value === 'string' ? null : `expected a string, got ${typeof value}`;
102
+ case 'datetime':
103
+ if (typeof value !== 'string')
104
+ return `expected an ISO-8601 string, got ${typeof value}`;
105
+ // A `datetime` that is not parseable renders fine and orders wrongly — the exact class of
106
+ // fault this whole check exists for, so it is a mismatch rather than a pass.
107
+ return Number.isNaN(Date.parse(value)) ? 'is not a parseable ISO-8601 timestamp' : null;
108
+ case 'integer':
109
+ if (typeof value !== 'number')
110
+ return `expected a number, got ${typeof value}`;
111
+ return Number.isInteger(value) ? null : 'is not an integer';
112
+ case 'real':
113
+ if (typeof value !== 'number')
114
+ return `expected a number, got ${typeof value}`;
115
+ return Number.isFinite(value) ? null : 'is not a finite number';
116
+ case 'boolean':
117
+ return typeof value === 'boolean' ? null : `expected a boolean, got ${typeof value}`;
118
+ case 'json': {
119
+ const reason = describeNonJsonValue(value);
120
+ return reason === null ? null : `is not a JSON value: it ${reason}`;
121
+ }
122
+ }
123
+ }
124
+ /**
125
+ * Every way `row` fails to match `descriptor`.
126
+ *
127
+ * Reports undeclared keys as well as missing and mistyped ones: a key the descriptor does not
128
+ * mention is invisible to a generic screen, so an adapter growing a field without declaring it
129
+ * shows up as data that exists and never renders — which reads as a screen bug rather than a
130
+ * descriptor gap.
131
+ *
132
+ * @complexity Time O(fields + row keys) plus the `json` walk; space O(violations).
133
+ * @overallScore 100
134
+ */
135
+ function findRowViolations(descriptor, operation, row) {
136
+ const found = [];
137
+ const rowId = typeof row.id === 'string' && row.id !== '' ? row.id : '<no id>';
138
+ const push = (field, problem, detail) => {
139
+ found.push({ entity: descriptor.name, operation, rowId, field, problem, detail });
140
+ };
141
+ if (typeof row.id !== 'string' || row.id === '') {
142
+ push(IMPLICIT_ROW_KEY, 'wrong-type', 'every row must carry a non-empty string `id`');
143
+ }
144
+ const declared = new Set([IMPLICIT_ROW_KEY]);
145
+ for (const field of descriptor.fields) {
146
+ declared.add(field.name);
147
+ const value = row[field.name];
148
+ if (value === undefined) {
149
+ if (field.required === true) {
150
+ push(field.name, 'missing-required', 'declared `required: true` but absent from the row');
151
+ }
152
+ continue;
153
+ }
154
+ const mismatch = describeAdminEntityFieldMismatch(field, value);
155
+ if (mismatch !== null)
156
+ push(field.name, 'wrong-type', `declared \`${field.kind}\`; ${mismatch}`);
157
+ }
158
+ for (const key of Object.keys(row)) {
159
+ if (declared.has(key))
160
+ continue;
161
+ push(key, 'undeclared-field', 'present on the row but not declared on the descriptor');
162
+ }
163
+ return found;
164
+ }
165
+ /**
166
+ * Runs `row` past its descriptor and reports anything wrong, then returns it unchanged.
167
+ *
168
+ * Deliberately identity-returning: this is an observation point, never a repair point. Coercing a
169
+ * bad value here would hide the adapter bug it exists to expose.
170
+ *
171
+ * @complexity Time O(rows × fields); no-op and O(1) when `onViolation` is absent.
172
+ * @overallScore 100
173
+ */
174
+ function checkRow(descriptor, operation, row, onViolation) {
175
+ if (onViolation === undefined)
176
+ return row;
177
+ for (const violation of findRowViolations(descriptor, operation, row))
178
+ onViolation(violation);
179
+ return row;
180
+ }
181
+ /**
182
+ * Erases a port's descriptor generic so a screen can hold ports for different entities in one
183
+ * collection.
184
+ *
185
+ * The `as unknown as` below is unavoidable and is the only one in this port. `create` and `update`
186
+ * take the row type as a *parameter*, so `AdminEntityPort<SpecificDescriptor>` is contravariant in
187
+ * it and is genuinely not assignable to any common supertype. The cast is sound in the direction
188
+ * that gets exercised — a typed row is a bag of unknowns — and unsound only if the adapter's rows
189
+ * do not match the descriptor it advertises, which is precisely what `options.onViolation` is here
190
+ * to surface.
191
+ *
192
+ * @param port A port whose rows are typed by its own descriptor.
193
+ * @param options Wire `onViolation` to have every row checked against the descriptor on the way
194
+ * out; omit it for zero added cost.
195
+ * @returns The same port, typed as {@link AdminErasedEntityPort}; a fresh wrapper object when
196
+ * `onViolation` is set, and the original object when it is not.
197
+ * @complexity Time O(1) to erase; O(rows × fields) per call when checking is on.
198
+ * @overallScore 100
199
+ */
200
+ export function eraseEntityPort(port, options = {}) {
201
+ const erased = port;
202
+ const { onViolation } = options;
203
+ if (onViolation === undefined)
204
+ return erased;
205
+ const { descriptor } = port;
206
+ const checked = {
207
+ descriptor,
208
+ async list(query) {
209
+ const page = await erased.list(query);
210
+ for (const row of page.items)
211
+ checkRow(descriptor, 'list', row, onViolation);
212
+ return page;
213
+ },
214
+ async get(id) {
215
+ const row = await erased.get(id);
216
+ return row === null ? null : checkRow(descriptor, 'get', row, onViolation);
217
+ },
218
+ async create(input) {
219
+ return checkRow(descriptor, 'create', await erased.create(input), onViolation);
220
+ },
221
+ async update(id, patch) {
222
+ return checkRow(descriptor, 'update', await erased.update(id, patch), onViolation);
223
+ },
224
+ };
225
+ // Preserved by presence, not by a forwarding stub: a screen decides whether to render a delete
226
+ // affordance by testing `remove !== undefined`, so wrapping an absent one into an always-present
227
+ // function would give every entity a delete button that throws.
228
+ const { remove } = erased;
229
+ if (remove === undefined)
230
+ return checked;
231
+ // `.call(erased, ...)` rather than a bare reference: an adapter written as an object literal with
232
+ // shorthand methods may legitimately use `this` to reach its own store.
233
+ return { ...checked, remove: (id) => remove.call(erased, id) };
234
+ }
235
+ /**
236
+ * Every internal inconsistency in one descriptor, as human-readable sentences.
237
+ *
238
+ * @param descriptor The descriptor to check.
239
+ * @param registryKey The key it is being registered under.
240
+ * @param registeredNames Every name in the registry, for resolving `relation` targets.
241
+ * @complexity Time O(fields); space O(problems).
242
+ * @overallScore 100
243
+ */
244
+ function findDescriptorProblems(descriptor, registryKey, registeredNames) {
245
+ const problems = [];
246
+ const at = `'${registryKey}'`;
247
+ if (descriptor.name !== registryKey) {
248
+ // One entity, one name. Allowing these to differ would leave the URL segment, the relation
249
+ // target, and the registry key as three identifiers with no stated relationship between them.
250
+ problems.push(`${at}: registered under '${registryKey}' but its descriptor is named '${descriptor.name}'`);
251
+ }
252
+ if (descriptor.labelSingular === '' || descriptor.labelPlural === '') {
253
+ problems.push(`${at}: labelSingular and labelPlural must both be non-empty`);
254
+ }
255
+ if (descriptor.fields.length === 0) {
256
+ problems.push(`${at}: declares no fields, so nothing but its id could ever be shown or edited`);
257
+ }
258
+ const seen = new Set();
259
+ for (const field of descriptor.fields) {
260
+ if (field.name === '') {
261
+ problems.push(`${at}: a field has an empty name`);
262
+ continue;
263
+ }
264
+ if (field.name === IMPLICIT_ROW_KEY) {
265
+ problems.push(`${at}: '${IMPLICIT_ROW_KEY}' is implicit on every row and must not be declared as a field`);
266
+ }
267
+ if (seen.has(field.name))
268
+ problems.push(`${at}: field '${field.name}' is declared more than once`);
269
+ seen.add(field.name);
270
+ if (field.kind === 'relation' && !registeredNames.has(field.target)) {
271
+ problems.push(`${at}: field '${field.name}' targets '${field.target}', which is not a registered entity`);
272
+ }
273
+ }
274
+ const titleField = descriptor.fields.find((field) => field.name === descriptor.titleField);
275
+ if (titleField === undefined) {
276
+ problems.push(`${at}: titleField '${descriptor.titleField}' does not name a declared field`);
277
+ }
278
+ else if (titleField.kind !== 'text') {
279
+ problems.push(`${at}: titleField '${descriptor.titleField}' is kind '${titleField.kind}'; a title must be 'text'`);
280
+ }
281
+ return problems;
282
+ }
283
+ /**
284
+ * Assembles entity ports into a registry, validating every descriptor first.
285
+ *
286
+ * Same ergonomics as `createAdminClient`: one object literal, `TPorts` inferred, host-owned and
287
+ * Jini-shipped entries indistinguishable. Registering an entity is one line.
288
+ *
289
+ * **No key is reserved.** `createAdminClient` reserves `'transport'` because it merges the
290
+ * transport into the same object it returns; this returns nothing but the ports, so there is
291
+ * nothing an entity named `transport` could shadow. The returned object has a `null` prototype, so
292
+ * a lookup by an attacker- or URL-supplied name (`'constructor'`, `'__proto__'`) resolves to
293
+ * `undefined` rather than walking to `Object.prototype` and yielding a truthy non-port.
294
+ *
295
+ * Deliberately takes no erasure options: a registry holds ports with their row types intact, and
296
+ * checking only becomes possible once those types are erased. `onViolation` therefore belongs to
297
+ * {@link getErasedEntityPort}/{@link listErasedEntityPorts}, at the point the guarantee is dropped.
298
+ *
299
+ * @param ports Entity name -> port. Each key must equal that port's `descriptor.name`.
300
+ * @returns A frozen, null-prototype registry preserving each port's own type.
301
+ * @throws {Error} listing *every* problem found, not just the first — a descriptor with three
302
+ * typos should take one round trip to fix, not three.
303
+ * @complexity Time O(entities × fields); space O(entities).
304
+ * @overallScore 100
305
+ */
306
+ export function createAdminEntityRegistry(ports) {
307
+ const entries = Object.entries(ports);
308
+ const registeredNames = new Set(entries.map(([, port]) => port.descriptor.name));
309
+ const problems = entries.flatMap(([key, port]) => findDescriptorProblems(port.descriptor, key, registeredNames));
310
+ if (problems.length > 0) {
311
+ throw new Error(`createAdminEntityRegistry: invalid descriptors\n- ${problems.join('\n- ')}`);
312
+ }
313
+ const registry = Object.create(null);
314
+ for (const [key, port] of entries)
315
+ registry[key] = port;
316
+ return Object.freeze(registry);
317
+ }
318
+ /**
319
+ * Every registered port, erased, in registration order — what a screen that renders any entity
320
+ * iterates.
321
+ *
322
+ * @complexity Time O(entities); space O(entities).
323
+ * @overallScore 100
324
+ */
325
+ export function listErasedEntityPorts(registry, options = {}) {
326
+ return Object.values(registry).map((port) => eraseEntityPort(port, options));
327
+ }
328
+ /**
329
+ * The erased port registered under `name`, or `null`.
330
+ *
331
+ * `name` is routinely a URL segment, so this never trusts a bare property read: the registry's null
332
+ * prototype already stops `'constructor'` resolving to something truthy, and `Object.hasOwn` holds
333
+ * that guarantee even for a caller that hands in a plain object literal instead.
334
+ *
335
+ * @complexity Time O(1) for the lookup, O(1) for the erasure.
336
+ * @overallScore 100
337
+ */
338
+ export function getErasedEntityPort(registry, name, options = {}) {
339
+ if (!Object.hasOwn(registry, name))
340
+ return null;
341
+ const port = registry[name];
342
+ return port === undefined ? null : eraseEntityPort(port, options);
343
+ }
344
+ //# sourceMappingURL=rules.js.map
@@ -74,14 +74,18 @@ export interface GatedConfirmResult {
74
74
  * excludes it is describing the easy case and abandoning the one that matters. Widened rather than
75
75
  * documented around.
76
76
  *
77
- * The extra parameters default to `string`, so the simple case still reads
77
+ * The extra parameters default to objects carrying `token` and `confirmToken`, so the simple case still reads
78
78
  * `GatedOperation<PlanInput, Details, Result>` with no change.
79
79
  */
80
- export interface GatedOperation<TPlanInput, TDetails, TResult, TConfirmInput = string, TExecuteInput = string> {
80
+ export interface GatedOperation<TPlanInput extends object, TDetails, TResult, TConfirmInput extends object = {
81
+ readonly token: string;
82
+ }, TExecuteInput extends object = {
83
+ readonly confirmToken: string;
84
+ }> {
81
85
  plan(input: TPlanInput): Promise<GatedPlanResult<TDetails>>;
82
- /** Takes the plan's `token`, either bare or as one field of an operation-specific object. */
86
+ /** Takes the plan's `token` as a field of an operation-specific object. */
83
87
  confirm(input: TConfirmInput): Promise<GatedConfirmResult>;
84
- /** Takes the confirm step's `confirmToken`, bare or within an operation-specific object. */
88
+ /** Takes the confirm step's `confirmToken` within an operation-specific object. */
85
89
  execute(input: TExecuteInput): Promise<TResult>;
86
90
  }
87
91
  //# sourceMappingURL=types.d.ts.map
@@ -18,4 +18,8 @@ export type { GatedConfirmResult, GatedOperation, GatedPlanResult } from './gate
18
18
  export type { DataTableSortDirection, DataTableSortState } from './data-table/types.js';
19
19
  export type { AdminAnalyticsHit, AdminAnalyticsPort, AdminAuthPort, AdminAuthUser, AdminComment, AdminCommentsPort, AdminCommentsQueuePage, AdminDatabasePort, AdminDegradedBanner, AdminDisclosureResult, AdminExtensionEnabledResult, AdminExtensionsPort, AdminIdentityPort, AdminIdentityUser, AdminIntegrationDelivery, AdminIntegrationDeliverySummary, AdminIntegrationSubscription, AdminIntegrationsPort, AdminLedgerRow, AdminMedia, AdminMediaPort, AdminMember, AdminMembersPort, AdminPlugin, AdminPolicy, AdminRecoveryDeepLinkResult, AdminRecoveryPort, AdminRecoveryStatus, AdminRestorePoint, AdminRestorePointSummary, AdminRole, AdminSettingsPort, AdminWorkspace, AdminWorkspacePort, CategoryCount, CommentModerationAction, CommentsSettings, CommentStatus, DatabaseContextEnvelope, DegradedBannerActionKind, DegradedBannerKind, MigrateForwardResult, RestoreConfirmInput, RestoreExecuteInput, RestoreExecuteResult, RestorePointCostClass, SettingResolvedValue, SettingResetResponse, SettingScope, SettingValueResponse, } from './ports/index.js';
20
20
  export type { AdminAssignMenuLocationResult, AdminDeleteMenuResult, AdminFormCreateInput, AdminFormDefinition, AdminFormField, AdminFormNotifyConfig, AdminFormsPort, AdminFormSubmission, AdminFormSubmissionPage, AdminFormUpdatePatch, AdminMenu, AdminMenuBinding, AdminMenuCreateInput, AdminMenuCustomTarget, AdminMenuEntryTarget, AdminMenuItem, AdminMenuItemAttrs, AdminMenuRouteTarget, AdminMenusPort, AdminMenuTarget, AdminMenuTermTarget, AdminMenuUpdateTreeInput, AdminMenuUrlTarget, AdminRedirect, AdminRedirectCreateInput, AdminRedirectHitStats, AdminRedirectImportFailure, AdminRedirectImportResult, AdminRedirectListFilter, AdminRedirectsPort, AdminRedirectUpdatePatch, AdminSeoAnalysis, AdminSeoIssue, AdminSeoMeta, AdminSeoOpenGraph, AdminSeoOverrides, AdminSeoPort, AdminSeoRobotsDirective, AdminSeoRobotsRule, AdminSeoSettings, AdminSeoTwitterCard, FormDefinitionStatus, FormFieldType, MenuStatus, NavTargetKind, RedirectMatchType, RedirectSource, RedirectStatus, RedirectStatusCode, SeoIssueSeverity, SeoOpenGraphType, SeoTwitterCardKind, } from './ports/index.js';
21
+ export type { AdminEntityDescriptor, AdminEntityField, AdminEntityFieldKind, AdminEntityFilter, AdminEntityJsonField, AdminEntityListQuery, AdminEntityPage, AdminEntityPort, AdminEntityRegistry, AdminEntityRelationField, AdminEntityRow, AdminEntityRowData, AdminEntityScalarField, AdminErasedEntityPort, } from './ports/index.js';
22
+ export { createAdminEntityRegistry, describeAdminEntityFieldMismatch, eraseEntityPort, getErasedEntityPort, listErasedEntityPorts, } from './entities/rules.js';
23
+ export type { AdminEntityErasureOptions, AdminEntityRowViolation } from './entities/rules.js';
24
+ export type { AdminShellContext, AdminShellNavigationPort, AdminShellSession, AdminShellSessionPort } from './ports/shell.js';
21
25
  //# sourceMappingURL=index.d.ts.map
@@ -12,4 +12,5 @@ export { DEFAULT_ADMIN_BASE, adminHref, currentRoutePath, matchRoute, stripTrail
12
12
  export { hasPermission } from './permissions/rules.js';
13
13
  // Transport — the seam every route group is built on.
14
14
  export { AdminApiError, createAdminClient, createHttpTransport, describeApiError, } from './transport/index.js';
15
+ export { createAdminEntityRegistry, describeAdminEntityFieldMismatch, eraseEntityPort, getErasedEntityPort, listErasedEntityPorts, } from './entities/rules.js';
15
16
  //# sourceMappingURL=index.js.map
@@ -22,7 +22,9 @@ export interface AdminRegistryContext {
22
22
  * @complexity O(p * (r + m)) — p panels, r requirements each, m permissions each. All three are
23
23
  * small, bounded by what a developer typed into a manifest.
24
24
  */
25
- export declare function resolvePanels<T>(panels: readonly AdminPanel<T>[], context?: AdminRegistryContext): readonly AdminPanel<T>[];
25
+ export declare function resolvePanels<T>({ panels }: {
26
+ readonly panels: readonly AdminPanel<T>[];
27
+ }, context?: AdminRegistryContext): readonly AdminPanel<T>[];
26
28
  /** A sidebar group, ready to render. */
27
29
  export interface AdminNavGroup {
28
30
  /** Group heading; absent for the ungrouped top row. */
@@ -46,9 +48,18 @@ export interface AdminNavItem extends AdminNavEntry {
46
48
  *
47
49
  * @complexity O(n log n) on the items within each group; O(n) otherwise.
48
50
  */
49
- export declare function buildNav<T>(panels: readonly AdminPanel<T>[]): readonly AdminNavGroup[];
50
- /** Panel id -> its **route path**. `dashboard` is the root, not `/dashboard`. */
51
- export declare function panelHref(panelId: string): string;
51
+ export declare function buildNav<T>({ panels }: {
52
+ readonly panels: readonly AdminPanel<T>[];
53
+ }, options?: {
54
+ readonly defaultPanelId?: string;
55
+ }): readonly AdminNavGroup[];
56
+ /** Panel id -> its **route path**. `dashboard` is the root, not `/dashboard`, unless the host
57
+ * assigns root to another default panel. Navigation and agent maps must share that policy. */
58
+ export declare function panelHref({ panelId }: {
59
+ readonly panelId: string;
60
+ }, { defaultPanelId }?: {
61
+ readonly defaultPanelId?: string;
62
+ }): string;
52
63
  /**
53
64
  * The agent-navigable page ids: panel id -> route path.
54
65
  *
@@ -68,8 +79,11 @@ export declare function panelHref(panelId: string): string;
68
79
  * Note the ordering dependency: callers must pass the **resolved** panel set, not the raw one, or
69
80
  * an agent could navigate to a panel whose capability is not wired.
70
81
  */
71
- export declare function buildAgentPageMap<T>(panels: readonly AdminPanel<T>[], options?: {
82
+ export declare function buildAgentPageMap<T>({ panels }: {
83
+ readonly panels: readonly AdminPanel<T>[];
84
+ }, options?: {
72
85
  readonly defaultReachable?: boolean;
86
+ readonly defaultPanelId?: string;
73
87
  }): Readonly<Record<string, string>>;
74
88
  /**
75
89
  * The page id a resolved route reports through `data-agent-page`.
@@ -80,5 +94,9 @@ export declare function buildAgentPageMap<T>(panels: readonly AdminPanel<T>[], o
80
94
  * Falls back to the panel id so a detail route reports its list page (`/posts/abc` -> `posts`),
81
95
  * which is the nearest id an agent can actually act on.
82
96
  */
83
- export declare function resolveAgentPageId<T>(panels: readonly AdminPanel<T>[], panelId: string | null, view: string | null): string | null;
97
+ export declare function resolveAgentPageId<T>({ panels, panelId, view }: {
98
+ readonly panels: readonly AdminPanel<T>[];
99
+ readonly panelId: string | null;
100
+ readonly view: string | null;
101
+ }): string | null;
84
102
  //# sourceMappingURL=rules.d.ts.map
@@ -14,14 +14,14 @@ import { hasPermission } from '../permissions/rules.js';
14
14
  * @complexity O(p * (r + m)) — p panels, r requirements each, m permissions each. All three are
15
15
  * small, bounded by what a developer typed into a manifest.
16
16
  */
17
- export function resolvePanels(panels, context = {}) {
17
+ export function resolvePanels({ panels }, context = {}) {
18
18
  const capabilities = context.capabilities ?? [];
19
19
  const permissions = context.permissions ?? [];
20
20
  return panels.filter((panel) => {
21
21
  const capabilitiesMet = (panel.requires ?? []).every((key) => capabilities.includes(key));
22
22
  if (!capabilitiesMet)
23
23
  return false;
24
- return (panel.permissions ?? []).every((p) => hasPermission(permissions, p));
24
+ return (panel.permissions ?? []).every((p) => hasPermission({ permissions, permission: p }));
25
25
  });
26
26
  }
27
27
  /**
@@ -34,7 +34,7 @@ export function resolvePanels(panels, context = {}) {
34
34
  *
35
35
  * @complexity O(n log n) on the items within each group; O(n) otherwise.
36
36
  */
37
- export function buildNav(panels) {
37
+ export function buildNav({ panels }, options = {}) {
38
38
  const groups = new Map();
39
39
  const groupOrder = [];
40
40
  // Sentinel for "no group". A panel cannot collide with it: `group` is `string | undefined`, and
@@ -48,7 +48,7 @@ export function buildNav(panels) {
48
48
  groups.set(key, []);
49
49
  groupOrder.push(key);
50
50
  }
51
- groups.get(key)?.push({ ...panel.nav, id: panel.id, href: panelHref(panel.id) });
51
+ groups.get(key)?.push({ ...panel.nav, id: panel.id, href: panelHref({ panelId: panel.id }, options) });
52
52
  });
53
53
  // Ungrouped first regardless of when it was registered — it is the top row, not a peer group.
54
54
  const ordered = [
@@ -65,9 +65,10 @@ export function buildNav(panels) {
65
65
  function stableSortByOrder(items) {
66
66
  return [...items].sort((a, b) => (a.order ?? Number.MAX_SAFE_INTEGER) - (b.order ?? Number.MAX_SAFE_INTEGER));
67
67
  }
68
- /** Panel id -> its **route path**. `dashboard` is the root, not `/dashboard`. */
69
- export function panelHref(panelId) {
70
- return panelId === 'dashboard' ? '/' : `/${panelId}`;
68
+ /** Panel id -> its **route path**. `dashboard` is the root, not `/dashboard`, unless the host
69
+ * assigns root to another default panel. Navigation and agent maps must share that policy. */
70
+ export function panelHref({ panelId }, { defaultPanelId = 'dashboard' } = {}) {
71
+ return panelId === 'dashboard' && defaultPanelId === 'dashboard' ? '/' : `/${panelId}`;
71
72
  }
72
73
  /**
73
74
  * The agent-navigable page ids: panel id -> route path.
@@ -88,12 +89,12 @@ export function panelHref(panelId) {
88
89
  * Note the ordering dependency: callers must pass the **resolved** panel set, not the raw one, or
89
90
  * an agent could navigate to a panel whose capability is not wired.
90
91
  */
91
- export function buildAgentPageMap(panels, options = {}) {
92
+ export function buildAgentPageMap({ panels }, options = {}) {
92
93
  const defaultReachable = options.defaultReachable ?? false;
93
94
  const map = {};
94
95
  panels.forEach((panel) => {
95
96
  if ((panel.agentReachable ?? defaultReachable) === true)
96
- map[panel.id] = panelHref(panel.id);
97
+ map[panel.id] = panelHref({ panelId: panel.id }, options);
97
98
  // A param-free detail route carrying an `agentPageId` is a destination in its own right —
98
99
  // the reference implementation publishes `widget-regions -> /widgets/regions` exactly this
99
100
  // way. A route WITH params
@@ -104,7 +105,7 @@ export function buildAgentPageMap(panels, options = {}) {
104
105
  return;
105
106
  if (route.pattern.includes(':'))
106
107
  return;
107
- map[route.agentPageId] = `${panelHref(panel.id)}${route.pattern}`.replace('//', '/');
108
+ map[route.agentPageId] = `${panelHref({ panelId: panel.id }, options)}${route.pattern}`.replace('//', '/');
108
109
  });
109
110
  });
110
111
  return map;
@@ -118,7 +119,7 @@ export function buildAgentPageMap(panels, options = {}) {
118
119
  * Falls back to the panel id so a detail route reports its list page (`/posts/abc` -> `posts`),
119
120
  * which is the nearest id an agent can actually act on.
120
121
  */
121
- export function resolveAgentPageId(panels, panelId, view) {
122
+ export function resolveAgentPageId({ panels, panelId, view }) {
122
123
  if (panelId == null)
123
124
  return null;
124
125
  const panel = panels.find((p) => p.id === panelId);
@@ -0,0 +1,22 @@
1
+ export interface ControllerStore<S> {
2
+ getSnapshot(required?: Record<string, never>, optional?: Record<string, never>): S;
3
+ subscribe(required: {
4
+ listener: () => void;
5
+ }, optional?: Record<string, never>): () => void;
6
+ dispose(required?: Record<string, never>, optional?: Record<string, never>): void;
7
+ }
8
+ /** Snapshot identity changes only on a write: useSyncExternalStore requires a cached snapshot. */
9
+ export declare function createControllerStore<S extends object>({ initial }: {
10
+ initial: S;
11
+ }, _optional?: Record<string, never>): {
12
+ getSnapshot: () => Readonly<S>;
13
+ subscribe: ({ listener }: {
14
+ listener: () => void;
15
+ }) => () => void;
16
+ set: ({ patch }: {
17
+ patch: Partial<S>;
18
+ }) => void;
19
+ signal: AbortSignal;
20
+ dispose: () => void;
21
+ };
22
+ //# sourceMappingURL=controller-store.d.ts.map
@@ -0,0 +1,32 @@
1
+ /** Snapshot identity changes only on a write: useSyncExternalStore requires a cached snapshot. */
2
+ export function createControllerStore({ initial }, _optional = {}) {
3
+ let state = Object.freeze(initial), disposed = false;
4
+ const listeners = new Set();
5
+ const abort = new AbortController();
6
+ return {
7
+ getSnapshot: () => state,
8
+ subscribe: ({ listener }) => {
9
+ if (!disposed)
10
+ listeners.add(listener);
11
+ return () => {
12
+ listeners.delete(listener);
13
+ };
14
+ },
15
+ set: ({ patch }) => {
16
+ if (disposed)
17
+ return;
18
+ state = Object.freeze({ ...state, ...patch });
19
+ for (const listener of listeners)
20
+ listener();
21
+ },
22
+ signal: abort.signal,
23
+ dispose: () => {
24
+ if (disposed)
25
+ return;
26
+ disposed = true;
27
+ abort.abort();
28
+ listeners.clear();
29
+ },
30
+ };
31
+ }
32
+ //# sourceMappingURL=controller-store.js.map
@@ -0,0 +1,41 @@
1
+ import type { AdminInstance, AdminModule, TabId } from './types.js';
2
+ import type { PortMap, PortValues } from './token.js';
3
+ export declare class AdminConfigError extends Error {
4
+ readonly issues: readonly string[];
5
+ constructor({ issues }: {
6
+ issues: readonly string[];
7
+ }, _optional?: Record<string, never>);
8
+ }
9
+ type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
10
+ type TabMaps<M extends AdminModule> = {
11
+ [P in keyof M['pages']]: {
12
+ [T in keyof M['pages'][P]['tabs']]: M['pages'][P]['tabs'][T] extends infer Tab ? Tab extends {
13
+ requires: infer R extends PortMap;
14
+ } ? R : {} : never;
15
+ }[keyof M['pages'][P]['tabs']];
16
+ }[keyof M['pages']];
17
+ type OptionalTabMaps<M extends AdminModule> = {
18
+ [P in keyof M['pages']]: {
19
+ [T in keyof M['pages'][P]['tabs']]: M['pages'][P]['tabs'][T] extends {
20
+ optional: infer R extends PortMap;
21
+ } ? R : {};
22
+ }[keyof M['pages'][P]['tabs']];
23
+ }[keyof M['pages']];
24
+ type Values<P> = P extends PortMap ? PortValues<P> : {};
25
+ type RequiredValues<M extends AdminModule> = M extends unknown ? PortValues<NonNullable<M['requires']>> & UnionToIntersection<Values<TabMaps<M>>> : never;
26
+ type ProvidedNames<M extends AdminModule> = M extends unknown ? keyof NonNullable<M['provides']> : never;
27
+ type AllValues<M extends AdminModule> = M extends unknown ? RequiredValues<M> & UnionToIntersection<Values<OptionalTabMaps<M>>> & PortValues<NonNullable<M['optional']>> & PortValues<NonNullable<M['provides']>> : never;
28
+ export type AdminHostPorts<Ms extends readonly AdminModule[]> = Omit<UnionToIntersection<RequiredValues<Ms[number]>>, ProvidedNames<Ms[number]>> & Partial<UnionToIntersection<AllValues<Ms[number]>>>;
29
+ export interface AdminOptions<Ms extends readonly AdminModule[]> {
30
+ readonly omit?: readonly TabId<Ms[number]>[];
31
+ /** Host collisions are rejected unless the provider name is explicitly listed here. */
32
+ readonly overrides?: readonly ProvidedNames<Ms[number]>[];
33
+ /** No grant means no page/tab access. This UI gate does not replace server authorization. */
34
+ readonly permissions?: readonly string[];
35
+ }
36
+ export declare function createAdmin<const Ms extends readonly AdminModule[], const P extends AdminHostPorts<Ms>>({ modules, ports, }: {
37
+ modules: Ms;
38
+ ports: P & Record<Exclude<keyof P, keyof AdminHostPorts<Ms>>, never>;
39
+ }, options?: AdminOptions<Ms>): AdminInstance;
40
+ export {};
41
+ //# sourceMappingURL=create-admin.d.ts.map