@aphexcms/cms-core 9.4.0 → 9.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/dist/admin/block-previews.svelte.d.ts +46 -0
  2. package/dist/admin/block-previews.svelte.d.ts.map +1 -0
  3. package/dist/admin/block-previews.svelte.js +26 -0
  4. package/dist/admin/field-components.svelte.d.ts +16 -0
  5. package/dist/admin/field-components.svelte.d.ts.map +1 -0
  6. package/dist/admin/field-components.svelte.js +18 -0
  7. package/dist/admin/nav.svelte.d.ts +34 -0
  8. package/dist/admin/nav.svelte.d.ts.map +1 -0
  9. package/dist/admin/nav.svelte.js +78 -0
  10. package/dist/admin/slots.svelte.d.ts +50 -0
  11. package/dist/admin/slots.svelte.d.ts.map +1 -0
  12. package/dist/admin/slots.svelte.js +67 -0
  13. package/dist/admin/types.d.ts +7 -0
  14. package/dist/admin/types.d.ts.map +1 -0
  15. package/dist/admin/types.js +1 -0
  16. package/dist/api/schemas/api-keys.d.ts +4 -37
  17. package/dist/api/schemas/api-keys.d.ts.map +1 -1
  18. package/dist/api/schemas/api-keys.js +5 -2
  19. package/dist/api/schemas/assets.d.ts +4 -0
  20. package/dist/api/schemas/assets.d.ts.map +1 -1
  21. package/dist/api/schemas/assets.js +3 -0
  22. package/dist/api/schemas/plugin-settings.d.ts +6 -0
  23. package/dist/api/schemas/plugin-settings.d.ts.map +1 -0
  24. package/dist/api/schemas/plugin-settings.js +8 -0
  25. package/dist/api/schemas/roles.d.ts +7 -56
  26. package/dist/api/schemas/roles.d.ts.map +1 -1
  27. package/dist/api/schemas/roles.js +11 -6
  28. package/dist/api/schemas/user.d.ts +2 -1
  29. package/dist/api/schemas/user.d.ts.map +1 -1
  30. package/dist/api/schemas/user.js +7 -2
  31. package/dist/app-augment.d.ts +11 -0
  32. package/dist/app-augment.d.ts.map +1 -1
  33. package/dist/app.d.ts +2 -0
  34. package/dist/auth/provider.d.ts +3 -0
  35. package/dist/auth/provider.d.ts.map +1 -1
  36. package/dist/cli/generate-types.d.ts +1 -4
  37. package/dist/cli/generate-types.d.ts.map +1 -1
  38. package/dist/cli/generate-types.js +99 -65
  39. package/dist/cli/generate-types.js.map +1 -1
  40. package/dist/cli/index.js +3 -3
  41. package/dist/cli/index.js.map +1 -1
  42. package/dist/client/index.d.ts +6 -0
  43. package/dist/client/index.d.ts.map +1 -1
  44. package/dist/client/index.js +9 -0
  45. package/dist/components/AdminApp.svelte +259 -113
  46. package/dist/components/AdminApp.svelte.d.ts +18 -2
  47. package/dist/components/AdminApp.svelte.d.ts.map +1 -1
  48. package/dist/components/admin/AdminSlot.svelte +18 -0
  49. package/dist/components/admin/AdminSlot.svelte.d.ts +12 -0
  50. package/dist/components/admin/AdminSlot.svelte.d.ts.map +1 -0
  51. package/dist/components/admin/DocumentEditor.svelte +646 -385
  52. package/dist/components/admin/DocumentEditor.svelte.d.ts +13 -0
  53. package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
  54. package/dist/components/admin/MediaBrowser.svelte +13 -3
  55. package/dist/components/admin/MediaBrowser.svelte.d.ts.map +1 -1
  56. package/dist/components/admin/PluginSettingsPanel.svelte +231 -0
  57. package/dist/components/admin/PluginSettingsPanel.svelte.d.ts +8 -0
  58. package/dist/components/admin/PluginSettingsPanel.svelte.d.ts.map +1 -0
  59. package/dist/components/admin/SchemaField.svelte +76 -95
  60. package/dist/components/admin/SchemaField.svelte.d.ts +7 -0
  61. package/dist/components/admin/SchemaField.svelte.d.ts.map +1 -1
  62. package/dist/components/admin/fields/ArrayField.svelte +24 -2
  63. package/dist/components/admin/fields/ArrayField.svelte.d.ts.map +1 -1
  64. package/dist/components/admin/fields/FieldInput.svelte +109 -0
  65. package/dist/components/admin/fields/FieldInput.svelte.d.ts +17 -0
  66. package/dist/components/admin/fields/FieldInput.svelte.d.ts.map +1 -0
  67. package/dist/components/admin/fields/richtext/PortableTextImageView.svelte +5 -12
  68. package/dist/components/admin/fields/richtext/PortableTextImageView.svelte.d.ts +2 -9
  69. package/dist/components/admin/fields/richtext/PortableTextImageView.svelte.d.ts.map +1 -1
  70. package/dist/components/admin/fields/richtext/PortableTextObjectView.svelte +18 -17
  71. package/dist/components/admin/fields/richtext/PortableTextObjectView.svelte.d.ts +2 -9
  72. package/dist/components/admin/fields/richtext/PortableTextObjectView.svelte.d.ts.map +1 -1
  73. package/dist/components/admin/fields/richtext/RichtextField.svelte +55 -2
  74. package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts.map +1 -1
  75. package/dist/components/admin/fields/richtext/portable-text-object-node.d.ts +7 -0
  76. package/dist/components/admin/fields/richtext/portable-text-object-node.d.ts.map +1 -1
  77. package/dist/components/admin/fields/richtext/portable-text-object-node.js +4 -2
  78. package/dist/components/admin/fields/richtext/svelte-node-view.d.ts +16 -1
  79. package/dist/components/admin/fields/richtext/svelte-node-view.d.ts.map +1 -1
  80. package/dist/components/admin/fields/richtext/svelte-node-view.js +20 -1
  81. package/dist/components/layout/OrganizationSwitcher.svelte +31 -10
  82. package/dist/components/layout/OrganizationSwitcher.svelte.d.ts.map +1 -1
  83. package/dist/components/layout/Sidebar.svelte +49 -11
  84. package/dist/components/layout/Sidebar.svelte.d.ts +5 -1
  85. package/dist/components/layout/Sidebar.svelte.d.ts.map +1 -1
  86. package/dist/components/layout/sidebar/AppSidebar.svelte +66 -3
  87. package/dist/components/layout/sidebar/AppSidebar.svelte.d.ts +5 -0
  88. package/dist/components/layout/sidebar/AppSidebar.svelte.d.ts.map +1 -1
  89. package/dist/components/layout/sidebar/NavMain.svelte +3 -2
  90. package/dist/components/layout/sidebar/NavMain.svelte.d.ts +4 -3
  91. package/dist/components/layout/sidebar/NavMain.svelte.d.ts.map +1 -1
  92. package/dist/components/layout/sidebar/NavUser.svelte +5 -1
  93. package/dist/config.d.ts.map +1 -1
  94. package/dist/config.js +11 -0
  95. package/dist/db/interfaces/asset.d.ts +1 -0
  96. package/dist/db/interfaces/asset.d.ts.map +1 -1
  97. package/dist/db/interfaces/index.d.ts +3 -1
  98. package/dist/db/interfaces/index.d.ts.map +1 -1
  99. package/dist/db/interfaces/plugin-settings.d.ts +23 -0
  100. package/dist/db/interfaces/plugin-settings.d.ts.map +1 -0
  101. package/dist/db/interfaces/plugin-settings.js +13 -0
  102. package/dist/db/interfaces/role.d.ts +14 -5
  103. package/dist/db/interfaces/role.d.ts.map +1 -1
  104. package/dist/engine.d.ts +28 -0
  105. package/dist/engine.d.ts.map +1 -1
  106. package/dist/engine.js +44 -0
  107. package/dist/hooks.d.ts +6 -0
  108. package/dist/hooks.d.ts.map +1 -1
  109. package/dist/hooks.js +59 -2
  110. package/dist/index.d.ts +2 -0
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +5 -0
  113. package/dist/lib/admin/block-previews.svelte.d.ts +46 -0
  114. package/dist/lib/admin/block-previews.svelte.d.ts.map +1 -0
  115. package/dist/lib/admin/block-previews.svelte.js +27 -0
  116. package/dist/lib/admin/block-previews.svelte.js.map +1 -0
  117. package/dist/lib/admin/field-components.svelte.d.ts +16 -0
  118. package/dist/lib/admin/field-components.svelte.d.ts.map +1 -0
  119. package/dist/lib/admin/field-components.svelte.js +19 -0
  120. package/dist/lib/admin/field-components.svelte.js.map +1 -0
  121. package/dist/lib/admin/nav.svelte.d.ts +34 -0
  122. package/dist/lib/admin/nav.svelte.d.ts.map +1 -0
  123. package/dist/lib/admin/nav.svelte.js +79 -0
  124. package/dist/lib/admin/nav.svelte.js.map +1 -0
  125. package/dist/lib/admin/slots.svelte.d.ts +50 -0
  126. package/dist/lib/admin/slots.svelte.d.ts.map +1 -0
  127. package/dist/lib/admin/slots.svelte.js +68 -0
  128. package/dist/lib/admin/slots.svelte.js.map +1 -0
  129. package/dist/lib/admin/types.d.ts +7 -0
  130. package/dist/lib/admin/types.d.ts.map +1 -0
  131. package/dist/lib/admin/types.js +2 -0
  132. package/dist/lib/admin/types.js.map +1 -0
  133. package/dist/lib/api/schemas/api-keys.d.ts +4 -37
  134. package/dist/lib/api/schemas/api-keys.d.ts.map +1 -1
  135. package/dist/lib/api/schemas/api-keys.js +5 -2
  136. package/dist/lib/api/schemas/api-keys.js.map +1 -1
  137. package/dist/lib/api/schemas/assets.d.ts +4 -0
  138. package/dist/lib/api/schemas/assets.d.ts.map +1 -1
  139. package/dist/lib/api/schemas/assets.js +3 -0
  140. package/dist/lib/api/schemas/assets.js.map +1 -1
  141. package/dist/lib/api/schemas/plugin-settings.d.ts +6 -0
  142. package/dist/lib/api/schemas/plugin-settings.d.ts.map +1 -0
  143. package/dist/lib/api/schemas/plugin-settings.js +9 -0
  144. package/dist/lib/api/schemas/plugin-settings.js.map +1 -0
  145. package/dist/lib/api/schemas/roles.d.ts +7 -56
  146. package/dist/lib/api/schemas/roles.d.ts.map +1 -1
  147. package/dist/lib/api/schemas/roles.js +11 -6
  148. package/dist/lib/api/schemas/roles.js.map +1 -1
  149. package/dist/lib/api/schemas/user.d.ts +2 -1
  150. package/dist/lib/api/schemas/user.d.ts.map +1 -1
  151. package/dist/lib/api/schemas/user.js +7 -2
  152. package/dist/lib/api/schemas/user.js.map +1 -1
  153. package/dist/lib/app-augment.d.ts +11 -0
  154. package/dist/lib/app-augment.d.ts.map +1 -1
  155. package/dist/lib/auth/provider.d.ts +3 -0
  156. package/dist/lib/auth/provider.d.ts.map +1 -1
  157. package/dist/lib/client/index.d.ts +6 -0
  158. package/dist/lib/client/index.d.ts.map +1 -1
  159. package/dist/lib/client/index.js +9 -0
  160. package/dist/lib/client/index.js.map +1 -1
  161. package/dist/lib/components/admin/fields/richtext/portable-text-object-node.d.ts +7 -0
  162. package/dist/lib/components/admin/fields/richtext/portable-text-object-node.d.ts.map +1 -1
  163. package/dist/lib/components/admin/fields/richtext/portable-text-object-node.js +4 -2
  164. package/dist/lib/components/admin/fields/richtext/portable-text-object-node.js.map +1 -1
  165. package/dist/lib/components/admin/fields/richtext/svelte-node-view.d.ts +16 -1
  166. package/dist/lib/components/admin/fields/richtext/svelte-node-view.d.ts.map +1 -1
  167. package/dist/lib/components/admin/fields/richtext/svelte-node-view.js +20 -1
  168. package/dist/lib/components/admin/fields/richtext/svelte-node-view.js.map +1 -1
  169. package/dist/lib/config.d.ts.map +1 -1
  170. package/dist/lib/config.js +11 -0
  171. package/dist/lib/config.js.map +1 -1
  172. package/dist/lib/db/interfaces/asset.d.ts +1 -0
  173. package/dist/lib/db/interfaces/asset.d.ts.map +1 -1
  174. package/dist/lib/db/interfaces/index.d.ts +3 -1
  175. package/dist/lib/db/interfaces/index.d.ts.map +1 -1
  176. package/dist/lib/db/interfaces/plugin-settings.d.ts +23 -0
  177. package/dist/lib/db/interfaces/plugin-settings.d.ts.map +1 -0
  178. package/dist/lib/db/interfaces/plugin-settings.js +14 -0
  179. package/dist/lib/db/interfaces/plugin-settings.js.map +1 -0
  180. package/dist/lib/db/interfaces/role.d.ts +14 -5
  181. package/dist/lib/db/interfaces/role.d.ts.map +1 -1
  182. package/dist/lib/engine.d.ts +28 -0
  183. package/dist/lib/engine.d.ts.map +1 -1
  184. package/dist/lib/engine.js +44 -0
  185. package/dist/lib/engine.js.map +1 -1
  186. package/dist/lib/hooks.d.ts +6 -0
  187. package/dist/lib/hooks.d.ts.map +1 -1
  188. package/dist/lib/hooks.js +59 -2
  189. package/dist/lib/hooks.js.map +1 -1
  190. package/dist/lib/index.d.ts +2 -0
  191. package/dist/lib/index.d.ts.map +1 -1
  192. package/dist/lib/index.js +5 -0
  193. package/dist/lib/index.js.map +1 -1
  194. package/dist/lib/local-api/collection-api.d.ts.map +1 -1
  195. package/dist/lib/local-api/collection-api.js +4 -2
  196. package/dist/lib/local-api/collection-api.js.map +1 -1
  197. package/dist/lib/local-api/types.d.ts +8 -0
  198. package/dist/lib/local-api/types.d.ts.map +1 -1
  199. package/dist/lib/mcp/tools.d.ts.map +1 -1
  200. package/dist/lib/mcp/tools.js +68 -0
  201. package/dist/lib/mcp/tools.js.map +1 -1
  202. package/dist/lib/permissions-context.svelte.d.ts +7 -4
  203. package/dist/lib/permissions-context.svelte.d.ts.map +1 -1
  204. package/dist/lib/permissions-context.svelte.js.map +1 -1
  205. package/dist/lib/plugins/index.d.ts +3 -0
  206. package/dist/lib/plugins/index.d.ts.map +1 -0
  207. package/dist/lib/plugins/index.js +3 -0
  208. package/dist/lib/plugins/index.js.map +1 -0
  209. package/dist/lib/plugins/resolver.d.ts +49 -0
  210. package/dist/lib/plugins/resolver.d.ts.map +1 -0
  211. package/dist/lib/plugins/resolver.js +66 -0
  212. package/dist/lib/plugins/resolver.js.map +1 -0
  213. package/dist/lib/plugins/types.d.ts +233 -0
  214. package/dist/lib/plugins/types.d.ts.map +1 -0
  215. package/dist/lib/plugins/types.js +9 -0
  216. package/dist/lib/plugins/types.js.map +1 -0
  217. package/dist/lib/schema-utils/desugar.d.ts +27 -0
  218. package/dist/lib/schema-utils/desugar.d.ts.map +1 -0
  219. package/dist/lib/schema-utils/desugar.js +102 -0
  220. package/dist/lib/schema-utils/desugar.js.map +1 -0
  221. package/dist/lib/schema-utils/index.d.ts +2 -0
  222. package/dist/lib/schema-utils/index.d.ts.map +1 -1
  223. package/dist/lib/schema-utils/index.js +2 -0
  224. package/dist/lib/schema-utils/index.js.map +1 -1
  225. package/dist/lib/schema-utils/settings.d.ts +17 -0
  226. package/dist/lib/schema-utils/settings.d.ts.map +1 -0
  227. package/dist/lib/schema-utils/settings.js +23 -0
  228. package/dist/lib/schema-utils/settings.js.map +1 -0
  229. package/dist/lib/schema-utils/validator.d.ts.map +1 -1
  230. package/dist/lib/schema-utils/validator.js +11 -0
  231. package/dist/lib/schema-utils/validator.js.map +1 -1
  232. package/dist/lib/security/secret-crypto.d.ts +18 -0
  233. package/dist/lib/security/secret-crypto.d.ts.map +1 -0
  234. package/dist/lib/security/secret-crypto.js +71 -0
  235. package/dist/lib/security/secret-crypto.js.map +1 -0
  236. package/dist/lib/server/api/index.d.ts.map +1 -1
  237. package/dist/lib/server/api/index.js +3 -0
  238. package/dist/lib/server/api/index.js.map +1 -1
  239. package/dist/lib/server/api/routes/assets.d.ts.map +1 -1
  240. package/dist/lib/server/api/routes/assets.js +8 -2
  241. package/dist/lib/server/api/routes/assets.js.map +1 -1
  242. package/dist/lib/server/api/routes/organizations.d.ts.map +1 -1
  243. package/dist/lib/server/api/routes/organizations.js +4 -1
  244. package/dist/lib/server/api/routes/organizations.js.map +1 -1
  245. package/dist/lib/server/api/routes/plugin-settings.d.ts +4 -0
  246. package/dist/lib/server/api/routes/plugin-settings.d.ts.map +1 -0
  247. package/dist/lib/server/api/routes/plugin-settings.js +109 -0
  248. package/dist/lib/server/api/routes/plugin-settings.js.map +1 -0
  249. package/dist/lib/server/api/routes/roles.d.ts.map +1 -1
  250. package/dist/lib/server/api/routes/roles.js +37 -0
  251. package/dist/lib/server/api/routes/roles.js.map +1 -1
  252. package/dist/lib/server/api/routes/user.d.ts.map +1 -1
  253. package/dist/lib/server/api/routes/user.js +14 -3
  254. package/dist/lib/server/api/routes/user.js.map +1 -1
  255. package/dist/lib/services/asset-service.d.ts +1 -0
  256. package/dist/lib/services/asset-service.d.ts.map +1 -1
  257. package/dist/lib/services/asset-service.js.map +1 -1
  258. package/dist/lib/services/index.d.ts +2 -0
  259. package/dist/lib/services/index.d.ts.map +1 -1
  260. package/dist/lib/services/index.js +1 -0
  261. package/dist/lib/services/index.js.map +1 -1
  262. package/dist/lib/services/plugin-settings-service.d.ts +76 -0
  263. package/dist/lib/services/plugin-settings-service.d.ts.map +1 -0
  264. package/dist/lib/services/plugin-settings-service.js +236 -0
  265. package/dist/lib/services/plugin-settings-service.js.map +1 -0
  266. package/dist/lib/services/roles-service.d.ts +2 -2
  267. package/dist/lib/services/roles-service.d.ts.map +1 -1
  268. package/dist/lib/services/roles-service.js.map +1 -1
  269. package/dist/lib/theme/css.d.ts +30 -0
  270. package/dist/lib/theme/css.d.ts.map +1 -0
  271. package/dist/lib/theme/css.js +54 -0
  272. package/dist/lib/theme/css.js.map +1 -0
  273. package/dist/lib/theme/derive.d.ts +27 -0
  274. package/dist/lib/theme/derive.d.ts.map +1 -0
  275. package/dist/lib/theme/derive.js +108 -0
  276. package/dist/lib/theme/derive.js.map +1 -0
  277. package/dist/lib/theme/index.d.ts +5 -0
  278. package/dist/lib/theme/index.d.ts.map +1 -0
  279. package/dist/lib/theme/index.js +5 -0
  280. package/dist/lib/theme/index.js.map +1 -0
  281. package/dist/lib/theme/schemes.d.ts +60 -0
  282. package/dist/lib/theme/schemes.d.ts.map +1 -0
  283. package/dist/lib/theme/schemes.js +150 -0
  284. package/dist/lib/theme/schemes.js.map +1 -0
  285. package/dist/lib/theme/tokens.d.ts +57 -0
  286. package/dist/lib/theme/tokens.d.ts.map +1 -0
  287. package/dist/lib/theme/tokens.js +11 -0
  288. package/dist/lib/theme/tokens.js.map +1 -0
  289. package/dist/lib/types/auth.d.ts +10 -10
  290. package/dist/lib/types/auth.d.ts.map +1 -1
  291. package/dist/lib/types/capabilities.d.ts +50 -9
  292. package/dist/lib/types/capabilities.d.ts.map +1 -1
  293. package/dist/lib/types/capabilities.js +147 -5
  294. package/dist/lib/types/capabilities.js.map +1 -1
  295. package/dist/lib/types/config.d.ts +30 -1
  296. package/dist/lib/types/config.d.ts.map +1 -1
  297. package/dist/lib/types/schemas.d.ts +90 -2
  298. package/dist/lib/types/schemas.d.ts.map +1 -1
  299. package/dist/lib/types/schemas.js.map +1 -1
  300. package/dist/lib/types/sidebar.d.ts +3 -1
  301. package/dist/lib/types/sidebar.d.ts.map +1 -1
  302. package/dist/lib/utils/index.d.ts +1 -0
  303. package/dist/lib/utils/index.d.ts.map +1 -1
  304. package/dist/lib/utils/index.js +1 -0
  305. package/dist/lib/utils/index.js.map +1 -1
  306. package/dist/lib/utils/preview.d.ts +16 -5
  307. package/dist/lib/utils/preview.d.ts.map +1 -1
  308. package/dist/lib/utils/preview.js +7 -2
  309. package/dist/lib/utils/preview.js.map +1 -1
  310. package/dist/lib/vite/index.d.ts +7 -0
  311. package/dist/lib/vite/index.d.ts.map +1 -1
  312. package/dist/lib/vite/index.js +37 -6
  313. package/dist/lib/vite/index.js.map +1 -1
  314. package/dist/local-api/collection-api.d.ts.map +1 -1
  315. package/dist/local-api/collection-api.js +4 -2
  316. package/dist/local-api/types.d.ts +8 -0
  317. package/dist/local-api/types.d.ts.map +1 -1
  318. package/dist/mcp/tools.d.ts.map +1 -1
  319. package/dist/mcp/tools.js +68 -0
  320. package/dist/permissions-context.svelte.d.ts +7 -4
  321. package/dist/permissions-context.svelte.d.ts.map +1 -1
  322. package/dist/plugins/index.d.ts +3 -0
  323. package/dist/plugins/index.d.ts.map +1 -0
  324. package/dist/plugins/index.js +2 -0
  325. package/dist/plugins/resolver.d.ts +49 -0
  326. package/dist/plugins/resolver.d.ts.map +1 -0
  327. package/dist/plugins/resolver.js +65 -0
  328. package/dist/plugins/types.d.ts +233 -0
  329. package/dist/plugins/types.d.ts.map +1 -0
  330. package/dist/plugins/types.js +8 -0
  331. package/dist/schema-utils/desugar.d.ts +27 -0
  332. package/dist/schema-utils/desugar.d.ts.map +1 -0
  333. package/dist/schema-utils/desugar.js +101 -0
  334. package/dist/schema-utils/index.d.ts +2 -0
  335. package/dist/schema-utils/index.d.ts.map +1 -1
  336. package/dist/schema-utils/index.js +2 -0
  337. package/dist/schema-utils/settings.d.ts +17 -0
  338. package/dist/schema-utils/settings.d.ts.map +1 -0
  339. package/dist/schema-utils/settings.js +22 -0
  340. package/dist/schema-utils/validator.d.ts.map +1 -1
  341. package/dist/schema-utils/validator.js +11 -0
  342. package/dist/security/secret-crypto.d.ts +18 -0
  343. package/dist/security/secret-crypto.d.ts.map +1 -0
  344. package/dist/security/secret-crypto.js +70 -0
  345. package/dist/server/api/index.d.ts.map +1 -1
  346. package/dist/server/api/index.js +3 -0
  347. package/dist/server/api/routes/assets.d.ts.map +1 -1
  348. package/dist/server/api/routes/assets.js +8 -2
  349. package/dist/server/api/routes/organizations.d.ts.map +1 -1
  350. package/dist/server/api/routes/organizations.js +4 -1
  351. package/dist/server/api/routes/plugin-settings.d.ts +4 -0
  352. package/dist/server/api/routes/plugin-settings.d.ts.map +1 -0
  353. package/dist/server/api/routes/plugin-settings.js +108 -0
  354. package/dist/server/api/routes/roles.d.ts.map +1 -1
  355. package/dist/server/api/routes/roles.js +37 -0
  356. package/dist/server/api/routes/user.d.ts.map +1 -1
  357. package/dist/server/api/routes/user.js +14 -3
  358. package/dist/services/asset-service.d.ts +1 -0
  359. package/dist/services/asset-service.d.ts.map +1 -1
  360. package/dist/services/index.d.ts +2 -0
  361. package/dist/services/index.d.ts.map +1 -1
  362. package/dist/services/index.js +1 -0
  363. package/dist/services/plugin-settings-service.d.ts +76 -0
  364. package/dist/services/plugin-settings-service.d.ts.map +1 -0
  365. package/dist/services/plugin-settings-service.js +235 -0
  366. package/dist/services/roles-service.d.ts +2 -2
  367. package/dist/services/roles-service.d.ts.map +1 -1
  368. package/dist/theme/css.d.ts +30 -0
  369. package/dist/theme/css.d.ts.map +1 -0
  370. package/dist/theme/css.js +53 -0
  371. package/dist/theme/derive.d.ts +27 -0
  372. package/dist/theme/derive.d.ts.map +1 -0
  373. package/dist/theme/derive.js +107 -0
  374. package/dist/theme/index.d.ts +5 -0
  375. package/dist/theme/index.d.ts.map +1 -0
  376. package/dist/theme/index.js +4 -0
  377. package/dist/theme/schemes.d.ts +60 -0
  378. package/dist/theme/schemes.d.ts.map +1 -0
  379. package/dist/theme/schemes.js +149 -0
  380. package/dist/theme/tokens.d.ts +57 -0
  381. package/dist/theme/tokens.d.ts.map +1 -0
  382. package/dist/theme/tokens.js +10 -0
  383. package/dist/types/auth.d.ts +10 -10
  384. package/dist/types/auth.d.ts.map +1 -1
  385. package/dist/types/capabilities.d.ts +50 -9
  386. package/dist/types/capabilities.d.ts.map +1 -1
  387. package/dist/types/capabilities.js +147 -5
  388. package/dist/types/config.d.ts +30 -1
  389. package/dist/types/config.d.ts.map +1 -1
  390. package/dist/types/schemas.d.ts +90 -2
  391. package/dist/types/schemas.d.ts.map +1 -1
  392. package/dist/types/sidebar.d.ts +3 -1
  393. package/dist/types/sidebar.d.ts.map +1 -1
  394. package/dist/utils/index.d.ts +1 -0
  395. package/dist/utils/index.d.ts.map +1 -1
  396. package/dist/utils/index.js +1 -0
  397. package/dist/utils/preview.d.ts +16 -5
  398. package/dist/utils/preview.d.ts.map +1 -1
  399. package/dist/utils/preview.js +7 -2
  400. package/dist/vite/index.d.ts +7 -0
  401. package/dist/vite/index.d.ts.map +1 -1
  402. package/dist/vite/index.js +37 -6
  403. package/package.json +6 -4
