rimecms 0.33.0 → 1.0.1

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 (526) 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/index.server.js +11 -3
  6. package/dist/adapter-sqlite/generate-schema/root.server.d.ts +13 -4
  7. package/dist/adapter-sqlite/generate-schema/root.server.js +75 -131
  8. package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +36 -15
  9. package/dist/adapter-sqlite/generate-schema/templates.server.js +60 -18
  10. package/dist/adapter-sqlite/index.server.d.ts +13 -5
  11. package/dist/adapter-sqlite/index.server.js +9 -6
  12. package/dist/adapter-sqlite/naming.server.d.ts +6 -8
  13. package/dist/adapter-sqlite/naming.server.js +22 -4
  14. package/dist/adapter-sqlite/paths.server.d.ts +10 -0
  15. package/dist/adapter-sqlite/paths.server.js +131 -0
  16. package/dist/adapter-sqlite/read.server.d.ts +10 -1
  17. package/dist/adapter-sqlite/read.server.js +22 -10
  18. package/dist/adapter-sqlite/rows.server.d.ts +1 -1
  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 +98 -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 +8 -8
  33. package/dist/core/config/context.server.d.ts +2 -2
  34. package/dist/core/config/types.d.ts +43 -5
  35. package/dist/core/config/validate.server.js +34 -51
  36. package/dist/core/dev/cli/commands/build.js +21 -6
  37. package/dist/core/dev/cli/commands/init.server.d.ts +2 -1
  38. package/dist/core/dev/cli/commands/init.server.js +32 -6
  39. package/dist/core/dev/cli/index.js +1 -0
  40. package/dist/core/dev/cli/templates/init.d.ts +6 -1
  41. package/dist/core/dev/cli/templates/init.js +30 -2
  42. package/dist/core/dev/cli/util/package-manager.server.d.ts +1 -0
  43. package/dist/core/dev/cli/util/package-manager.server.js +11 -8
  44. package/dist/core/dev/cli/util/package.server.d.ts +9 -0
  45. package/dist/core/dev/cli/util/package.server.js +43 -0
  46. package/dist/core/dev/codegen/routes/common.server.d.ts +2 -0
  47. package/dist/core/dev/codegen/routes/common.server.js +7 -3
  48. package/dist/core/dev/codegen/routes/util.server.d.ts +2 -1
  49. package/dist/core/dev/codegen/routes/util.server.js +4 -1
  50. package/dist/core/dev/codegen/types/contributions.server.d.ts +3 -2
  51. package/dist/core/dev/codegen/types/contributions.server.js +10 -3
  52. package/dist/core/dev/config-memo.server.js +4 -0
  53. package/dist/core/dev/vite.server.js +4 -3
  54. package/dist/core/fields/blank.d.ts +21 -0
  55. package/dist/core/fields/blank.js +37 -0
  56. package/dist/core/fields/builders/field-builder.d.ts +53 -0
  57. package/dist/core/fields/builders/field-builder.js +14 -1
  58. package/dist/core/fields/builders/form-field-builder.d.ts +8 -0
  59. package/dist/core/fields/builders/form-field-builder.js +14 -1
  60. package/dist/core/fields/util.d.ts +9 -2
  61. package/dist/core/fields/util.js +123 -135
  62. package/dist/core/fields/walk.d.ts +44 -0
  63. package/dist/core/fields/walk.js +55 -0
  64. package/dist/core/handler.server.js +4 -0
  65. package/dist/core/i18n/context.d.ts +5 -0
  66. package/dist/core/i18n/context.js +6 -0
  67. package/dist/core/i18n/en/common.d.ts +71 -0
  68. package/dist/core/i18n/en/common.js +72 -1
  69. package/dist/core/i18n/en/fields.d.ts +68 -0
  70. package/dist/core/i18n/en/fields.js +69 -1
  71. package/dist/core/i18n/fr/common.d.ts +71 -0
  72. package/dist/core/i18n/fr/common.js +72 -1
  73. package/dist/core/i18n/fr/fields.d.ts +68 -0
  74. package/dist/core/i18n/fr/fields.js +69 -1
  75. package/dist/core/i18n/index.d.ts +29 -3
  76. package/dist/core/i18n/index.js +55 -29
  77. package/dist/core/locale/copy.server.js +3 -3
  78. package/dist/core/logger.server.js +15 -6
  79. package/dist/core/pipeline/build-document.server.d.ts +3 -0
  80. package/dist/core/pipeline/build-document.server.js +10 -7
  81. package/dist/core/pipeline/config-map/index.d.ts +9 -0
  82. package/dist/core/pipeline/config-map/index.js +16 -50
  83. package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +3 -0
  84. package/dist/core/pipeline/hooks/process-document-fields.server.js +48 -12
  85. package/dist/core/pipeline/hooks/set-default-values.server.d.ts +1 -0
  86. package/dist/core/pipeline/hooks/set-default-values.server.js +1 -0
  87. package/dist/core/pipeline/persist/blocks/extract.server.js +1 -1
  88. package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
  89. package/dist/core/pipeline/populate-relations.server.d.ts +27 -0
  90. package/dist/core/pipeline/populate-relations.server.js +42 -0
  91. package/dist/core/pipeline/run.server.d.ts +17 -6
  92. package/dist/core/pipeline/run.server.js +44 -30
  93. package/dist/core/plugins/cache/module.server.d.ts +1 -1
  94. package/dist/core/plugins/cache/module.server.js +5 -5
  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/duplicate.js +1 -1
  112. package/dist/core/prototype/collection/operations/find-by-id.js +2 -0
  113. package/dist/core/prototype/collection/operations/find-by-ids.d.ts +19 -0
  114. package/dist/core/prototype/collection/operations/find-by-ids.js +54 -0
  115. package/dist/core/prototype/collection/operations/find.js +21 -27
  116. package/dist/core/prototype/collection/operations/update-slug-by-id.d.ts +20 -0
  117. package/dist/core/prototype/collection/operations/update-slug-by-id.js +53 -0
  118. package/dist/core/prototype/collection/rest/index.server.js +3 -1
  119. package/dist/core/prototype/collection/rest/update-slug-by-id.server.d.ts +2 -0
  120. package/dist/core/prototype/collection/rest/update-slug-by-id.server.js +20 -0
  121. package/dist/core/prototype/collection/thumbnail/find-thumbnail.d.ts +2 -1
  122. package/dist/core/prototype/collection/thumbnail/find-thumbnail.js +4 -27
  123. package/dist/core/prototype/collection/thumbnail/hooks/set-document-thumbnail.server.js +1 -1
  124. package/dist/core/prototype/collection/upload/directories/derive.js +3 -1
  125. package/dist/core/prototype/collection/upload/disk/delete.server.js +1 -2
  126. package/dist/core/prototype/define.js +2 -0
  127. package/dist/core/prototype/shared/metas/fields.js +2 -1
  128. package/dist/core/prototype/shared/title/find-title.d.ts +2 -1
  129. package/dist/core/prototype/shared/title/find-title.js +5 -28
  130. package/dist/core/prototype/shared/title/hooks/set-document-title.server.js +1 -1
  131. package/dist/core/prototype/shared/url/addresses.server.d.ts +36 -0
  132. package/dist/core/prototype/shared/url/addresses.server.js +119 -0
  133. package/dist/core/prototype/shared/url/doc-type.d.ts +6 -0
  134. package/dist/core/prototype/shared/url/doc-type.js +9 -0
  135. package/dist/core/prototype/shared/url/format.server.d.ts +27 -0
  136. package/dist/core/prototype/shared/url/format.server.js +38 -0
  137. package/dist/core/prototype/shared/url/hooks/create-paths.server.d.ts +2 -0
  138. package/dist/core/prototype/shared/url/hooks/create-paths.server.js +9 -0
  139. package/dist/core/prototype/shared/url/hooks/detach-paths.server.d.ts +6 -0
  140. package/dist/core/prototype/shared/url/hooks/detach-paths.server.js +19 -0
  141. package/dist/core/prototype/shared/url/hooks/index.server.d.ts +5 -1
  142. package/dist/core/prototype/shared/url/hooks/index.server.js +5 -1
  143. package/dist/core/prototype/shared/url/hooks/set-area-url.server.d.ts +2 -0
  144. package/dist/core/prototype/shared/url/hooks/set-area-url.server.js +8 -0
  145. package/dist/core/prototype/shared/url/hooks/set-live-url.server.d.ts +5 -0
  146. package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +19 -0
  147. package/dist/core/prototype/shared/url/hooks/sync-paths.server.d.ts +8 -0
  148. package/dist/core/prototype/shared/url/hooks/sync-paths.server.js +38 -0
  149. package/dist/core/prototype/shared/url/refresh.server.d.ts +36 -0
  150. package/dist/core/prototype/shared/url/refresh.server.js +58 -0
  151. package/dist/core/prototype/shared/versions/configure.server.js +3 -0
  152. package/dist/core/routes/context.server.d.ts +2 -1
  153. package/dist/fields/blocks/component/AddBlockButton.svelte +48 -137
  154. package/dist/fields/blocks/component/Block.svelte +153 -117
  155. package/dist/fields/blocks/component/Block.svelte.d.ts +11 -5
  156. package/dist/fields/blocks/component/BlockActions.svelte +76 -26
  157. package/dist/fields/blocks/component/BlockActions.svelte.d.ts +3 -0
  158. package/dist/fields/blocks/component/Blocks.svelte +248 -91
  159. package/dist/fields/blocks/component/focus/BlocksFocus.svelte +680 -0
  160. package/dist/fields/blocks/component/focus/BlocksFocus.svelte.d.ts +7 -0
  161. package/dist/fields/blocks/component/focus/Layers.svelte +145 -0
  162. package/dist/fields/blocks/component/focus/Layers.svelte.d.ts +9 -0
  163. package/dist/fields/blocks/component/focus/LayersList.svelte +304 -0
  164. package/dist/fields/blocks/component/focus/LayersList.svelte.d.ts +10 -0
  165. package/dist/fields/blocks/component/focus/Palette.svelte +135 -0
  166. package/dist/fields/blocks/component/focus/Palette.svelte.d.ts +9 -0
  167. package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte +77 -0
  168. package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte.d.ts +10 -0
  169. package/dist/fields/blocks/component/focus/Renders.svelte +302 -0
  170. package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +11 -0
  171. package/dist/fields/blocks/component/focus/Stage.svelte +190 -0
  172. package/dist/fields/blocks/component/focus/Stage.svelte.d.ts +8 -0
  173. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +69 -0
  174. package/dist/fields/blocks/component/focus/StagePlaceholder.svelte.d.ts +3 -0
  175. package/dist/fields/blocks/component/focus/focus.svelte.d.ts +140 -0
  176. package/dist/fields/blocks/component/focus/focus.svelte.js +424 -0
  177. package/dist/fields/blocks/component/picker/BlockPicker.svelte +88 -0
  178. package/dist/fields/blocks/component/picker/BlockPicker.svelte.d.ts +10 -0
  179. package/dist/fields/blocks/component/picker/BlockTile.svelte +121 -0
  180. package/dist/fields/blocks/component/picker/BlockTile.svelte.d.ts +12 -0
  181. package/dist/fields/blocks/index.d.ts +49 -7
  182. package/dist/fields/blocks/index.js +61 -12
  183. package/dist/fields/checkbox/component/Checkbox.svelte +11 -37
  184. package/dist/fields/checkbox/component/Checkbox.svelte.d.ts +1 -0
  185. package/dist/fields/combobox/component/ComboBox.svelte +37 -7
  186. package/dist/fields/combobox/component/combobox.css +26 -10
  187. package/dist/fields/date/component/Date.svelte +43 -12
  188. package/dist/fields/group/component/Group.svelte +110 -41
  189. package/dist/fields/group/index.d.ts +5 -1
  190. package/dist/fields/group/index.js +10 -2
  191. package/dist/fields/link/component/Link.svelte +184 -143
  192. package/dist/fields/link/component/RessourceInput.svelte +26 -24
  193. package/dist/fields/link/index.d.ts +2 -1
  194. package/dist/fields/link/module.server.js +2 -4
  195. package/dist/fields/number/component/Number.svelte +38 -20
  196. package/dist/fields/number/component/number.css +22 -20
  197. package/dist/fields/number/index.d.ts +1 -0
  198. package/dist/fields/radio/component/Radio.svelte +12 -0
  199. package/dist/fields/radio/index.js +1 -1
  200. package/dist/fields/relation/component/Relation.svelte +169 -40
  201. package/dist/fields/relation/component/RelationInline.svelte +258 -0
  202. package/dist/fields/relation/component/RelationInline.svelte.d.ts +26 -0
  203. package/dist/fields/relation/component/default/Default.svelte +210 -100
  204. package/dist/fields/relation/component/default/Default.svelte.d.ts +14 -1
  205. package/dist/fields/relation/component/types.d.ts +4 -0
  206. package/dist/fields/relation/component/upload/Browse.svelte +619 -88
  207. package/dist/fields/relation/component/upload/Browse.svelte.d.ts +10 -2
  208. package/dist/fields/relation/component/upload/Create.svelte +41 -0
  209. package/dist/fields/relation/component/upload/Create.svelte.d.ts +13 -0
  210. package/dist/fields/relation/component/upload/Upload.svelte +287 -101
  211. package/dist/fields/relation/component/upload/Upload.svelte.d.ts +6 -1
  212. package/dist/fields/relation/component/upload/upload.css +5 -81
  213. package/dist/fields/relation/index.d.ts +1 -41
  214. package/dist/fields/relation/index.js +0 -67
  215. package/dist/fields/relation/module.server.js +7 -1
  216. package/dist/fields/relation/populate.d.ts +8 -0
  217. package/dist/fields/relation/populate.js +49 -0
  218. package/dist/fields/relation/util.d.ts +69 -0
  219. package/dist/fields/relation/util.js +103 -0
  220. package/dist/fields/relation/value.d.ts +25 -0
  221. package/dist/fields/relation/value.js +27 -0
  222. package/dist/fields/rich-text/client.d.ts +2 -5
  223. package/dist/fields/rich-text/client.js +1 -3
  224. package/dist/fields/rich-text/component/Cell.svelte +1 -1
  225. package/dist/fields/rich-text/component/RichText.svelte +12 -80
  226. package/dist/fields/rich-text/component/RichText.svelte.d.ts +1 -1
  227. package/dist/fields/rich-text/component/RichTextInline.svelte +28 -0
  228. package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +11 -0
  229. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +4 -3
  230. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +3 -1
  231. package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +2 -2
  232. package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +7 -10
  233. package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -2
  234. package/dist/fields/rich-text/component/styles/editor.css +111 -0
  235. package/dist/fields/rich-text/component/styles/field.css +71 -0
  236. package/dist/fields/rich-text/component/suggestion/suggestion.svelte +41 -56
  237. package/dist/fields/rich-text/core/build-editor-config.js +1 -1
  238. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +29 -3
  239. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -0
  240. package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +2 -1
  241. package/dist/fields/rich-text/core/features/fields/fields.css +2 -3
  242. package/dist/fields/rich-text/core/features/hr/hr.css +4 -4
  243. package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -4
  244. package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +24 -8
  245. package/dist/fields/rich-text/core/features/resource/resource-extension.js +3 -3
  246. package/dist/fields/rich-text/core/features/resource/resource.svelte +21 -7
  247. package/dist/fields/rich-text/core/features/upload/upload-extension.js +3 -4
  248. package/dist/fields/rich-text/core/features/upload/upload.svelte +21 -9
  249. package/dist/fields/rich-text/core/rich-text-editor-core.svelte +103 -0
  250. package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +15 -0
  251. package/dist/fields/rich-text/index.d.ts +0 -17
  252. package/dist/fields/rich-text/index.js +0 -44
  253. package/dist/fields/rich-text/json.d.ts +18 -0
  254. package/dist/fields/rich-text/json.js +44 -0
  255. package/dist/fields/select/component/Select.svelte +67 -28
  256. package/dist/fields/slug/component/Slug.svelte +26 -53
  257. package/dist/fields/slug/index.d.ts +1 -0
  258. package/dist/fields/slug/index.js +1 -1
  259. package/dist/fields/tabs/component/Tabs.svelte +28 -22
  260. package/dist/fields/tabs/index.d.ts +4 -1
  261. package/dist/fields/tabs/index.js +17 -5
  262. package/dist/fields/text/index.d.ts +1 -0
  263. package/dist/fields/textarea/component/TextArea.svelte +28 -13
  264. package/dist/fields/textarea/index.d.ts +1 -0
  265. package/dist/fields/time/component/Time.svelte +9 -2
  266. package/dist/fields/toggle/component/Toggle.svelte +8 -25
  267. package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -0
  268. package/dist/fields/toggle/index.d.ts +1 -0
  269. package/dist/fields/tree/component/AddItemButton.svelte +18 -5
  270. package/dist/fields/tree/component/Tree.svelte +48 -19
  271. package/dist/fields/tree/component/TreeBlock.svelte +318 -104
  272. package/dist/fields/tree/component/TreeBlockActions.svelte +71 -7
  273. package/dist/fields/tree/component/TreeBlockActions.svelte.d.ts +4 -0
  274. package/dist/fields/tree/component/props.d.ts +2 -1
  275. package/dist/fields/tree/index.d.ts +13 -1
  276. package/dist/fields/tree/index.js +35 -9
  277. package/dist/fields/types.d.ts +3 -1
  278. package/dist/index.d.ts +2 -8
  279. package/dist/index.js +2 -6
  280. package/dist/{panel/components/sections/live → live}/Consumer.svelte +2 -2
  281. package/dist/{panel/components/sections/live → live}/Consumer.svelte.d.ts +1 -1
  282. package/dist/{panel/components/sections/live → live}/LiveEdit.svelte +3 -3
  283. package/dist/{panel/components/sections/live → live}/Provider.svelte +1 -1
  284. package/dist/{panel/context/live.svelte.d.ts → live/context.svelte.d.ts} +1 -1
  285. package/dist/{panel/context/live.svelte.js → live/context.svelte.js} +3 -74
  286. package/dist/panel/components/Root.svelte +16 -44
  287. package/dist/panel/components/Root.svelte.d.ts +1 -1
  288. package/dist/panel/components/fields/Error.svelte +18 -3
  289. package/dist/panel/components/fields/FieldsPreview.svelte +30 -17
  290. package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +25 -3
  291. package/dist/panel/components/fields/Hint.svelte +51 -8
  292. package/dist/panel/components/fields/Hint.svelte.d.ts +11 -0
  293. package/dist/panel/components/fields/Label.svelte +2 -0
  294. package/dist/panel/components/fields/LabelFor.svelte +7 -2
  295. package/dist/panel/components/fields/RenderFields.svelte +10 -3
  296. package/dist/panel/components/fields/fieldset.svelte.d.ts +4 -1
  297. package/dist/panel/components/fields/fieldset.svelte.js +9 -2
  298. package/dist/panel/components/fields/index.d.ts +1 -0
  299. package/dist/panel/components/fields/setting.css +82 -0
  300. package/dist/panel/components/sections/auth/AuthForm.svelte +25 -26
  301. package/dist/panel/components/sections/collection/Avatar.svelte +61 -0
  302. package/dist/panel/components/sections/collection/Avatar.svelte.d.ts +9 -0
  303. package/dist/panel/components/sections/collection/DocStatus.svelte +28 -0
  304. package/dist/panel/components/sections/collection/DocStatus.svelte.d.ts +7 -0
  305. package/dist/panel/components/sections/collection/Empty.svelte +3 -3
  306. package/dist/panel/components/sections/collection/StatusDot.svelte +7 -5
  307. package/dist/panel/components/sections/collection/When.svelte +33 -0
  308. package/dist/panel/components/sections/collection/When.svelte.d.ts +8 -0
  309. package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte +65 -21
  310. package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte.d.ts +3 -2
  311. package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte +45 -162
  312. package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte.d.ts +3 -2
  313. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +151 -0
  314. package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte.d.ts +17 -0
  315. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +177 -0
  316. package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte.d.ts +12 -0
  317. package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte +75 -0
  318. package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte.d.ts +8 -0
  319. package/dist/panel/components/sections/collection/folder/Folder.svelte +18 -3
  320. package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +26 -18
  321. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +98 -58
  322. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte.d.ts +0 -1
  323. package/dist/panel/components/sections/collection/folder/Folders.svelte +60 -0
  324. package/dist/panel/components/sections/collection/folder/Folders.svelte.d.ts +7 -0
  325. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +31 -71
  326. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +1 -0
  327. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +5 -3
  328. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +250 -37
  329. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte.d.ts +2 -0
  330. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +43 -18
  331. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +6 -4
  332. package/dist/panel/components/sections/collection/header/DisplayMode.svelte +69 -58
  333. package/dist/panel/components/sections/collection/header/DisplayMode.svelte.d.ts +0 -1
  334. package/dist/panel/components/sections/collection/header/FilterMenu.svelte +60 -0
  335. package/dist/panel/components/sections/collection/header/FilterMenu.svelte.d.ts +14 -0
  336. package/dist/panel/components/sections/collection/header/SearchInput.svelte +17 -26
  337. package/dist/panel/components/sections/collection/header/SelectUI.svelte +19 -34
  338. package/dist/panel/components/sections/collection/list/CollectionList.svelte +99 -68
  339. package/dist/panel/components/sections/collection/list/columns.d.ts +21 -0
  340. package/dist/panel/components/sections/collection/list/columns.js +23 -0
  341. package/dist/panel/components/sections/collection/list/header/Header.svelte +99 -51
  342. package/dist/panel/components/sections/collection/list/row/Row.svelte +165 -82
  343. package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -0
  344. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +92 -44
  345. package/dist/panel/components/sections/collection/tree/CollectionTree.svelte.d.ts +1 -0
  346. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +139 -43
  347. package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte.d.ts +2 -0
  348. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +1 -1
  349. package/dist/panel/components/sections/commands/CommandButton.svelte +99 -0
  350. package/dist/panel/components/sections/commands/CommandButton.svelte.d.ts +10 -0
  351. package/dist/panel/components/sections/commands/CommandPalette.svelte +275 -0
  352. package/dist/panel/components/sections/commands/CommandPalette.svelte.d.ts +8 -0
  353. package/dist/panel/components/sections/commands/Commands.svelte +18 -0
  354. package/dist/panel/components/sections/commands/Commands.svelte.d.ts +9 -0
  355. package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +23 -7
  356. package/dist/panel/components/sections/document/AuthFooter.svelte +31 -12
  357. package/dist/panel/components/sections/document/AutoSaveBanner.svelte +24 -7
  358. package/dist/panel/components/sections/document/ButtonSave.svelte +32 -21
  359. package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +5 -5
  360. package/dist/panel/components/sections/document/ButtonStatus.svelte +68 -20
  361. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +199 -0
  362. package/dist/panel/components/sections/document/ChangeSlugDialog.svelte.d.ts +10 -0
  363. package/dist/panel/components/sections/document/CurrentlyEdited.svelte +2 -2
  364. package/dist/panel/components/sections/document/Document.svelte +96 -65
  365. package/dist/panel/components/sections/document/DocumentChildren.svelte +175 -0
  366. package/dist/panel/components/sections/document/DocumentChildren.svelte.d.ts +8 -0
  367. package/dist/panel/components/sections/document/DocumentUrl.svelte +119 -0
  368. package/dist/panel/components/sections/document/DocumentUrl.svelte.d.ts +9 -0
  369. package/dist/panel/components/sections/document/Header.svelte +171 -94
  370. package/dist/panel/components/sections/document/Settings.svelte +255 -110
  371. package/dist/panel/components/sections/document/Settings.svelte.d.ts +0 -1
  372. package/dist/panel/components/sections/document/Versions.svelte +5 -3
  373. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +112 -53
  374. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -2
  375. package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +74 -41
  376. package/dist/panel/components/sections/live/LiveFloatingUI.svelte +30 -11
  377. package/dist/panel/components/sections/live/live-edit-panel.css +2 -2
  378. package/dist/panel/components/sections/page-layout/Page.svelte +13 -1
  379. package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +55 -27
  380. package/dist/panel/components/ui/button/button.svelte +81 -54
  381. package/dist/panel/components/ui/button/index.d.ts +7 -3
  382. package/dist/panel/components/ui/button/index.js +2 -2
  383. package/dist/panel/components/ui/calendar/calendar.css +27 -27
  384. package/dist/panel/components/ui/card/card-description.svelte +1 -1
  385. package/dist/panel/components/ui/card/card.svelte +21 -4
  386. package/dist/panel/components/ui/card-document/card-document.svelte +24 -12
  387. package/dist/panel/components/ui/card-resource/card-resource.svelte +26 -8
  388. package/dist/panel/components/ui/checkbox/checkbox.css +8 -10
  389. package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
  390. package/dist/panel/components/ui/command/command-dialog.css +28 -4
  391. package/dist/panel/components/ui/command/command-dialog.svelte +4 -1
  392. package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +2 -0
  393. package/dist/panel/components/ui/command/command-empty.css +1 -1
  394. package/dist/panel/components/ui/command/command-group.css +3 -3
  395. package/dist/panel/components/ui/command/command-input-select.svelte +3 -3
  396. package/dist/panel/components/ui/command/command-input.svelte +38 -14
  397. package/dist/panel/components/ui/command/command-input.svelte.d.ts +6 -1
  398. package/dist/panel/components/ui/command/command-item.css +2 -2
  399. package/dist/panel/components/ui/command/command-list.css +1 -1
  400. package/dist/panel/components/ui/command/command-separator.css +1 -1
  401. package/dist/panel/components/ui/context-menu/context-menu-item.css +2 -2
  402. package/dist/panel/components/ui/context-menu/context-menu.css +6 -7
  403. package/dist/panel/components/ui/dialog/dialog-content.css +8 -10
  404. package/dist/panel/components/ui/dialog/dialog-content.svelte +19 -0
  405. package/dist/panel/components/ui/dialog/dialog-description.css +1 -1
  406. package/dist/panel/components/ui/dialog/dialog-footer.svelte +5 -1
  407. package/dist/panel/components/ui/dialog/dialog-overlay.css +1 -1
  408. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +19 -5
  409. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +1 -1
  410. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +6 -4
  411. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +1 -1
  412. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +1 -1
  413. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +1 -1
  414. package/dist/panel/components/ui/input/input.svelte +57 -31
  415. package/dist/panel/components/ui/kbd/Kbd.svelte +90 -0
  416. package/dist/panel/components/ui/kbd/Kbd.svelte.d.ts +11 -0
  417. package/dist/panel/components/ui/kbd/index.d.ts +1 -0
  418. package/dist/panel/components/ui/kbd/index.js +1 -0
  419. package/dist/panel/components/ui/label/label.css +5 -3
  420. package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +27 -15
  421. package/dist/panel/components/ui/nav/Nav.svelte +180 -110
  422. package/dist/panel/components/ui/nav/Nav.svelte.d.ts +0 -2
  423. package/dist/panel/components/ui/nav/NavGroup.svelte +87 -73
  424. package/dist/panel/components/ui/nav/NavItemButton.svelte +69 -29
  425. package/dist/panel/components/ui/nav/UserButton.svelte +132 -71
  426. package/dist/panel/components/ui/page-header/PageHeader.svelte +140 -42
  427. package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +8 -1
  428. package/dist/panel/components/ui/popover/popover-content.css +4 -3
  429. package/dist/panel/components/ui/radio-group/radio-group.css +4 -6
  430. package/dist/panel/components/ui/radio-row-group/radio-row-group.css +19 -7
  431. package/dist/panel/components/ui/scroll-area/scroll-area.css +2 -2
  432. package/dist/panel/components/ui/separator/separator.svelte +1 -1
  433. package/dist/panel/components/ui/sheet/index.d.ts +4 -4
  434. package/dist/panel/components/ui/sheet/index.js +5 -5
  435. package/dist/panel/components/ui/sheet/sheet.css +50 -11
  436. package/dist/panel/components/ui/sonner/sonner.css +11 -8
  437. package/dist/panel/components/ui/switch/switch.css +13 -18
  438. package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
  439. package/dist/panel/components/ui/tabs/tabs.css +44 -35
  440. package/dist/panel/components/ui/tag/tag.svelte +20 -6
  441. package/dist/panel/components/ui/tooltip/tooltip-content.svelte +14 -4
  442. package/dist/panel/components/ui/tree/tree-rows.css +146 -0
  443. package/dist/panel/context/blocks-ops.d.ts +78 -0
  444. package/dist/panel/context/blocks-ops.js +170 -0
  445. package/dist/panel/context/collection.svelte.d.ts +28 -0
  446. package/dist/panel/context/collection.svelte.js +120 -65
  447. package/dist/panel/context/commands.svelte.d.ts +80 -0
  448. package/dist/panel/context/commands.svelte.js +108 -0
  449. package/dist/panel/context/config.svelte.d.ts +2 -2
  450. package/dist/panel/context/documentForm.svelte.d.ts +34 -2
  451. package/dist/panel/context/documentForm.svelte.js +106 -103
  452. package/dist/panel/context/nav.svelte.d.ts +23 -0
  453. package/dist/panel/context/nav.svelte.js +56 -0
  454. package/dist/panel/fonts/Geist-VariableFont_wght.ttf +0 -0
  455. package/dist/panel/fonts/GeistMono-VariableFont_wght.ttf +0 -0
  456. package/dist/panel/index.d.ts +7 -4
  457. package/dist/panel/index.js +11 -5
  458. package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +16 -1
  459. package/dist/panel/pages/collection/CollectionPage.svelte +236 -61
  460. package/dist/panel/pages/collection/load.server.js +1 -1
  461. package/dist/panel/pages/dashboard/Dashboard.svelte +135 -90
  462. package/dist/panel/pages/dashboard/DashboardCard.svelte +109 -0
  463. package/dist/panel/pages/dashboard/DashboardCard.svelte.d.ts +14 -0
  464. package/dist/panel/pages/dashboard/DashboardCollection.svelte +180 -57
  465. package/dist/panel/pages/dashboard/DashboardCollection.svelte.d.ts +1 -0
  466. package/dist/panel/pages/dashboard/DashboardRow.svelte +93 -0
  467. package/dist/panel/pages/dashboard/DashboardRow.svelte.d.ts +16 -0
  468. package/dist/panel/pages/dashboard/load.server.js +49 -25
  469. package/dist/panel/pages/dashboard/time.d.ts +19 -0
  470. package/dist/panel/pages/dashboard/time.js +29 -0
  471. package/dist/panel/pages/dashboard/types.d.ts +9 -2
  472. package/dist/panel/pages/live/Live.svelte +53 -50
  473. package/dist/panel/public.d.ts +4 -0
  474. package/dist/panel/public.js +6 -0
  475. package/dist/panel/style/font.css +21 -32
  476. package/dist/panel/style/index.css +191 -122
  477. package/dist/panel/style/mixins/index.css +14 -0
  478. package/dist/panel/style/palette.css +35 -26
  479. package/dist/panel/style/postcss/size-function.d.ts +4 -0
  480. package/dist/panel/style/postcss/size-function.js +24 -0
  481. package/dist/panel/style/radius.css +4 -5
  482. package/dist/panel/style/scheme.css +111 -0
  483. package/dist/panel/style/size.css +3 -0
  484. package/dist/panel/util/Sortable.js +9 -4
  485. package/dist/panel/util/keys.d.ts +24 -0
  486. package/dist/panel/util/keys.js +63 -0
  487. package/dist/panel/util/time.d.ts +12 -0
  488. package/dist/panel/util/time.js +35 -0
  489. package/dist/panel/util/upload-file.d.ts +106 -0
  490. package/dist/panel/util/upload-file.js +165 -0
  491. package/dist/public.d.ts +13 -0
  492. package/dist/public.js +12 -0
  493. package/dist/util/index.d.ts +7 -10
  494. package/dist/util/index.js +7 -8
  495. package/dist/util/object.d.ts +10 -0
  496. package/dist/util/object.js +22 -1
  497. package/dist/util/string.d.ts +17 -0
  498. package/dist/util/string.js +23 -0
  499. package/package.json +12 -8
  500. package/dist/core/pipeline/config-map/build-tree-map.d.ts +0 -4
  501. package/dist/core/pipeline/config-map/build-tree-map.js +0 -30
  502. package/dist/core/prototype/doc.d.ts +0 -31
  503. package/dist/core/prototype/doc.js +0 -118
  504. package/dist/core/prototype/shared/url/augment.d.ts +0 -13
  505. package/dist/core/prototype/shared/url/augment.js +0 -11
  506. package/dist/core/prototype/shared/url/hooks/populate-url.server.d.ts +0 -4
  507. package/dist/core/prototype/shared/url/hooks/populate-url.server.js +0 -120
  508. package/dist/fields/relation/client.d.ts +0 -28
  509. package/dist/fields/relation/client.js +0 -37
  510. package/dist/fields/rich-text/component/styles/rich-text.css +0 -183
  511. package/dist/panel/components/sections/collection/header/Header.svelte +0 -17
  512. package/dist/panel/components/sections/collection/header/Header.svelte.d.ts +0 -3
  513. package/dist/panel/components/sections/collection/header/Separator.svelte +0 -8
  514. package/dist/panel/components/sections/collection/header/Separator.svelte.d.ts +0 -26
  515. package/dist/panel/components/sections/collection/tree/util.d.ts +0 -12
  516. package/dist/panel/components/sections/collection/tree/util.js +0 -22
  517. package/dist/panel/fonts/ChivoMono-Italic-VariableFont_wght.ttf +0 -0
  518. package/dist/panel/fonts/ChivoMono-VariableFont_wght.ttf +0 -0
  519. package/dist/panel/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
  520. package/dist/panel/fonts/Lora-Italic-VariableFont_wght.ttf +0 -0
  521. package/dist/panel/fonts/Lora-VariableFont_wght.ttf +0 -0
  522. package/dist/panel/style/shadow.css +0 -10
  523. package/dist/util/path.d.ts +0 -16
  524. package/dist/util/path.js +0 -19
  525. /package/dist/{panel/components/sections/live → live}/LiveEdit.svelte.d.ts +0 -0
  526. /package/dist/{panel/components/sections/live → live}/Provider.svelte.d.ts +0 -0
