rimecms 0.32.1 → 1.0.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 (497) hide show
  1. package/dist/adapter-sqlite/auth.server.d.ts +2 -2
  2. package/dist/adapter-sqlite/columns.server.js +2 -2
  3. package/dist/adapter-sqlite/connect.server.d.ts +12 -0
  4. package/dist/adapter-sqlite/connect.server.js +31 -0
  5. package/dist/adapter-sqlite/generate-schema/column.server.js +1 -1
  6. package/dist/adapter-sqlite/generate-schema/index.server.js +11 -3
  7. package/dist/adapter-sqlite/generate-schema/root.server.d.ts +13 -4
  8. package/dist/adapter-sqlite/generate-schema/root.server.js +75 -131
  9. package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +27 -6
  10. package/dist/adapter-sqlite/generate-schema/templates.server.js +63 -11
  11. package/dist/adapter-sqlite/index.server.d.ts +13 -5
  12. package/dist/adapter-sqlite/index.server.js +9 -6
  13. package/dist/adapter-sqlite/naming.server.d.ts +6 -8
  14. package/dist/adapter-sqlite/naming.server.js +22 -4
  15. package/dist/adapter-sqlite/paths.server.d.ts +10 -0
  16. package/dist/adapter-sqlite/paths.server.js +122 -0
  17. package/dist/adapter-sqlite/read.server.d.ts +10 -1
  18. package/dist/adapter-sqlite/read.server.js +22 -10
  19. package/dist/adapter-sqlite/select.server.d.ts +19 -0
  20. package/dist/adapter-sqlite/select.server.js +71 -63
  21. package/dist/adapter-sqlite/table.server.d.ts +2 -2
  22. package/dist/adapter-sqlite/transform.server.js +33 -3
  23. package/dist/adapter-sqlite/types.server.d.ts +10 -3
  24. package/dist/adapter-sqlite/where.server.d.ts +2 -3
  25. package/dist/adapter-sqlite/where.server.js +19 -1
  26. package/dist/core/adapter.d.ts +94 -0
  27. package/dist/core/auth/better-auth/config.server.d.ts +3 -3
  28. package/dist/core/auth/better-auth/instance.server.d.ts +6 -6
  29. package/dist/core/auth/handler/index.server.js +1 -1
  30. package/dist/core/auth/staff/derive.js +1 -1
  31. package/dist/core/auth/validate-config.js +3 -5
  32. package/dist/core/boot.server.d.ts +6 -6
  33. package/dist/core/config/types.d.ts +53 -5
  34. package/dist/core/config/validate.server.js +34 -51
  35. package/dist/core/dev/cli/commands/build.js +21 -6
  36. package/dist/core/dev/cli/commands/init.server.d.ts +2 -1
  37. package/dist/core/dev/cli/commands/init.server.js +32 -6
  38. package/dist/core/dev/cli/index.js +1 -0
  39. package/dist/core/dev/cli/templates/init.d.ts +6 -1
  40. package/dist/core/dev/cli/templates/init.js +30 -2
  41. package/dist/core/dev/cli/util/package-manager.server.d.ts +1 -0
  42. package/dist/core/dev/cli/util/package-manager.server.js +11 -8
  43. package/dist/core/dev/cli/util/package.server.d.ts +9 -0
  44. package/dist/core/dev/cli/util/package.server.js +43 -0
  45. package/dist/core/dev/codegen/types/contributions.server.d.ts +3 -2
  46. package/dist/core/dev/codegen/types/contributions.server.js +10 -3
  47. package/dist/core/dev/vite.server.js +4 -3
  48. package/dist/core/fields/blank.d.ts +21 -0
  49. package/dist/core/fields/blank.js +37 -0
  50. package/dist/core/fields/builders/field-builder.d.ts +53 -0
  51. package/dist/core/fields/builders/field-builder.js +14 -1
  52. package/dist/core/fields/builders/form-field-builder.d.ts +8 -0
  53. package/dist/core/fields/builders/form-field-builder.js +14 -1
  54. package/dist/core/fields/util.d.ts +9 -2
  55. package/dist/core/fields/util.js +123 -135
  56. package/dist/core/fields/walk.d.ts +44 -0
  57. package/dist/core/fields/walk.js +55 -0
  58. package/dist/core/handler.server.js +4 -0
  59. package/dist/core/i18n/context.d.ts +5 -0
  60. package/dist/core/i18n/context.js +6 -0
  61. package/dist/core/i18n/en/common.d.ts +71 -0
  62. package/dist/core/i18n/en/common.js +72 -1
  63. package/dist/core/i18n/en/fields.d.ts +68 -0
  64. package/dist/core/i18n/en/fields.js +69 -1
  65. package/dist/core/i18n/fr/common.d.ts +71 -0
  66. package/dist/core/i18n/fr/common.js +72 -1
  67. package/dist/core/i18n/fr/fields.d.ts +68 -0
  68. package/dist/core/i18n/fr/fields.js +69 -1
  69. package/dist/core/i18n/index.d.ts +29 -3
  70. package/dist/core/i18n/index.js +55 -29
  71. package/dist/core/locale/copy.server.js +3 -3
  72. package/dist/core/logger.server.js +15 -6
  73. package/dist/core/pipeline/build-document.server.d.ts +3 -0
  74. package/dist/core/pipeline/build-document.server.js +10 -7
  75. package/dist/core/pipeline/config-map/index.d.ts +9 -0
  76. package/dist/core/pipeline/config-map/index.js +16 -50
  77. package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +3 -0
  78. package/dist/core/pipeline/hooks/process-document-fields.server.js +48 -12
  79. package/dist/core/pipeline/hooks/set-default-values.server.d.ts +1 -0
  80. package/dist/core/pipeline/hooks/set-default-values.server.js +1 -0
  81. package/dist/core/pipeline/persist/blocks/extract.server.js +1 -1
  82. package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
  83. package/dist/core/pipeline/populate-relations.server.d.ts +27 -0
  84. package/dist/core/pipeline/populate-relations.server.js +42 -0
  85. package/dist/core/pipeline/run.server.d.ts +17 -6
  86. package/dist/core/pipeline/run.server.js +44 -30
  87. package/dist/core/plugins/cache/module.server.d.ts +1 -1
  88. package/dist/core/plugins/cache/module.server.js +5 -5
  89. package/dist/core/plugins/defaults/module.server.js +2 -2
  90. package/dist/core/plugins/defaults/types.d.ts +5 -3
  91. package/dist/core/plugins/sse/index.d.ts +1 -1
  92. package/dist/core/plugins/sse/index.server.d.ts +5 -6
  93. package/dist/core/plugins/sse/index.server.js +3 -2
  94. package/dist/core/plugins/sse/types.d.ts +5 -0
  95. package/dist/core/prototype/area/api.server.js +1 -2
  96. package/dist/core/prototype/area/definition.js +1 -10
  97. package/dist/core/prototype/area/definition.server.js +4 -5
  98. package/dist/core/prototype/area/hooks.server.js +3 -2
  99. package/dist/core/prototype/area/operations/find.js +2 -0
  100. package/dist/core/prototype/blank.d.ts +26 -0
  101. package/dist/core/prototype/blank.js +22 -0
  102. package/dist/core/prototype/collection/api.server.d.ts +29 -3
  103. package/dist/core/prototype/collection/api.server.js +47 -4
  104. package/dist/core/prototype/collection/definition.js +0 -3
  105. package/dist/core/prototype/collection/hooks/merge-with-blank.server.d.ts +5 -1
  106. package/dist/core/prototype/collection/hooks/merge-with-blank.server.js +8 -22
  107. package/dist/core/prototype/collection/hooks.server.js +11 -5
  108. package/dist/core/prototype/collection/nested/module.server.js +3 -1
  109. package/dist/core/prototype/collection/nested/tree.d.ts +12 -0
  110. package/dist/core/prototype/collection/nested/tree.js +42 -0
  111. package/dist/core/prototype/collection/operations/find-by-id.js +2 -0
  112. package/dist/core/prototype/collection/operations/find-by-ids.d.ts +19 -0
  113. package/dist/core/prototype/collection/operations/find-by-ids.js +54 -0
  114. package/dist/core/prototype/collection/operations/find.js +21 -27
  115. package/dist/core/prototype/collection/operations/update-slug-by-id.d.ts +20 -0
  116. package/dist/core/prototype/collection/operations/update-slug-by-id.js +53 -0
  117. package/dist/core/prototype/collection/rest/index.server.js +3 -1
  118. package/dist/core/prototype/collection/rest/update-slug-by-id.server.d.ts +2 -0
  119. package/dist/core/prototype/collection/rest/update-slug-by-id.server.js +20 -0
  120. package/dist/core/prototype/collection/thumbnail/find-thumbnail.d.ts +2 -1
  121. package/dist/core/prototype/collection/thumbnail/find-thumbnail.js +4 -27
  122. package/dist/core/prototype/collection/upload/directories/derive.js +3 -1
  123. package/dist/core/prototype/collection/upload/disk/delete.server.js +1 -2
  124. package/dist/core/prototype/define.js +2 -0
  125. package/dist/core/prototype/shared/metas/fields.js +2 -1
  126. package/dist/core/prototype/shared/title/find-title.d.ts +2 -1
  127. package/dist/core/prototype/shared/title/find-title.js +5 -28
  128. package/dist/core/prototype/shared/url/addresses.server.d.ts +26 -0
  129. package/dist/core/prototype/shared/url/addresses.server.js +119 -0
  130. package/dist/core/prototype/shared/url/doc-type.d.ts +6 -0
  131. package/dist/core/prototype/shared/url/doc-type.js +9 -0
  132. package/dist/core/prototype/shared/url/format.server.d.ts +27 -0
  133. package/dist/core/prototype/shared/url/format.server.js +38 -0
  134. package/dist/core/prototype/shared/url/hooks/create-paths.server.d.ts +2 -0
  135. package/dist/core/prototype/shared/url/hooks/create-paths.server.js +9 -0
  136. package/dist/core/prototype/shared/url/hooks/detach-paths.server.d.ts +5 -0
  137. package/dist/core/prototype/shared/url/hooks/detach-paths.server.js +18 -0
  138. package/dist/core/prototype/shared/url/hooks/index.server.d.ts +5 -1
  139. package/dist/core/prototype/shared/url/hooks/index.server.js +5 -1
  140. package/dist/core/prototype/shared/url/hooks/set-area-url.server.d.ts +2 -0
  141. package/dist/core/prototype/shared/url/hooks/set-area-url.server.js +8 -0
  142. package/dist/core/prototype/shared/url/hooks/set-live-url.server.d.ts +5 -0
  143. package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +19 -0
  144. package/dist/core/prototype/shared/url/hooks/sync-paths.server.d.ts +7 -0
  145. package/dist/core/prototype/shared/url/hooks/sync-paths.server.js +37 -0
  146. package/dist/core/prototype/shared/url/refresh.server.d.ts +36 -0
  147. package/dist/core/prototype/shared/url/refresh.server.js +58 -0
  148. package/dist/core/prototype/shared/versions/configure.server.js +3 -0
  149. package/dist/core/routes/context.server.d.ts +2 -1
  150. package/dist/fields/blocks/component/AddBlockButton.svelte +48 -137
  151. package/dist/fields/blocks/component/Block.svelte +153 -117
  152. package/dist/fields/blocks/component/Block.svelte.d.ts +11 -5
  153. package/dist/fields/blocks/component/BlockActions.svelte +76 -26
  154. package/dist/fields/blocks/component/BlockActions.svelte.d.ts +3 -0
  155. package/dist/fields/blocks/component/Blocks.svelte +248 -91
  156. package/dist/fields/blocks/component/focus/BlocksFocus.svelte +680 -0
  157. package/dist/fields/blocks/component/focus/BlocksFocus.svelte.d.ts +7 -0
  158. package/dist/fields/blocks/component/focus/Layers.svelte +145 -0
  159. package/dist/fields/blocks/component/focus/Layers.svelte.d.ts +9 -0
  160. package/dist/fields/blocks/component/focus/LayersList.svelte +304 -0
  161. package/dist/fields/blocks/component/focus/LayersList.svelte.d.ts +10 -0
  162. package/dist/fields/blocks/component/focus/Palette.svelte +135 -0
  163. package/dist/fields/blocks/component/focus/Palette.svelte.d.ts +9 -0
  164. package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte +77 -0
  165. package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte.d.ts +10 -0
  166. package/dist/fields/blocks/component/focus/Renders.svelte +302 -0
  167. package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +11 -0
  168. package/dist/fields/blocks/component/focus/Stage.svelte +190 -0
  169. package/dist/fields/blocks/component/focus/Stage.svelte.d.ts +8 -0
  170. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +69 -0
  171. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte.d.ts +3 -0
  172. package/dist/fields/blocks/component/focus/focus.svelte.d.ts +140 -0
  173. package/dist/fields/blocks/component/focus/focus.svelte.js +424 -0
  174. package/dist/fields/blocks/component/picker/BlockPicker.svelte +88 -0
  175. package/dist/fields/blocks/component/picker/BlockPicker.svelte.d.ts +10 -0
  176. package/dist/fields/blocks/component/picker/BlockTile.svelte +121 -0
  177. package/dist/fields/blocks/component/picker/BlockTile.svelte.d.ts +12 -0
  178. package/dist/fields/blocks/index.d.ts +49 -7
  179. package/dist/fields/blocks/index.js +61 -12
  180. package/dist/fields/checkbox/component/Checkbox.svelte +11 -37
  181. package/dist/fields/checkbox/component/Checkbox.svelte.d.ts +1 -0
  182. package/dist/fields/combobox/component/ComboBox.svelte +37 -7
  183. package/dist/fields/combobox/component/combobox.css +26 -10
  184. package/dist/fields/date/component/Date.svelte +43 -12
  185. package/dist/fields/group/component/Group.svelte +110 -41
  186. package/dist/fields/group/index.d.ts +5 -1
  187. package/dist/fields/group/index.js +10 -2
  188. package/dist/fields/link/component/Link.svelte +184 -143
  189. package/dist/fields/link/component/RessourceInput.svelte +26 -24
  190. package/dist/fields/link/index.d.ts +1 -0
  191. package/dist/fields/link/module.server.js +2 -4
  192. package/dist/fields/number/component/Number.svelte +38 -20
  193. package/dist/fields/number/component/number.css +22 -20
  194. package/dist/fields/number/index.d.ts +1 -0
  195. package/dist/fields/radio/component/Radio.svelte +12 -0
  196. package/dist/fields/radio/index.js +1 -1
  197. package/dist/fields/relation/component/Relation.svelte +169 -40
  198. package/dist/fields/relation/component/RelationInline.svelte +258 -0
  199. package/dist/fields/relation/component/RelationInline.svelte.d.ts +26 -0
  200. package/dist/fields/relation/component/default/Default.svelte +210 -100
  201. package/dist/fields/relation/component/default/Default.svelte.d.ts +14 -1
  202. package/dist/fields/relation/component/types.d.ts +4 -0
  203. package/dist/fields/relation/component/upload/Browse.svelte +619 -88
  204. package/dist/fields/relation/component/upload/Browse.svelte.d.ts +10 -2
  205. package/dist/fields/relation/component/upload/Create.svelte +41 -0
  206. package/dist/fields/relation/component/upload/Create.svelte.d.ts +13 -0
  207. package/dist/fields/relation/component/upload/Upload.svelte +287 -101
  208. package/dist/fields/relation/component/upload/Upload.svelte.d.ts +6 -1
  209. package/dist/fields/relation/component/upload/upload.css +5 -81
  210. package/dist/fields/relation/module.server.js +7 -1
  211. package/dist/fields/relation/value.d.ts +25 -0
  212. package/dist/fields/relation/value.js +27 -0
  213. package/dist/fields/rich-text/component/RichText.svelte +12 -80
  214. package/dist/fields/rich-text/component/RichText.svelte.d.ts +1 -1
  215. package/dist/fields/rich-text/component/RichTextInline.svelte +28 -0
  216. package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +11 -0
  217. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +4 -3
  218. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +3 -1
  219. package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +2 -2
  220. package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +7 -10
  221. package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -2
  222. package/dist/fields/rich-text/component/styles/editor.css +111 -0
  223. package/dist/fields/rich-text/component/styles/field.css +71 -0
  224. package/dist/fields/rich-text/component/suggestion/suggestion.svelte +41 -56
  225. package/dist/fields/rich-text/core/build-editor-config.js +1 -1
  226. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +29 -3
  227. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -0
  228. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +2 -1
  229. package/dist/fields/rich-text/core/features/fields/fields.css +2 -3
  230. package/dist/fields/rich-text/core/features/hr/hr.css +4 -4
  231. package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -4
  232. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +24 -8
  233. package/dist/fields/rich-text/core/features/resource/resource.svelte +20 -6
  234. package/dist/fields/rich-text/core/features/upload/upload.svelte +20 -8
  235. package/dist/fields/rich-text/core/rich-text-editor-core.svelte +103 -0
  236. package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +15 -0
  237. package/dist/fields/select/component/Select.svelte +67 -28
  238. package/dist/fields/slug/component/Slug.svelte +26 -53
  239. package/dist/fields/slug/index.d.ts +1 -0
  240. package/dist/fields/slug/index.js +1 -1
  241. package/dist/fields/tabs/component/Tabs.svelte +28 -22
  242. package/dist/fields/tabs/index.d.ts +4 -1
  243. package/dist/fields/tabs/index.js +17 -5
  244. package/dist/fields/text/index.d.ts +1 -0
  245. package/dist/fields/textarea/component/TextArea.svelte +28 -13
  246. package/dist/fields/textarea/index.d.ts +1 -0
  247. package/dist/fields/time/component/Time.svelte +9 -2
  248. package/dist/fields/toggle/component/Toggle.svelte +8 -25
  249. package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -0
  250. package/dist/fields/toggle/index.d.ts +1 -0
  251. package/dist/fields/tree/component/AddItemButton.svelte +18 -5
  252. package/dist/fields/tree/component/Tree.svelte +48 -19
  253. package/dist/fields/tree/component/TreeBlock.svelte +318 -104
  254. package/dist/fields/tree/component/TreeBlockActions.svelte +71 -7
  255. package/dist/fields/tree/component/TreeBlockActions.svelte.d.ts +4 -0
  256. package/dist/fields/tree/component/props.d.ts +2 -1
  257. package/dist/fields/tree/index.d.ts +13 -1
  258. package/dist/fields/tree/index.js +35 -9
  259. package/dist/fields/types.d.ts +3 -1
  260. package/dist/index.d.ts +4 -3
  261. package/dist/index.js +3 -2
  262. package/dist/panel/components/Root.svelte +16 -44
  263. package/dist/panel/components/Root.svelte.d.ts +1 -1
  264. package/dist/panel/components/fields/Error.svelte +18 -3
  265. package/dist/panel/components/fields/FieldsPreview.svelte +30 -17
  266. package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +25 -3
  267. package/dist/panel/components/fields/Hint.svelte +51 -8
  268. package/dist/panel/components/fields/Hint.svelte.d.ts +11 -0
  269. package/dist/panel/components/fields/Label.svelte +2 -0
  270. package/dist/panel/components/fields/LabelFor.svelte +7 -2
  271. package/dist/panel/components/fields/RenderFields.svelte +10 -3
  272. package/dist/panel/components/fields/fieldset.svelte.d.ts +4 -1
  273. package/dist/panel/components/fields/fieldset.svelte.js +9 -2
  274. package/dist/panel/components/fields/index.d.ts +1 -0
  275. package/dist/panel/components/fields/setting.css +82 -0
  276. package/dist/panel/components/sections/auth/AuthForm.svelte +25 -26
  277. package/dist/panel/components/sections/collection/Avatar.svelte +61 -0
  278. package/dist/panel/components/sections/collection/Avatar.svelte.d.ts +9 -0
  279. package/dist/panel/components/sections/collection/DocStatus.svelte +28 -0
  280. package/dist/panel/components/sections/collection/DocStatus.svelte.d.ts +7 -0
  281. package/dist/panel/components/sections/collection/Empty.svelte +3 -3
  282. package/dist/panel/components/sections/collection/StatusDot.svelte +7 -5
  283. package/dist/panel/components/sections/collection/When.svelte +33 -0
  284. package/dist/panel/components/sections/collection/When.svelte.d.ts +8 -0
  285. package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte +65 -21
  286. package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte.d.ts +3 -2
  287. package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte +45 -162
  288. package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte.d.ts +3 -2
  289. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +151 -0
  290. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte.d.ts +17 -0
  291. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +177 -0
  292. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte.d.ts +12 -0
  293. package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte +75 -0
  294. package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte.d.ts +8 -0
  295. package/dist/panel/components/sections/collection/folder/Folder.svelte +18 -3
  296. package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +26 -18
  297. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +98 -58
  298. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte.d.ts +0 -1
  299. package/dist/panel/components/sections/collection/folder/Folders.svelte +60 -0
  300. package/dist/panel/components/sections/collection/folder/Folders.svelte.d.ts +7 -0
  301. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +31 -71
  302. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +1 -0
  303. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +5 -3
  304. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +250 -37
  305. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte.d.ts +2 -0
  306. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +43 -18
  307. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +6 -4
  308. package/dist/panel/components/sections/collection/header/DisplayMode.svelte +69 -58
  309. package/dist/panel/components/sections/collection/header/DisplayMode.svelte.d.ts +0 -1
  310. package/dist/panel/components/sections/collection/header/FilterMenu.svelte +60 -0
  311. package/dist/panel/components/sections/collection/header/FilterMenu.svelte.d.ts +14 -0
  312. package/dist/panel/components/sections/collection/header/SearchInput.svelte +17 -26
  313. package/dist/panel/components/sections/collection/header/SelectUI.svelte +19 -34
  314. package/dist/panel/components/sections/collection/list/CollectionList.svelte +99 -68
  315. package/dist/panel/components/sections/collection/list/columns.d.ts +21 -0
  316. package/dist/panel/components/sections/collection/list/columns.js +23 -0
  317. package/dist/panel/components/sections/collection/list/header/Header.svelte +99 -51
  318. package/dist/panel/components/sections/collection/list/row/Row.svelte +165 -82
  319. package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -0
  320. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +92 -44
  321. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte.d.ts +1 -0
  322. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +139 -43
  323. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte.d.ts +2 -0
  324. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +1 -1
  325. package/dist/panel/components/sections/commands/CommandButton.svelte +99 -0
  326. package/dist/panel/components/sections/commands/CommandButton.svelte.d.ts +10 -0
  327. package/dist/panel/components/sections/commands/CommandPalette.svelte +275 -0
  328. package/dist/panel/components/sections/commands/CommandPalette.svelte.d.ts +8 -0
  329. package/dist/panel/components/sections/commands/Commands.svelte +18 -0
  330. package/dist/panel/components/sections/commands/Commands.svelte.d.ts +9 -0
  331. package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +23 -7
  332. package/dist/panel/components/sections/document/AuthFooter.svelte +31 -12
  333. package/dist/panel/components/sections/document/AutoSaveBanner.svelte +24 -7
  334. package/dist/panel/components/sections/document/ButtonSave.svelte +32 -21
  335. package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +5 -5
  336. package/dist/panel/components/sections/document/ButtonStatus.svelte +68 -20
  337. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +199 -0
  338. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte.d.ts +10 -0
  339. package/dist/panel/components/sections/document/CurrentlyEdited.svelte +2 -2
  340. package/dist/panel/components/sections/document/Document.svelte +96 -65
  341. package/dist/panel/components/sections/document/DocumentChildren.svelte +175 -0
  342. package/dist/panel/components/sections/document/DocumentChildren.svelte.d.ts +8 -0
  343. package/dist/panel/components/sections/document/DocumentUrl.svelte +119 -0
  344. package/dist/panel/components/sections/document/DocumentUrl.svelte.d.ts +9 -0
  345. package/dist/panel/components/sections/document/Header.svelte +171 -94
  346. package/dist/panel/components/sections/document/Settings.svelte +255 -110
  347. package/dist/panel/components/sections/document/Settings.svelte.d.ts +0 -1
  348. package/dist/panel/components/sections/document/Versions.svelte +5 -3
  349. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +112 -53
  350. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -2
  351. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +74 -41
  352. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +1 -1
  353. package/dist/panel/components/sections/live/LiveEdit.svelte +2 -2
  354. package/dist/panel/components/sections/live/LiveFloatingUI.svelte +30 -11
  355. package/dist/panel/components/sections/live/live-edit-panel.css +2 -2
  356. package/dist/panel/components/sections/page-layout/Page.svelte +13 -1
  357. package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +55 -27
  358. package/dist/panel/components/ui/button/button.svelte +81 -54
  359. package/dist/panel/components/ui/button/index.d.ts +7 -3
  360. package/dist/panel/components/ui/button/index.js +2 -2
  361. package/dist/panel/components/ui/calendar/calendar.css +27 -27
  362. package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
  363. package/dist/panel/components/ui/card/card-description.svelte +1 -1
  364. package/dist/panel/components/ui/card/card.svelte +21 -4
  365. package/dist/panel/components/ui/card-document/card-document.svelte +24 -12
  366. package/dist/panel/components/ui/card-resource/card-resource.svelte +26 -8
  367. package/dist/panel/components/ui/checkbox/checkbox.css +8 -10
  368. package/dist/panel/components/ui/command/command-dialog.css +28 -4
  369. package/dist/panel/components/ui/command/command-dialog.svelte +4 -1
  370. package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +2 -0
  371. package/dist/panel/components/ui/command/command-empty.css +1 -1
  372. package/dist/panel/components/ui/command/command-group.css +3 -3
  373. package/dist/panel/components/ui/command/command-input-select.svelte +3 -3
  374. package/dist/panel/components/ui/command/command-input.svelte +38 -14
  375. package/dist/panel/components/ui/command/command-input.svelte.d.ts +6 -1
  376. package/dist/panel/components/ui/command/command-item.css +2 -2
  377. package/dist/panel/components/ui/command/command-list.css +1 -1
  378. package/dist/panel/components/ui/command/command-separator.css +1 -1
  379. package/dist/panel/components/ui/context-menu/context-menu-item.css +2 -2
  380. package/dist/panel/components/ui/context-menu/context-menu.css +6 -7
  381. package/dist/panel/components/ui/dialog/dialog-content.css +8 -10
  382. package/dist/panel/components/ui/dialog/dialog-content.svelte +19 -0
  383. package/dist/panel/components/ui/dialog/dialog-description.css +1 -1
  384. package/dist/panel/components/ui/dialog/dialog-footer.svelte +5 -1
  385. package/dist/panel/components/ui/dialog/dialog-overlay.css +1 -1
  386. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +19 -5
  387. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +6 -4
  388. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +1 -1
  389. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +1 -1
  390. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +1 -1
  391. package/dist/panel/components/ui/input/input.svelte +57 -31
  392. package/dist/panel/components/ui/kbd/Kbd.svelte +90 -0
  393. package/dist/panel/components/ui/kbd/Kbd.svelte.d.ts +11 -0
  394. package/dist/panel/components/ui/kbd/index.d.ts +1 -0
  395. package/dist/panel/components/ui/kbd/index.js +1 -0
  396. package/dist/panel/components/ui/label/label.css +5 -3
  397. package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +27 -15
  398. package/dist/panel/components/ui/nav/Nav.svelte +180 -110
  399. package/dist/panel/components/ui/nav/Nav.svelte.d.ts +0 -2
  400. package/dist/panel/components/ui/nav/NavGroup.svelte +87 -73
  401. package/dist/panel/components/ui/nav/NavItemButton.svelte +69 -29
  402. package/dist/panel/components/ui/nav/UserButton.svelte +132 -71
  403. package/dist/panel/components/ui/page-header/PageHeader.svelte +140 -42
  404. package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +8 -1
  405. package/dist/panel/components/ui/popover/popover-content.css +4 -3
  406. package/dist/panel/components/ui/radio-group/radio-group.css +4 -6
  407. package/dist/panel/components/ui/radio-row-group/radio-row-group.css +19 -7
  408. package/dist/panel/components/ui/scroll-area/scroll-area.css +2 -2
  409. package/dist/panel/components/ui/separator/separator.svelte +1 -1
  410. package/dist/panel/components/ui/sheet/index.d.ts +4 -4
  411. package/dist/panel/components/ui/sheet/index.js +5 -5
  412. package/dist/panel/components/ui/sheet/sheet.css +50 -11
  413. package/dist/panel/components/ui/sonner/sonner.css +11 -8
  414. package/dist/panel/components/ui/switch/switch.css +13 -18
  415. package/dist/panel/components/ui/tabs/tabs.css +44 -35
  416. package/dist/panel/components/ui/tag/tag.svelte +20 -6
  417. package/dist/panel/components/ui/tooltip/tooltip-content.svelte +14 -4
  418. package/dist/panel/components/ui/tree/tree-rows.css +146 -0
  419. package/dist/panel/context/blocks-ops.d.ts +78 -0
  420. package/dist/panel/context/blocks-ops.js +170 -0
  421. package/dist/panel/context/collection.svelte.d.ts +28 -0
  422. package/dist/panel/context/collection.svelte.js +120 -65
  423. package/dist/panel/context/commands.svelte.d.ts +80 -0
  424. package/dist/panel/context/commands.svelte.js +108 -0
  425. package/dist/panel/context/documentForm.svelte.d.ts +34 -2
  426. package/dist/panel/context/documentForm.svelte.js +105 -102
  427. package/dist/panel/context/live.svelte.js +2 -73
  428. package/dist/panel/context/nav.svelte.d.ts +23 -0
  429. package/dist/panel/context/nav.svelte.js +56 -0
  430. package/dist/panel/fonts/Geist-VariableFont_wght.ttf +0 -0
  431. package/dist/panel/fonts/GeistMono-VariableFont_wght.ttf +0 -0
  432. package/dist/panel/index.d.ts +7 -1
  433. package/dist/panel/index.js +10 -1
  434. package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +16 -1
  435. package/dist/panel/pages/collection/CollectionPage.svelte +236 -61
  436. package/dist/panel/pages/collection/load.server.js +1 -1
  437. package/dist/panel/pages/dashboard/Dashboard.svelte +135 -90
  438. package/dist/panel/pages/dashboard/DashboardCard.svelte +109 -0
  439. package/dist/panel/pages/dashboard/DashboardCard.svelte.d.ts +14 -0
  440. package/dist/panel/pages/dashboard/DashboardCollection.svelte +180 -57
  441. package/dist/panel/pages/dashboard/DashboardCollection.svelte.d.ts +1 -0
  442. package/dist/panel/pages/dashboard/DashboardRow.svelte +93 -0
  443. package/dist/panel/pages/dashboard/DashboardRow.svelte.d.ts +16 -0
  444. package/dist/panel/pages/dashboard/load.server.js +49 -25
  445. package/dist/panel/pages/dashboard/time.d.ts +19 -0
  446. package/dist/panel/pages/dashboard/time.js +29 -0
  447. package/dist/panel/pages/dashboard/types.d.ts +9 -2
  448. package/dist/panel/pages/live/Live.svelte +53 -50
  449. package/dist/panel/style/font.css +21 -32
  450. package/dist/panel/style/index.css +191 -122
  451. package/dist/panel/style/mixins/index.css +14 -0
  452. package/dist/panel/style/palette.css +35 -26
  453. package/dist/panel/style/postcss/size-function.d.ts +4 -0
  454. package/dist/panel/style/postcss/size-function.js +24 -0
  455. package/dist/panel/style/radius.css +4 -5
  456. package/dist/panel/style/scheme.css +111 -0
  457. package/dist/panel/style/size.css +3 -0
  458. package/dist/panel/util/Sortable.js +9 -4
  459. package/dist/panel/util/keys.d.ts +24 -0
  460. package/dist/panel/util/keys.js +63 -0
  461. package/dist/panel/util/populate.d.ts +8 -0
  462. package/dist/panel/util/populate.js +49 -0
  463. package/dist/panel/util/time.d.ts +12 -0
  464. package/dist/panel/util/time.js +35 -0
  465. package/dist/panel/util/upload-file.d.ts +106 -0
  466. package/dist/panel/util/upload-file.js +165 -0
  467. package/dist/types.d.ts +1 -0
  468. package/dist/util/index.d.ts +7 -10
  469. package/dist/util/index.js +7 -8
  470. package/dist/util/object.d.ts +10 -0
  471. package/dist/util/object.js +22 -1
  472. package/dist/util/string.d.ts +17 -0
  473. package/dist/util/string.js +23 -0
  474. package/package.json +1 -3
  475. package/dist/core/pipeline/config-map/build-tree-map.d.ts +0 -4
  476. package/dist/core/pipeline/config-map/build-tree-map.js +0 -30
  477. package/dist/core/prototype/doc.d.ts +0 -31
  478. package/dist/core/prototype/doc.js +0 -118
  479. package/dist/core/prototype/shared/url/augment.d.ts +0 -13
  480. package/dist/core/prototype/shared/url/augment.js +0 -11
  481. package/dist/core/prototype/shared/url/hooks/populate-url.server.d.ts +0 -4
  482. package/dist/core/prototype/shared/url/hooks/populate-url.server.js +0 -120
  483. package/dist/fields/rich-text/component/styles/rich-text.css +0 -183
  484. package/dist/panel/components/sections/collection/header/Header.svelte +0 -17
  485. package/dist/panel/components/sections/collection/header/Header.svelte.d.ts +0 -3
  486. package/dist/panel/components/sections/collection/header/Separator.svelte +0 -8
  487. package/dist/panel/components/sections/collection/header/Separator.svelte.d.ts +0 -26
  488. package/dist/panel/components/sections/collection/tree/util.d.ts +0 -12
  489. package/dist/panel/components/sections/collection/tree/util.js +0 -22
  490. package/dist/panel/fonts/ChivoMono-Italic-VariableFont_wght.ttf +0 -0
  491. package/dist/panel/fonts/ChivoMono-VariableFont_wght.ttf +0 -0
  492. package/dist/panel/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
  493. package/dist/panel/fonts/Lora-Italic-VariableFont_wght.ttf +0 -0
  494. package/dist/panel/fonts/Lora-VariableFont_wght.ttf +0 -0
  495. package/dist/panel/style/shadow.css +0 -10
  496. package/dist/util/path.d.ts +0 -16
  497. package/dist/util/path.js +0 -19