@@ -0,0 +1,149 @@
1
+ import { sanitizeTokenValue } from './css.js';
2
+ const FALLBACK = {
3
+ surface: '#ffffff',
4
+ text: '#15171a',
5
+ primary: '#3eb0ef'
6
+ };
7
+ /** Slugify a scheme name into a stable, safe CSS class fragment. */
8
+ export function schemeSlug(name) {
9
+ const slug = name
10
+ .toLowerCase()
11
+ .replace(/[^a-z0-9]+/g, '-')
12
+ .replace(/^-+|-+$/g, '');
13
+ return slug || 'scheme';
14
+ }
15
+ /** The CSS class that carries a scheme's tokens, e.g. `scheme-dark`. */
16
+ export function schemeClass(name) {
17
+ return `scheme-${schemeSlug(name)}`;
18
+ }
19
+ /** Parse a 3/6-digit hex to [r,g,b] in 0–255, or null if not a plain hex. */
20
+ function parseHex(hex) {
21
+ const m = hex.trim().match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
22
+ const group = m?.[1];
23
+ if (!group)
24
+ return null;
25
+ const h = group.length === 3
26
+ ? group
27
+ .split('')
28
+ .map((c) => c + c)
29
+ .join('')
30
+ : group;
31
+ return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];
32
+ }
33
+ /** WCAG relative luminance (0 black → 1 white) of an sRGB triple. */
34
+ function luminance([r, g, b]) {
35
+ const lin = (c) => {
36
+ const s = c / 255;
37
+ return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
38
+ };
39
+ return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
40
+ }
41
+ /**
42
+ * Pick a readable on-color (near-black or white) for text/icons that sit on top
43
+ * of `background`. Falls back to white when the color can't be parsed.
44
+ */
45
+ export function contrastColor(background) {
46
+ const rgb = parseHex(background);
47
+ if (!rgb)
48
+ return '#ffffff';
49
+ // Compare contrast against white vs near-black; whichever is higher wins.
50
+ const L = luminance(rgb);
51
+ const contrastWhite = 1.05 / (L + 0.05);
52
+ const contrastBlack = (L + 0.05) / 0.05;
53
+ return contrastWhite >= contrastBlack ? '#ffffff' : '#0b0b0c';
54
+ }
55
+ /**
56
+ * Resolve a scheme's three seeds into the full CSS-var role map. Seeds are
57
+ * sanitized; anything invalid falls back to a sensible default so a scheme always
58
+ * emits a complete, coherent palette. The derived roles are `color-mix`
59
+ * expressions over `var(--ink)`/`var(--paper)`, so they recompute correctly for
60
+ * whichever scheme is in scope — no per-shade user input, no drift.
61
+ */
62
+ export function resolveSchemeVars(scheme) {
63
+ const surface = sanitizeTokenValue(scheme.surface) ?? FALLBACK.surface;
64
+ const text = sanitizeTokenValue(scheme.text) ?? FALLBACK.text;
65
+ const primary = sanitizeTokenValue(scheme.primary) ?? FALLBACK.primary;
66
+ return {
67
+ '--paper': surface,
68
+ '--ink': text,
69
+ '--accent': primary,
70
+ '--accent-contrast': contrastColor(primary),
71
+ // Derived — relative to this scheme's ink/paper.
72
+ '--paper-raised': 'color-mix(in srgb, var(--ink) 2%, var(--paper))',
73
+ '--ink-soft': 'color-mix(in srgb, var(--ink) 58%, var(--paper))',
74
+ '--ink-faint': 'color-mix(in srgb, var(--ink) 38%, var(--paper))',
75
+ '--rule': 'color-mix(in srgb, var(--ink) 12%, transparent)',
76
+ '--rule-soft': 'color-mix(in srgb, var(--ink) 7%, transparent)',
77
+ '--accent-ink': 'color-mix(in srgb, var(--accent) 82%, var(--ink))'
78
+ };
79
+ }
80
+ /**
81
+ * Emit one scoped rule per scheme, prefixed so it only styles the site subtree
82
+ * (never `:root`/admin chrome). Returns `''` when there are no schemes.
83
+ *
84
+ * @param scopeSelector Ancestor selector the scheme classes live under, e.g. `.blog-shell`.
85
+ */
86
+ export function emitSchemeStyles(schemes, scopeSelector) {
87
+ const rules = [];
88
+ for (const scheme of schemes) {
89
+ const vars = resolveSchemeVars(scheme);
90
+ const decls = Object.entries(vars)
91
+ .map(([k, v]) => `${k}: ${v};`)
92
+ .join(' ');
93
+ const cls = schemeClass(scheme.name);
94
+ // Match the shell itself when it wears the scheme, and any descendant that does.
95
+ rules.push(`${scopeSelector}.${cls}, ${scopeSelector} .${cls} { ${decls} }`);
96
+ }
97
+ return rules.join('\n');
98
+ }
99
+ /** Read a theme document's `schemes` array, falling back to `defaults` when absent. */
100
+ export function readSchemes(values, defaults) {
101
+ const doc = {};
102
+ if (values && typeof values === 'object')
103
+ Object.assign(doc, values);
104
+ const raw = doc.schemes;
105
+ if (!Array.isArray(raw) || raw.length === 0)
106
+ return defaults;
107
+ const parsed = [];
108
+ for (const item of raw) {
109
+ if (!item || typeof item !== 'object')
110
+ continue;
111
+ const rec = item;
112
+ const name = typeof rec.name === 'string' && rec.name.trim() !== '' ? rec.name : 'Scheme';
113
+ parsed.push({
114
+ name,
115
+ surface: typeof rec.surface === 'string' ? rec.surface : FALLBACK.surface,
116
+ text: typeof rec.text === 'string' ? rec.text : FALLBACK.text,
117
+ primary: typeof rec.primary === 'string' ? rec.primary : FALLBACK.primary
118
+ });
119
+ }
120
+ return parsed.length > 0 ? parsed : defaults;
121
+ }
122
+ /**
123
+ * Build the `schemes` array field for the theme singleton — a repeatable object
124
+ * of { name, surface, text, primary }. The first scheme is the site default.
125
+ */
126
+ export function deriveSchemesField(defaults, group) {
127
+ return {
128
+ name: 'schemes',
129
+ type: 'array',
130
+ title: 'Color schemes',
131
+ description: 'Reusable palettes. The first is the site default; sections can opt into any other. Set the background, text, and accent — the rest is derived.',
132
+ group,
133
+ initialValue: defaults,
134
+ of: [
135
+ {
136
+ type: 'object',
137
+ name: 'colorScheme',
138
+ title: 'Scheme',
139
+ preview: { select: { title: 'name', subtitle: 'primary' } },
140
+ fields: [
141
+ { name: 'name', type: 'string', title: 'Name' },
142
+ { name: 'surface', type: 'string', input: 'color', title: 'Background' },
143
+ { name: 'text', type: 'string', input: 'color', title: 'Text' },
144
+ { name: 'primary', type: 'string', input: 'color', title: 'Accent' }
145
+ ]
146
+ }
147
+ ]
148
+ };
149
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Theme token *types* — the shape of a design-system token.
3
+ *
4
+ * cms-core owns the machinery (turn a token list into a schema + scoped CSS); the
5
+ * consuming app owns the concrete token list, its default colors, and font choices
6
+ * (that's design opinion, not engine concern). See ./derive.ts and ./css.ts for
7
+ * the functions that operate on these, and the app's own `theme/tokens.ts` for a
8
+ * concrete set.
9
+ */
10
+ /** A curated font choice — the stored `value` resolves to a full CSS `stack`. */
11
+ export interface FontOption {
12
+ title: string;
13
+ value: string;
14
+ stack: string;
15
+ }
16
+ interface BaseToken {
17
+ /** Field name in the theme schema and the token's identity. */
18
+ name: string;
19
+ title: string;
20
+ description?: string;
21
+ /** The CSS custom property this token drives, e.g. `--accent`. */
22
+ cssVar: string;
23
+ /** Field group in the admin form. */
24
+ group: string;
25
+ }
26
+ export interface ColorToken extends BaseToken {
27
+ kind: 'color';
28
+ default: string;
29
+ }
30
+ export interface FontToken extends BaseToken {
31
+ kind: 'font';
32
+ /** The stored `value` of the default option. */
33
+ default: string;
34
+ options: FontOption[];
35
+ }
36
+ /** A numeric slider — widths, radii, sizes. Emitted as `${value}${unit}`. */
37
+ export interface RangeToken extends BaseToken {
38
+ kind: 'range';
39
+ default: number;
40
+ min: number;
41
+ max: number;
42
+ step?: number;
43
+ /** CSS unit appended to the value, e.g. `'px'`, `'rem'`. Defaults to `''`. */
44
+ unit?: string;
45
+ }
46
+ /** A fixed-choice dropdown — weights, styles. The stored value is emitted verbatim. */
47
+ export interface SelectToken extends BaseToken {
48
+ kind: 'select';
49
+ default: string;
50
+ options: Array<{
51
+ title: string;
52
+ value: string;
53
+ }>;
54
+ }
55
+ export type ThemeToken = ColorToken | FontToken | RangeToken | SelectToken;
56
+ export {};
57
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/lib/theme/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,iFAAiF;AACjF,MAAM,WAAW,UAAU;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd;AAED,UAAU,SAAS;IAClB,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,6EAA6E;AAC7E,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,uFAAuF;AACvF,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC7C,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjD;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Theme token *types* — the shape of a design-system token.
3
+ *
4
+ * cms-core owns the machinery (turn a token list into a schema + scoped CSS); the
5
+ * consuming app owns the concrete token list, its default colors, and font choices
6
+ * (that's design opinion, not engine concern). See ./derive.ts and ./css.ts for
7
+ * the functions that operate on these, and the app's own `theme/tokens.ts` for a
8
+ * concrete set.
9
+ */
10
+ export {};
@@ -1,6 +1,5 @@
1
1
  import type { CMSUser } from './user.js';
2
2
  import type { OrganizationRole } from './organization.js';
3
- import type { Capability } from './capabilities.js';
4
3
  export interface SessionAuth {
5
4
  type: 'session';
6
5
  user: CMSUser;
@@ -19,11 +18,13 @@ export interface SessionAuth {
19
18
  */
20
19
  organizationRole: OrganizationRole | string;
21
20
  /**
22
- * Capabilities resolved for this session by the auth hook (RolesService).
23
- * Present for fully-authenticated sessions. When absent, callers fall
24
- * back to built-in seed values see `resolveCapabilities`.
21
+ * Capability ids granted to this session, resolved by the auth hook (RolesService).
22
+ * `string[]`, not `Capability[]`: a role can grant plugin-declared capabilities that
23
+ * aren't in the built-in `Capability` union. Present for fully-authenticated
24
+ * sessions; when absent, callers fall back to built-in seed values — see
25
+ * `resolveCapabilities`.
25
26
  */
26
- capabilities?: Capability[];
27
+ capabilities?: string[];
27
28
  organizations?: Array<{
28
29
  id: string;
29
30
  name: string;
@@ -57,12 +58,11 @@ export interface ApiKeyAuth {
57
58
  */
58
59
  permissions: ('read' | 'write')[];
59
60
  /**
60
- * Fine-grained capability allowlist for this API key. When present,
61
- * overrides the coarse `permissions` mapping — the key can do exactly
62
- * what's listed and nothing else. Storage format on the key metadata
63
- * matches the Capability union.
61
+ * Fine-grained capability-id allowlist for this API key. When present, overrides
62
+ * the coarse `permissions` mapping — the key can do exactly what's listed and
63
+ * nothing else. `string[]` so keys can be scoped to plugin capabilities too.
64
64
  */
65
- capabilities?: Capability[];
65
+ capabilities?: string[];
66
66
  organizationId: string;
67
67
  environment?: string;
68
68
  lastUsedAt?: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/types/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,IAAI,CAAC;KAChB,CAAC;IACF,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;;;OAOG;IACH,gBAAgB,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAC5C;;;;OAIG;IACH,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC;QACrB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAAC;QAChC,QAAQ,EAAE,OAAO,CAAC;QAClB,QAAQ,CAAC,EAAE,GAAG,CAAC;KACf,CAAC,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,IAAI,CAAC;KAChB,CAAC;CACF;AAED,MAAM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rganizationRole } from './organization.js';
6
6
  * Append-only: removing or renaming a value silently weakens every call site.
7
7
  * If a capability is no longer needed, leave the string and stop granting it.
8
8
  */
9
- export type Capability = 'document.read' | 'document.create' | 'document.update' | 'document.delete' | 'document.publish' | 'document.unpublish' | 'asset.read' | 'asset.upload' | 'asset.delete' | 'member.invite' | 'member.remove' | 'member.changeRole' | 'apiKey.manage' | 'role.manage' | 'org.settings';
9
+ export type Capability = 'document.read' | 'document.create' | 'document.update' | 'document.delete' | 'document.publish' | 'document.unpublish' | 'asset.read' | 'asset.upload' | 'asset.delete' | 'member.invite' | 'member.remove' | 'member.changeRole' | 'apiKey.manage' | 'role.manage' | 'org.settings' | 'plugin.settings.manage';
10
10
  /**
11
11
  * Enumerate every capability. Useful for owner seeding and validation.
12
12
  */
13
13
  export declare const ALL_CAPABILITIES: readonly Capability[];
14
+ /**
15
+ * Metadata for one capability — a registry entry. Turns a bare permission string
16
+ * into something the roles UI can present (title, help text, grouping). Built-ins
17
+ * are defined below; plugins add their own via the `aphex/capabilities` part, and
18
+ * the part resolver merges both into one catalog (`resolver.capabilityCatalog()`).
19
+ */
20
+ export interface CapabilityDefinition {
21
+ /** The permission string checked at runtime, e.g. `'document.publish'`. */
22
+ id: string;
23
+ /** Human label shown in the roles UI. */
24
+ title: string;
25
+ /** One-line explanation shown under the title. */
26
+ description?: string;
27
+ /** Group heading in the roles UI, e.g. `'Documents'`. */
28
+ group?: string;
29
+ }
30
+ /**
31
+ * Define a capability with metadata. Plugins pass these to the `aphex/capabilities`
32
+ * part so their permissions appear (and are assignable) in the roles UI.
33
+ *
34
+ * @example
35
+ * defineCapability('forms.export', { title: 'Export submissions', group: 'Forms' })
36
+ */
37
+ export declare function defineCapability(id: string, meta?: Partial<Omit<CapabilityDefinition, 'id'>>): CapabilityDefinition;
38
+ /** Fallback label for a bare id: `document.publish` → `Publish` (last segment, title-cased). */
39
+ export declare function prettifyCapabilityId(id: string): string;
40
+ /** The built-in capability catalog — metadata for every core capability. */
41
+ export declare const BUILTIN_CAPABILITY_DEFS: readonly CapabilityDefinition[];
42
+ /**
43
+ * Merge the built-in catalog with extra (plugin) definitions, deduped by id — the
44
+ * first definition of an id wins, so plugins can't silently redefine a core cap.
45
+ */
46
+ export declare function mergeCapabilityCatalog(extra?: readonly CapabilityDefinition[]): CapabilityDefinition[];
14
47
  /**
15
48
  * Built-in role names. These are the guaranteed defaults every org receives.
16
49
  * Custom role names are any other string.
@@ -19,9 +52,15 @@ export declare const BUILTIN_ROLE_NAMES: readonly OrganizationRole[];
19
52
  /**
20
53
  * Seed data for the four built-in roles.
21
54
  *
22
- * This is the **default floor** — the set of capabilities a freshly-created
23
- * org starts with. Once seeded, rows live in `cms_roles` and can be edited by
24
- * admins (via future Roles UI). Custom roles live alongside these.
55
+ * For viewer/editor/admin this is the **default floor** — the set of capabilities
56
+ * a freshly-created org starts with. Once seeded, rows live in `cms_roles` and can
57
+ * be edited by admins via the Roles UI; they are never force-updated afterwards,
58
+ * so a capability added by a later core upgrade is not granted retroactively.
59
+ *
60
+ * `owner` is different: it is an **invariant**, not a floor. It is always the whole
61
+ * of ALL_CAPABILITIES, is rejected by the roles PATCH route, and is reconciled on
62
+ * every boot (see CMSEngine.reconcileBuiltinRoles) so new capabilities reach orgs
63
+ * that were seeded before those capabilities existed.
25
64
  *
26
65
  * Also acts as the defense-in-depth fallback: if a role lookup misses (e.g.
27
66
  * a row got deleted out-of-band for a built-in name), the checker falls back
@@ -34,8 +73,10 @@ export declare const BUILTIN_ROLE_SEED: Record<OrganizationRole, {
34
73
  /**
35
74
  * Idempotently expand a capability list so that any write cap drags in the
36
75
  * corresponding read. Used by both the role schema and the API-key schema.
76
+ * Accepts `string[]` since a granted list may include plugin capability ids; the
77
+ * built-in read/write implications only touch known core ids and pass others through.
37
78
  */
38
- export declare function normalizeCapabilities(caps: readonly Capability[]): Capability[];
79
+ export declare function normalizeCapabilities(caps: readonly string[]): string[];
39
80
  /**
40
81
  * A persisted role row (per organization).
41
82
  */
@@ -44,7 +85,7 @@ export interface Role {
44
85
  organizationId: string;
45
86
  name: string;
46
87
  description: string | null;
47
- capabilities: Capability[];
88
+ capabilities: string[];
48
89
  isBuiltIn: boolean;
49
90
  createdAt: Date;
50
91
  updatedAt: Date;
@@ -53,7 +94,7 @@ export interface NewRole {
53
94
  organizationId: string;
54
95
  name: string;
55
96
  description?: string | null;
56
- capabilities: Capability[];
97
+ capabilities: string[];
57
98
  isBuiltIn?: boolean;
58
99
  }
59
100
  /**
@@ -69,7 +110,7 @@ export declare function isInstanceRole(auth: Auth): boolean;
69
110
  * RolesService. If absent (e.g. legacy call site), falls back to the built-in
70
111
  * seed for the org role so behavior remains safe.
71
112
  */
72
- export declare function hasCapability(auth: Auth, capability: Capability): boolean;
113
+ export declare function hasCapability(auth: Auth, capability: Capability | (string & {})): boolean;
73
114
  /**
74
115
  * Resolve the effective capability set for an Auth.
75
116
  *
@@ -80,7 +121,7 @@ export declare function hasCapability(auth: Auth, capability: Capability): boole
80
121
  * 4. Session fallback → built-in seed for the org role.
81
122
  * 5. Partial session → empty set.
82
123
  */
83
- export declare function resolveCapabilities(auth: Auth): ReadonlySet<Capability>;
124
+ export declare function resolveCapabilities(auth: Auth): ReadonlySet<string>;
84
125
  /**
85
126
  * Resolve the effective organization role name for an Auth, honoring
86
127
  * instance-role overrides. Returns the role name as a string — built-in or
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/lib/types/capabilities.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAEnB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,oBAAoB,GAEpB,YAAY,GACZ,cAAc,GACd,cAAc,GAEd,eAAe,GACf,eAAe,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QtE;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,OAAO,CAEzF;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,CAoCnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAInE;AAID;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,4EAA4E;IAC5E,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,0EAA0E;IAC1E,YAAY,EAAE,UAAU,EAAE,CAAC;CAC3B"}
@@ -31,8 +31,141 @@ export const ALL_CAPABILITIES = [
31
31
  'member.changeRole',
32
32
  'apiKey.manage',
33
33
  'role.manage',
34
- 'org.settings'
34
+ 'org.settings',
35
+ 'plugin.settings.manage'
35
36
  ];
37
+ /**
38
+ * Define a capability with metadata. Plugins pass these to the `aphex/capabilities`
39
+ * part so their permissions appear (and are assignable) in the roles UI.
40
+ *
41
+ * @example
42
+ * defineCapability('forms.export', { title: 'Export submissions', group: 'Forms' })
43
+ */
44
+ export function defineCapability(id, meta = {}) {
45
+ return {
46
+ id,
47
+ title: meta.title || prettifyCapabilityId(id),
48
+ description: meta.description,
49
+ group: meta.group
50
+ };
51
+ }
52
+ /** Fallback label for a bare id: `document.publish` → `Publish` (last segment, title-cased). */
53
+ export function prettifyCapabilityId(id) {
54
+ const last = id.split(/[.:]/).pop() ?? id;
55
+ const spaced = last.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/[-_]/g, ' ');
56
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
57
+ }
58
+ /** The built-in capability catalog — metadata for every core capability. */
59
+ export const BUILTIN_CAPABILITY_DEFS = [
60
+ {
61
+ id: 'document.read',
62
+ title: 'Read documents',
63
+ group: 'Documents',
64
+ description: 'View documents and their content.'
65
+ },
66
+ {
67
+ id: 'document.create',
68
+ title: 'Create documents',
69
+ group: 'Documents',
70
+ description: 'Create new documents.'
71
+ },
72
+ {
73
+ id: 'document.update',
74
+ title: 'Edit documents',
75
+ group: 'Documents',
76
+ description: 'Edit existing documents.'
77
+ },
78
+ {
79
+ id: 'document.delete',
80
+ title: 'Delete documents',
81
+ group: 'Documents',
82
+ description: 'Delete documents.'
83
+ },
84
+ {
85
+ id: 'document.publish',
86
+ title: 'Publish documents',
87
+ group: 'Documents',
88
+ description: 'Publish drafts to the live site.'
89
+ },
90
+ {
91
+ id: 'document.unpublish',
92
+ title: 'Unpublish documents',
93
+ group: 'Documents',
94
+ description: 'Revert published documents to draft.'
95
+ },
96
+ {
97
+ id: 'asset.read',
98
+ title: 'View assets',
99
+ group: 'Assets',
100
+ description: 'Browse the media library.'
101
+ },
102
+ {
103
+ id: 'asset.upload',
104
+ title: 'Upload assets',
105
+ group: 'Assets',
106
+ description: 'Upload files to the media library.'
107
+ },
108
+ {
109
+ id: 'asset.delete',
110
+ title: 'Delete assets',
111
+ group: 'Assets',
112
+ description: 'Delete files from the media library.'
113
+ },
114
+ {
115
+ id: 'member.invite',
116
+ title: 'Invite members',
117
+ group: 'Organization',
118
+ description: 'Invite people to the organization.'
119
+ },
120
+ {
121
+ id: 'member.remove',
122
+ title: 'Remove members',
123
+ group: 'Organization',
124
+ description: 'Remove people from the organization.'
125
+ },
126
+ {
127
+ id: 'member.changeRole',
128
+ title: 'Change member roles',
129
+ group: 'Organization',
130
+ description: "Change a member's role."
131
+ },
132
+ {
133
+ id: 'apiKey.manage',
134
+ title: 'Manage API keys',
135
+ group: 'Organization',
136
+ description: 'Create and revoke API keys.'
137
+ },
138
+ {
139
+ id: 'role.manage',
140
+ title: 'Manage roles',
141
+ group: 'Organization',
142
+ description: 'Create and edit custom roles.'
143
+ },
144
+ {
145
+ id: 'org.settings',
146
+ title: 'Edit settings',
147
+ group: 'Organization',
148
+ description: 'Change organization settings.'
149
+ },
150
+ {
151
+ id: 'plugin.settings.manage',
152
+ title: 'Manage plugin settings',
153
+ group: 'Organization',
154
+ description: 'View and edit configuration and secrets for installed plugins.'
155
+ }
156
+ ];
157
+ /**
158
+ * Merge the built-in catalog with extra (plugin) definitions, deduped by id — the
159
+ * first definition of an id wins, so plugins can't silently redefine a core cap.
160
+ */
161
+ export function mergeCapabilityCatalog(extra = []) {
162
+ const byId = new Map();
163
+ for (const def of [...BUILTIN_CAPABILITY_DEFS, ...extra]) {
164
+ if (!byId.has(def.id))
165
+ byId.set(def.id, def);
166
+ }
167
+ return [...byId.values()];
168
+ }
36
169
  /**
37
170
  * Built-in role names. These are the guaranteed defaults every org receives.
38
171
  * Custom role names are any other string.
@@ -46,9 +179,15 @@ export const BUILTIN_ROLE_NAMES = [
46
179
  /**
47
180
  * Seed data for the four built-in roles.
48
181
  *
49
- * This is the **default floor** — the set of capabilities a freshly-created
50
- * org starts with. Once seeded, rows live in `cms_roles` and can be edited by
51
- * admins (via future Roles UI). Custom roles live alongside these.
182
+ * For viewer/editor/admin this is the **default floor** — the set of capabilities
183
+ * a freshly-created org starts with. Once seeded, rows live in `cms_roles` and can
184
+ * be edited by admins via the Roles UI; they are never force-updated afterwards,
185
+ * so a capability added by a later core upgrade is not granted retroactively.
186
+ *
187
+ * `owner` is different: it is an **invariant**, not a floor. It is always the whole
188
+ * of ALL_CAPABILITIES, is rejected by the roles PATCH route, and is reconciled on
189
+ * every boot (see CMSEngine.reconcileBuiltinRoles) so new capabilities reach orgs
190
+ * that were seeded before those capabilities existed.
52
191
  *
53
192
  * Also acts as the defense-in-depth fallback: if a role lookup misses (e.g.
54
193
  * a row got deleted out-of-band for a built-in name), the checker falls back
@@ -90,7 +229,8 @@ export const BUILTIN_ROLE_SEED = {
90
229
  'member.changeRole',
91
230
  'apiKey.manage',
92
231
  'role.manage',
93
- 'org.settings'
232
+ 'org.settings',
233
+ 'plugin.settings.manage'
94
234
  ]
95
235
  },
96
236
  owner: {
@@ -113,6 +253,8 @@ const ASSET_WRITE_CAPS = ['asset.upload', 'asset.delete'];
113
253
  /**
114
254
  * Idempotently expand a capability list so that any write cap drags in the
115
255
  * corresponding read. Used by both the role schema and the API-key schema.
256
+ * Accepts `string[]` since a granted list may include plugin capability ids; the
257
+ * built-in read/write implications only touch known core ids and pass others through.
116
258
  */
117
259
  export function normalizeCapabilities(caps) {
118
260
  const set = new Set(caps);
@@ -8,10 +8,20 @@ import type { GraphQLConfig } from '../graphql/index.js';
8
8
  import type { AphexEnv } from '../server/api/index.js';
9
9
  import type { SchemaType } from './schemas.js';
10
10
  import type { Logger } from '../utils/logger.js';
11
+ import type { CMSPlugin } from '../plugins/types.js';
12
+ import type { Auth } from './auth.js';
13
+ import type { PreviewPerspective } from '../preview/perspective.js';
11
14
  export type { GraphQLConfig };
12
15
  export interface CMSConfig {
13
16
  schemaTypes: SchemaType[];
14
17
  database: DatabaseAdapter;
18
+ /**
19
+ * Build-time plugins. Each contributes typed "parts" (schemas, server routes,
20
+ * document actions, admin tools, field components, capabilities). Schema parts
21
+ * are merged into `schemaTypes` at config time; the rest are indexed by a part
22
+ * resolver on `event.locals.aphexCMS.partResolver`. See the plugins module.
23
+ */
24
+ plugins?: CMSPlugin[];
15
25
  storage?: StorageAdapter | null;
16
26
  email?: EmailAdapter | null;
17
27
  customization?: {
@@ -69,10 +79,21 @@ export interface CMSConfig {
69
79
  };
70
80
  /**
71
81
  * Live preview configuration.
72
- * - `stega`: Enable stega encoding in preview data pushes so field overlays work automatically. Default: true.
82
+ * - `stega`: Enable stega encoding in preview data pushes so field overlays work
83
+ * automatically. Default: true.
84
+ * - `resolvePerspective`: Decide the read perspective per request. The CMS hook
85
+ * runs it and stores the result on `locals.previewPerspective`, which site loads
86
+ * inherit via a preview-aware context (see `siteContext`). Defaults to
87
+ * `getPreviewPerspective` — `'draft'` only for an authenticated session with
88
+ * `?aphex-preview`; `'published'` otherwise. Override to change the signal
89
+ * (e.g. a preview token, a different query param, or per-role rules).
73
90
  */
74
91
  preview?: {
75
92
  stega?: boolean;
93
+ resolvePerspective?: (args: {
94
+ auth?: Auth;
95
+ url: URL;
96
+ }) => PreviewPerspective;
76
97
  };
77
98
  security?: {
78
99
  /**
@@ -81,6 +102,14 @@ export interface CMSConfig {
81
102
  * Required for signed asset URLs to work
82
103
  */
83
104
  assetSigningSecret?: string;
105
+ /**
106
+ * Key used to encrypt plugin secret settings at rest (AES-256-GCM). A long,
107
+ * random string (32+ chars); keep it out of source and stable across deploys —
108
+ * rotating it makes existing encrypted secrets undecryptable. When absent,
109
+ * `type: 'secret'` settings fields are read-only and flagged in the UI (fail
110
+ * safe — core never stores a secret as plaintext).
111
+ */
112
+ secretEncryptionKey?: string;
84
113
  };
85
114
  /**
86
115
  * Register custom HTTP endpoints / middleware onto the Aphex API Hono app.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/types/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,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