@@ -1,20 +1,20 @@
1
1
  import { toSnakeCase } from '../../util/string.js';
2
- import { baseTableName, declaredTableProperty, getSchemaColumnNames, joinName } from '../naming.server.js';
3
2
  import dedent from 'dedent';
3
+ import { baseTableName, declaredTableProperty, getSchemaColumnNames, joinName, tableName } from '../naming.server.js';
4
4
  const s = toSnakeCase;
5
5
  /**
6
6
  * Generates the standard imports needed for Drizzle ORM schema definitions
7
7
  * Includes SQLite table definitions, relations, and a primary key helper function
8
8
  */
9
9
  export const templateImports = `
10
- import { text, integer, sqliteTable, real } from "drizzle-orm/sqlite-core";
11
- import { defineRelations } from 'drizzle-orm';
10
+ import { text, integer, sqliteTable, real, index, unique, check, foreignKey } from "drizzle-orm/sqlite-core";
11
+ import { defineRelations, sql } from 'drizzle-orm';
12
12
 
13
13
  const pk = () => text("id").primaryKey().$defaultFn(() => crypto.randomUUID());
14
14
  `;
15
15
  /**
16
16
  * Generates a basic table definition with a primary key
17
- * Takes a table name and optional content for additional columns
17
+ * Takes a table name, its columns, and the columns to index
18
18
  *
19
19
  * @example
20
20
  * ```typescript
@@ -22,18 +22,29 @@ const pk = () => text("id").primaryKey().$defaultFn(() => crypto.randomUUID());
22
22
  * id: pk(),
23
23
  * title: text('title'),
24
24
  * content: text('content')
25
- * })
25
+ * }, (t) => [index('pages_updated_at_idx').on(t.updatedAt)])
26
26
  * ```
27
27
  */