@@ -1,7 +1,7 @@
1
1
  import { definePlugin } from '../index.js';
2
2
  import { connect, emit } from './bus.server.js';
3
3
  /**
4
- * The event stream, at `/api/sse`.
4
+ * The event stream, at `/api/sse`. Added to every config, configured by its `$sse` key.
5
5
  *
6
6
  * Send with `rime.sse.emit(key, event, payload)`, listen with `openSse(keys, handler)`.
7
7
  *
@@ -9,7 +9,8 @@ import { connect, emit } from './bus.server.js';
9
9
  * otherwise, so an app opens its own deliberately rather than by leaving a default alone.
10
10
  *
11
11
  * @example
12
- * sse({ access: (key) => key.startsWith('public:') })
12
+ * // rime.config.server.ts
13
+ * $sse: { access: (key) => key.startsWith('public:') }
13
14
  */
14
15
  export const sse = definePlugin((options) => ({
15
16
  name: 'sse',
@@ -14,3 +14,8 @@ export type SSEHandler = (event: SSEEvent) => void | Promise<void>;
14
14
  * point of naming keys up front rather than filtering in the browser.
15
15
  */
16
16
  export type SSEAccess = (key: string, user?: User) => boolean;
17
+ /** The `$sse` key of the config. */
18
+ export type SSEConfig = {
19
+ /** Which keys, besides the panel's own, a caller may listen to. None without it. */
20
+ access?: SSEAccess;
21
+ };
@@ -1,4 +1,3 @@
1
- import { createBlankDocument } from '../doc.js';
2
1
  import { versionsReadQuery } from '../shared/versions/read-query.js';
3
2
  import { find } from './operations/find.js';
4
3
  import { update } from './operations/update.js';
@@ -40,7 +39,7 @@ class AreaAPI {
40
39
  }
41
40
  /** The area's document with every default applied. */
42
41
  blank() {
43
- return createBlankDocument(this.config, this.event);
42
+ return this.config.blank(this.event);
44
43
  }
45
44
  /** The locale to act in: the one asked for, else the request's, else the config's default. */
46
45
  fallbackLocale(locale) {
@@ -1,9 +1,6 @@
1
1
  import { augmentMetas } from 'rimecms/core/prototype/shared/metas/module';
2
2
  import { augmentTitle } from '../shared/title/augment.js';
3
- import { augmentUrl } from '../shared/url/augment.js';
4
- import { hasUrl } from '../shared/url/enabled.js';
5
3
  import { augmentVersions } from '../shared/versions/augment.js';
6
- import { when } from '../when.js';
7
4
  import { definePrototype } from '../define.js';
8
5
  import { augmentAreaLabel } from './augment-label.js';
9
6
  /**
@@ -27,13 +24,7 @@ export const area = definePrototype({
27
24
  * in — it simply does not list them. That is what the two lists say that a shared
28
25
  * implementation with a flag could not.
29
26
  */
30
- augments: () => [
31
- augmentAreaLabel,
32
- augmentVersions,
33
- when(hasUrl, augmentUrl),
34
- augmentTitle,
35
- augmentMetas
36
- ]
27
+ augments: () => [augmentAreaLabel, augmentVersions, augmentTitle, augmentMetas]
37
28
  });
38
29
  /**
39
30
  * The public authoring API: `Area.create('settings', {…})`. See the collection's for why the
@@ -1,5 +1,4 @@
1
1
  import { definePrototype } from '../define.js';
2
- import { createBlankDocument } from '../doc.js';
3
2
  import { blankVersion } from '../shared/versions/blank.js';
4
3
  import { area as base } from './definition.js';
5
4
  import { areaHooks } from './hooks.server.js';
@@ -22,9 +21,9 @@ export const area = definePrototype({
22
21
  hooks: areaHooks,
23
22
  boot: async ({ config, adapter, defaultLocale }) => {
24
23
  /**
25
- * No request event: boot has no request. `createBlankDocument` takes one only to pass to a
26
- * field's `defaultValue({ event })`, which already declares it optional — so a default that
27
- * reads it gets `undefined` here rather than whichever request arrived first.
24
+ * No request event: boot has no request. `blank` takes one only to pass to a field's
25
+ * `defaultValue({ event })`, which already declares it optional — so a default that reads it
26
+ * gets `undefined` here rather than whichever request arrived first.
28
27
  *
29
28
  * The locale is the config's default for the same reason: the locale of an area's first row
30
29
  * is a property of the config, not of its first reader.
@@ -33,7 +32,7 @@ export const area = definePrototype({
33
32
  // Intent `'seed'`, not `'create'`: a feature that gives this prototype a versions table may need
34
33
  // the first row to differ from what an author's create starts with. See
35
34
  // FeatureDefinition.blank.
36
- blank: blankVersion(createBlankDocument(config), config),
35
+ blank: blankVersion(config.blank(), config),
37
36
  locale: defaultLocale
38
37
  });
39
38
  }
@@ -39,8 +39,9 @@ export const areaHooks = {
39
39
  setDocumentType,
40
40
  when(isVersioned, versions.exposeVersionId),
41
41
  title.setDocumentTitle,
42
- // After the title, for the reason the collection's list gives.
43
- when(hasUrl, url.populateURL),
42
+ // After the title: `$url` is the author's function, and may read it.
43
+ when(hasUrl, url.setAreaUrl),
44
+ when(hasUrl, url.setLiveUrl),
44
45
  metas.deletePanelLockMetas
45
46
  ],
46
47
  beforeUpdate: [
@@ -1,3 +1,4 @@
1
+ import { readableReferences } from '../../../fields/util.js';
1
2
  import { RimeError } from '../../../errors/index.js';
2
3
  import { readDocument, runBeforeOperation } from '../../../pipeline/run.server.js';
3
4
  export const find = async (args) => {
@@ -24,6 +25,7 @@ export const find = async (args) => {
24
25
  locale,
25
26
  localeFallback,
26
27
  select,
28
+ resolve: isSystemOperation ? undefined : readableReferences(config.fields, event.locals.user),
27
29
  // See the collection's findById.
28
30
  content: ctx.versionQuery({ latest, versionId })
29
31
  });
@@ -0,0 +1,26 @@
1
+ import type { FieldBuilder } from '../fields/builders/field-builder.js';
2
+ import type { GenericDoc } from './types.js';
3
+ import type { Field } from '../../fields/types.js';
4
+ import type { RequestEvent } from '@sveltejs/kit';
5
+ /** What `blank` reads off the config it is a method of. */
6
+ type BlankOwner = {
7
+ fields: FieldBuilder<Field>[];
8
+ slug: string;
9
+ type: string;
10
+ };
11
+ /**
12
+ * A document of this config's shape with every default applied, and no id.
13
+ *
14
+ * ```ts
15
+ * const page = config.getCollection('pages').blank();
16
+ * ```
17
+ *
18
+ * Written as a standalone function so every config carries the same one — `definePrototype.create`
19
+ * for an authored config, and the three derivations that build a config by hand. The event is a
20
+ * field default's; boot has none, and a default that reads it gets `undefined` there.
21
+ *
22
+ * Nothing feature-shaped lands here: a feature adds to a blank document through
23
+ * `FeatureDefinition.blank`, which the local API folds.
24
+ */
25
+ export declare function blank(this: BlankOwner, event?: RequestEvent): GenericDoc;
26
+ export {};
@@ -0,0 +1,22 @@
1
+ import { blankFields } from '../fields/blank.js';
2
+ /**
3
+ * A document of this config's shape with every default applied, and no id.
4
+ *
5
+ * ```ts
6
+ * const page = config.getCollection('pages').blank();
7
+ * ```
8
+ *
9
+ * Written as a standalone function so every config carries the same one — `definePrototype.create`
10
+ * for an authored config, and the three derivations that build a config by hand. The event is a
11
+ * field default's; boot has none, and a default that reads it gets `undefined` there.
12
+ *
13
+ * Nothing feature-shaped lands here: a feature adds to a blank document through
14
+ * `FeatureDefinition.blank`, which the local API folds.
15
+ */
16
+ export function blank(event) {
17
+ return {
18
+ ...blankFields(this.fields, { event }),
19
+ _type: this.slug,
20
+ _prototype: this.type
21
+ };
22
+ }
@@ -10,8 +10,10 @@ import { type DeleteByIdArgs } from './operations/delete-by-id.js';
10
10
  import { type DeleteArgs } from './operations/delete.js';
11
11
  import { type DuplicateArgs } from './operations/duplicate.js';
12
12
  import { type FindByIdArgs } from './operations/find-by-id.js';
13
+ import { type FindByIdsArgs } from './operations/find-by-ids.js';
13
14
  import { type FindArgs } from './operations/find.js';
14
15
  import { type UpdateByIdArgs } from './operations/update-by-id.js';
16
+ import { type UpdateSlugByIdArgs } from './operations/update-slug-by-id.js';
15
17
  /** What building a collection's API for one request needs. */
16
18
  export type CollectionApiArgs = {
17
19
  config: BuiltCollection;
@@ -49,8 +51,15 @@ declare class CollectionAPI<Doc extends RegisterCollection[CollectionSlug]> impl
49
51
  /**
50
52
  * A document of this collection's shape with every default applied, and no id.
51
53
  *
52
- * An auth collection hands back nothing private — the password, the better-auth link. Only a
53
- * collection signs in, which is why this step is here and not on the area's.
54
+ * An auth collection hands back nothing private. Only a collection signs in, which is why this
55
+ * step is here and not on the area's.
56
+ *
57
+ * **Likely dead, to be checked and dropped.** `withoutPrivateFields` strips `PRIVATE_FIELDS`, and
58
+ * of those only `apiKeyId` is ever a member of `config.fields` — `augment.ts` adds it, hidden, on
59
+ * an apiKey collection. `password` is appended per-operation by `augmentFieldsPassword`, which
60
+ * runs *after* the blank merge, and the rest are columns no field declares. So the one member
61
+ * this can remove is `apiKeyId`, which `removePrivateFields` takes off again on every read. If
62
+ * that holds, an auth collection's blank is a blank like any other and this line is ceremony.
54
63
  */
55
64
  blank(): Doc;
56
65
  /** The locale to act in: the one asked for, else the request's, else the config's default. */
@@ -119,6 +128,23 @@ declare class CollectionAPI<Doc extends RegisterCollection[CollectionSlug]> impl
119
128
  * });
120
129
  */
121
130
  findById(args: FindByIdArgs): Promise<Doc>;
131
+ /**
132
+ * Finds the documents with these ids, in one read. Each id is checked against the read access
133
+ * as findById would check it; a missing or refused one is left out. The order is the list's
134
+ * default sort, not the order of `ids`.
135
+ *
136
+ * @example
137
+ * const medias = await rime.collection('medias').findByIds({ ids: ['a1', 'b2'] });
138
+ */
139
+ findByIds(args: FindByIdsArgs): Promise<Doc[]>;
140
+ /**
141
+ * Changes a page's slug in one locale, on the published page. Its address changes, and the pages
142
+ * under it follow. A collection with `$url` only.
143
+ *
144
+ * @example
145
+ * await rime.collection('pages').updateSlugById({ id: '12345', slug: 'web-design', locale: 'en' });
146
+ */
147
+ updateSlugById(args: UpdateSlugByIdArgs): Promise<import("../../adapter.js").PathRow>;
122
148
  /**
123
149
  * Updates a document in the collection by ID.
124
150
  *
@@ -168,6 +194,6 @@ export declare const collectionApi: <Doc extends RegisterCollection[CollectionSl
168
194
  * itself and every `rime.collection(...)` in the repo would resolve to `never`. Each operation
169
195
  * exports its caller-facing arguments separately for the same reason.
170
196
  */
171
- export type CollectionApi<Doc extends RegisterCollection[CollectionSlug] = RegisterCollection[CollectionSlug]> = Pick<CollectionAPI<Doc>, 'config' | 'blank' | 'create' | 'duplicate' | 'find' | 'findById' | 'updateById' | 'deleteById' | 'delete' | 'system'>;
197
+ export type CollectionApi<Doc extends RegisterCollection[CollectionSlug] = RegisterCollection[CollectionSlug]> = Pick<CollectionAPI<Doc>, 'config' | 'blank' | 'create' | 'duplicate' | 'find' | 'findById' | 'findByIds' | 'updateById' | 'updateSlugById' | 'deleteById' | 'delete' | 'system'>;
172
198
  export type CollectionAccessor = <Slug extends keyof RegisterCollection>(slug: Slug) => CollectionApi<RegisterCollection[Slug]>;
173
199
  export {};
@@ -1,15 +1,16 @@
1
1
  import { RimeError } from '../../errors/index.js';
2
2
  import { withoutPrivateFields } from '../../auth/constant.server.js';
3
3
  import { isAuth } from '../../auth/enabled.js';
4
- import { createBlankDocument } from '../doc.js';
5
4
  import { versionsReadQuery } from '../shared/versions/read-query.js';
6
5
  import { create } from './operations/create.js';
7
6
  import { deleteById } from './operations/delete-by-id.js';
8
7
  import { deleteDocs } from './operations/delete.js';
9
8
  import { duplicate } from './operations/duplicate.js';
10
9
  import { findById } from './operations/find-by-id.js';
10
+ import { findByIds } from './operations/find-by-ids.js';
11
11
  import { find } from './operations/find.js';
12
12
  import { updateById } from './operations/update-by-id.js';
13
+ import { updateSlugById } from './operations/update-slug-by-id.js';
13
14
  /**
14
15
  * Everything `rime.collection('pages')` can do, in the collection's own folder, beside the
15
16
  * operations that implement it.
@@ -49,11 +50,18 @@ class CollectionAPI {
49
50
  /**
50
51
  * A document of this collection's shape with every default applied, and no id.
51
52
  *
52
- * An auth collection hands back nothing private — the password, the better-auth link. Only a
53
- * collection signs in, which is why this step is here and not on the area's.
53
+ * An auth collection hands back nothing private. Only a collection signs in, which is why this
54
+ * step is here and not on the area's.
55
+ *
56
+ * **Likely dead, to be checked and dropped.** `withoutPrivateFields` strips `PRIVATE_FIELDS`, and
57
+ * of those only `apiKeyId` is ever a member of `config.fields` — `augment.ts` adds it, hidden, on
58
+ * an apiKey collection. `password` is appended per-operation by `augmentFieldsPassword`, which
59
+ * runs *after* the blank merge, and the rest are columns no field declares. So the one member
60
+ * this can remove is `apiKeyId`, which `removePrivateFields` takes off again on every read. If
61
+ * that holds, an auth collection's blank is a blank like any other and this line is ceremony.
54
62
  */
55
63
  blank() {
56
- const doc = createBlankDocument(this.config, this.event);
64
+ const doc = this.config.blank(this.event);
57
65
  return (isAuth(this.config) ? withoutPrivateFields(doc) : doc);
58
66
  }
59
67
  /** The locale to act in: the one asked for, else the request's, else the config's default. */
@@ -173,6 +181,41 @@ class CollectionAPI {
173
181
  locale: this.fallbackLocale(locale)
174
182
  }));
