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.
- package/dist/adapter-sqlite/auth.server.d.ts +2 -2
- package/dist/adapter-sqlite/columns.server.js +2 -2
- package/dist/adapter-sqlite/connect.server.d.ts +12 -0
- package/dist/adapter-sqlite/connect.server.js +31 -0
- package/dist/adapter-sqlite/generate-schema/index.server.js +11 -3
- package/dist/adapter-sqlite/generate-schema/root.server.d.ts +13 -4
- package/dist/adapter-sqlite/generate-schema/root.server.js +75 -131
- package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +36 -15
- package/dist/adapter-sqlite/generate-schema/templates.server.js +60 -18
- package/dist/adapter-sqlite/index.server.d.ts +13 -5
- package/dist/adapter-sqlite/index.server.js +9 -6
- package/dist/adapter-sqlite/naming.server.d.ts +6 -8
- package/dist/adapter-sqlite/naming.server.js +22 -4
- package/dist/adapter-sqlite/paths.server.d.ts +10 -0
- package/dist/adapter-sqlite/paths.server.js +131 -0
- package/dist/adapter-sqlite/read.server.d.ts +10 -1
- package/dist/adapter-sqlite/read.server.js +22 -10
- package/dist/adapter-sqlite/rows.server.d.ts +1 -1
- package/dist/adapter-sqlite/select.server.d.ts +19 -0
- package/dist/adapter-sqlite/select.server.js +71 -63
- package/dist/adapter-sqlite/table.server.d.ts +2 -2
- package/dist/adapter-sqlite/transform.server.js +33 -3
- package/dist/adapter-sqlite/types.server.d.ts +10 -3
- package/dist/adapter-sqlite/where.server.d.ts +2 -3
- package/dist/adapter-sqlite/where.server.js +19 -1
- package/dist/core/adapter.d.ts +98 -0
- package/dist/core/auth/better-auth/config.server.d.ts +3 -3
- package/dist/core/auth/better-auth/instance.server.d.ts +6 -6
- package/dist/core/auth/handler/index.server.js +1 -1
- package/dist/core/auth/staff/derive.js +1 -1
- package/dist/core/auth/validate-config.js +3 -5
- package/dist/core/boot.server.d.ts +8 -8
- package/dist/core/config/context.server.d.ts +2 -2
- package/dist/core/config/types.d.ts +43 -5
- package/dist/core/config/validate.server.js +34 -51
- package/dist/core/dev/cli/commands/build.js +21 -6
- package/dist/core/dev/cli/commands/init.server.d.ts +2 -1
- package/dist/core/dev/cli/commands/init.server.js +32 -6
- package/dist/core/dev/cli/index.js +1 -0
- package/dist/core/dev/cli/templates/init.d.ts +6 -1
- package/dist/core/dev/cli/templates/init.js +30 -2
- package/dist/core/dev/cli/util/package-manager.server.d.ts +1 -0
- package/dist/core/dev/cli/util/package-manager.server.js +11 -8
- package/dist/core/dev/cli/util/package.server.d.ts +9 -0
- package/dist/core/dev/cli/util/package.server.js +43 -0
- package/dist/core/dev/codegen/routes/common.server.d.ts +2 -0
- package/dist/core/dev/codegen/routes/common.server.js +7 -3
- package/dist/core/dev/codegen/routes/util.server.d.ts +2 -1
- package/dist/core/dev/codegen/routes/util.server.js +4 -1
- package/dist/core/dev/codegen/types/contributions.server.d.ts +3 -2
- package/dist/core/dev/codegen/types/contributions.server.js +10 -3
- package/dist/core/dev/config-memo.server.js +4 -0
- package/dist/core/dev/vite.server.js +4 -3
- package/dist/core/fields/blank.d.ts +21 -0
- package/dist/core/fields/blank.js +37 -0
- package/dist/core/fields/builders/field-builder.d.ts +53 -0
- package/dist/core/fields/builders/field-builder.js +14 -1
- package/dist/core/fields/builders/form-field-builder.d.ts +8 -0
- package/dist/core/fields/builders/form-field-builder.js +14 -1
- package/dist/core/fields/util.d.ts +9 -2
- package/dist/core/fields/util.js +123 -135
- package/dist/core/fields/walk.d.ts +44 -0
- package/dist/core/fields/walk.js +55 -0
- package/dist/core/handler.server.js +4 -0
- package/dist/core/i18n/context.d.ts +5 -0
- package/dist/core/i18n/context.js +6 -0
- package/dist/core/i18n/en/common.d.ts +71 -0
- package/dist/core/i18n/en/common.js +72 -1
- package/dist/core/i18n/en/fields.d.ts +68 -0
- package/dist/core/i18n/en/fields.js +69 -1
- package/dist/core/i18n/fr/common.d.ts +71 -0
- package/dist/core/i18n/fr/common.js +72 -1
- package/dist/core/i18n/fr/fields.d.ts +68 -0
- package/dist/core/i18n/fr/fields.js +69 -1
- package/dist/core/i18n/index.d.ts +29 -3
- package/dist/core/i18n/index.js +55 -29
- package/dist/core/locale/copy.server.js +3 -3
- package/dist/core/logger.server.js +15 -6
- package/dist/core/pipeline/build-document.server.d.ts +3 -0
- package/dist/core/pipeline/build-document.server.js +10 -7
- package/dist/core/pipeline/config-map/index.d.ts +9 -0
- package/dist/core/pipeline/config-map/index.js +16 -50
- package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +3 -0
- package/dist/core/pipeline/hooks/process-document-fields.server.js +48 -12
- package/dist/core/pipeline/hooks/set-default-values.server.d.ts +1 -0
- package/dist/core/pipeline/hooks/set-default-values.server.js +1 -0
- package/dist/core/pipeline/persist/blocks/extract.server.js +1 -1
- package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
- package/dist/core/pipeline/populate-relations.server.d.ts +27 -0
- package/dist/core/pipeline/populate-relations.server.js +42 -0
- package/dist/core/pipeline/run.server.d.ts +17 -6
- package/dist/core/pipeline/run.server.js +44 -30
- package/dist/core/plugins/cache/module.server.d.ts +1 -1
- package/dist/core/plugins/cache/module.server.js +5 -5
- package/dist/core/prototype/area/api.server.js +1 -2
- package/dist/core/prototype/area/definition.js +1 -10
- package/dist/core/prototype/area/definition.server.js +4 -5
- package/dist/core/prototype/area/hooks.server.js +3 -2
- package/dist/core/prototype/area/operations/find.js +2 -0
- package/dist/core/prototype/blank.d.ts +26 -0
- package/dist/core/prototype/blank.js +22 -0
- package/dist/core/prototype/collection/api.server.d.ts +29 -3
- package/dist/core/prototype/collection/api.server.js +47 -4
- package/dist/core/prototype/collection/definition.js +0 -3
- package/dist/core/prototype/collection/hooks/merge-with-blank.server.d.ts +5 -1
- package/dist/core/prototype/collection/hooks/merge-with-blank.server.js +8 -22
- package/dist/core/prototype/collection/hooks.server.js +11 -5
- package/dist/core/prototype/collection/nested/module.server.js +3 -1
- package/dist/core/prototype/collection/nested/tree.d.ts +12 -0
- package/dist/core/prototype/collection/nested/tree.js +42 -0
- package/dist/core/prototype/collection/operations/duplicate.js +1 -1
- package/dist/core/prototype/collection/operations/find-by-id.js +2 -0
- package/dist/core/prototype/collection/operations/find-by-ids.d.ts +19 -0
- package/dist/core/prototype/collection/operations/find-by-ids.js +54 -0
- package/dist/core/prototype/collection/operations/find.js +21 -27
- package/dist/core/prototype/collection/operations/update-slug-by-id.d.ts +20 -0
- package/dist/core/prototype/collection/operations/update-slug-by-id.js +53 -0
- package/dist/core/prototype/collection/rest/index.server.js +3 -1
- package/dist/core/prototype/collection/rest/update-slug-by-id.server.d.ts +2 -0
- package/dist/core/prototype/collection/rest/update-slug-by-id.server.js +20 -0
- package/dist/core/prototype/collection/thumbnail/find-thumbnail.d.ts +2 -1
- package/dist/core/prototype/collection/thumbnail/find-thumbnail.js +4 -27
- package/dist/core/prototype/collection/thumbnail/hooks/set-document-thumbnail.server.js +1 -1
- package/dist/core/prototype/collection/upload/directories/derive.js +3 -1
- package/dist/core/prototype/collection/upload/disk/delete.server.js +1 -2
- package/dist/core/prototype/define.js +2 -0
- package/dist/core/prototype/shared/metas/fields.js +2 -1
- package/dist/core/prototype/shared/title/find-title.d.ts +2 -1
- package/dist/core/prototype/shared/title/find-title.js +5 -28
- package/dist/core/prototype/shared/title/hooks/set-document-title.server.js +1 -1
- package/dist/core/prototype/shared/url/addresses.server.d.ts +36 -0
- package/dist/core/prototype/shared/url/addresses.server.js +119 -0
- package/dist/core/prototype/shared/url/doc-type.d.ts +6 -0
- package/dist/core/prototype/shared/url/doc-type.js +9 -0
- package/dist/core/prototype/shared/url/format.server.d.ts +27 -0
- package/dist/core/prototype/shared/url/format.server.js +38 -0
- package/dist/core/prototype/shared/url/hooks/create-paths.server.d.ts +2 -0
- package/dist/core/prototype/shared/url/hooks/create-paths.server.js +9 -0
- package/dist/core/prototype/shared/url/hooks/detach-paths.server.d.ts +6 -0
- package/dist/core/prototype/shared/url/hooks/detach-paths.server.js +19 -0
- package/dist/core/prototype/shared/url/hooks/index.server.d.ts +5 -1
- package/dist/core/prototype/shared/url/hooks/index.server.js +5 -1
- package/dist/core/prototype/shared/url/hooks/set-area-url.server.d.ts +2 -0
- package/dist/core/prototype/shared/url/hooks/set-area-url.server.js +8 -0
- package/dist/core/prototype/shared/url/hooks/set-live-url.server.d.ts +5 -0
- package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +19 -0
- package/dist/core/prototype/shared/url/hooks/sync-paths.server.d.ts +8 -0
- package/dist/core/prototype/shared/url/hooks/sync-paths.server.js +38 -0
- package/dist/core/prototype/shared/url/refresh.server.d.ts +36 -0
- package/dist/core/prototype/shared/url/refresh.server.js +58 -0
- package/dist/core/prototype/shared/versions/configure.server.js +3 -0
- package/dist/core/routes/context.server.d.ts +2 -1
- package/dist/fields/blocks/component/AddBlockButton.svelte +48 -137
- package/dist/fields/blocks/component/Block.svelte +153 -117
- package/dist/fields/blocks/component/Block.svelte.d.ts +11 -5
- package/dist/fields/blocks/component/BlockActions.svelte +76 -26
- package/dist/fields/blocks/component/BlockActions.svelte.d.ts +3 -0
- package/dist/fields/blocks/component/Blocks.svelte +248 -91
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte +680 -0
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte.d.ts +7 -0
- package/dist/fields/blocks/component/focus/Layers.svelte +145 -0
- package/dist/fields/blocks/component/focus/Layers.svelte.d.ts +9 -0
- package/dist/fields/blocks/component/focus/LayersList.svelte +304 -0
- package/dist/fields/blocks/component/focus/LayersList.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/focus/Palette.svelte +135 -0
- package/dist/fields/blocks/component/focus/Palette.svelte.d.ts +9 -0
- package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte +77 -0
- package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/focus/Renders.svelte +302 -0
- package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +11 -0
- package/dist/fields/blocks/component/focus/Stage.svelte +190 -0
- package/dist/fields/blocks/component/focus/Stage.svelte.d.ts +8 -0
- package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +69 -0
- package/dist/fields/blocks/component/focus/StagePlaceholder.svelte.d.ts +3 -0
- package/dist/fields/blocks/component/focus/focus.svelte.d.ts +140 -0
- package/dist/fields/blocks/component/focus/focus.svelte.js +424 -0
- package/dist/fields/blocks/component/picker/BlockPicker.svelte +88 -0
- package/dist/fields/blocks/component/picker/BlockPicker.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/picker/BlockTile.svelte +121 -0
- package/dist/fields/blocks/component/picker/BlockTile.svelte.d.ts +12 -0
- package/dist/fields/blocks/index.d.ts +49 -7
- package/dist/fields/blocks/index.js +61 -12
- package/dist/fields/checkbox/component/Checkbox.svelte +11 -37
- package/dist/fields/checkbox/component/Checkbox.svelte.d.ts +1 -0
- package/dist/fields/combobox/component/ComboBox.svelte +37 -7
- package/dist/fields/combobox/component/combobox.css +26 -10
- package/dist/fields/date/component/Date.svelte +43 -12
- package/dist/fields/group/component/Group.svelte +110 -41
- package/dist/fields/group/index.d.ts +5 -1
- package/dist/fields/group/index.js +10 -2
- package/dist/fields/link/component/Link.svelte +184 -143
- package/dist/fields/link/component/RessourceInput.svelte +26 -24
- package/dist/fields/link/index.d.ts +2 -1
- package/dist/fields/link/module.server.js +2 -4
- package/dist/fields/number/component/Number.svelte +38 -20
- package/dist/fields/number/component/number.css +22 -20
- package/dist/fields/number/index.d.ts +1 -0
- package/dist/fields/radio/component/Radio.svelte +12 -0
- package/dist/fields/radio/index.js +1 -1
- package/dist/fields/relation/component/Relation.svelte +169 -40
- package/dist/fields/relation/component/RelationInline.svelte +258 -0
- package/dist/fields/relation/component/RelationInline.svelte.d.ts +26 -0
- package/dist/fields/relation/component/default/Default.svelte +210 -100
- package/dist/fields/relation/component/default/Default.svelte.d.ts +14 -1
- package/dist/fields/relation/component/types.d.ts +4 -0
- package/dist/fields/relation/component/upload/Browse.svelte +619 -88
- package/dist/fields/relation/component/upload/Browse.svelte.d.ts +10 -2
- package/dist/fields/relation/component/upload/Create.svelte +41 -0
- package/dist/fields/relation/component/upload/Create.svelte.d.ts +13 -0
- package/dist/fields/relation/component/upload/Upload.svelte +287 -101
- package/dist/fields/relation/component/upload/Upload.svelte.d.ts +6 -1
- package/dist/fields/relation/component/upload/upload.css +5 -81
- package/dist/fields/relation/index.d.ts +1 -41
- package/dist/fields/relation/index.js +0 -67
- package/dist/fields/relation/module.server.js +7 -1
- package/dist/fields/relation/populate.d.ts +8 -0
- package/dist/fields/relation/populate.js +49 -0
- package/dist/fields/relation/util.d.ts +69 -0
- package/dist/fields/relation/util.js +103 -0
- package/dist/fields/relation/value.d.ts +25 -0
- package/dist/fields/relation/value.js +27 -0
- package/dist/fields/rich-text/client.d.ts +2 -5
- package/dist/fields/rich-text/client.js +1 -3
- package/dist/fields/rich-text/component/Cell.svelte +1 -1
- package/dist/fields/rich-text/component/RichText.svelte +12 -80
- package/dist/fields/rich-text/component/RichText.svelte.d.ts +1 -1
- package/dist/fields/rich-text/component/RichTextInline.svelte +28 -0
- package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +11 -0
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +4 -3
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +3 -1
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +2 -2
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +7 -10
- package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -2
- package/dist/fields/rich-text/component/styles/editor.css +111 -0
- package/dist/fields/rich-text/component/styles/field.css +71 -0
- package/dist/fields/rich-text/component/suggestion/suggestion.svelte +41 -56
- package/dist/fields/rich-text/core/build-editor-config.js +1 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +29 -3
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +2 -1
- package/dist/fields/rich-text/core/features/fields/fields.css +2 -3
- package/dist/fields/rich-text/core/features/hr/hr.css +4 -4
- package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -4
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +24 -8
- package/dist/fields/rich-text/core/features/resource/resource-extension.js +3 -3
- package/dist/fields/rich-text/core/features/resource/resource.svelte +21 -7
- package/dist/fields/rich-text/core/features/upload/upload-extension.js +3 -4
- package/dist/fields/rich-text/core/features/upload/upload.svelte +21 -9
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte +103 -0
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +15 -0
- package/dist/fields/rich-text/index.d.ts +0 -17
- package/dist/fields/rich-text/index.js +0 -44
- package/dist/fields/rich-text/json.d.ts +18 -0
- package/dist/fields/rich-text/json.js +44 -0
- package/dist/fields/select/component/Select.svelte +67 -28
- package/dist/fields/slug/component/Slug.svelte +26 -53
- package/dist/fields/slug/index.d.ts +1 -0
- package/dist/fields/slug/index.js +1 -1
- package/dist/fields/tabs/component/Tabs.svelte +28 -22
- package/dist/fields/tabs/index.d.ts +4 -1
- package/dist/fields/tabs/index.js +17 -5
- package/dist/fields/text/index.d.ts +1 -0
- package/dist/fields/textarea/component/TextArea.svelte +28 -13
- package/dist/fields/textarea/index.d.ts +1 -0
- package/dist/fields/time/component/Time.svelte +9 -2
- package/dist/fields/toggle/component/Toggle.svelte +8 -25
- package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -0
- package/dist/fields/toggle/index.d.ts +1 -0
- package/dist/fields/tree/component/AddItemButton.svelte +18 -5
- package/dist/fields/tree/component/Tree.svelte +48 -19
- package/dist/fields/tree/component/TreeBlock.svelte +318 -104
- package/dist/fields/tree/component/TreeBlockActions.svelte +71 -7
- package/dist/fields/tree/component/TreeBlockActions.svelte.d.ts +4 -0
- package/dist/fields/tree/component/props.d.ts +2 -1
- package/dist/fields/tree/index.d.ts +13 -1
- package/dist/fields/tree/index.js +35 -9
- package/dist/fields/types.d.ts +3 -1
- package/dist/index.d.ts +2 -8
- package/dist/index.js +2 -6
- package/dist/{panel/components/sections/live → live}/Consumer.svelte +2 -2
- package/dist/{panel/components/sections/live → live}/Consumer.svelte.d.ts +1 -1
- package/dist/{panel/components/sections/live → live}/LiveEdit.svelte +3 -3
- package/dist/{panel/components/sections/live → live}/Provider.svelte +1 -1
- package/dist/{panel/context/live.svelte.d.ts → live/context.svelte.d.ts} +1 -1
- package/dist/{panel/context/live.svelte.js → live/context.svelte.js} +3 -74
- package/dist/panel/components/Root.svelte +16 -44
- package/dist/panel/components/Root.svelte.d.ts +1 -1
- package/dist/panel/components/fields/Error.svelte +18 -3
- package/dist/panel/components/fields/FieldsPreview.svelte +30 -17
- package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +25 -3
- package/dist/panel/components/fields/Hint.svelte +51 -8
- package/dist/panel/components/fields/Hint.svelte.d.ts +11 -0
- package/dist/panel/components/fields/Label.svelte +2 -0
- package/dist/panel/components/fields/LabelFor.svelte +7 -2
- package/dist/panel/components/fields/RenderFields.svelte +10 -3
- package/dist/panel/components/fields/fieldset.svelte.d.ts +4 -1
- package/dist/panel/components/fields/fieldset.svelte.js +9 -2
- package/dist/panel/components/fields/index.d.ts +1 -0
- package/dist/panel/components/fields/setting.css +82 -0
- package/dist/panel/components/sections/auth/AuthForm.svelte +25 -26
- package/dist/panel/components/sections/collection/Avatar.svelte +61 -0
- package/dist/panel/components/sections/collection/Avatar.svelte.d.ts +9 -0
- package/dist/panel/components/sections/collection/DocStatus.svelte +28 -0
- package/dist/panel/components/sections/collection/DocStatus.svelte.d.ts +7 -0
- package/dist/panel/components/sections/collection/Empty.svelte +3 -3
- package/dist/panel/components/sections/collection/StatusDot.svelte +7 -5
- package/dist/panel/components/sections/collection/When.svelte +33 -0
- package/dist/panel/components/sections/collection/When.svelte.d.ts +8 -0
- package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte +65 -21
- package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte.d.ts +3 -2
- package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte +45 -162
- package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte.d.ts +3 -2
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +151 -0
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte.d.ts +17 -0
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +177 -0
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte.d.ts +12 -0
- package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte +75 -0
- package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte.d.ts +8 -0
- package/dist/panel/components/sections/collection/folder/Folder.svelte +18 -3
- package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +26 -18
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +98 -58
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte.d.ts +0 -1
- package/dist/panel/components/sections/collection/folder/Folders.svelte +60 -0
- package/dist/panel/components/sections/collection/folder/Folders.svelte.d.ts +7 -0
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +31 -71
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +1 -0
- package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +5 -3
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +250 -37
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte.d.ts +2 -0
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +43 -18
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +6 -4
- package/dist/panel/components/sections/collection/header/DisplayMode.svelte +69 -58
- package/dist/panel/components/sections/collection/header/DisplayMode.svelte.d.ts +0 -1
- package/dist/panel/components/sections/collection/header/FilterMenu.svelte +60 -0
- package/dist/panel/components/sections/collection/header/FilterMenu.svelte.d.ts +14 -0
- package/dist/panel/components/sections/collection/header/SearchInput.svelte +17 -26
- package/dist/panel/components/sections/collection/header/SelectUI.svelte +19 -34
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +99 -68
- package/dist/panel/components/sections/collection/list/columns.d.ts +21 -0
- package/dist/panel/components/sections/collection/list/columns.js +23 -0
- package/dist/panel/components/sections/collection/list/header/Header.svelte +99 -51
- package/dist/panel/components/sections/collection/list/row/Row.svelte +165 -82
- package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -0
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +92 -44
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte.d.ts +1 -0
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +139 -43
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte.d.ts +2 -0
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +1 -1
- package/dist/panel/components/sections/commands/CommandButton.svelte +99 -0
- package/dist/panel/components/sections/commands/CommandButton.svelte.d.ts +10 -0
- package/dist/panel/components/sections/commands/CommandPalette.svelte +275 -0
- package/dist/panel/components/sections/commands/CommandPalette.svelte.d.ts +8 -0
- package/dist/panel/components/sections/commands/Commands.svelte +18 -0
- package/dist/panel/components/sections/commands/Commands.svelte.d.ts +9 -0
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +23 -7
- package/dist/panel/components/sections/document/AuthFooter.svelte +31 -12
- package/dist/panel/components/sections/document/AutoSaveBanner.svelte +24 -7
- package/dist/panel/components/sections/document/ButtonSave.svelte +32 -21
- package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +5 -5
- package/dist/panel/components/sections/document/ButtonStatus.svelte +68 -20
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +199 -0
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte.d.ts +10 -0
- package/dist/panel/components/sections/document/CurrentlyEdited.svelte +2 -2
- package/dist/panel/components/sections/document/Document.svelte +96 -65
- package/dist/panel/components/sections/document/DocumentChildren.svelte +175 -0
- package/dist/panel/components/sections/document/DocumentChildren.svelte.d.ts +8 -0
- package/dist/panel/components/sections/document/DocumentUrl.svelte +119 -0
- package/dist/panel/components/sections/document/DocumentUrl.svelte.d.ts +9 -0
- package/dist/panel/components/sections/document/Header.svelte +171 -94
- package/dist/panel/components/sections/document/Settings.svelte +255 -110
- package/dist/panel/components/sections/document/Settings.svelte.d.ts +0 -1
- package/dist/panel/components/sections/document/Versions.svelte +5 -3
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +112 -53
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -2
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +74 -41
- package/dist/panel/components/sections/live/LiveFloatingUI.svelte +30 -11
- package/dist/panel/components/sections/live/live-edit-panel.css +2 -2
- package/dist/panel/components/sections/page-layout/Page.svelte +13 -1
- package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +55 -27
- package/dist/panel/components/ui/button/button.svelte +81 -54
- package/dist/panel/components/ui/button/index.d.ts +7 -3
- package/dist/panel/components/ui/button/index.js +2 -2
- package/dist/panel/components/ui/calendar/calendar.css +27 -27
- package/dist/panel/components/ui/card/card-description.svelte +1 -1
- package/dist/panel/components/ui/card/card.svelte +21 -4
- package/dist/panel/components/ui/card-document/card-document.svelte +24 -12
- package/dist/panel/components/ui/card-resource/card-resource.svelte +26 -8
- package/dist/panel/components/ui/checkbox/checkbox.css +8 -10
- package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/panel/components/ui/command/command-dialog.css +28 -4
- package/dist/panel/components/ui/command/command-dialog.svelte +4 -1
- package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +2 -0
- package/dist/panel/components/ui/command/command-empty.css +1 -1
- package/dist/panel/components/ui/command/command-group.css +3 -3
- package/dist/panel/components/ui/command/command-input-select.svelte +3 -3
- package/dist/panel/components/ui/command/command-input.svelte +38 -14
- package/dist/panel/components/ui/command/command-input.svelte.d.ts +6 -1
- package/dist/panel/components/ui/command/command-item.css +2 -2
- package/dist/panel/components/ui/command/command-list.css +1 -1
- package/dist/panel/components/ui/command/command-separator.css +1 -1
- package/dist/panel/components/ui/context-menu/context-menu-item.css +2 -2
- package/dist/panel/components/ui/context-menu/context-menu.css +6 -7
- package/dist/panel/components/ui/dialog/dialog-content.css +8 -10
- package/dist/panel/components/ui/dialog/dialog-content.svelte +19 -0
- package/dist/panel/components/ui/dialog/dialog-description.css +1 -1
- package/dist/panel/components/ui/dialog/dialog-footer.svelte +5 -1
- package/dist/panel/components/ui/dialog/dialog-overlay.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +19 -5
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +6 -4
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +1 -1
- package/dist/panel/components/ui/input/input.svelte +57 -31
- package/dist/panel/components/ui/kbd/Kbd.svelte +90 -0
- package/dist/panel/components/ui/kbd/Kbd.svelte.d.ts +11 -0
- package/dist/panel/components/ui/kbd/index.d.ts +1 -0
- package/dist/panel/components/ui/kbd/index.js +1 -0
- package/dist/panel/components/ui/label/label.css +5 -3
- package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +27 -15
- package/dist/panel/components/ui/nav/Nav.svelte +180 -110
- package/dist/panel/components/ui/nav/Nav.svelte.d.ts +0 -2
- package/dist/panel/components/ui/nav/NavGroup.svelte +87 -73
- package/dist/panel/components/ui/nav/NavItemButton.svelte +69 -29
- package/dist/panel/components/ui/nav/UserButton.svelte +132 -71
- package/dist/panel/components/ui/page-header/PageHeader.svelte +140 -42
- package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +8 -1
- package/dist/panel/components/ui/popover/popover-content.css +4 -3
- package/dist/panel/components/ui/radio-group/radio-group.css +4 -6
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +19 -7
- package/dist/panel/components/ui/scroll-area/scroll-area.css +2 -2
- package/dist/panel/components/ui/separator/separator.svelte +1 -1
- package/dist/panel/components/ui/sheet/index.d.ts +4 -4
- package/dist/panel/components/ui/sheet/index.js +5 -5
- package/dist/panel/components/ui/sheet/sheet.css +50 -11
- package/dist/panel/components/ui/sonner/sonner.css +11 -8
- package/dist/panel/components/ui/switch/switch.css +13 -18
- package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
- package/dist/panel/components/ui/tabs/tabs.css +44 -35
- package/dist/panel/components/ui/tag/tag.svelte +20 -6
- package/dist/panel/components/ui/tooltip/tooltip-content.svelte +14 -4
- package/dist/panel/components/ui/tree/tree-rows.css +146 -0
- package/dist/panel/context/blocks-ops.d.ts +78 -0
- package/dist/panel/context/blocks-ops.js +170 -0
- package/dist/panel/context/collection.svelte.d.ts +28 -0
- package/dist/panel/context/collection.svelte.js +120 -65
- package/dist/panel/context/commands.svelte.d.ts +80 -0
- package/dist/panel/context/commands.svelte.js +108 -0
- package/dist/panel/context/config.svelte.d.ts +2 -2
- package/dist/panel/context/documentForm.svelte.d.ts +34 -2
- package/dist/panel/context/documentForm.svelte.js +106 -103
- package/dist/panel/context/nav.svelte.d.ts +23 -0
- package/dist/panel/context/nav.svelte.js +56 -0
- package/dist/panel/fonts/Geist-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/GeistMono-VariableFont_wght.ttf +0 -0
- package/dist/panel/index.d.ts +7 -4
- package/dist/panel/index.js +11 -5
- package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +16 -1
- package/dist/panel/pages/collection/CollectionPage.svelte +236 -61
- package/dist/panel/pages/collection/load.server.js +1 -1
- package/dist/panel/pages/dashboard/Dashboard.svelte +135 -90
- package/dist/panel/pages/dashboard/DashboardCard.svelte +109 -0
- package/dist/panel/pages/dashboard/DashboardCard.svelte.d.ts +14 -0
- package/dist/panel/pages/dashboard/DashboardCollection.svelte +180 -57
- package/dist/panel/pages/dashboard/DashboardCollection.svelte.d.ts +1 -0
- package/dist/panel/pages/dashboard/DashboardRow.svelte +93 -0
- package/dist/panel/pages/dashboard/DashboardRow.svelte.d.ts +16 -0
- package/dist/panel/pages/dashboard/load.server.js +49 -25
- package/dist/panel/pages/dashboard/time.d.ts +19 -0
- package/dist/panel/pages/dashboard/time.js +29 -0
- package/dist/panel/pages/dashboard/types.d.ts +9 -2
- package/dist/panel/pages/live/Live.svelte +53 -50
- package/dist/panel/public.d.ts +4 -0
- package/dist/panel/public.js +6 -0
- package/dist/panel/style/font.css +21 -32
- package/dist/panel/style/index.css +191 -122
- package/dist/panel/style/mixins/index.css +14 -0
- package/dist/panel/style/palette.css +35 -26
- package/dist/panel/style/postcss/size-function.d.ts +4 -0
- package/dist/panel/style/postcss/size-function.js +24 -0
- package/dist/panel/style/radius.css +4 -5
- package/dist/panel/style/scheme.css +111 -0
- package/dist/panel/style/size.css +3 -0
- package/dist/panel/util/Sortable.js +9 -4
- package/dist/panel/util/keys.d.ts +24 -0
- package/dist/panel/util/keys.js +63 -0
- package/dist/panel/util/time.d.ts +12 -0
- package/dist/panel/util/time.js +35 -0
- package/dist/panel/util/upload-file.d.ts +106 -0
- package/dist/panel/util/upload-file.js +165 -0
- package/dist/public.d.ts +13 -0
- package/dist/public.js +12 -0
- package/dist/util/index.d.ts +7 -10
- package/dist/util/index.js +7 -8
- package/dist/util/object.d.ts +10 -0
- package/dist/util/object.js +22 -1
- package/dist/util/string.d.ts +17 -0
- package/dist/util/string.js +23 -0
- package/package.json +12 -8
- package/dist/core/pipeline/config-map/build-tree-map.d.ts +0 -4
- package/dist/core/pipeline/config-map/build-tree-map.js +0 -30
- package/dist/core/prototype/doc.d.ts +0 -31
- package/dist/core/prototype/doc.js +0 -118
- package/dist/core/prototype/shared/url/augment.d.ts +0 -13
- package/dist/core/prototype/shared/url/augment.js +0 -11
- package/dist/core/prototype/shared/url/hooks/populate-url.server.d.ts +0 -4
- package/dist/core/prototype/shared/url/hooks/populate-url.server.js +0 -120
- package/dist/fields/relation/client.d.ts +0 -28
- package/dist/fields/relation/client.js +0 -37
- package/dist/fields/rich-text/component/styles/rich-text.css +0 -183
- package/dist/panel/components/sections/collection/header/Header.svelte +0 -17
- package/dist/panel/components/sections/collection/header/Header.svelte.d.ts +0 -3
- package/dist/panel/components/sections/collection/header/Separator.svelte +0 -8
- package/dist/panel/components/sections/collection/header/Separator.svelte.d.ts +0 -26
- package/dist/panel/components/sections/collection/tree/util.d.ts +0 -12
- package/dist/panel/components/sections/collection/tree/util.js +0 -22
- package/dist/panel/fonts/ChivoMono-Italic-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/ChivoMono-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/dist/panel/fonts/Lora-Italic-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/Lora-VariableFont_wght.ttf +0 -0
- package/dist/panel/style/shadow.css +0 -10
- package/dist/util/path.d.ts +0 -16
- package/dist/util/path.js +0 -19
- /package/dist/{panel/components/sections/live → live}/LiveEdit.svelte.d.ts +0 -0
- /package/dist/{panel/components/sections/live → live}/Provider.svelte.d.ts +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { getFieldAtPath, resolvedReferencesOf } from '../core/fields/util.js';
|
|
2
|
-
import { BlocksBuilder } from '../fields/blocks/index.js';
|
|
3
2
|
import { getColumns } from 'drizzle-orm';
|
|
4
3
|
import { RelationFieldBuilder } from '../fields/relation/index.js';
|
|
5
|
-
import { TreeBuilder } from '../fields/tree/index.js';
|
|
6
4
|
import { baseTableName, childTableNames, joinName, tableName } from './naming.server.js';
|
|
7
5
|
/** What a joined target is projected to, beside its `id`: whatever of these its table has. */
|
|
8
6
|
const JOINED_COLUMNS = ['name', 'email', 'title', 'filename'];
|
|
@@ -14,7 +12,7 @@ const JOINED_COLUMNS = ['name', 'email', 'title', 'filename'];
|
|
|
14
12
|
* `select`, only the selected ones.
|
|
15
13
|
*/
|
|
16
14
|
export const resolvedReferenceJoins = (args) => {
|
|
17
|
-
const { table, tables, config, select } = args;
|
|
15
|
+
const { table, tables, config, select, resolve } = args;
|
|
18
16
|
const isBase = table === baseTableName(config.slug);
|
|
19
17
|
const withParam = {};
|
|
20
18
|
for (const reference of resolvedReferencesOf(config.fields)) {
|
|
@@ -22,6 +20,8 @@ export const resolvedReferenceJoins = (args) => {
|
|
|
22
20
|
continue;
|
|
23
21
|
if (select?.length && !select.includes(reference.path))
|
|
24
22
|
continue;
|
|
23
|
+
if (resolve && !resolve.includes(reference.path))
|
|
24
|
+
continue;
|
|
25
25
|
const target = tables[baseTableName(reference.to)];
|
|
26
26
|
if (!target)
|
|
27
27
|
continue;
|
|
@@ -33,88 +33,96 @@ export const resolvedReferenceJoins = (args) => {
|
|
|
33
33
|
}
|
|
34
34
|
return withParam;
|
|
35
35
|
};
|
|
36
|
+
/** What a read of a page's address asks for: `url`, `_urlPath` and `_slug`, or all of the page. */
|
|
37
|
+
const ADDRESS_PATHS = ['url', '_urlPath', '_slug'];
|
|
38
|
+
/**
|
|
39
|
+
* The page's row in its paths table, in the locale read, when its collection has `$url`. A page
|
|
40
|
+
* has a row in every locale, so there is no fallback to resolve.
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* pathsJoin({ base: 'pages', tables, locale: 'en' })
|
|
44
|
+
* // { 'pages__$paths': { where: { locale: 'en' }, columns: { slug: true, path: true, url: true } } }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export const pathsJoin = (args) => {
|
|
48
|
+
const { base, tables, locale, select } = args;
|
|
49
|
+
const paths = tableName({ owner: base, child: { kind: 'paths' } });
|
|
50
|
+
if (!(paths in tables))
|
|
51
|
+
return {};
|
|
52
|
+
if (select?.length && !select.some((path) => ADDRESS_PATHS.includes(path)))
|
|
53
|
+
return {};
|
|
54
|
+
return {
|
|
55
|
+
[paths]: { where: { locale: locale ?? '' }, columns: { slug: true, path: true, url: true } }
|
|
56
|
+
};
|
|
57
|
+
};
|
|
36
58
|
export const buildWithParam = (args) => {
|
|
37
|
-
const { table, select = [], locale, fallback, tables, config: documentConfig } = args;
|
|
59
|
+
const { table, select = [], resolve, locale, fallback, tables, config: documentConfig } = args;
|
|
38
60
|
// A child row — a block, a tree node — belongs to one locale. Its locales branch, and the
|
|
39
61
|
// document's, are read for every locale in the order and merged in `transform`.
|
|
40
62
|
const branchWhere = branchFilter(locale, fallback);
|
|
63
|
+
// On the base table only: a versioned read joins it above the content row.
|
|
64
|
+
const paths = table === baseTableName(documentConfig.slug)
|
|
65
|
+
? pathsJoin({ base: table, tables, locale, select })
|
|
66
|
+
: {};
|
|
41
67
|
if (!select.length) {
|
|
42
68
|
return {
|
|
43
69
|
...buildFullWithParam({ table, locale, fallback, tables }),
|
|
44
|
-
...resolvedReferenceJoins({ table, tables, config: documentConfig })
|
|
70
|
+
...resolvedReferenceJoins({ table, tables, config: documentConfig, resolve }),
|
|
71
|
+
...paths
|
|
45
72
|
};
|
|
46
73
|
}
|
|
47
|
-
const withParam =
|
|
48
|
-
|
|
74
|
+
const withParam = {
|
|
75
|
+
...resolvedReferenceJoins({
|
|
76
|
+
table,
|
|
77
|
+
tables,
|
|
78
|
+
config: documentConfig,
|
|
79
|
+
select,
|
|
80
|
+
resolve
|
|
81
|
+
}),
|
|
82
|
+
...paths
|
|
83
|
+
};
|
|
49
84
|
const directRelationPaths = [];
|
|
50
|
-
|
|
51
|
-
const
|
|
85
|
+
/** The selected paths stored as child tables, by the tables' kind. */
|
|
86
|
+
const childPaths = { blocks: [], tree: [] };
|
|
87
|
+
const allChildPaths = () => [...childPaths.blocks, ...childPaths.tree];
|
|
88
|
+
/** The kinds of child table a field's branches are stored in — none for a column. */
|
|
89
|
+
const storageKinds = (field) => [
|
|
90
|
+
...new Set(field.use.nodes().flatMap((node) => (node.storage ? [node.storage.kind] : [])))
|
|
91
|
+
];
|
|
52
92
|
for (const path of select) {
|
|
53
93
|
// Convert dot notation to double underscore notation for SQLite queries
|
|
54
94
|
const sqlPath = path.replace(/\./g, '__');
|
|
55
95
|
const fieldConfig = getFieldAtPath(path, documentConfig.fields);
|
|
96
|
+
// Each branch is where the field's rows are stored: the junction table, a child table, or a
|
|
97
|
+
// column of the row itself.
|
|
56
98
|
if (fieldConfig instanceof RelationFieldBuilder) {
|
|
57
|
-
// Handle relation fields
|
|
58
99
|
directRelationPaths.push(path);
|
|
59
100
|
}
|
|
60
|
-
else if (fieldConfig
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
101
|
+
else if (fieldConfig && storageKinds(fieldConfig).length) {
|
|
102
|
+
for (const kind of storageKinds(fieldConfig)) {
|
|
103
|
+
childPaths[kind].push(path);
|
|
104
|
+
for (const childTable of childTableNames(table, kind, tables)) {
|
|
105
|
+
if (withParam[childTable])
|
|
106
|
+
continue;
|
|
66
107
|
let params = { orderBy: { position: 'asc' } };
|
|
67
|
-
const columns = getColumns(tables[
|
|
108
|
+
const columns = getColumns(tables[childTable]);
|
|
68
109
|
const hasLocale = Object.keys(columns).includes('locale');
|
|
69
110
|
if (locale && hasLocale) {
|
|
70
111
|
params = { ...params, where: { locale } };
|
|
71
112
|
}
|
|
72
|
-
withParam[
|
|
73
|
-
//
|
|
74
|
-
const
|
|
75
|
-
if (locale &&
|
|
76
|
-
withParam[
|
|
77
|
-
...withParam[
|
|
78
|
-
with: {
|
|
79
|
-
[localesBlockTable]: {
|
|
80
|
-
where: branchWhere
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
else if (fieldConfig instanceof TreeBuilder) {
|
|
89
|
-
// Handle tree fields
|
|
90
|
-
treePaths.push(path);
|
|
91
|
-
const treeTables = childTableNames(table, 'tree', tables);
|
|
92
|
-
for (const treeTable of treeTables) {
|
|
93
|
-
if (!withParam[treeTable]) {
|
|
94
|
-
let params = { orderBy: { position: 'asc' } };
|
|
95
|
-
const columns = getColumns(tables[treeTable]);
|
|
96
|
-
const hasLocale = Object.keys(columns).includes('locale');
|
|
97
|
-
if (locale && hasLocale) {
|
|
98
|
-
params = { ...params, where: { locale } };
|
|
99
|
-
}
|
|
100
|
-
withParam[treeTable] = params;
|
|
101
|
-
// Handle localized trees
|
|
102
|
-
const localesTreeTables = tableName({ owner: treeTable, branch: 'locales' });
|
|
103
|
-
if (locale && localesTreeTables in tables) {
|
|
104
|
-
withParam[treeTable] = {
|
|
105
|
-
...withParam[treeTable],
|
|
106
|
-
with: {
|
|
107
|
-
[localesTreeTables]: {
|
|
108
|
-
where: branchWhere
|
|
109
|
-
}
|
|
110
|
-
}
|
|
113
|
+
withParam[childTable] = params;
|
|
114
|
+
// Its locales branch with it.
|
|
115
|
+
const localesTable = tableName({ owner: childTable, branch: 'locales' });
|
|
116
|
+
if (locale && localesTable in tables) {
|
|
117
|
+
withParam[childTable] = {
|
|
118
|
+
...withParam[childTable],
|
|
119
|
+
with: { [localesTable]: { where: branchWhere } }
|
|
111
120
|
};
|
|
112
121
|
}
|
|
113
122
|
}
|
|
114
123
|
}
|
|
115
124
|
}
|
|
116
125
|
else if (fieldConfig) {
|
|
117
|
-
// Handle regular fields
|
|
118
126
|
if (fieldConfig.get.localized && locale) {
|
|
119
127
|
const localesTableName = tableName({ owner: table, branch: 'locales' });
|
|
120
128
|
if (localesTableName in tables) {
|
|
@@ -147,7 +155,7 @@ export const buildWithParam = (args) => {
|
|
|
147
155
|
// 1. Include relations table if container paths exist (blocks or trees).
|
|
148
156
|
// If container paths are present we include relations for those containers
|
|
149
157
|
// and also include any direct relation paths.
|
|
150
|
-
if ((
|
|
158
|
+
if (allChildPaths().length > 0 &&
|
|
151
159
|
tableName({ owner: table, child: { kind: 'rels' } }) in tables) {
|
|
152
160
|
// Create a where condition that matches relations within any of the container paths,
|
|
153
161
|
// and include direct relation paths as exact matches.
|
|
@@ -155,7 +163,7 @@ export const buildWithParam = (args) => {
|
|
|
155
163
|
where: {
|
|
156
164
|
OR: [
|
|
157
165
|
// A container's rows sit under its path; a direct relation is the path itself.
|
|
158
|
-
...
|
|
166
|
+
...allChildPaths().map((path) => ({ path: { like: `${path}__%` } })),
|
|
159
167
|
...directRelationPaths.map((path) => ({ path }))
|
|
160
168
|
]
|
|
161
169
|
},
|
|
@@ -163,12 +171,12 @@ export const buildWithParam = (args) => {
|
|
|
163
171
|
};
|
|
164
172
|
}
|
|
165
173
|
// 2. Include tree tables for blocks that might contain trees
|
|
166
|
-
if (
|
|
174
|
+
if (childPaths.blocks.length > 0) {
|
|
167
175
|
const treeTables = childTableNames(table, 'tree', tables);
|
|
168
176
|
for (const treeTable of treeTables) {
|
|
169
177
|
if (!withParam[treeTable]) {
|
|
170
178
|
withParam[treeTable] = {
|
|
171
|
-
where: { OR:
|
|
179
|
+
where: { OR: childPaths.blocks.map((path) => ({ path: { like: `${path}__%` } })) },
|
|
172
180
|
orderBy: { position: 'asc' }
|
|
173
181
|
};
|
|
174
182
|
// Handle localized trees
|
|
@@ -187,12 +195,12 @@ export const buildWithParam = (args) => {
|
|
|
187
195
|
}
|
|
188
196
|
}
|
|
189
197
|
// 3. Include block tables for trees that might contain blocks
|
|
190
|
-
if (
|
|
198
|
+
if (childPaths.tree.length > 0) {
|
|
191
199
|
const blocksTables = childTableNames(table, 'blocks', tables);
|
|
192
200
|
for (const blocksTable of blocksTables) {
|
|
193
201
|
if (!withParam[blocksTable]) {
|
|
194
202
|
withParam[blocksTable] = {
|
|
195
|
-
where: { OR:
|
|
203
|
+
where: { OR: childPaths.tree.map((path) => ({ path: { like: `${path}__%` } })) },
|
|
196
204
|
orderBy: { position: 'asc' }
|
|
197
205
|
};
|
|
198
206
|
// Handle localized blocks
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TableHandle } from '../core/adapter.js';
|
|
2
2
|
import type { GetRegisterType } from '../index.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SqliteDatabase } from './types.server.js';
|
|
4
4
|
/**
|
|
5
5
|
* Handles for the tables features declared — see `FeatureDefinition.tables`.
|
|
6
6
|
*
|
|
@@ -13,6 +13,6 @@ import type { LibSQLDatabase } from 'drizzle-orm/libsql';
|
|
|
13
13
|
* had no way to name until a feature could declare one.
|
|
14
14
|
*/
|
|
15
15
|
export declare const createTableHandles: (args: {
|
|
16
|
-
db:
|
|
16
|
+
db: SqliteDatabase;
|
|
17
17
|
tables: GetRegisterType<"Tables">;
|
|
18
18
|
}) => (slug: string) => TableHandle;
|
|
@@ -2,9 +2,9 @@ import { getTableColumns } from 'drizzle-orm';
|
|
|
2
2
|
import { flatten } from 'flat';
|
|
3
3
|
import { logger } from '../core/logger.server.js';
|
|
4
4
|
import { extractFieldName } from '../fields/tree/util.js';
|
|
5
|
-
import { omit } from '../util/object.js';
|
|
5
|
+
import { isObjectLiteral, omit } from '../util/object.js';
|
|
6
6
|
import { baseTableName, tableName as buildTableName, childTableNames, joinName } from './naming.server.js';
|
|
7
|
-
import { transformDatabaseColumnsToPaths } from './columns.server.js';
|
|
7
|
+
import { databaseColumnToPath, transformDatabaseColumnsToPaths } from './columns.server.js';
|
|
8
8
|
import { localeOrder, mergeLocaleRows } from './locales.server.js';
|
|
9
9
|
import { resolvedReferencesOf } from '../core/fields/util.js';
|
|
10
10
|
/**
|
|
@@ -42,6 +42,8 @@ export const createTransformHandle = (args) => {
|
|
|
42
42
|
// the config rather than asked of a feature, which is what keeps this file naming none.
|
|
43
43
|
const tableName = baseTableName(configCtx.getBySlug(slug)._versions?.slug ?? slug);
|
|
44
44
|
const tableNameRelationFields = buildTableName({ owner: tableName, child: { kind: 'rels' } });
|
|
45
|
+
// The addresses hang off the base row, whether or not the content is on a versions table.
|
|
46
|
+
const tableNamePaths = buildTableName({ owner: baseTableName(slug), child: { kind: 'paths' } });
|
|
45
47
|
const tableNameLocales = buildTableName({ owner: tableName, branch: 'locales' });
|
|
46
48
|
/** Add localized fields, each from the first locale in the fallback order that holds it. */
|
|
47
49
|
if (locale && tableNameLocales in tables && doc[tableNameLocales]) {
|
|
@@ -109,7 +111,35 @@ export const createTransformHandle = (args) => {
|
|
|
109
111
|
// The child tables came back on the same row; they are their own piles now. Left on, they
|
|
110
112
|
// flatten into `pages__$blocks_hero.0.id` keys that survive every step to be stripped by name
|
|
111
113
|
// at the very end.
|
|
112
|
-
|
|
114
|
+
// One pass over the row: a child table's key is dropped, a column becomes its path, and a
|
|
115
|
+
// JSON value — an object or an array — is flattened under it, nothing else is walked.
|
|
116
|
+
const childTables = new Set([
|
|
117
|
+
...blocksTables,
|
|
118
|
+
...treeTables,
|
|
119
|
+
tableNameRelationFields,
|
|
120
|
+
tableNamePaths
|
|
121
|
+
]);
|
|
122
|
+
const base = {};
|
|
123
|
+
for (const [key, value] of Object.entries(doc)) {
|
|
124
|
+
if (childTables.has(key))
|
|
125
|
+
continue;
|
|
126
|
+
if (isObjectLiteral(value) || Array.isArray(value)) {
|
|
127
|
+
for (const [flatKey, flatValue] of Object.entries(flatten({ [key]: value }))) {
|
|
128
|
+
base[databaseColumnToPath(flatKey)] = flatValue;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
base[databaseColumnToPath(key)] = value;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// The page's address in the locale read: `url`, `_urlPath` and `_slug` on the document. Not
|
|
136
|
+
// `_path`, which an upload collection already names.
|
|
137
|
+
if (tableNamePaths in doc) {
|
|
138
|
+
const [address] = doc[tableNamePaths] ?? [];
|
|
139
|
+
base.url = address?.url ?? null;
|
|
140
|
+
base._urlPath = address?.path ?? null;
|
|
141
|
+
base._slug = address?.slug ?? null;
|
|
142
|
+
}
|
|
113
143
|
return { base, blocks, tree, relations };
|
|
114
144
|
};
|
|
115
145
|
return { rows };
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { GetRegisterType } from '../index.js';
|
|
2
2
|
import type { ColumnBaseConfig, ColumnDataType } from 'drizzle-orm';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { SQLiteAsyncDatabase, SQLiteColumn, SQLiteTableWithColumns } from 'drizzle-orm/sqlite-core';
|
|
4
|
+
/**
|
|
5
|
+
* The drizzle connection, whichever driver opened it.
|
|
6
|
+
*
|
|
7
|
+
* libsql is async and bun:sqlite is sync, but drizzle wraps both in `SQLiteAsyncDatabase`, so
|
|
8
|
+
* every query is awaited the same way. The one difference that leaks: a sync driver's
|
|
9
|
+
* `db.transaction()` rejects an async callback.
|
|
10
|
+
*/
|
|
11
|
+
export type SqliteDatabase = SQLiteAsyncDatabase<'sync' | 'async', unknown, GetRegisterType<'Relations'>>;
|
|
5
12
|
/**
|
|
6
13
|
* What every facade in this folder is built from: the connection and the generated tables.
|
|
7
14
|
*/
|
|
8
15
|
export type AdapterDeps = {
|
|
9
|
-
db:
|
|
16
|
+
db: SqliteDatabase;
|
|
10
17
|
tables: GenericTables;
|
|
11
18
|
};
|
|
12
19
|
type GenericColumn = SQLiteColumn<ColumnBaseConfig<ColumnDataType>, Record<string, unknown>>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { ConfigContext } from '../core/rime.server.js';
|
|
2
2
|
import { type GetRegisterType } from '../index.js';
|
|
3
|
-
import type { LibSQLDatabase } from 'drizzle-orm/libsql';
|
|
4
3
|
import type { ParsedQs } from 'qs';
|
|
5
4
|
import type { PrototypeSlug } from '../types.js';
|
|
6
|
-
import type { GenericTable } from './types.server.js';
|
|
5
|
+
import type { GenericTable, SqliteDatabase } from './types.server.js';
|
|
7
6
|
type BuildWhereArgs = {
|
|
8
7
|
query: ParsedQs;
|
|
9
8
|
slug: PrototypeSlug;
|
|
10
9
|
locale?: string;
|
|
11
|
-
db:
|
|
10
|
+
db: SqliteDatabase;
|
|
12
11
|
tables: GetRegisterType<'Tables'>;
|
|
13
12
|
configCtx: ConfigContext;
|
|
14
13
|
/**
|
|
@@ -52,6 +52,16 @@ export const buildWhereParam = ({ query, slug, db, locale, tables, configCtx, ba
|
|
|
52
52
|
const {
|
|
53
53
|
// Get condition members
|
|
54
54
|
column, sqlColumn, fn, operator, rawValue, value } = getConditionMembers(conditionObject);
|
|
55
|
+
// A collection with `$url` finds its pages by url or by path through its paths table, in the
|
|
56
|
+
// locale read. A versions table is matched through its `ownerId`, like any base-row filter.
|
|
57
|
+
const pathsTable = getTable(tableName({ owner: baseTableName(base ?? slug), child: { kind: 'paths' } }));
|
|
58
|
+
if (pathsTable && (column === 'url' || column === '_urlPath')) {
|
|
59
|
+
const owners = db
|
|
60
|
+
.select({ id: pathsTable.ownerId })
|
|
61
|
+
.from(pathsTable)
|
|
62
|
+
.where(and(eq(pathsTable.locale, locale ?? ''), fn(column === 'url' ? pathsTable.url : pathsTable.path, value)));
|
|
63
|
+
return inArray(isShadow ? table.ownerId : table.id, owners);
|
|
64
|
+
}
|
|
55
65
|
// Handle regular fields
|
|
56
66
|
if (unlocalizedColumns.includes(sqlColumn)) {
|
|
57
67
|
return fn(table[sqlColumn], value);
|
|
@@ -66,7 +76,15 @@ export const buildWhereParam = ({ query, slug, db, locale, tables, configCtx, ba
|
|
|
66
76
|
const resolved = order.length > 1
|
|
67
77
|
? sql `COALESCE(${sql.join(order.map(valueIn), sql `, `)})`
|
|
68
78
|
: valueIn(order[0]);
|
|
69
|
-
|
|
79
|
+
if (operator !== 'equals' && operator !== 'in_array')
|
|
80
|
+
return fn(resolved, value);
|
|
81
|
+
// A document whose read value matches has a locales row holding it, so the documents with
|
|
82
|
+
// one are asked first: that is what an index on the column answers, and the comparison
|
|
83
|
+
// above then runs on those alone.
|
|
84
|
+
return and(inArray(table.id, db
|
|
85
|
+
.select({ ownerId: tableLocales.ownerId })
|
|
86
|
+
.from(tableLocales)
|
|
87
|
+
.where(fn(tableLocales[sqlColumn], value))), fn(resolved, value));
|
|
70
88
|
}
|
|
71
89
|
// A column the base row keeps — the hierarchy columns, and any `$root()` field — reached
|
|
72
90
|
// through `ownerId` when the table queried is the versions table.
|
package/dist/core/adapter.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export interface Adapter {
|
|
|
55
55
|
blocks: BlocksHandle;
|
|
56
56
|
tree: TreeHandle;
|
|
57
57
|
relations: RelationsHandle;
|
|
58
|
+
paths: PathsHandle;
|
|
58
59
|
transform: TransformHandle;
|
|
59
60
|
auth: AuthHandle;
|
|
60
61
|
}
|
|
@@ -78,6 +79,12 @@ export interface BaseHandle {
|
|
|
78
79
|
locale?: string;
|
|
79
80
|
/** See `find`. */
|
|
80
81
|
localeFallback?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The resolved references to join, by document path. Absent, every one; `select` narrows
|
|
84
|
+
* further. A read hands down the ones its reader may see, so a join is never made for a
|
|
85
|
+
* field the pipeline goes on to drop.
|
|
86
|
+
*/
|
|
87
|
+
resolve?: string[];
|
|
81
88
|
/** Per document, which content row — see `find`. Filters the list as well as picking rows. */
|
|
82
89
|
content?: OperationQuery;
|
|
83
90
|
}): Promise<RawDoc[]>;
|
|
@@ -119,6 +126,8 @@ export interface CollectionHandle extends BaseHandle {
|
|
|
119
126
|
* else, which is what a copy from one row to another reads.
|
|
120
127
|
*/
|
|
121
128
|
localeFallback?: boolean;
|
|
129
|
+
/** See `findMany`. */
|
|
130
|
+
resolve?: string[];
|
|
122
131
|
/**
|
|
123
132
|
* Narrows which content row this read means, for a config that has one. The newest when
|
|
124
133
|
* omitted, which is what "the content of this document" means with nothing else said.
|
|
@@ -191,6 +200,8 @@ export interface AreaHandle extends BaseHandle {
|
|
|
191
200
|
locale?: string;
|
|
192
201
|
/** See `CollectionHandle.find`. */
|
|
193
202
|
localeFallback?: boolean;
|
|
203
|
+
/** See `CollectionHandle.findMany`. */
|
|
204
|
+
resolve?: string[];
|
|
194
205
|
content?: OperationQuery;
|
|
195
206
|
}): Promise<RawDoc | undefined>;
|
|
196
207
|
/** Writes the rows a write plan names. See `CollectionHandle.update`. */
|
|
@@ -275,6 +286,93 @@ export interface RelationsHandle {
|
|
|
275
286
|
locale?: string;
|
|
276
287
|
}): Promise<Relation[]>;
|
|
277
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* A page's address in one locale, as a collection with `$url` stores it.
|
|
291
|
+
*
|
|
292
|
+
* ```
|
|
293
|
+
* { ownerId: 'web', locale: 'en', slug: 'web', path: 'services/web', url: 'https://site.test/en/services/web' }
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* `locale` is `''` when the config has no localization. `path` is the slugs from the top page down
|
|
297
|
+
* to this one; the adapter keeps it in step when a slug changes or a page moves.
|
|
298
|
+
*/
|
|
299
|
+
export type PathRow = {
|
|
300
|
+
ownerId: string;
|
|
301
|
+
locale: string;
|
|
302
|
+
slug: string;
|
|
303
|
+
path: string;
|
|
304
|
+
url: string | null;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* The addresses of a collection's pages. Every verb names one page; the pages under it follow.
|
|
308
|
+
*/
|
|
309
|
+
export interface PathsHandle {
|
|
310
|
+
/** One row per locale for a new page, under its parent's row in each locale. */
|
|
311
|
+
insert(args: {
|
|
312
|
+
slug: PrototypeSlug;
|
|
313
|
+
ownerId: string;
|
|
314
|
+
parentId: string | null;
|
|
315
|
+
rows: {
|
|
316
|
+
locale: string;
|
|
317
|
+
slug: string;
|
|
318
|
+
}[];
|
|
319
|
+
}): Promise<PathRow[]>;
|
|
320
|
+
/** The page's rows, in every locale unless one is given. */
|
|
321
|
+
get(args: {
|
|
322
|
+
slug: PrototypeSlug;
|
|
323
|
+
ownerId: string;
|
|
324
|
+
locale?: string;
|
|
325
|
+
}): Promise<PathRow[]>;
|
|
326
|
+
/** A new slug in one locale. Answers the row with its new path. */
|
|
327
|
+
setSlug(args: {
|
|
328
|
+
slug: PrototypeSlug;
|
|
329
|
+
ownerId: string;
|
|
330
|
+
locale: string;
|
|
331
|
+
value: string;
|
|
332
|
+
}): Promise<PathRow | undefined>;
|
|
333
|
+
/**
|
|
334
|
+
* Under another parent, or at the top, with the slug it takes there in each of its locales:
|
|
335
|
+
* `{ en: 'team', fr: 'equipe' }`. Answers the page's rows.
|
|
336
|
+
*/
|
|
337
|
+
moveUnder(args: {
|
|
338
|
+
slug: PrototypeSlug;
|
|
339
|
+
ownerId: string;
|
|
340
|
+
parentId: string | null;
|
|
341
|
+
slugs: Record<string, string>;
|
|
342
|
+
}): Promise<PathRow[]>;
|
|
343
|
+
/** The pages directly under this one, in any locale. */
|
|
344
|
+
children(args: {
|
|
345
|
+
slug: PrototypeSlug;
|
|
346
|
+
ownerId: string;
|
|
347
|
+
}): Promise<string[]>;
|
|
348
|
+
/** The row at `path` and, with `withDescendants`, every row below it, in one locale. */
|
|
349
|
+
under(args: {
|
|
350
|
+
slug: PrototypeSlug;
|
|
351
|
+
locale: string;
|
|
352
|
+
path: string;
|
|
353
|
+
withDescendants?: boolean;
|
|
354
|
+
}): Promise<PathRow[]>;
|
|
355
|
+
/** The slugs the children of `parentId` hold in `locale`, or of the top pages when it is null. */
|
|
356
|
+
siblingSlugs(args: {
|
|
357
|
+
slug: PrototypeSlug;
|
|
358
|
+
locale: string;
|
|
359
|
+
parentId: string | null;
|
|
360
|
+
}): Promise<string[]>;
|
|
361
|
+
/** The documents of the collection with no row in `locale` yet. */
|
|
362
|
+
missingOwners(args: {
|
|
363
|
+
slug: PrototypeSlug;
|
|
364
|
+
locale: string;
|
|
365
|
+
}): Promise<string[]>;
|
|
366
|
+
/** New urls, in one transaction. */
|
|
367
|
+
setUrls(args: {
|
|
368
|
+
slug: PrototypeSlug;
|
|
369
|
+
rows: {
|
|
370
|
+
ownerId: string;
|
|
371
|
+
locale: string;
|
|
372
|
+
url: string;
|
|
373
|
+
}[];
|
|
374
|
+
}): Promise<void>;
|
|
375
|
+
}
|
|
278
376
|
export interface TransformHandle {
|
|
279
377
|
/**
|
|
280
378
|
* The rows one document is stored across, unflattened and grouped by what they are.
|
|
@@ -1257,7 +1257,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
|
|
|
1257
1257
|
$Infer: {
|
|
1258
1258
|
body: {
|
|
1259
1259
|
userId: string;
|
|
1260
|
-
role: "user" | "
|
|
1260
|
+
role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
|
|
1261
1261
|
};
|
|
1262
1262
|
};
|
|
1263
1263
|
};
|
|
@@ -1346,7 +1346,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
|
|
|
1346
1346
|
email: string;
|
|
1347
1347
|
password?: string | undefined;
|
|
1348
1348
|
name: string;
|
|
1349
|
-
role?: "user" | "
|
|
1349
|
+
role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
|
|
1350
1350
|
data?: Record<string, any> | undefined;
|
|
1351
1351
|
};
|
|
1352
1352
|
};
|
|
@@ -1970,7 +1970,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
|
|
|
1970
1970
|
};
|
|
1971
1971
|
} & {
|
|
1972
1972
|
userId?: string | undefined;
|
|
1973
|
-
role?: "user" | "
|
|
1973
|
+
role?: "user" | "staff" | "admin" | undefined;
|
|
1974
1974
|
};
|
|
1975
1975
|
};
|
|
1976
1976
|
};
|
|
@@ -1273,7 +1273,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
|
|
|
1273
1273
|
$Infer: {
|
|
1274
1274
|
body: {
|
|
1275
1275
|
userId: string;
|
|
1276
|
-
role: "user" | "
|
|
1276
|
+
role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
|
|
1277
1277
|
};
|
|
1278
1278
|
};
|
|
1279
1279
|
};
|
|
@@ -1362,7 +1362,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
|
|
|
1362
1362
|
email: string;
|
|
1363
1363
|
password?: string | undefined;
|
|
1364
1364
|
name: string;
|
|
1365
|
-
role?: "user" | "
|
|
1365
|
+
role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
|
|
1366
1366
|
data?: Record<string, any> | undefined;
|
|
1367
1367
|
};
|
|
1368
1368
|
};
|
|
@@ -1986,7 +1986,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
|
|
|
1986
1986
|
};
|
|
1987
1987
|
} & {
|
|
1988
1988
|
userId?: string | undefined;
|
|
1989
|
-
role?: "user" | "
|
|
1989
|
+
role?: "user" | "staff" | "admin" | undefined;
|
|
1990
1990
|
};
|
|
1991
1991
|
};
|
|
1992
1992
|
};
|
|
@@ -3344,7 +3344,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
|
|
|
3344
3344
|
$Infer: {
|
|
3345
3345
|
body: {
|
|
3346
3346
|
userId: string;
|
|
3347
|
-
role: "user" | "
|
|
3347
|
+
role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
|
|
3348
3348
|
};
|
|
3349
3349
|
};
|
|
3350
3350
|
};
|
|
@@ -3433,7 +3433,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
|
|
|
3433
3433
|
email: string;
|
|
3434
3434
|
password?: string | undefined;
|
|
3435
3435
|
name: string;
|
|
3436
|
-
role?: "user" | "
|
|
3436
|
+
role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
|
|
3437
3437
|
data?: Record<string, any> | undefined;
|
|
3438
3438
|
};
|
|
3439
3439
|
};
|
|
@@ -4057,7 +4057,7 @@ export declare const createAuthInstance: <const C extends Config>(args: {
|
|
|
4057
4057
|
};
|
|
4058
4058
|
} & {
|
|
4059
4059
|
userId?: string | undefined;
|
|
4060
|
-
role?: "user" | "
|
|
4060
|
+
role?: "user" | "staff" | "admin" | undefined;
|
|
4061
4061
|
};
|
|
4062
4062
|
};
|
|
4063
4063
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RimeError } from '../../errors/index.js';
|
|
2
2
|
import { error, redirect } from '@sveltejs/kit';
|
|
3
|
-
import { access } from '
|
|
3
|
+
import { access } from '../access.js';
|
|
4
4
|
import { BETTER_AUTH_ROLES } from '../constant.server.js';
|
|
5
5
|
import { userAttributes } from '../user.server.js';
|
|
6
6
|
import { hasAuthUser } from '../better-auth-tables.server.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isFormField } from '../fields/util.js';
|
|
2
1
|
import { SelectFieldBuilder } from '../../fields/select/index.js';
|
|
3
2
|
/**
|
|
4
3
|
* What a collection declaring `auth` has to look like.
|
|
@@ -22,12 +21,11 @@ export const validateAuth = (config) => {
|
|
|
22
21
|
if (config.versions) {
|
|
23
22
|
errors.push(`Auth collections can't be versionned (${config.slug})`);
|
|
24
23
|
}
|
|
25
|
-
const
|
|
26
|
-
const rolesField = formFields
|
|
24
|
+
const rolesField = config.fields
|
|
27
25
|
.filter((f) => f.name === 'roles')
|
|
28
26
|
.filter((f) => f instanceof SelectFieldBuilder)[0];
|
|
29
|
-
const nameField =
|
|
30
|
-
const emailField =
|
|
27
|
+
const nameField = config.fields.filter((f) => f.name === 'name')[0];
|
|
28
|
+
const emailField = config.fields.find((f) => f.name === 'email' && f.type === 'email');
|
|
31
29
|
if (!rolesField)
|
|
32
30
|
errors.push(`Field roles is missing in collection ${config.slug}`);
|
|
33
31
|
if (!emailField && config.auth?.type !== 'apiKey')
|