28
- export const templateTable = (table, content) => {
28
+ export const templateTable = (table, content, indexed = []) => {
29
29
  if (!content.includes('id:')) {
30
30
  content = `id: pk(),\n${content}`;
31
31
  }
32
32
  return `export const ${table} = sqliteTable( '${table}', {
33
33
  ${content}
34
- })
34
+ }${templateIndexes(table, indexed)})
35
35
  `;
36
36
  };
37
+ /**
38
+ * One index per column, named after the table and the column.
39
+ *
40
+ * ```ts
41
+ * templateIndexes('pages__$rels', ['ownerId', 'mediasId'])
42
+ * // , (t) => [index('pages__$rels_owner_id_idx').on(t.ownerId), index('pages__$rels_medias_id_idx').on(t.mediasId)]
43
+ * ```
44
+ */
45
+ export const templateIndexes = (table, columns) => columns.length
46
+ ? `, (t) => [${columns.map((column) => `index('${table}_${s(column)}_idx').on(t.${column})`).join(', ')}]`
47
+ : '';
37
48
  /**
38
49
  * Generates a locale field for internationalized tables
39
50
  *
@@ -160,12 +171,44 @@ export const templateUniqueRequired = (field, defaultValue) => {
160
171
  * ```
161
172
  */
162
173
  const templateDefault = (value) => value instanceof Date ? `new Date(${value.getTime()})` : JSON.stringify(value);
174
+ /**
175
+ * The addresses of a collection with `$url`: one row per page and per locale, off its base table.
176
+ *
177
+ * `path` is generated from the parent's path and the slug. Renaming or moving a row carries down
178
+ * its subtree, through the foreign key on `(locale, parent_path)`.
179
+ *
180
+ * ```ts
181
+ * export const pages__$paths = sqliteTable('pages__$paths', { …, path: text('path').generatedAlwaysAs(…) }, …)
182
+ * ```
183
+ */
184
+ export const templatePathsTable = (owner) => {
185
+ const table = tableName({ owner, child: { kind: 'paths' } });
186
+ return `
187
+ export const ${table} = sqliteTable('${table}', {
188
+ id: pk(),
189
+ ownerId: text('owner_id').notNull().references(() => ${owner}.id, { onDelete: 'cascade' }),
190
+ locale: text('locale').notNull(),
191
+ slug: text('slug').notNull(),
192
+ parentPath: text('parent_path'),
193
+ path: text('path').generatedAlwaysAs(sql\`coalesce(parent_path || '/', '') || slug\`, { mode: 'stored' }),
194
+ url: text('url')
195
+ }, (t) => [
196
+ unique('${table}_owner_locale').on(t.ownerId, t.locale),
197
+ unique('${table}_path').on(t.locale, t.path),
198
+ index('${table}_parent_idx').on(t.locale, t.parentPath),
199
+ index('${table}_url_idx').on(t.locale, t.url),
200
+ check('${table}_slug', sql\`slug <> ''\`),
201
+ foreignKey({ columns: [t.locale, t.parentPath], foreignColumns: [t.locale, t.path] }).onUpdate('cascade')
202
+ ]);
203
+ `;
204
+ };
163
205
  /** Template rows Relation */
164
206
  /**
165
- * The whole schema's relations, in one declaration.
207
+ * The drizzle relations of the whole schema. A read lists them in its `with` to load related rows
208
+ * in the same query, by the names given here.
166
209
  *
167
- * Every relation rime generates is the same shape — a child row points at its owner through
168
- * `ownerId` — so the tree is `parent -> children` and both directions fall out of it:
210
+ * A child table (blocks, tree…) points at its owner through `ownerId`. It gets a relation each way,
211
+ * named after the table on the other end:
169
212
  *
170
213
  * ```ts
171
214
  * export const relations = defineRelations(tables, (r) => ({
@@ -180,14 +223,13 @@ const templateDefault = (value) => value instanceof Date ? `new Date(${value.get
180
223
  * }));
181
224
  * ```
182
225
  *
183
- * A relation is keyed by the table on the other end, which is what `buildWithParam` names when it
184
- * builds a `with`.
185
- *
186
- * A reference the read resolves is the other shape: the owner's row points at its target through
187
- * the field's own column, one direction, keyed by `joinName(column)`:
226
+ * A reference field that stores another document's id in its own column: `updatedBy` holds a staff id.
227
+ * It gets one relation, from that column to the target, named after the column. Two columns can
228
+ * point at the same table:
188
229
  *
189
230
  * ```ts
190
231
  * pages: {
232
+ * createdBy__$doc: r.one.staff({ from: r.pages.createdBy, to: r.staff.id }),
191
233
  * updatedBy__$doc: r.one.staff({ from: r.pages.updatedBy, to: r.staff.id })
192
234
  * }
193
235
  * ```
@@ -234,7 +276,7 @@ export const templateFieldRelationColumn = (slug) => {
234
276
  };
235
277
  /**
236
278
  * Generates a junction table for many-to-many relationships
237
- * Creates a table with references to the owner table and related tables
279
+ * Creates a table with references to the owner table and related tables, each one indexed
238
280
  * Includes path and position fields for ordering relationships
239
281
  *
240
282
  * @example
@@ -246,7 +288,7 @@ export const templateFieldRelationColumn = (slug) => {
246
288
  * ownerId: text('owner_id').references(() => pages.id, { onDelete: 'cascade' }),
247
289
  * mediasId: text('medias_id').references(() => medias.id, { onDelete: 'cascade' }),
248
290
  * locale: text('locale'),
249
- * })
291
+ * }, (t) => [index('pages_rels_owner_id_idx').on(t.ownerId), index('pages_rels_medias_id_idx').on(t.mediasId)])
250
292
  * ```
251
293
  */
252
294
  export const templateRelationFieldsTable = ({ table, junctionTable, relations, hasLocale }) => `
@@ -257,7 +299,7 @@ export const ${junctionTable} = sqliteTable('${junctionTable}', {
257
299
  ${templateParent(table)}
258
300
  ${relations.map((rel) => templateFieldRelationColumn(rel)).join(',\n')},
259
301
  ${hasLocale ? `locale: text('locale'),` : ''}
260
- })
302
+ }${templateIndexes(junctionTable, ['ownerId', ...relations.map((rel) => `${rel}Id`)])})
261
303
  `;
262
304
  /**
263
305
  * Generates an export of relation field mappings for runtime use
@@ -2,12 +2,21 @@ import type { Adapter } from '../core/adapter.js';
2
2
  import type { Config } from '../core/config/types.js';
3
3
  import type { ConfigContext } from '../core/rime.server.js';
4
4
  import type { GetRegisterType } from '../index.js';
5
- import { LibSQLDatabase } from 'drizzle-orm/libsql';
5
+ import { type SqliteDriver } from './connect.server.js';
6
6
  import generateSchema from './generate-schema/index.server.js';
7
7
  import type { RelationFieldsMap } from './generate-schema/root.server.js';
8
- import type { GenericTable } from './types.server.js';
8
+ import type { GenericTable, SqliteDatabase } from './types.server.js';
9
9
  type Schema = GetRegisterType<'Schema'>;
10
- export declare function adapterSqlite(database: string): {
10
+ export type { SqliteDriver };
11
+ export type AdapterSqliteOptions = {
12
+ /**
13
+ * `'bun'` opens the file with `bun:sqlite` — the app must then run on Bun
14
+ * (`bun --bun vite dev`, `bun index.js`). Migrations still go through drizzle-kit.
15
+ * @default 'libsql'
16
+ */
17
+ driver?: SqliteDriver;
18
+ };
19
+ export declare function adapterSqlite(database: string, options?: AdapterSqliteOptions): {
11
20
  createAdapter: <C extends Config>(configCtx: ConfigContext<C>) => Promise<SqliteAdapter>;
12
21
  generateSchema: typeof generateSchema;
13
22
  };