175
183
  }
184
+ /**
185
+ * Finds the documents with these ids, in one read. Each id is checked against the read access
186
+ * as findById would check it; a missing or refused one is left out. The order is the list's
187
+ * default sort, not the order of `ids`.
188
+ *
189
+ * @example
190
+ * const medias = await rime.collection('medias').findByIds({ ids: ['a1', 'b2'] });
191
+ */
192
+ findByIds(args) {
193
+ const { ids, locale, depth = 0, localeFallback } = args;
194
+ if (!ids.length)
195
+ return Promise.resolve([]);
196
+ return findByIds({
197
+ ctx: this,
198
+ ids,
199
+ depth,
200
+ localeFallback,
201
+ locale: this.fallbackLocale(locale)
202
+ });
203
+ }
204
+ /**
205
+ * Changes a page's slug in one locale, on the published page. Its address changes, and the pages
206
+ * under it follow. A collection with `$url` only.
207
+ *
208
+ * @example
209
+ * await rime.collection('pages').updateSlugById({ id: '12345', slug: 'web-design', locale: 'en' });
210
+ */
211
+ updateSlugById(args) {
212
+ return updateSlugById({
213
+ ctx: this,
214
+ id: args.id,
215
+ slug: args.slug,
216
+ locale: this.fallbackLocale(args.locale)
217
+ });
218
+ }
176
219
  /**
177
220
  * Updates a document in the collection by ID.
178
221
  *
@@ -7,8 +7,6 @@ import { augmentThumbnail } from './thumbnail/augment.js';
7
7
  import { augmentTitle } from '../shared/title/augment.js';
8
8
  import { augmentUpload } from 'rimecms/core/prototype/collection/upload/module';
9
9
  import { isUpload } from './upload/enabled.js';
10
- import { augmentUrl } from '../shared/url/augment.js';
11
- import { hasUrl } from '../shared/url/enabled.js';
12
10
  import { augmentVersions } from '../shared/versions/augment.js';
13
11
  import { when } from '../when.js';
14
12
  import { definePrototype } from '../define.js';
@@ -50,7 +48,6 @@ export const collection = definePrototype({
50
48
  when(isUpload, augmentUpload),
51
49
  when(isNested, augmentNested),
52
50
  augmentVersions,
53
- when(hasUrl, augmentUrl),
54
51
  augmentTitle,
55
52
  augmentThumbnail,
56
53
  augmentMetas
@@ -1,5 +1,9 @@
1
1
  /**
2
- * Merges the incoming data onto a blank document, so a create starts from every field the config
2
+ * Fills the incoming data from a blank document, so a create starts from every field the config
3
3
  * declares rather than only the ones the caller sent.
4
+ *
5
+ * What the caller sent is kept as sent: an upload's `File` is not a plain object and is not
6
+ * walked, a key no field declares has no blank to fill from. The data's own nested objects are
7
+ * shared with the caller's payload from here on, not copied.
4
8
  */
5
9
  export declare const mergeWithBlankDocument: import("../../../pipeline/types").Hook<"raw", "create", "before">;
@@ -1,28 +1,14 @@
1
1
  import { Hooks } from '../../../pipeline/define-hook.js';
2
- import { createBlankDocument } from '../../doc.js';
3
- import { omit, pick } from '../../../../util/object.js';
4
- import deepmerge from 'deepmerge';
2
+ import { withDefaults } from '../../../../util/object.js';
5
3
  /**
6
- * Merges the incoming data onto a blank document, so a create starts from every field the config
4
+ * Fills the incoming data from a blank document, so a create starts from every field the config
7
5
  * declares rather than only the ones the caller sent.
6
+ *
7
+ * What the caller sent is kept as sent: an upload's `File` is not a plain object and is not
8
+ * walked, a key no field declares has no blank to fill from. The data's own nested objects are
9
+ * shared with the caller's payload from here on, not copied.
8
10
  */
9
11
  export const mergeWithBlankDocument = Hooks.beforeCreate(async function mergeWithBlankDocument(args) {
10
- const blank = createBlankDocument(args.config, args.event);
11
- const known = Object.keys(blank);
12
- const data = args.data;
13
- /**
14
- * The blank is built from the config's fields, so only the keys it has are keys there is
15
- * anything to merge *with*. Everything else is carried across rather than through.
16
- *
17
- * That is what keeps a `File` a `File`. `deepmerge` clones every plain object it walks, so an
18
- * upload payload passed through it would come out with none of a `File`'s methods — and `file`
19
- * is not a field on any config, so the blank has no key for it and nothing to merge it into.
20
- */
21
- return {
22
- ...args,
23
- data: {
24
- ...deepmerge(blank, pick(known, data), { arrayMerge: (_, incoming) => incoming }),
25
- ...omit(known, data)
26
- }
27
- };
12
+ const blank = args.config.blank(args.event);
13
+ return { ...args, data: withDefaults(args.data, blank) };
28
14
  });