@@ -23,11 +32,10 @@ export declare function adapterSqlite(database: string): {
23
32
  * that drifts from the contract is a build error rather than a runtime surprise.
24
33
  */
25
34
  export type SqliteAdapter = Adapter & {
26
- db: LibSQLDatabase<GetRegisterType<'Relations'>>;
35
+ db: SqliteDatabase;
27
36
  tables: GetRegisterType<'Tables'>;
28
37
  getTable<T>(key: string): T extends any ? GenericTable : T;
29
38
  tableForSlug<T>(slug: string): T extends any ? GenericTable : T;
30
39
  readonly schema: Schema;
31
40
  readonly relationFieldsMap: RelationFieldsMap;
32
41
  };
33
- export {};
@@ -1,28 +1,29 @@
1
- import { drizzle, LibSQLDatabase } from 'drizzle-orm/libsql';
2
1
  import path from 'path';
3
2
  import createAuthHandle from './auth.server.js';
4
3
  import createBlocksHandle from './blocks.server.js';
4
+ import { connect } from './connect.server.js';
5
5
  import generateSchema from './generate-schema/index.server.js';
6
6
  import { baseTableName } from './naming.server.js';
7
+ import createPathsHandle from './paths.server.js';
7
8
  import { createPrototypeRegistry } from './registry.server.js';
8
9
  import createRelationsHandle from './relations.server.js';
9
10
  import { createTableHandles } from './table.server.js';
10
11
  import { createTransformHandle } from './transform.server.js';
11
12
  import createTreeHandle from './tree.server.js';
12
- export function adapterSqlite(database) {
13
- //
13
+ export function adapterSqlite(database, options = {}) {
14
+ const driver = options.driver ?? 'libsql';
14
15
  return {
15
- createAdapter: (configCtx) => createAdapter({ database, configCtx }),
16
+ createAdapter: (configCtx) => createAdapter({ database, driver, configCtx }),
16
17
  generateSchema
17
18
  };
18
19
  }
19
20
  const createAdapter = async (args) => {
20
- const { database, configCtx } = args;
21
+ const { database, driver, configCtx } = args;
21
22
  const schema = (await import('$rime/schema'));
22
23
  const dbPath = path.join(process.cwd(), 'db', database);
23
24
  // `relations`, not `schema`: a relational query resolves through the one `defineRelations`
24
25
  // block the generator emits. `tables` is still read straight off the module everywhere else.
25
- const db = drizzle('file:' + dbPath, { relations: schema.relations });
26
+ const db = await connect({ driver, dbPath, relations: schema.relations });
26
27
  const tables = schema.tables;
27
28
  // Two words, and each is the contract's own. `core/adapter.ts` declares `BlocksHandle`,
28
29
  // `TreeHandle`, `RelationsHandle`, `TransformHandle` and `AuthHandle` — one object of verbs
@@ -32,6 +33,7 @@ const createAdapter = async (args) => {
32
33
  const blocks = createBlocksHandle({ db, tables });
33
34
  const tree = createTreeHandle({ db, tables });
34
35
  const relations = createRelationsHandle({ db, tables });
36
+ const paths = createPathsHandle({ db, tables });
35
37
  const auth = createAuthHandle({
36
38
  db,
37
39
  schema: schema.default
@@ -48,6 +50,7 @@ const createAdapter = async (args) => {
48
50
  blocks,
49
51
  tree,
50
52
  relations,
53
+ paths,
51
54
  transform,
52
55
  auth,
53
56
  db,
@@ -10,6 +10,7 @@
10
10
  * child pages__$relations hangs off an owner by `ownerId`
11
11
  * pages__$blocks_hero one per block type
12
12
  * pages__$tree_facts one per tree field
13
+ * pages__$paths a page's address per locale, off the base table
13
14
  * branch pages__$blocks_hero__$$locales the localized half of whatever it hangs off
14
15
  * ```
15
16
  *
@@ -57,7 +58,7 @@ export declare const baseTableName: (slug: string) => TableName;
57
58
  * the SQL name is derived.
58
59
  */
59
60
  export declare const declaredTableProperty: (slug: string) => TableName;
60
- export type ChildKind = 'blocks' | 'tree' | 'rels';
61
+ export type ChildKind = 'blocks' | 'tree' | 'rels' | 'paths';
61
62
  export type TableParts = {
62
63
  /**
63
64
  * The base or versions table this hangs off, already resolved.
@@ -66,7 +67,7 @@ export type TableParts = {
66
67
  * a whole subtree of children onto it.
67
68
  */
68
69
  owner: TableName;
69
- /** A child table. `name` is the block type or the tree field; `rels` has no name. */
70
+ /** A child table. `name` is the block type or the tree field; `rels` and `paths` have none. */
70
71
  child?: {
71
72
  kind: ChildKind;
72
73
  name?: string;
@@ -74,6 +75,8 @@ export type TableParts = {
74
75
  /** The localized half of whatever the parts above resolve to. */
75
76
  branch?: 'locales';
76
77
  };
78
+ /** `pages__$paths` -> true: the addresses table a read joins off the base row. */
79
+ export declare const isPathsTable: (name: string) => boolean;
77
80
  /**
78
81
  * Assembles a Drizzle property name from its parts.
79
82
  *
@@ -82,6 +85,7 @@ export type TableParts = {
82
85
  * tableName({ owner: pagesShadow, branch: 'locales' }) // 'pages__shadow__$$locales'
83
86
  * tableName({ owner: pages, child: { kind: 'blocks', name: 'hero' }}) // 'pages__$blocks_hero'
84
87
  * tableName({ owner: pages, child: { kind: 'rels' } }) // 'pages__$relations'
88
+ * tableName({ owner: pages, child: { kind: 'paths' } }) // 'pages__$paths'
85
89
  */
86
90
  export declare const tableName: (parts: TableParts) => TableName;
87
91
  /**
@@ -93,12 +97,6 @@ export declare const tableName: (parts: TableParts) => TableName;
93
97
  * underscore means what.
94
98
  */
95
99
  export declare const toSqlTableName: (drizzleName: TableName) => TableName;
96
- /**
97
- * Every child table of `owner` of a given kind, read back off the schema.
98
- *
99
- * Excludes the `locales` branches, which are reached through their own owner rather than listed
100
- * alongside it. Replaces the three hand-written filters, one of which was misnamed.
101
- */
102
100
  export declare const childTableNames: (owner: TableName, kind: ChildKind, tables: Record<string, unknown>) => TableName[];
103
101
  /**
104
102
  * The relation key a resolved reference's target is joined under.
@@ -23,8 +23,11 @@ export const declaredTableProperty = (slug) => slug.replace(/^\$/, '');
23
23
  const CHILD_MARKER = {
24
24
  blocks: '__$blocks',
25
25
  tree: '__$tree',
26
- rels: '__$relations'
26
+ rels: '__$relations',
27
+ paths: '__$paths'
27
28
  };
29
+ /** `pages__$paths` -> true: the addresses table a read joins off the base row. */
30
+ export const isPathsTable = (name) => name.endsWith(CHILD_MARKER.paths);
28
31
  /** `__$$` marks a branch: the half of a table holding its localized columns. */
29
32
  const BRANCH_MARKER = '__$$locales';
30
33
  /**
@@ -35,6 +38,7 @@ const BRANCH_MARKER = '__$$locales';
35
38
  * tableName({ owner: pagesShadow, branch: 'locales' }) // 'pages__shadow__$$locales'
36
39
  * tableName({ owner: pages, child: { kind: 'blocks', name: 'hero' }}) // 'pages__$blocks_hero'
37
40
  * tableName({ owner: pages, child: { kind: 'rels' } }) // 'pages__$relations'
41
+ * tableName({ owner: pages, child: { kind: 'paths' } }) // 'pages__$paths'
38
42
  */
39
43
  export const tableName = (parts) => {
40
44
  let name = parts.owner;
@@ -60,10 +64,24 @@ export const toSqlTableName = (drizzleName) => drizzleName;
60
64
  * Excludes the `locales` branches, which are reached through their own owner rather than listed
61
65
  * alongside it. Replaces the three hand-written filters, one of which was misnamed.
62
66
  */
67
+ const childTablesMemo = new WeakMap();
63
68
  export const childTableNames = (owner, kind, tables) => {
64
- const prefix = tableName({ owner, child: { kind } });
65
- // Keys of the generated schema: table names by construction.
66
- return Object.keys(tables).filter((key) => key.startsWith(prefix) && !key.endsWith(BRANCH_MARKER));
69
+ // The schema does not change once loaded, and this is asked several times per query and twice
70
+ // per document read: answered once per schema, owner and kind.
71
+ let byOwner = childTablesMemo.get(tables);
72
+ if (!byOwner) {
73
+ byOwner = new Map();
74
+ childTablesMemo.set(tables, byOwner);
75
+ }
76
+ const key = `${owner}|${kind}`;
77
+ let names = byOwner.get(key);
78
+ if (!names) {
79
+ const prefix = tableName({ owner, child: { kind } });
80
+ // Keys of the generated schema: table names by construction.
81
+ names = Object.keys(tables).filter((key) => key.startsWith(prefix) && !key.endsWith(BRANCH_MARKER));
82
+ byOwner.set(key, names);
83
+ }
84
+ return names;
67
85
  };
68
86
  /**
69
87
  * The relation key a resolved reference's target is joined under.
@@ -0,0 +1,10 @@
1
+ import type { PathsHandle } from '../core/adapter.js';
2
+ import type { AdapterDeps } from './types.server.js';
3
+ /**
4
+ * The addresses of a collection's pages, in its `__$paths` table.
5
+ *
6
+ * Every statement names one page. The pages under it follow through the foreign key on
7
+ * `(locale, parent_path)`: SQLite rewrites their `parent_path`, which regenerates their `path`.
8
+ */
9
+ declare const createPathsHandle: ({ db, tables }: AdapterDeps) => PathsHandle;
10
+ export default createPathsHandle;
@@ -0,0 +1,131 @@
1
+ import { and, eq, gt, isNull, lt, notInArray, or, sql } from 'drizzle-orm';
2
+ import { alias } from 'drizzle-orm/sqlite-core';
3
+ import { baseTableName, tableName } from './naming.server.js';
4
+ /**
5
+ * The addresses of a collection's pages, in its `__$paths` table.
6
+ *
7
+ * Every statement names one page. The pages under it follow through the foreign key on
8
+ * `(locale, parent_path)`: SQLite rewrites their `parent_path`, which regenerates their `path`.
9
+ */
10
+ const createPathsHandle = ({ db, tables }) => {
11
+ const tablesOf = (slug) => {
12
+ const base = baseTableName(slug);
13
+ return {
14
+ base: tables[base],
15
+ paths: tables[tableName({ owner: base, child: { kind: 'paths' } })]
16
+ };
17
+ };
18
+ /** The parent's path in `locale`: a subquery, so the write stays one statement. */
19
+ const parentPathIn = (paths, parentId, locale) => {
20
+ const parent = alias(paths, 'parent');
21
+ return sql `(${db
22
+ .select({ path: parent.path })
23
+ .from(parent)
24
+ .where(and(eq(parent.ownerId, parentId), sql `${parent.locale} = ${locale}`))})`;
25
+ };
26
+ const rowsOf = (rows) => rows;
27
+ return {
28
+ insert: async ({ slug, ownerId, parentId, rows }) => {
29
+ if (!rows.length)
30
+ return [];
31
+ const { paths } = tablesOf(slug);
32
+ const inserted = await db
33
+ .insert(paths)
34
+ .values(rows.map((row) => ({
35
+ ownerId,
36
+ locale: row.locale,
37
+ slug: row.slug,
38
+ parentPath: parentId ? parentPathIn(paths, parentId, row.locale) : null
39
+ })))
40
+ .returning();
41
+ return rowsOf(inserted);
42
+ },
43
+ get: async ({ slug, ownerId, locale }) => {
44
+ const { paths } = tablesOf(slug);
45
+ const where = locale === undefined
46
+ ? eq(paths.ownerId, ownerId)
47
+ : and(eq(paths.ownerId, ownerId), eq(paths.locale, locale));
48
+ return rowsOf(await db.select().from(paths).where(where));
49
+ },
50
+ setSlug: async ({ slug, ownerId, locale, value }) => {
51
+ const { paths } = tablesOf(slug);
52
+ const [row] = await db
53
+ .update(paths)
54
+ .set({ slug: value })
55
+ .where(and(eq(paths.ownerId, ownerId), eq(paths.locale, locale)))
56
+ .returning();
57
+ return row;
58
+ },
59
+ // One statement per locale, in one transaction: each row takes its new parent's path in its
60
+ // locale, and its slug there.
61
+ moveUnder: async ({ slug, ownerId, parentId, slugs }) => {
62
+ const { paths } = tablesOf(slug);
63
+ return db.transaction(async (tx) => {
64
+ const moved = [];
65
+ for (const [locale, value] of Object.entries(slugs)) {
66
+ const rows = await tx
67
+ .update(paths)
68
+ .set({
69
+ slug: value,
70
+ parentPath: parentId ? parentPathIn(paths, parentId, locale) : null
71
+ })
72
+ .where(and(eq(paths.ownerId, ownerId), eq(paths.locale, locale)))
73
+ .returning();
74
+ moved.push(...rows);
75
+ }
76
+ return rowsOf(moved);
77
+ });
78
+ },
79
+ children: async ({ slug, ownerId }) => {
80
+ const { paths } = tablesOf(slug);
81
+ const self = alias(paths, 'self');
82
+ const rows = await db
83
+ .selectDistinct({ ownerId: paths.ownerId })
84
+ .from(paths)
85
+ .where(sql `(${paths.locale}, ${paths.parentPath}) IN (${db
86
+ .select({ locale: self.locale, path: self.path })
87
+ .from(self)
88
+ .where(eq(self.ownerId, ownerId))})`);
89
+ return rows.map((row) => row.ownerId);
90
+ },
91
+ // `path/` <= p < `path0` is every path starting with `path/`, read off the unique index:
92
+ // '0' is the character after '/'.
93
+ under: async ({ slug, locale, path, withDescendants = true }) => {
94
+ const { paths } = tablesOf(slug);
95
+ const below = and(gt(paths.path, `${path}/`), lt(paths.path, `${path}0`));
96
+ const where = and(eq(paths.locale, locale), withDescendants ? or(eq(paths.path, path), below) : eq(paths.path, path));
97
+ return rowsOf(await db.select().from(paths).where(where));
98
+ },
99
+ siblingSlugs: async ({ slug, locale, parentId }) => {
100
+ const { paths } = tablesOf(slug);
101
+ const parent = parentId
102
+ ? sql `${paths.parentPath} = ${parentPathIn(paths, parentId, locale)}`
103
+ : isNull(paths.parentPath);
104
+ const rows = await db
105
+ .select({ slug: paths.slug })
106
+ .from(paths)
107
+ .where(and(eq(paths.locale, locale), parent));
108
+ return rows.map((row) => row.slug);
109
+ },
110
+ missingOwners: async ({ slug, locale }) => {
111
+ const { base, paths } = tablesOf(slug);
112
+ const owned = db.select({ id: paths.ownerId }).from(paths).where(eq(paths.locale, locale));
113
+ const rows = await db.select({ id: base.id }).from(base).where(notInArray(base.id, owned));
114
+ return rows.map((row) => row.id);
115
+ },
116
+ setUrls: async ({ slug, rows }) => {
117
+ if (!rows.length)
118
+ return;
119
+ const { paths } = tablesOf(slug);
120
+ await db.transaction(async (tx) => {
121
+ for (const { ownerId, locale, url } of rows) {
122
+ await tx
123
+ .update(paths)
124
+ .set({ url })
125
+ .where(and(eq(paths.ownerId, ownerId), eq(paths.locale, locale)));
126
+ }
127
+ });
128
+ }
129
+ };
130
+ };
131
+ export default createPathsHandle;
@@ -28,6 +28,13 @@ type ReadArgs = {
28
28
  locale?: string;
29
29
  /** Whether an untranslated field reads from the other locales. `true` unless said otherwise. */
30
30
  localeFallback?: boolean;
31
+ /**
32
+ * The resolved references to join, by document path — a `$references(slug, { resolve: true })`
33
+ * field comes back as the document it points at only when its path is here. Every one when
34
+ * absent; `select` narrows further. The caller lists what its reader may see, so a row is never
35
+ * joined for a field the pipeline goes on to drop.
36
+ */
37
+ resolve?: string[];
31
38
  /** Which content row, when the caller means a particular one. The newest otherwise. */
32
39
  content?: OperationQuery;
33
40
  config: BuiltCollection | BuiltArea;
@@ -46,7 +53,7 @@ type ReadArgs = {
46
53
  * The one structural difference between reading a singleton and reading one of many is the
47
54
  * `where` on the root row — supply `id`, or don't.
48
55
  */
49
- export declare const readPrototype: ({ db, tables, configCtx }: DepsWithConfig, { slug, id, select, locale, localeFallback, content, config, versions }: ReadArgs) => Promise<Dic | undefined>;
56
+ export declare const readPrototype: ({ db, tables, configCtx }: DepsWithConfig, { slug, id, select, resolve, locale, localeFallback, content, config, versions }: ReadArgs) => Promise<Dic | undefined>;
50
57
  export declare const findManyPrototypes: ({ db, tables, configCtx }: DepsWithConfig, args: FindManyArgs) => Promise<RawDoc[]>;
51
58
  /** Removes a document. Its content rows and children follow by cascade. */
52
59
  type FindManyArgs = {
@@ -60,6 +67,8 @@ type FindManyArgs = {
60
67
  locale?: string;
61
68
  /** See `readPrototype`. */
62
69
  localeFallback?: boolean;
70
+ /** See `readPrototype`. */
71
+ resolve?: string[];
63
72
  /** Per document, which content row — see `readPrototype`. */
64
73
  content?: OperationQuery;
65
74
  config: BuiltCollection | BuiltArea;
@@ -6,7 +6,7 @@ import { buildOrderByParam } from './order-by.server.js';
6
6
  import * as adapterUtil from './columns.server.js';
7
7
  import { buildWhereParam } from './where.server.js';
8
8
  import { localeOrder } from './locales.server.js';
9
- import { buildWithParam, resolvedReferenceJoins } from './select.server.js';
9
+ import { buildWithParam, pathsJoin, resolvedReferenceJoins } from './select.server.js';
10
10
  /**
11
11
  * Reads one prototype document, merged with the content row it should show.
12
12
  *
@@ -21,7 +21,7 @@ import { buildWithParam, resolvedReferenceJoins } from './select.server.js';
21
21
  * The one structural difference between reading a singleton and reading one of many is the
22
22
  * `where` on the root row — supply `id`, or don't.
23
23
  */
24
- export const readPrototype = async ({ db, tables, configCtx }, { slug, id, select, locale, localeFallback, content, config, versions }) => {
24
+ export const readPrototype = async ({ db, tables, configCtx }, { slug, id, select, resolve, locale, localeFallback, content, config, versions }) => {
25
25
  const table = baseTableName(slug);
26
26
  const rootTable = tables[table];
27
27
  const fallback = localeOrder(configCtx, locale, localeFallback);
@@ -34,7 +34,7 @@ export const readPrototype = async ({ db, tables, configCtx }, { slug, id, selec
34
34
  return queryTable.findFirst({
35
35
  columns: adapterUtil.columnsParams({ table: rootTable, select }),
36
36
  ...byId,
37
- with: buildWithParam({ table, select, locale, fallback, tables, config }) || undefined
37
+ with: buildWithParam({ table, select, resolve, locale, fallback, tables, config }) || undefined
38
38
  });
39
39
  }
40
40
  // See findManyPrototypes for why the versions table's slug is castable.
@@ -44,11 +44,21 @@ export const readPrototype = async ({ db, tables, configCtx }, { slug, id, selec
44
44
  columns: adapterUtil.columnsParams({ table: rootTable, select }),
45
45
  ...byId,
46
46
  with: {
47
- // The base row's own resolved references; the content row's come with `buildWithParam`.
48
- ...resolvedReferenceJoins({ table, tables, config, select }),
47
+ // The base row's own resolved references and address; the content row's come with
48
+ // `buildWithParam`.
49
+ ...resolvedReferenceJoins({ table, tables, config, select, resolve }),
50
+ ...pathsJoin({ base: table, tables, locale, select }),
49
51
  [contentTable]: {
50
52
  columns: adapterUtil.columnsParams({ table: tables[contentTable], select }),
51
- with: buildWithParam({ table: contentTable, select, locale, fallback, tables, config }),
53
+ with: buildWithParam({
54
+ table: contentTable,
55
+ select,
56
+ resolve,
57
+ locale,
58
+ fallback,
59
+ tables,
60
+ config
61
+ }),
52
62
  // The row the caller's filter names, else the newest — one query either way, and the
53
63
  // adapter chooses nothing. Which content row a request means is decided above this module
54
64
  // and arrives as an ordinary filter (`FeatureDefinition.readQuery`).
@@ -83,7 +93,7 @@ export const readPrototype = async ({ db, tables, configCtx }, { slug, id, selec
83
93
  return adapterUtil.mergeContentRow(doc, contentTable, config, select);
84
94
  };
85
95
  export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
86
- const { select, query: incomingQuery, sort, limit, offset, locale, localeFallback, content, config, versions } = args;
96
+ const { select, resolve, query: incomingQuery, sort, limit, offset, locale, localeFallback, content, config, versions } = args;
87
97
  // buildOrderByParam and buildWhereParam resolve fields against the config, so they take a
88
98
  // prototype slug. Registration guarantees this one is registered, hence is one.
89
99
  const slug = args.slug;
@@ -93,7 +103,7 @@ export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
93
103
  // No versions: everything is on the base table, so this is one plain query.
94
104
  if (!versions) {
95
105
  const params = {
96
- with: buildWithParam({ table, select, tables, config, locale, fallback }) || undefined,
106
+ with: buildWithParam({ table, select, resolve, tables, config, locale, fallback }) || undefined,
97
107
  orderBy: (t) => buildOrderByParam({ slug, locale, tables, configCtx, by: sort, rootTable: t }),
98
108
  // sqlite requires a limit when an offset is present.
99
109
  limit: limit || (typeof offset === 'number' ? 1000000 : undefined),
@@ -119,7 +129,8 @@ export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
119
129
  // declares one also derives its config), so `buildWhereParam` can resolve fields against it.
120
130
  const versionsSlug = versions.slug;
121
131
  const contentTable = baseTableName(versionsSlug);
122
- const withParam = buildWithParam({ table: contentTable, select, tables, config, locale, fallback }) || undefined;
132
+ const withParam = buildWithParam({ table: contentTable, select, resolve, tables, config, locale, fallback }) ||
133
+ undefined;
123
134
  // The caller's own filter, and the one saying which content row each document shows. Both
124
135
  // resolve against the versions table, so they are two wheres to `and` rather than two query objects to
125
136
  // splice — which is what this was, a condition spliced into somebody else's `where` by hand
@@ -161,7 +172,8 @@ export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
161
172
  ...params,
162
173
  columns: adapterUtil.columnsParams({ table: tables[table], select }),
163
174
  with: {
164
- ...resolvedReferenceJoins({ table, tables, config, select }),
175
+ ...resolvedReferenceJoins({ table, tables, config, select, resolve }),
176
+ ...pathsJoin({ base: table, tables, locale, select }),
165
177
  [contentTable]: {
166
178
  with: withParam,
167
179
  where: { RAW: contentWhere },
@@ -30,7 +30,7 @@ export declare const bundles: ({ db, tables, configCtx, config, versions }: Hand
30
30
  };
31
31
  self: {
32
32
  slug: never;
33
- config: BuiltCollection | BuiltArea;
33
+ config: BuiltArea | BuiltCollection;
34
34
  versions: VersionsTable | undefined;
35
35
  };
36
36
  };
@@ -13,10 +13,29 @@ export declare const resolvedReferenceJoins: (args: {
13
13
  tables: Dic;
14
14
  config: BuiltCollection | BuiltArea;
15
15
  select?: string[];
16
+ /** The references to join at all, by path; every one when absent. */
17
+ resolve?: string[];
18
+ }) => Dic;
19
+ /**
20
+ * The page's row in its paths table, in the locale read, when its collection has `$url`. A page
21
+ * has a row in every locale, so there is no fallback to resolve.
22
+ *
23
+ * ```ts
24
+ * pathsJoin({ base: 'pages', tables, locale: 'en' })
25
+ * // { 'pages__$paths': { where: { locale: 'en' }, columns: { slug: true, path: true, url: true } } }
26
+ * ```
27
+ */
28
+ export declare const pathsJoin: (args: {
29
+ base: TableName;
30
+ tables: Dic;
31
+ locale?: string;
32
+ select?: string[];
16
33
  }) => Dic;
17
34
  export declare const buildWithParam: (args: {
18
35
  table: TableName;
19
36
  select?: string[];
37
+ /** See `resolvedReferenceJoins`. */
38
+ resolve?: string[];
20
39
  locale?: string;
21
40
  /** The locales a read draws on, first to last — `localeOrder`. The requested one alone if absent. */
22
41
  fallback?: string[];