@@ -62,9 +62,8 @@ export const collectionHooks = {
62
62
  when(isNested, nested.addChildrenProperty),
63
63
  when(isVersioned, versions.exposeVersionId),
64
64
  title.setDocumentTitle,
65
- // After the title: `config.$url(document)` is the author's own function, and a slug built
66
- // from the title is the ordinary case.
67
- when(hasUrl, url.populateURL),
65
+ // The live edit link, from the url the read joined.
66
+ when(hasUrl, url.setLiveUrl),
68
67
  // After the sizes: it takes the thumbnail `upload.populateSizes` derived when there is one.
69
68
  thumbnail.setDocumentThumbnail,
70
69
  metas.deletePanelLockMetas
@@ -89,7 +88,12 @@ export const collectionHooks = {
89
88
  when(isUpload, upload.castBase64ToFile),
90
89
  when(isUpload, upload.processFileUpload)
91
90
  ],
92
- afterCreate: [when(isAuth, auth.populateAPIKey), when(isAuth, auth.signInNewUser)],
91
+ afterCreate: [
92
+ when(isAuth, auth.populateAPIKey),
93
+ when(isAuth, auth.signInNewUser),
94
+ when(hasUrl, url.createPaths)
95
+ ],
96
+ afterUpdate: [when(hasUrl, url.syncPaths)],
93
97
  beforeUpdate: [
94
98
  versions.stripAutoSaveFlag,
95
99
  getOriginalDocument,
@@ -127,7 +131,9 @@ export const collectionHooks = {
127
131
  when(isAuth, auth.preventSupperAdminDeletion),
128
132
  // After the refusal above: a user who cannot be deleted keeps their auto-saves.
129
133
  when(isStaffCollection, versions.discardAutoSavesOf),
130
- when(isUpload, upload.cleanUpFiles)
134
+ when(isUpload, upload.cleanUpFiles),
135
+ // Its children go to the top with their addresses, before its own go by cascade.
136
+ when(hasUrl, url.detachPaths)
131
137
  ],
132
138
  afterDelete: [when(isAuth, auth.deleteBetterAuthUser)]
133
139
  };
@@ -15,7 +15,9 @@ export const augmentNested = (config) => ({
15
15
  text('_parent')
16
16
  .$references(config.slug, { onDelete: 'set null', selfReferencing: true })
17
17
  .hidden()
18
- .$root(),
18
+ .$root()
19
+ // A read lists a document's children by it
20
+ .$index(),
19
21
  number('_position').defaultValue(0).hidden().$root()
20
22
  ]
21
23
  });
@@ -0,0 +1,12 @@
1
+ import type { GenericDoc } from '../../types.js';
2
+ /**
3
+ * The flat rows of a nested collection as a tree, each document holding its own children.
4
+ *
5
+ * Roots are the documents with no `_parent`, ordered by `_position`; a document already placed is
6
+ * never placed twice, so a cycle in the rows stops rather than recurses.
7
+ *
8
+ * ```ts
9
+ * toNestedStructure(pages); // [{ id: '1', _children: [{ id: '2', _children: [] }] }]
10
+ * ```
11
+ */
12
+ export declare const toNestedStructure: (documents: GenericDoc[]) => GenericDoc[];
@@ -0,0 +1,42 @@
1
+ import { snapshot } from '../../../../util/state.js';
2
+ /**
3
+ * The flat rows of a nested collection as a tree, each document holding its own children.
4
+ *
5
+ * Roots are the documents with no `_parent`, ordered by `_position`; a document already placed is
6
+ * never placed twice, so a cycle in the rows stops rather than recurses.
7
+ *
8
+ * ```ts
9
+ * toNestedStructure(pages); // [{ id: '1', _children: [{ id: '2', _children: [] }] }]
10
+ * ```
11
+ */
12
+ export const toNestedStructure = (documents) => {
13
+ const incomingDocs = snapshot(documents);
14
+ const docById = new Map();
15
+ incomingDocs.forEach((doc) => docById.set(doc.id, doc));
16
+ const processed = new Set();
17
+ const processDocument = (doc) => {
18
+ if (!doc || processed.has(doc.id)) {
19
+ return doc;
20
+ }
21
+ processed.add(doc.id);
22
+ const result = { ...doc };
23
+ // Children first, depth-first.
24
+ if (Array.isArray(result._children)) {
25
+ result._children = result._children
26
+ .map((id) => {
27
+ const childDoc = docById.get(id);
28
+ return childDoc ? processDocument(childDoc) : null;
29
+ })
30
+ .filter(Boolean);
31
+ }
32
+ // The parent stays an id — only children are expanded.
33
+ if (result._parent && typeof result._parent === 'string') {
34
+ result._parent = docById.get(result._parent)?.id || null;
35
+ }
36
+ return result;
37
+ };
38
+ return incomingDocs
39
+ .filter((doc) => !doc._parent)
40
+ .map(processDocument)
41
+ .sort((a, b) => (a._position || 0) - (b._position || 0));
42
+ };
@@ -1,3 +1,4 @@
1
+ import { readableReferences } from '../../../fields/util.js';
1
2
  import { RimeError } from '../../../errors/index.js';
2
3
  import { readDocument, runBeforeOperation } from '../../../pipeline/run.server.js';
3
4
  export const findById = async (args) => {
@@ -26,6 +27,7 @@ export const findById = async (args) => {
26
27
  locale,
27
28
  localeFallback,
28
29
  select,
30
+ resolve: isSystemOperation ? undefined : readableReferences(config.fields, event.locals.user),
29
31
  // `draft` and `versionId` are request parameters; which row they name is the feature's answer.
30
32
  content: ctx.versionQuery({ latest, versionId })
31
33
  });
@@ -0,0 +1,19 @@
1
+ import type { BuiltCollection } from '../../../config/types.js';
2
+ import type { PrototypeApiContext } from '../../define.js';
3
+ import type { GenericDoc } from '../../types.js';
4
+ export type FindByIdsArgs = {
5
+ ids: string[];
6
+ locale?: string | undefined;
7
+ depth?: number;
8
+ /** See the collection's findById. */
9
+ localeFallback?: boolean;
10
+ };
11
+ type Args = FindByIdsArgs & {
12
+ ctx: PrototypeApiContext<BuiltCollection>;
13
+ };
14
+ /**
15
+ * The published documents with these ids, in one read. A missing id, or one this reader is refused,
16
+ * is left out.
17
+ */
18
+ export declare const findByIds: <T extends GenericDoc>(args: Args) => Promise<T[]>;
19
+ export {};
@@ -0,0 +1,54 @@
1
+ import { readableReferences } from '../../../fields/util.js';
2
+ import { RimeError } from '../../../errors/index.js';
3
+ import { logger } from '../../../logger.server.js';
4
+ import { readDocuments, runBeforeOperation } from '../../../pipeline/run.server.js';
5
+ import { trycatch } from '../../../../util/function.js';
6
+ /**
7
+ * The published documents with these ids, in one read. A missing id, or one this reader is refused,
8
+ * is left out.
9
+ */
10
+ export const findByIds = async (args) => {
11
+ const { ctx, ids, locale, depth, localeFallback } = args;
12
+ const { config, event, isSystemOperation } = ctx;
13
+ // The beforeOperation chain findById runs, once per id: a read rule that looks at `id` answers
14
+ // for each document as it would one at a time. A refusal leaves the id out; anything else throws.
15
+ const readable = [];
16
+ for (const id of ids) {
17
+ const [error] = await trycatch(() => runBeforeOperation({
18
+ config,
19
+ event,
20
+ operation: 'read',
21
+ context: { isSystemOperation, params: { id, locale, depth } }
22
+ }));
23
+ if (!error)
24
+ readable.push(id);
25
+ else if (!(error instanceof RimeError && error.code === RimeError.UNAUTHORIZED))
26
+ throw error;
27
+ }
28
+ if (!readable.length)
29
+ return [];
30
+ const documentsRaw = await event.locals.rime.adapter.collection(config.slug).findMany({
31
+ // `id` names the document on a versioned collection too: the adapter reads it as `ownerId`.
32
+ query: { where: { id: { in_array: readable } } },
33
+ locale,
34
+ localeFallback,
35
+ resolve: isSystemOperation ? undefined : readableReferences(config.fields, event.locals.user),
36
+ // The published row, as findById reads with no `latest` and no `versionId`.
37
+ content: ctx.versionQuery({})
38
+ });
39
+ const results = await readDocuments({
40
+ raws: documentsRaw,
41
+ config,
42
+ event,
43
+ context: { isSystemOperation, params: { locale, depth, select: [] } },
44
+ locale,
45
+ localeFallback,
46
+ depth
47
+ });
48
+ return results.flatMap((result) => {
49
+ if (result.status === 'fulfilled')
50
+ return [result.value.doc];
51
+ logger.error(result.reason.message, result.reason);
52
+ return [];
53
+ });
54
+ };
@@ -1,5 +1,6 @@
1
+ import { readableReferences } from '../../../fields/util.js';
1
2
  import { logger } from '../../../logger.server.js';
2
- import { readDocument, runBeforeOperation } from '../../../pipeline/run.server.js';
3
+ import { readDocuments, runBeforeOperation } from '../../../pipeline/run.server.js';
3
4
  export const find = async (args) => {
4
5
  //
5
6
  const { ctx, locale, sort, limit, offset, depth, query, latest, select = [], localeFallback } = args;
@@ -32,34 +33,27 @@ export const find = async (args) => {
32
33
  locale,
33
34
  localeFallback,
34
35
  select,
36
+ resolve: isSystemOperation ? undefined : readableReferences(config.fields, event.locals.user),
35
37
  // Which content row each document shows. `and`ed with `query` by the adapter, rather than
36
38
  // spliced into it — see the collection's findById for where the answer comes from.
37
39
  content: ctx.versionQuery({ latest })
38
40
  });
39
- async function processDocument(documentRaw) {
40
- try {
41
- const result = await readDocument({
42
- raw: documentRaw,
43
- config,
44
- event,
45
- context,
46
- locale,
47
- localeFallback,
48
- depth,
49
- select
50
- });
51
- context = result.context;
52
- return result.doc;
53
- }
54
- catch (error) {
55
- // Skip this document and carry on with the next one. The transform is inside the try
56
- // alongside the hooks now: a row rime cannot turn into a document is the same kind of
57
- // per-row problem as a beforeRead hook rejecting one, and taking the whole query down
58
- // for it made a single bad row look like an empty collection.
59
- logger.error(error.message, error);
60
- return null;
61
- }
62
- }
63
- const documents = await Promise.all(documentsRaw.map((doc) => processDocument(doc)));
64
- return documents.filter((d) => !!d);
41
+ const results = await readDocuments({
42
+ raws: documentsRaw,
43
+ config,
44
+ event,
45
+ context,
46
+ locale,
47
+ localeFallback,
48
+ depth,
49
+ select
50
+ });
51
+ // A row rime cannot turn into a document, or that a beforeRead hook rejects, is skipped: one bad
52
+ // row does not take the whole list down.
53
+ return results.flatMap((result) => {
54
+ if (result.status === 'fulfilled')
55
+ return [result.value.doc];
56
+ logger.error(result.reason.message, result.reason);
57
+ return [];
58
+ });
65
59
  };