rimecms 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-sqlite/collection.server.js +2 -1
- package/dist/adapter-sqlite/columns.server.d.ts +42 -61
- package/dist/adapter-sqlite/columns.server.js +50 -111
- package/dist/adapter-sqlite/constant.d.ts +16 -0
- package/dist/adapter-sqlite/constant.js +16 -0
- package/dist/adapter-sqlite/db-move.server.d.ts +31 -0
- package/dist/adapter-sqlite/db-move.server.js +102 -0
- package/dist/adapter-sqlite/drizzle-config.server.d.ts +9 -0
- package/dist/adapter-sqlite/drizzle-config.server.js +39 -0
- package/dist/adapter-sqlite/generate-schema/column.server.d.ts +8 -6
- package/dist/adapter-sqlite/generate-schema/column.server.js +13 -49
- package/dist/adapter-sqlite/generate-schema/index.server.d.ts +1 -0
- package/dist/adapter-sqlite/generate-schema/index.server.js +6 -0
- package/dist/adapter-sqlite/generate-schema/relations/junction.server.d.ts +3 -3
- package/dist/adapter-sqlite/generate-schema/relations/junction.server.js +3 -3
- package/dist/adapter-sqlite/generate-schema/root.server.d.ts +4 -0
- package/dist/adapter-sqlite/generate-schema/root.server.js +26 -33
- package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +0 -22
- package/dist/adapter-sqlite/generate-schema/templates.server.js +0 -33
- package/dist/adapter-sqlite/generate-schema/write.server.d.ts +6 -0
- package/dist/adapter-sqlite/generate-schema/write.server.js +13 -3
- package/dist/adapter-sqlite/hooks.server.d.ts +3 -0
- package/dist/adapter-sqlite/hooks.server.js +64 -0
- package/dist/adapter-sqlite/index.server.d.ts +9 -1
- package/dist/adapter-sqlite/index.server.js +23 -2
- package/dist/adapter-sqlite/locales.server.js +1 -4
- package/dist/adapter-sqlite/order-by.server.d.ts +6 -0
- package/dist/adapter-sqlite/order-by.server.js +6 -0
- package/dist/adapter-sqlite/read.server.d.ts +12 -1
- package/dist/adapter-sqlite/read.server.js +94 -38
- package/dist/adapter-sqlite/registry.server.d.ts +2 -2
- package/dist/adapter-sqlite/registry.server.js +2 -2
- package/dist/adapter-sqlite/relations.server.d.ts +5 -0
- package/dist/adapter-sqlite/relations.server.js +27 -7
- package/dist/adapter-sqlite/repeatable.server.d.ts +4 -1
- package/dist/adapter-sqlite/repeatable.server.js +4 -1
- package/dist/adapter-sqlite/select.server.d.ts +6 -0
- package/dist/adapter-sqlite/select.server.js +56 -113
- package/dist/adapter-sqlite/table.server.js +7 -0
- package/dist/adapter-sqlite/transform.server.js +8 -2
- package/dist/adapter-sqlite/where.server.d.ts +11 -0
- package/dist/adapter-sqlite/where.server.js +237 -236
- package/dist/adapter-sqlite/write.server.d.ts +5 -0
- package/dist/adapter-sqlite/write.server.js +9 -7
- package/dist/core/adapter.d.ts +63 -12
- package/dist/core/auth/access.d.ts +3 -5
- package/dist/core/auth/access.js +3 -5
- package/dist/core/auth/augment.js +3 -4
- package/dist/core/auth/augment.server.d.ts +4 -0
- package/dist/core/auth/augment.server.js +4 -0
- package/dist/core/auth/better-auth/config.server.d.ts +24 -16
- package/dist/core/auth/better-auth/config.server.js +6 -0
- package/dist/core/auth/better-auth/hooks.server.js +17 -5
- package/dist/core/auth/better-auth/instance.server.d.ts +38 -32
- package/dist/core/auth/better-auth/permissions.d.ts +8 -7
- package/dist/core/auth/better-auth/permissions.js +1 -0
- package/dist/core/auth/better-auth-tables.server.d.ts +9 -7
- package/dist/core/auth/better-auth-tables.server.js +9 -7
- package/dist/core/auth/constant.d.ts +3 -3
- package/dist/core/auth/constant.js +3 -3
- package/dist/core/auth/constant.server.d.ts +3 -3
- package/dist/core/auth/constant.server.js +3 -3
- package/dist/core/auth/handler/index.server.js +37 -15
- package/dist/core/auth/hooks/create-better-auth-user.server.d.ts +4 -2
- package/dist/core/auth/hooks/create-better-auth-user.server.js +132 -185
- package/dist/core/auth/hooks/forward-roles.server.d.ts +2 -1
- package/dist/core/auth/hooks/forward-roles.server.js +3 -3
- package/dist/core/auth/hooks/populate-api-key.server.d.ts +2 -2
- package/dist/core/auth/hooks/populate-api-key.server.js +11 -3
- package/dist/core/auth/hooks/prevent-user-mutations.server.d.ts +2 -2
- package/dist/core/auth/hooks/prevent-user-mutations.server.js +5 -4
- package/dist/core/auth/hooks/sign-in-new-user.server.d.ts +5 -6
- package/dist/core/auth/hooks/sign-in-new-user.server.js +5 -6
- package/dist/core/auth/staff/derive.d.ts +10 -0
- package/dist/core/auth/staff/derive.js +10 -0
- package/dist/core/auth/tables.d.ts +4 -0
- package/dist/core/auth/tables.js +4 -0
- package/dist/core/auth/types.d.ts +10 -5
- package/dist/core/auth/user.server.d.ts +8 -3
- package/dist/core/auth/user.server.js +8 -3
- package/dist/core/auth/validate-config.d.ts +1 -3
- package/dist/core/auth/validate-config.js +2 -4
- package/dist/core/boot.server.d.ts +38 -32
- package/dist/core/boot.server.js +7 -2
- package/dist/core/codegen.server.d.ts +2 -3
- package/dist/core/codegen.server.js +18 -16
- package/dist/core/config/build.d.ts +1 -1
- package/dist/core/config/build.server.d.ts +2 -1
- package/dist/core/config/build.server.js +1 -0
- package/dist/core/config/context.server.d.ts +3 -9
- package/dist/core/config/context.server.js +3 -9
- package/dist/core/config/index.server.d.ts +4 -2
- package/dist/core/config/index.server.js +4 -2
- package/dist/core/config/types.d.ts +17 -6
- package/dist/core/config/validate.server.d.ts +4 -0
- package/dist/core/config/validate.server.js +100 -90
- package/dist/core/constants.d.ts +13 -5
- package/dist/core/constants.js +13 -5
- package/dist/core/constants.server.d.ts +7 -0
- package/dist/core/constants.server.js +7 -0
- package/dist/core/dev/cache.server.d.ts +10 -7
- package/dist/core/dev/cache.server.js +10 -11
- package/dist/core/dev/cli/commands/build.d.ts +7 -2
- package/dist/core/dev/cli/commands/build.js +38 -12
- package/dist/core/dev/cli/commands/clear.server.d.ts +6 -0
- package/dist/core/dev/cli/commands/clear.server.js +20 -6
- package/dist/core/dev/cli/commands/generate-exports.server.js +25 -4
- package/dist/core/dev/cli/commands/generate.server.d.ts +5 -0
- package/dist/core/dev/cli/commands/generate.server.js +7 -8
- package/dist/core/dev/cli/commands/init.server.d.ts +10 -1
- package/dist/core/dev/cli/commands/init.server.js +45 -53
- package/dist/core/dev/cli/commands/uploads-move.server.js +3 -0
- package/dist/core/dev/cli/index.js +34 -16
- package/dist/core/dev/cli/templates/build.d.ts +4 -0
- package/dist/core/dev/cli/templates/build.js +4 -0
- package/dist/core/dev/cli/templates/init.d.ts +7 -10
- package/dist/core/dev/cli/templates/init.js +22 -47
- package/dist/core/dev/cli/util/adapter-hooks.server.d.ts +15 -0
- package/dist/core/dev/cli/util/adapter-hooks.server.js +17 -0
- package/dist/core/dev/cli/util/package-manager.server.d.ts +10 -1
- package/dist/core/dev/cli/util/package-manager.server.js +21 -19
- package/dist/core/dev/cli/util/package.server.d.ts +1 -0
- package/dist/core/dev/cli/util/package.server.js +2 -2
- package/dist/core/dev/cli/util/project-name.d.ts +2 -1
- package/dist/core/dev/cli/util/project-name.js +6 -4
- package/dist/core/dev/cli/util/prompt.server.d.ts +2 -1
- package/dist/core/dev/cli/util/prompt.server.js +2 -1
- package/dist/core/dev/codegen/routes/common.server.d.ts +12 -0
- package/dist/core/dev/codegen/routes/common.server.js +9 -17
- package/dist/core/dev/codegen/routes/custom-css.server.d.ts +3 -9
- package/dist/core/dev/codegen/routes/custom-css.server.js +8 -34
- package/dist/core/dev/codegen/routes/index.server.d.ts +4 -5
- package/dist/core/dev/codegen/routes/index.server.js +33 -17
- package/dist/core/dev/codegen/routes/util.server.d.ts +13 -23
- package/dist/core/dev/codegen/routes/util.server.js +15 -25
- package/dist/core/dev/codegen/runtime/index.server.d.ts +2 -3
- package/dist/core/dev/codegen/runtime/index.server.js +2 -3
- package/dist/core/dev/codegen/runtime/parse-exports.server.js +10 -3
- package/dist/core/dev/codegen/sanitize/index.server.d.ts +11 -1
- package/dist/core/dev/codegen/sanitize/index.server.js +81 -50
- package/dist/core/dev/codegen/types/index.server.d.ts +2 -4
- package/dist/core/dev/codegen/types/index.server.js +6 -10
- package/dist/core/dev/codegen/types/templates.server.d.ts +4 -2
- package/dist/core/dev/codegen/types/templates.server.js +13 -26
- package/dist/core/dev/config-memo.server.js +6 -7
- package/dist/core/dev/constants.server.d.ts +4 -2
- package/dist/core/dev/constants.server.js +7 -4
- package/dist/core/dev/deny-storage.server.d.ts +2 -2
- package/dist/core/dev/deny-storage.server.js +2 -2
- package/dist/core/dev/ensure.server.d.ts +5 -0
- package/dist/core/dev/ensure.server.js +9 -22
- package/dist/core/dev/env.server.d.ts +3 -1
- package/dist/core/dev/env.server.js +3 -1
- package/dist/core/dev/vite.server.d.ts +10 -0
- package/dist/core/dev/vite.server.js +21 -5
- package/dist/core/errors/handler.server.d.ts +9 -3
- package/dist/core/errors/handler.server.js +11 -6
- package/dist/core/errors/index.d.ts +21 -1
- package/dist/core/errors/index.js +23 -3
- package/dist/core/fields/builders/boolean-builder.d.ts +4 -0
- package/dist/core/fields/builders/boolean-builder.js +6 -1
- package/dist/core/fields/builders/field-builder.d.ts +16 -4
- package/dist/core/fields/builders/field-builder.js +11 -0
- package/dist/core/fields/builders/form-field-builder.d.ts +46 -2
- package/dist/core/fields/builders/form-field-builder.js +47 -2
- package/dist/core/fields/builders/index.d.ts +0 -2
- package/dist/core/fields/builders/index.js +0 -2
- package/dist/core/fields/builders/select-builder.d.ts +13 -2
- package/dist/core/fields/builders/select-builder.js +13 -1
- package/dist/core/fields/initial.d.ts +4 -1
- package/dist/core/fields/types.d.ts +5 -6
- package/dist/core/fields/util.d.ts +9 -14
- package/dist/core/fields/util.js +10 -15
- package/dist/core/fields/validate.d.ts +3 -0
- package/dist/core/fields/validate.js +3 -0
- package/dist/core/fields/walk.d.ts +4 -1
- package/dist/core/fields/walk.js +1 -2
- package/dist/core/handler.server.d.ts +5 -0
- package/dist/core/handler.server.js +15 -1
- package/dist/core/i18n/en/common.d.ts +28 -0
- package/dist/core/i18n/en/common.js +28 -0
- package/dist/core/i18n/en/errors.d.ts +6 -0
- package/dist/core/i18n/en/errors.js +6 -0
- package/dist/core/i18n/en/fields.d.ts +11 -0
- package/dist/core/i18n/en/fields.js +12 -1
- package/dist/core/i18n/fr/common.d.ts +28 -0
- package/dist/core/i18n/fr/common.js +29 -0
- package/dist/core/i18n/fr/errors.d.ts +6 -0
- package/dist/core/i18n/fr/errors.js +6 -0
- package/dist/core/i18n/fr/fields.d.ts +11 -0
- package/dist/core/i18n/fr/fields.js +12 -1
- package/dist/core/i18n/index.d.ts +1 -0
- package/dist/core/i18n/index.js +7 -0
- package/dist/core/i18n/register.server.js +1 -1
- package/dist/core/locale/types.d.ts +2 -6
- package/dist/core/logger.server.js +8 -2
- package/dist/core/panel/configure.js +2 -2
- package/dist/core/panel/types.d.ts +4 -2
- package/dist/core/pipeline/build-document.server.d.ts +2 -2
- package/dist/core/pipeline/build-document.server.js +2 -2
- package/dist/core/pipeline/build.server.js +2 -12
- package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.d.ts +6 -6
- package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.js +5 -5
- package/dist/core/pipeline/hooks/original-config-map.server.d.ts +3 -2
- package/dist/core/pipeline/hooks/original-config-map.server.js +3 -2
- package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +2 -1
- package/dist/core/pipeline/hooks/process-document-fields.server.js +4 -9
- package/dist/core/pipeline/hooks/sort-document-props.server.js +4 -3
- package/dist/core/pipeline/hooks/validate-fields.server.d.ts +15 -1
- package/dist/core/pipeline/hooks/validate-fields.server.js +142 -47
- package/dist/core/pipeline/persist/blocks/extract.server.d.ts +5 -0
- package/dist/core/pipeline/persist/blocks/extract.server.js +5 -0
- package/dist/core/pipeline/persist/blocks/index.server.d.ts +3 -7
- package/dist/core/pipeline/persist/blocks/index.server.js +3 -8
- package/dist/core/pipeline/persist/relations/diff.server.js +1 -0
- package/dist/core/pipeline/persist/relations/extract.server.d.ts +1 -0
- package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
- package/dist/core/pipeline/persist/relations/index.server.d.ts +6 -0
- package/dist/core/pipeline/persist/relations/index.server.js +31 -8
- package/dist/core/pipeline/persist/repeatable.server.d.ts +21 -12
- package/dist/core/pipeline/persist/repeatable.server.js +28 -4
- package/dist/core/pipeline/persist/tree/extract.server.d.ts +5 -0
- package/dist/core/pipeline/persist/tree/extract.server.js +6 -8
- package/dist/core/pipeline/persist/tree/index.server.d.ts +5 -0
- package/dist/core/pipeline/persist/tree/index.server.js +5 -0
- package/dist/core/pipeline/populate-relations.server.d.ts +1 -0
- package/dist/core/pipeline/populate-relations.server.js +1 -0
- package/dist/core/pipeline/run.server.d.ts +26 -17
- package/dist/core/pipeline/run.server.js +51 -9
- package/dist/core/pipeline/types.d.ts +30 -7
- package/dist/core/pipeline/without-denied-fields.d.ts +15 -0
- package/dist/core/pipeline/without-denied-fields.js +53 -2
- package/dist/core/plugins/api-init/index.server.d.ts +8 -0
- package/dist/core/plugins/api-init/index.server.js +8 -0
- package/dist/core/plugins/cache/HeaderButton.svelte +15 -6
- package/dist/core/plugins/cache/cache.server.d.ts +9 -0
- package/dist/core/plugins/cache/cache.server.js +9 -0
- package/dist/core/plugins/cache/handler.server.d.ts +5 -0
- package/dist/core/plugins/cache/handler.server.js +5 -0
- package/dist/core/plugins/cache/module.server.d.ts +4 -19
- package/dist/core/plugins/cache/module.server.js +5 -1
- package/dist/core/plugins/cache/types.d.ts +6 -0
- package/dist/core/plugins/index.d.ts +1 -0
- package/dist/core/plugins/index.js +1 -0
- package/dist/core/plugins/mailer/index.server.d.ts +5 -2
- package/dist/core/plugins/mailer/index.server.js +4 -0
- package/dist/core/plugins/plugins.server.d.ts +1 -0
- package/dist/core/plugins/plugins.server.js +1 -0
- package/dist/core/plugins/sse/client.js +4 -0
- package/dist/core/prototype/area/definition.server.d.ts +2 -3
- package/dist/core/prototype/area/definition.server.js +2 -3
- package/dist/core/prototype/area/operations/find.d.ts +5 -0
- package/dist/core/prototype/area/operations/find.js +5 -0
- package/dist/core/prototype/area/rest/endpoint.server.d.ts +3 -3
- package/dist/core/prototype/area/rest/endpoint.server.js +3 -3
- package/dist/core/prototype/area/rest/get.server.d.ts +2 -1
- package/dist/core/prototype/area/rest/get.server.js +2 -1
- package/dist/core/prototype/area/rest/update.server.d.ts +2 -1
- package/dist/core/prototype/area/rest/update.server.js +2 -1
- package/dist/core/prototype/collection/api.server.d.ts +15 -1
- package/dist/core/prototype/collection/api.server.js +16 -0
- package/dist/core/prototype/collection/augment-label.d.ts +9 -0
- package/dist/core/prototype/collection/augment-label.js +9 -0
- package/dist/core/prototype/collection/definition.d.ts +1 -1
- package/dist/core/prototype/collection/definition.js +1 -1
- package/dist/core/prototype/collection/hooks/merge-with-initial.server.d.ts +3 -3
- package/dist/core/prototype/collection/hooks/merge-with-initial.server.js +3 -3
- package/dist/core/prototype/collection/hooks.server.d.ts +2 -6
- package/dist/core/prototype/collection/hooks.server.js +8 -9
- package/dist/core/prototype/collection/nested/hooks/add-children.server.d.ts +3 -1
- package/dist/core/prototype/collection/nested/hooks/add-children.server.js +19 -11
- package/dist/core/prototype/collection/nested/hooks/index.server.d.ts +1 -0
- package/dist/core/prototype/collection/nested/hooks/index.server.js +1 -0
- package/dist/core/prototype/collection/nested/hooks/place-at-end.server.d.ts +10 -0
- package/dist/core/prototype/collection/nested/hooks/place-at-end.server.js +24 -0
- package/dist/core/prototype/collection/nested/move.server.d.ts +35 -0
- package/dist/core/prototype/collection/nested/move.server.js +74 -0
- package/dist/core/prototype/collection/operations/count.d.ts +19 -0
- package/dist/core/prototype/collection/operations/count.js +23 -0
- package/dist/core/prototype/collection/operations/create.d.ts +16 -0
- package/dist/core/prototype/collection/operations/create.js +46 -26
- package/dist/core/prototype/collection/operations/delete-by-id.d.ts +5 -0
- package/dist/core/prototype/collection/operations/delete-by-id.js +5 -0
- package/dist/core/prototype/collection/operations/delete.d.ts +8 -0
- package/dist/core/prototype/collection/operations/delete.js +8 -0
- package/dist/core/prototype/collection/operations/duplicate.d.ts +8 -0
- package/dist/core/prototype/collection/operations/duplicate.js +12 -0
- package/dist/core/prototype/collection/operations/find-by-id.d.ts +5 -0
- package/dist/core/prototype/collection/operations/find-by-id.js +5 -0
- package/dist/core/prototype/collection/operations/find.d.ts +6 -1
- package/dist/core/prototype/collection/operations/find.js +7 -2
- package/dist/core/prototype/collection/rest/count.server.d.ts +5 -0
- package/dist/core/prototype/collection/rest/count.server.js +12 -0
- package/dist/core/prototype/collection/rest/create.server.d.ts +2 -1
- package/dist/core/prototype/collection/rest/create.server.js +2 -1
- package/dist/core/prototype/collection/rest/delete-by-id.server.d.ts +1 -3
- package/dist/core/prototype/collection/rest/delete-by-id.server.js +1 -3
- package/dist/core/prototype/collection/rest/get-by-id.server.d.ts +2 -1
- package/dist/core/prototype/collection/rest/get-by-id.server.js +2 -1
- package/dist/core/prototype/collection/rest/get.server.d.ts +2 -1
- package/dist/core/prototype/collection/rest/get.server.js +2 -1
- package/dist/core/prototype/collection/rest/index.server.js +5 -0
- package/dist/core/prototype/collection/rest/lock.server.js +0 -5
- package/dist/core/prototype/collection/rest/move.server.d.ts +11 -0
- package/dist/core/prototype/collection/rest/move.server.js +34 -0
- package/dist/core/prototype/collection/rest/update-by-id.server.d.ts +3 -1
- package/dist/core/prototype/collection/rest/update-by-id.server.js +3 -1
- package/dist/core/prototype/collection/thumbnail/hooks/set-document-thumbnail.server.js +17 -9
- package/dist/core/prototype/collection/upload/boot/index.server.d.ts +3 -5
- package/dist/core/prototype/collection/upload/boot/index.server.js +3 -5
- package/dist/core/prototype/collection/upload/directories/configure.server.js +1 -2
- package/dist/core/prototype/collection/upload/directories/create.server.d.ts +15 -0
- package/dist/core/prototype/collection/upload/directories/create.server.js +19 -0
- package/dist/core/prototype/collection/upload/directories/derive.js +2 -2
- package/dist/core/prototype/collection/upload/directories/pipeline.server.js +5 -4
- package/dist/core/prototype/collection/upload/disk/save.server.d.ts +9 -5
- package/dist/core/prototype/collection/upload/disk/save.server.js +19 -6
- package/dist/core/prototype/collection/upload/ensure.server.d.ts +2 -7
- package/dist/core/prototype/collection/upload/ensure.server.js +2 -7
- package/dist/core/prototype/collection/upload/handler.server.d.ts +4 -0
- package/dist/core/prototype/collection/upload/handler.server.js +13 -4
- package/dist/core/prototype/collection/upload/hooks/convert-base64.server.d.ts +3 -10
- package/dist/core/prototype/collection/upload/hooks/convert-base64.server.js +5 -18
- package/dist/core/prototype/collection/upload/hooks/delete-folder-contents.server.d.ts +10 -0
- package/dist/core/prototype/collection/upload/hooks/delete-folder-contents.server.js +30 -0
- package/dist/core/prototype/collection/upload/hooks/extract-path.server.d.ts +1 -1
- package/dist/core/prototype/collection/upload/hooks/extract-path.server.js +1 -1
- package/dist/core/prototype/collection/upload/hooks/handle-path-creation.server.js +8 -20
- package/dist/core/prototype/collection/upload/hooks/index.server.d.ts +2 -5
- package/dist/core/prototype/collection/upload/hooks/index.server.js +2 -5
- package/dist/core/prototype/collection/upload/hooks/populate-sizes.server.d.ts +4 -2
- package/dist/core/prototype/collection/upload/hooks/populate-sizes.server.js +18 -19
- package/dist/core/prototype/collection/upload/hooks/process-file-upload.server.d.ts +3 -1
- package/dist/core/prototype/collection/upload/hooks/process-file-upload.server.js +16 -3
- package/dist/core/prototype/collection/upload/hooks/update-directory-children.server.js +3 -2
- package/dist/core/prototype/collection/upload/module.d.ts +4 -2
- package/dist/core/prototype/collection/upload/module.js +12 -17
- package/dist/core/prototype/collection/upload/module.server.d.ts +3 -4
- package/dist/core/prototype/collection/upload/module.server.js +3 -4
- package/dist/core/prototype/collection/upload/types.d.ts +21 -6
- package/dist/core/prototype/collection/upload/util/client.d.ts +2 -2
- package/dist/core/prototype/collection/upload/util/client.js +2 -2
- package/dist/core/prototype/collection/upload/util/config.d.ts +1 -0
- package/dist/core/prototype/collection/upload/util/converter.server.d.ts +5 -0
- package/dist/core/prototype/collection/upload/util/converter.server.js +16 -24
- package/dist/core/prototype/collection/upload/util/mime.d.ts +60 -0
- package/dist/core/prototype/collection/upload/util/mime.js +94 -4
- package/dist/core/prototype/collection/upload/util/path.d.ts +5 -1
- package/dist/core/prototype/collection/upload/util/path.js +9 -12
- package/dist/core/prototype/define.d.ts +14 -0
- package/dist/core/prototype/define.js +14 -0
- package/dist/core/prototype/shared/title/find-title.js +1 -0
- package/dist/core/prototype/shared/title/select.d.ts +2 -2
- package/dist/core/prototype/shared/title/select.js +2 -2
- package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +2 -3
- package/dist/core/prototype/shared/versions/augment.js +8 -4
- package/dist/core/prototype/shared/versions/hooks/handle-new-version.server.js +6 -2
- package/dist/core/prototype/shared/versions/validate-config.server.js +1 -2
- package/dist/core/prototype/types.d.ts +0 -5
- package/dist/core/rime.server.d.ts +3 -2
- package/dist/core/rime.server.js +3 -2
- package/dist/core/routes/context.server.d.ts +11 -0
- package/dist/core/routes/context.server.js +11 -0
- package/dist/core/routes/handler.server.d.ts +4 -3
- package/dist/core/routes/handler.server.js +4 -3
- package/dist/core/routes/panel-navigation.d.ts +4 -5
- package/dist/core/routes/panel-navigation.js +4 -8
- package/dist/core/routes/util.d.ts +8 -2
- package/dist/core/routes/util.js +10 -4
- package/dist/fields/blocks/component/AddBlockButton.svelte +1 -0
- package/dist/fields/blocks/component/Blocks.svelte +15 -11
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte +22 -10
- package/dist/fields/blocks/component/focus/LayersList.svelte +5 -0
- package/dist/fields/blocks/component/focus/Palette.svelte +0 -1
- package/dist/fields/blocks/component/focus/Renders.svelte +5 -4
- package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +2 -1
- package/dist/fields/blocks/component/focus/focus.svelte.js +42 -13
- package/dist/fields/blocks/component/picker/BlockPicker.svelte +2 -2
- package/dist/fields/blocks/index.d.ts +16 -0
- package/dist/fields/blocks/index.js +15 -2
- package/dist/fields/checkbox/component/Checkbox.svelte +1 -0
- package/dist/fields/combobox/component/ComboBox.svelte +3 -2
- package/dist/fields/combobox/index.d.ts +1 -0
- package/dist/fields/combobox/index.js +1 -0
- package/dist/fields/component/index.d.ts +3 -0
- package/dist/fields/component/index.js +3 -0
- package/dist/fields/date/component/Date.svelte +8 -5
- package/dist/fields/date/index.d.ts +1 -0
- package/dist/fields/date/index.js +1 -0
- package/dist/fields/email/component/Email.svelte +8 -5
- package/dist/fields/email/index.d.ts +1 -0
- package/dist/fields/email/index.js +1 -0
- package/dist/fields/group/component/Group.svelte +8 -15
- package/dist/fields/group/index.d.ts +7 -1
- package/dist/fields/group/index.js +5 -4
- package/dist/fields/link/component/Link.svelte +19 -8
- package/dist/fields/link/component/RessourceInput.svelte +68 -47
- package/dist/fields/link/index.d.ts +12 -0
- package/dist/fields/link/index.js +14 -1
- package/dist/fields/number/component/Number.svelte +1 -0
- package/dist/fields/number/index.js +5 -3
- package/dist/fields/radio/component/Radio.svelte +12 -3
- package/dist/fields/radio/index.d.ts +1 -0
- package/dist/fields/radio/index.js +1 -0
- package/dist/fields/relation/component/Cell.svelte +4 -4
- package/dist/fields/relation/component/Relation.svelte +92 -131
- package/dist/fields/relation/component/Relation.svelte.d.ts +0 -1
- package/dist/fields/relation/component/RelationInline.svelte +22 -27
- package/dist/fields/relation/component/default/Default.svelte +50 -19
- package/dist/fields/relation/component/default/Default.svelte.d.ts +12 -1
- package/dist/fields/relation/component/types.d.ts +5 -3
- package/dist/fields/relation/component/upload/Browse.svelte +50 -41
- package/dist/fields/relation/component/upload/Browse.svelte.d.ts +6 -1
- package/dist/fields/relation/component/upload/Upload.svelte +8 -3
- package/dist/fields/relation/component/upload/Upload.svelte.d.ts +0 -1
- package/dist/fields/relation/index.d.ts +27 -10
- package/dist/fields/relation/index.js +16 -0
- package/dist/fields/relation/populate.js +1 -0
- package/dist/fields/relation/query.d.ts +22 -0
- package/dist/fields/relation/query.js +29 -0
- package/dist/fields/relation/relation.test-d.js +11 -0
- package/dist/fields/repeatable/RepeatableActions.svelte +4 -0
- package/dist/fields/repeatable/RepeatableActions.svelte.d.ts +4 -0
- package/dist/fields/repeatable.js +3 -21
- package/dist/fields/rich-text/client.d.ts +26 -0
- package/dist/fields/rich-text/client.js +26 -0
- package/dist/fields/rich-text/component/RichTextInline.svelte +2 -9
- package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +2 -9
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +2 -0
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +0 -1
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.svelte +1 -2
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +0 -1
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.svelte +9 -6
- package/dist/fields/rich-text/component/context.svelte.d.ts +1 -0
- package/dist/fields/rich-text/component/context.svelte.js +1 -0
- package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -1
- package/dist/fields/rich-text/component/drag-handle/drag-handle.svelte +1 -0
- package/dist/fields/rich-text/component/styles/editor.css +0 -1
- package/dist/fields/rich-text/component/styles/field.css +10 -11
- package/dist/fields/rich-text/core/build-editor-config.d.ts +15 -6
- package/dist/fields/rich-text/core/build-editor-config.js +47 -66
- package/dist/fields/rich-text/core/extensions/current-node/current-node.css +1 -0
- package/dist/fields/rich-text/core/extensions/current-node/current-node.d.ts +2 -2
- package/dist/fields/rich-text/core/extensions/current-node/current-node.js +3 -4
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.d.ts +5 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +40 -77
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +1 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.d.ts +4 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.js +5 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.d.ts +5 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.js +11 -13
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.d.ts +6 -8
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.js +9 -14
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.d.ts +1 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.js +6 -5
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getOuterNode.d.ts +3 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getOuterNode.js +8 -21
- package/dist/fields/rich-text/core/features/blockquote.js +5 -1
- package/dist/fields/rich-text/core/features/bold.js +0 -3
- package/dist/fields/rich-text/core/features/bullet-list.js +5 -1
- package/dist/fields/rich-text/core/features/fields/extension.d.ts +1 -0
- package/dist/fields/rich-text/core/features/fields/extension.js +1 -0
- package/dist/fields/rich-text/core/features/fields/fields-form.svelte +54 -0
- package/dist/fields/rich-text/core/features/fields/fields-form.svelte.d.ts +14 -0
- package/dist/fields/rich-text/core/features/fields/fields.svelte +30 -35
- package/dist/fields/rich-text/core/features/fields/index.d.ts +2 -0
- package/dist/fields/rich-text/core/features/fields/index.js +1 -0
- package/dist/fields/rich-text/core/features/heading.js +19 -68
- package/dist/fields/rich-text/core/features/hr/hr.css +1 -2
- package/dist/fields/rich-text/core/features/hr/hr.js +5 -1
- package/dist/fields/rich-text/core/features/index.d.ts +1 -0
- package/dist/fields/rich-text/core/features/index.js +1 -0
- package/dist/fields/rich-text/core/features/json-attribute.d.ts +1 -1
- package/dist/fields/rich-text/core/features/json-attribute.js +1 -1
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +61 -58
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte.d.ts +3 -1
- package/dist/fields/rich-text/core/features/link/index.d.ts +5 -0
- package/dist/fields/rich-text/core/features/link/index.js +2 -14
- package/dist/fields/rich-text/core/features/ordered-list.js +5 -1
- package/dist/fields/rich-text/core/features/paragraph.js +5 -1
- package/dist/fields/rich-text/core/features/pick-dialog.svelte +16 -4
- package/dist/fields/rich-text/core/features/pick-dialog.svelte.d.ts +7 -3
- package/dist/fields/rich-text/core/features/resource/index.d.ts +1 -0
- package/dist/fields/rich-text/core/features/resource/index.js +1 -0
- package/dist/fields/rich-text/core/features/resource/resource-extension.d.ts +1 -0
- package/dist/fields/rich-text/core/features/resource/resource-extension.js +8 -6
- package/dist/fields/rich-text/core/features/resource/resource.svelte +38 -49
- package/dist/fields/rich-text/core/features/resource/types.d.ts +1 -0
- package/dist/fields/rich-text/core/features/upload/index.d.ts +1 -0
- package/dist/fields/rich-text/core/features/upload/index.js +2 -1
- package/dist/fields/rich-text/core/features/upload/upload-extension.d.ts +6 -0
- package/dist/fields/rich-text/core/features/upload/upload-extension.js +2 -2
- package/dist/fields/{relation/component → rich-text/core/features}/upload/upload.css +1 -2
- package/dist/fields/rich-text/core/features/upload/upload.svelte +47 -73
- package/dist/fields/rich-text/core/features/upload/upload.svelte.d.ts +1 -0
- package/dist/fields/rich-text/core/render-rich-text.svelte +30 -16
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte +8 -3
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +1 -0
- package/dist/fields/rich-text/core/svelte/constant.d.ts +1 -0
- package/dist/fields/rich-text/core/svelte/constant.js +1 -0
- package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.d.ts +10 -0
- package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.js +23 -6
- package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte +6 -2
- package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte.d.ts +1 -0
- package/dist/fields/rich-text/core/svelte/renderer.d.ts +1 -0
- package/dist/fields/rich-text/core/svelte/renderer.js +1 -0
- package/dist/fields/rich-text/core/types.d.ts +11 -0
- package/dist/fields/rich-text/index.d.ts +2 -0
- package/dist/fields/rich-text/index.js +12 -7
- package/dist/fields/rich-text/json.d.ts +6 -4
- package/dist/fields/rich-text/json.js +6 -4
- package/dist/fields/select/component/Select.svelte +37 -12
- package/dist/fields/select/index.d.ts +2 -1
- package/dist/fields/select/index.js +1 -0
- package/dist/fields/separator/index.d.ts +1 -0
- package/dist/fields/separator/index.js +1 -0
- package/dist/fields/slug/component/Slug.svelte +14 -13
- package/dist/fields/slug/index.d.ts +11 -0
- package/dist/fields/slug/index.js +11 -0
- package/dist/fields/tabs/component/Tabs.svelte +4 -7
- package/dist/fields/tabs/index.d.ts +10 -0
- package/dist/fields/tabs/index.js +10 -0
- package/dist/fields/text/component/TextInline.svelte +12 -10
- package/dist/fields/text/index.d.ts +7 -0
- package/dist/fields/text/index.js +9 -2
- package/dist/fields/textarea/index.d.ts +3 -0
- package/dist/fields/textarea/index.js +5 -2
- package/dist/fields/time/index.d.ts +1 -0
- package/dist/fields/time/index.js +4 -6
- package/dist/fields/toggle/component/Toggle.svelte +1 -0
- package/dist/fields/toggle/index.d.ts +1 -0
- package/dist/fields/toggle/index.js +1 -0
- package/dist/fields/tree/component/AddItemButton.svelte +3 -2
- package/dist/fields/tree/component/AddItemButton.svelte.d.ts +1 -1
- package/dist/fields/tree/component/Tree.svelte +16 -57
- package/dist/fields/tree/component/TreeBlock.svelte +26 -40
- package/dist/fields/tree/component/props.d.ts +3 -2
- package/dist/fields/tree/index.js +14 -2
- package/dist/fields/tree/util.js +0 -3
- package/dist/fields/types.d.ts +23 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/live/Consumer.svelte +6 -0
- package/dist/live/LiveEdit.svelte +23 -5
- package/dist/live/LiveEdit.svelte.d.ts +2 -1
- package/dist/live/Provider.svelte +5 -1
- package/dist/live/context.svelte.d.ts +3 -4
- package/dist/live/context.svelte.js +9 -6
- package/dist/panel/components/Root.svelte +7 -1
- package/dist/panel/components/fields/FieldsPreview.svelte +15 -1
- package/dist/panel/components/fields/Label.svelte +2 -0
- package/dist/panel/components/fields/RenderFields.svelte +12 -1
- package/dist/panel/components/fields/fieldset.svelte.d.ts +7 -1
- package/dist/panel/components/fields/fieldset.svelte.js +7 -1
- package/dist/panel/components/fields/setting.css +7 -0
- package/dist/panel/components/sections/auth/AuthForm.svelte +4 -1
- package/dist/panel/components/sections/collection/Avatar.svelte +1 -1
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +3 -0
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +11 -1
- package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +10 -1
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +45 -34
- package/dist/panel/components/sections/collection/folder/Folders.svelte +1 -0
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +8 -3
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +2 -1
- package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +3 -1
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +4 -0
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +1 -5
- package/dist/panel/components/sections/collection/header/SearchInput.svelte +2 -0
- package/dist/panel/components/sections/collection/header/SelectUI.svelte +25 -5
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +4 -1
- package/dist/panel/components/sections/collection/list/row/Row.svelte +16 -16
- package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -4
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +4 -80
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +18 -8
- package/dist/panel/components/sections/collection/tree/sortable.d.ts +11 -0
- package/dist/panel/components/sections/collection/tree/sortable.js +45 -0
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +5 -3
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte.d.ts +0 -1
- package/dist/panel/components/sections/commands/CommandPalette.svelte +5 -0
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +14 -4
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte.d.ts +2 -0
- package/dist/panel/components/sections/document/AuthFooter.svelte +37 -31
- package/dist/panel/components/sections/document/AuthFooter.svelte.d.ts +0 -2
- package/dist/panel/components/sections/document/ButtonSave.svelte +2 -6
- package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +1 -3
- package/dist/panel/components/sections/document/ButtonStatus.svelte +24 -11
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +16 -0
- package/dist/panel/components/sections/document/CurrentlyEdited.svelte +5 -3
- package/dist/panel/components/sections/document/CurrentlyEdited.svelte.d.ts +1 -0
- package/dist/panel/components/sections/document/Document.svelte +29 -18
- package/dist/panel/components/sections/document/DocumentChildren.svelte +48 -41
- package/dist/panel/components/sections/document/Header.svelte +13 -11
- package/dist/panel/components/sections/document/Settings.svelte +127 -157
- package/dist/panel/components/sections/document/Versions.svelte +11 -2
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +32 -13
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -0
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +24 -10
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +3 -0
- package/dist/panel/components/sections/live/LiveEditPanel.svelte +11 -5
- package/dist/panel/components/sections/live/LiveEditPanel.svelte.d.ts +10 -3
- package/dist/panel/components/sections/live/LiveFloatingUI.svelte +18 -2
- package/dist/panel/components/sections/live/LiveFloatingUI.svelte.d.ts +3 -0
- package/dist/panel/components/ui/button/button.svelte +0 -3
- package/dist/panel/components/ui/calendar/calendar.css +0 -1
- package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/panel/components/ui/card-resource/card-resource.svelte +17 -3
- package/dist/panel/components/ui/card-resource/card-resource.svelte.d.ts +2 -0
- package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/panel/components/ui/command/command-count.css +6 -0
- package/dist/panel/components/ui/command/command-count.svelte +15 -0
- package/dist/panel/components/ui/command/command-count.svelte.d.ts +9 -0
- package/dist/panel/components/ui/command/command-dialog.css +2 -0
- package/dist/panel/components/ui/command/command-input-select.svelte +5 -0
- package/dist/panel/components/ui/command/filter.d.ts +10 -0
- package/dist/panel/components/ui/command/filter.js +11 -0
- package/dist/panel/components/ui/command/index.d.ts +2 -1
- package/dist/panel/components/ui/command/index.js +2 -1
- package/dist/panel/components/ui/context-menu/context-menu.css +2 -2
- package/dist/panel/components/ui/dialog/dialog-content.css +4 -1
- package/dist/panel/components/ui/dialog/dialog-content.svelte +8 -1
- package/dist/panel/components/ui/dialog/dialog-overlay.css +2 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +2 -2
- package/dist/panel/components/ui/input/input.svelte +3 -0
- package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +1 -1
- package/dist/panel/components/ui/layer/layer.svelte.d.ts +22 -0
- package/dist/panel/components/ui/layer/layer.svelte.js +37 -0
- package/dist/panel/components/ui/nav/Nav.svelte +4 -9
- package/dist/panel/components/ui/nav/NavGroup.svelte +6 -6
- package/dist/panel/components/ui/nav/NavItem.svelte +1 -0
- package/dist/panel/components/ui/nav/NavItem.svelte.d.ts +1 -0
- package/dist/panel/components/ui/nav/UserButton.svelte +4 -4
- package/dist/panel/components/ui/page-header/PageHeader.svelte +1 -5
- package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +1 -0
- package/dist/panel/components/ui/popover/popover-content.css +2 -1
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +0 -1
- package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte +3 -4
- package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte.d.ts +1 -1
- package/dist/panel/components/ui/scroll-area/scroll-area.css +0 -6
- package/dist/panel/components/ui/scroll-area/scroll-area.svelte +4 -1
- package/dist/panel/components/ui/sheet/index.d.ts +1 -1
- package/dist/panel/components/ui/sheet/sheet-content.svelte +13 -2
- package/dist/panel/components/ui/sheet/sheet-content.svelte.d.ts +3 -0
- package/dist/panel/components/ui/sheet/sheet.css +11 -43
- package/dist/panel/components/ui/sonner/sonner.css +5 -0
- package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
- package/dist/panel/components/ui/tag/tag.svelte +8 -1
- package/dist/panel/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/panel/components/ui/tree/tree-rows.css +1 -8
- package/dist/panel/context/api-proxy.svelte.d.ts +2 -0
- package/dist/panel/context/api-proxy.svelte.js +30 -4
- package/dist/panel/context/blocks-ops.d.ts +6 -0
- package/dist/panel/context/blocks-ops.js +6 -0
- package/dist/panel/context/bulk-delete.d.ts +4 -3
- package/dist/panel/context/bulk-delete.js +13 -7
- package/dist/panel/context/collection.svelte.d.ts +10 -22
- package/dist/panel/context/collection.svelte.js +73 -115
- package/dist/panel/context/commands.svelte.js +5 -0
- package/dist/panel/context/config.svelte.js +2 -0
- package/dist/panel/context/createContext.svelte.d.ts +1 -0
- package/dist/panel/context/createContext.svelte.js +1 -0
- package/dist/panel/context/documentForm.svelte.d.ts +4 -2
- package/dist/panel/context/documentForm.svelte.js +87 -159
- package/dist/panel/context/errors.svelte.d.ts +8 -0
- package/dist/panel/context/errors.svelte.js +8 -0
- package/dist/panel/context/form.svelte.d.ts +8 -1
- package/dist/panel/context/form.svelte.js +37 -40
- package/dist/panel/context/livePanel.svelte.d.ts +3 -0
- package/dist/panel/context/locale.svelte.js +3 -0
- package/dist/panel/context/nav.svelte.js +9 -21
- package/dist/panel/context/tree-ops.d.ts +14 -0
- package/dist/panel/context/tree-ops.js +70 -0
- package/dist/panel/context/versions.svelte.d.ts +6 -0
- package/dist/panel/context/versions.svelte.js +18 -0
- package/dist/panel/index.d.ts +1 -10
- package/dist/panel/pages/area/Area.svelte +1 -1
- package/dist/panel/pages/area/actions.server.js +1 -0
- package/dist/panel/pages/area/load.server.d.ts +1 -0
- package/dist/panel/pages/area/load.server.js +1 -1
- package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +23 -16
- package/dist/panel/pages/auth/forgot-password/load.server.d.ts +1 -0
- package/dist/panel/pages/auth/forgot-password/load.server.js +3 -5
- package/dist/panel/pages/auth/image.server.d.ts +6 -0
- package/dist/panel/pages/auth/image.server.js +19 -0
- package/dist/panel/pages/auth/reset-password/ResetPassword.svelte +22 -15
- package/dist/panel/pages/auth/reset-password/load.server.d.ts +3 -0
- package/dist/panel/pages/auth/reset-password/load.server.js +5 -5
- package/dist/panel/pages/auth/sign-in/actions.server.js +33 -25
- package/dist/panel/pages/auth/sign-in/load.server.d.ts +4 -0
- package/dist/panel/pages/auth/sign-in/load.server.js +6 -5
- package/dist/panel/pages/collection/Collection.svelte.d.ts +1 -1
- package/dist/panel/pages/collection/CollectionPage.svelte +31 -27
- package/dist/panel/pages/collection/CollectionPage.svelte.d.ts +1 -1
- package/dist/panel/pages/collection/load.server.d.ts +5 -2
- package/dist/panel/pages/collection/load.server.js +53 -54
- package/dist/panel/pages/collection-document/CollectionDocument.svelte +1 -1
- package/dist/panel/pages/collection-document/actions.server.js +3 -11
- package/dist/panel/pages/collection-document/load.server.d.ts +5 -0
- package/dist/panel/pages/collection-document/load.server.js +10 -3
- package/dist/panel/pages/dashboard/DashboardRow.svelte +13 -0
- package/dist/panel/pages/dashboard/load.server.d.ts +3 -0
- package/dist/panel/pages/dashboard/load.server.js +19 -8
- package/dist/panel/pages/live/Live.svelte +45 -45
- package/dist/panel/pages/live/load.server.d.ts +5 -0
- package/dist/panel/pages/live/load.server.js +5 -0
- package/dist/panel/pages/shared/DocumentPage.svelte +9 -5
- package/dist/panel/pages/shared/DocumentPage.svelte.d.ts +0 -1
- package/dist/panel/style/font.css +3 -3
- package/dist/panel/style/index.css +23 -8
- package/dist/panel/style/palette.css +1 -1
- package/dist/panel/style/size.css +1 -0
- package/dist/panel/style/z-index.css +18 -0
- package/dist/panel/types.d.ts +0 -1
- package/dist/panel/util/Sortable.d.ts +6 -1
- package/dist/panel/util/Sortable.js +6 -1
- package/dist/panel/util/auth.d.ts +18 -0
- package/dist/panel/util/auth.js +25 -0
- package/dist/panel/util/candidates.svelte.d.ts +118 -0
- package/dist/panel/util/candidates.svelte.js +176 -0
- package/dist/panel/util/count.d.ts +19 -0
- package/dist/panel/util/count.js +20 -0
- package/dist/panel/util/dataError.d.ts +1 -0
- package/dist/panel/util/dataError.js +1 -0
- package/dist/panel/util/storage.d.ts +13 -0
- package/dist/panel/util/storage.js +37 -0
- package/dist/panel/util/time.d.ts +7 -1
- package/dist/panel/util/time.js +19 -5
- package/dist/panel/util/upload-file.d.ts +0 -8
- package/dist/panel/util/upload-file.js +6 -12
- package/dist/server.js +3 -0
- package/dist/util/form-data.d.ts +3 -3
- package/dist/util/form-data.js +4 -2
- package/dist/util/function.d.ts +7 -6
- package/dist/util/function.js +7 -6
- package/dist/util/object.d.ts +10 -11
- package/dist/util/object.js +21 -55
- package/dist/util/random.d.ts +8 -12
- package/dist/util/random.js +34 -88
- package/dist/util/string.js +76 -114
- package/dist/util/types.d.ts +2 -0
- package/package.json +17 -15
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getComputedStyle.d.ts +0 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getComputedStyle.js +0 -4
- package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -0
- package/dist/fields/rich-text/core/features/resource/resource.css +0 -0
- package/dist/panel/style/util.css +0 -3
- package/dist/panel/util/once.svelte.d.ts +0 -3
- package/dist/panel/util/once.svelte.js +0 -12
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bundles } from './rows.server.js';
|
|
2
|
-
import { findManyPrototypes, readPrototype } from './read.server.js';
|
|
2
|
+
import { countPrototypes, findManyPrototypes, readPrototype } from './read.server.js';
|
|
3
3
|
import { deletePrototype, insertPrototype, updatePrototype, updateWherePrototype } from './write.server.js';
|
|
4
4
|
/**
|
|
5
5
|
* What the adapter can do to one registered collection.
|
|
@@ -16,6 +16,7 @@ export const createCollectionHandle = (deps) => {
|
|
|
16
16
|
versions: deps.versions,
|
|
17
17
|
find: (args) => readPrototype(read, { ...args, ...self }),
|
|
18
18
|
findMany: (args = {}) => findManyPrototypes(read, { ...args, ...self }),
|
|
19
|
+
count: (args = {}) => countPrototypes(read, { ...args, ...self }),
|
|
19
20
|
insert: (args) => insertPrototype(write, { ...args, slug, versions: deps.versions }),
|
|
20
21
|
update: (args) => updatePrototype(write, { ...args, slug, versions: deps.versions }),
|
|
21
22
|
updateWhere: (args) => updateWherePrototype(read, { ...args, slug }),
|
|
@@ -17,14 +17,12 @@ export declare function updateTableRecord(db: any, tables: any, tableName: strin
|
|
|
17
17
|
recordId: string;
|
|
18
18
|
data: any;
|
|
19
19
|
}): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Inserts a new record into a database table
|
|
22
|
-
* @returns The ID of the inserted record
|
|
23
|
-
*/
|
|
20
|
+
/** Inserts `data` as a new row of `tableName` and answers its id: `data.id`, or a new UUID. */
|
|
24
21
|
export declare function insertTableRecord(db: any, tables: any, tableName: string, data: any): Promise<string>;
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* Writes `data` on the locales row of `ownerId` in `locale`: updates the row when it exists,
|
|
24
|
+
* inserts it otherwise. The `ROW_ADDRESS` keys of `data` are dropped. Empty `data` writes nothing,
|
|
25
|
+
* so a locale nothing was written in has no row.
|
|
28
26
|
*/
|
|
29
27
|
export declare function upsertLocalizedData(db: any, tables: any, tableLocalesName: string, options: {
|
|
30
28
|
ownerId: string;
|
|
@@ -32,14 +30,24 @@ export declare function upsertLocalizedData(db: any, tables: any, tableLocalesNa
|
|
|
32
30
|
locale: string;
|
|
33
31
|
}): Promise<void>;
|
|
34
32
|
/**
|
|
35
|
-
*
|
|
33
|
+
* Splits a document's data between a table and its `__$$locales` branch: each key named like a
|
|
34
|
+
* column of one of them is copied there, bookkeeping columns (`id`, `ownerId`, `locale`)
|
|
35
|
+
* included. Without a `locale`, or without a branch, everything goes to the table.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* // title localized, slug not
|
|
39
|
+
* prepareSchemaData(
|
|
40
|
+
* { title: 'Home', slug: 'home' },
|
|
41
|
+
* { mainTableName: 'pages', localesTableName: 'pages__$$locales', locale: 'en', tables }
|
|
42
|
+
* )
|
|
43
|
+
* // { mainData: { slug: 'home' }, localizedData: { title: 'Home' }, isLocalized: true }
|
|
44
|
+
* ```
|
|
36
45
|
*/
|
|
37
46
|
export declare function prepareSchemaData(data: any, options: {
|
|
38
47
|
mainTableName: string;
|
|
39
48
|
localesTableName: string;
|
|
40
49
|
locale?: string;
|
|
41
50
|
tables: any;
|
|
42
|
-
fillNotNull?: boolean;
|
|
43
51
|
}): {
|
|
44
52
|
mainData: Record<string, any>;
|
|
45
53
|
localizedData: Record<string, any>;
|
|
@@ -66,75 +74,48 @@ export declare function prepareSchemaData(data: any, options: {
|
|
|
66
74
|
export declare function mergeContentRow(doc: RawDoc, contentTable: string, config: {
|
|
67
75
|
fields: FieldBuilder[];
|
|
68
76
|
}, select?: string[]): RawDoc;
|
|
77
|
+
/**
|
|
78
|
+
* The drizzle `columns` of a read with `select`: `id`, plus each selected path that is a column
|
|
79
|
+
* of `table` (`attributes.title` -> `attributes__title`). `undefined` without a `select`, which
|
|
80
|
+
* reads every column.
|
|
81
|
+
*/
|
|
69
82
|
export declare function columnsParams({ table, select }: {
|
|
70
83
|
table: Dic;
|
|
71
84
|
select?: string[];
|
|
72
85
|
}): Dic | undefined;
|
|
73
86
|
/**
|
|
74
|
-
*
|
|
75
|
-
* This transformation is needed because SQL databases don't support dots in column names.
|
|
76
|
-
*
|
|
77
|
-
* @param path - The document path with dot notation
|
|
78
|
-
* @returns The database column path with double underscore notation
|
|
87
|
+
* A document path as a column name: SQL names hold no dot, so `.` becomes `__`.
|
|
79
88
|
*
|
|
80
|
-
*
|
|
81
|
-
* //
|
|
82
|
-
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* pathToDatabaseColumn('attributes.hero.title') // 'attributes__hero__title'
|
|
91
|
+
* ```
|
|
83
92
|
*/
|
|
84
93
|
export declare const pathToDatabaseColumn: (path: string) => string;
|
|
85
94
|
/**
|
|
86
|
-
*
|
|
87
|
-
* This transforms database column names back to document property paths.
|
|
88
|
-
*
|
|
89
|
-
* @param path - The database column path with double underscore notation
|
|
90
|
-
* @returns The document path with dot notation
|
|
95
|
+
* A column name as a document path. A table key (it holds a `$`) stays as it is.
|
|
91
96
|
*
|
|
92
|
-
*
|
|
93
|
-
* //
|
|
94
|
-
*
|
|
97
|
+
* ```ts
|
|
98
|
+
* databaseColumnToPath('attributes__hero__title') // 'attributes.hero.title'
|
|
99
|
+
* ```
|
|
95
100
|
*/
|
|
96
101
|
export declare const databaseColumnToPath: (path: string) => string;
|
|
97
102
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* This function takes an object with keys using database column naming (e.g., 'attributes__title')
|
|
101
|
-
* and transforms them to document path format (e.g., 'attributes.title') while preserving the values.
|
|
103
|
+
* The object with each key turned from a column name into a document path.
|
|
102
104
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* // Returns { 'attributes.title': 'Home' }
|
|
108
|
-
* transformDatabaseColumnsToPaths({ 'attributes__title': 'Home' });
|
|
105
|
+
* ```ts
|
|
106
|
+
* transformDatabaseColumnsToPaths({ attributes__title: 'Home' }) // { 'attributes.title': 'Home' }
|
|
107
|
+
* ```
|
|
109
108
|
*/
|
|
110
109
|
export declare const transformDatabaseColumnsToPaths: (obj: Record<string, any>) => Record<string, any>;
|
|
111
110
|
/**
|
|
112
|
-
*
|
|
111
|
+
* The values of `data` for `columns`, keyed by column name: each column's path is read from the
|
|
112
|
+
* nested data (`attributes__title` from `data.attributes.title`). A missing value is left out,
|
|
113
|
+
* `null` is kept.
|
|
113
114
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* @param columns - The database schema columns definition
|
|
120
|
-
* @param params - Optional parameters for transformation
|
|
121
|
-
* @param params.fillNotNull - If true, adds default values for NOT NULL columns
|
|
122
|
-
* @returns A flat object with database column names and values
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* // Returns { 'attributes__title': 'Home' }
|
|
126
|
-
* transformDataToSchema(
|
|
127
|
-
* { attributes: { title: 'Home' } },
|
|
128
|
-
* { 'attributes__title': { dataType: 'string', notNull: true } }
|
|
129
|
-
* );
|
|
130
|
-
*
|
|
131
|
-
* // With fillNotNull, provides defaults for missing NOT NULL columns
|
|
132
|
-
* transformDataToSchema(
|
|
133
|
-
* { attributes: {} },
|
|
134
|
-
* { 'attributes__title': { dataType: 'string', notNull: true } },
|
|
135
|
-
* { fillNotNull: true }
|
|
136
|
-
* ); // Returns { 'attributes__title': '' }
|
|
115
|
+
* ```ts
|
|
116
|
+
* transformDataToSchema({ attributes: { title: 'Home' } }, columns) // { attributes__title: 'Home' }
|
|
117
|
+
* transformDataToSchema({ attributes: {} }, columns) // {}
|
|
118
|
+
* transformDataToSchema({ attributes: null }, columns) // { attributes__title: null }
|
|
119
|
+
* ```
|
|
137
120
|
*/
|
|
138
|
-
export declare const transformDataToSchema: (data: Record<string, any>, columns: Record<string, any
|
|
139
|
-
fillNotNull?: boolean;
|
|
140
|
-
}) => Record<string, any>;
|
|
121
|
+
export declare const transformDataToSchema: (data: Record<string, any>, columns: Record<string, any>) => Record<string, any>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RimeError } from '../core/errors/index.js';
|
|
2
2
|
import { omit, pick } from '../util/object.js';
|
|
3
|
-
import { randomId } from '../util/random.js';
|
|
4
3
|
import { baseFieldNames } from '../core/fields/util.js';
|
|
5
4
|
import { and, eq, getTableColumns } from 'drizzle-orm';
|
|
6
5
|
import { isPathsTable, JOIN_SUFFIX } from './naming.server.js';
|
|
@@ -24,10 +23,7 @@ export async function updateTableRecord(db, tables, tableName, options) {
|
|
|
24
23
|
await db.update(tables[tableName]).set(data).where(eq(tables[tableName].id, recordId));
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Inserts a new record into a database table
|
|
29
|
-
* @returns The ID of the inserted record
|
|
30
|
-
*/
|
|
26
|
+
/** Inserts `data` as a new row of `tableName` and answers its id: `data.id`, or a new UUID. */
|
|
31
27
|
export async function insertTableRecord(db, tables, tableName, data) {
|
|
32
28
|
const recordId = data.id || generatePK();
|
|
33
29
|
await db.insert(tables[tableName]).values({
|
|
@@ -37,8 +33,9 @@ export async function insertTableRecord(db, tables, tableName, data) {
|
|
|
37
33
|
return recordId;
|
|
38
34
|
}
|
|
39
35
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
36
|
+
* Writes `data` on the locales row of `ownerId` in `locale`: updates the row when it exists,
|
|
37
|
+
* inserts it otherwise. The `ROW_ADDRESS` keys of `data` are dropped. Empty `data` writes nothing,
|
|
38
|
+
* so a locale nothing was written in has no row.
|
|
42
39
|
*/
|
|
43
40
|
export async function upsertLocalizedData(db, tables, tableLocalesName, options) {
|
|
44
41
|
const { ownerId, locale } = options;
|
|
@@ -49,14 +46,12 @@ export async function upsertLocalizedData(db, tables, tableLocalesName, options)
|
|
|
49
46
|
where: { ownerId, locale }
|
|
50
47
|
});
|
|
51
48
|
if (localizedRow) {
|
|
52
|
-
// Update existing localized data
|
|
53
49
|
await db
|
|
54
50
|
.update(tableLocales)
|
|
55
51
|
.set(data)
|
|
56
52
|
.where(and(eq(tableLocales.ownerId, ownerId), eq(tableLocales.locale, locale)));
|
|
57
53
|
}
|
|
58
54
|
else {
|
|
59
|
-
// Insert new localized data
|
|
60
55
|
await db.insert(tableLocales).values({
|
|
61
56
|
...data,
|
|
62
57
|
id: generatePK(),
|
|
@@ -67,25 +62,34 @@ export async function upsertLocalizedData(db, tables, tableLocalesName, options)
|
|
|
67
62
|
}
|
|
68
63
|
}
|
|
69
64
|
/**
|
|
70
|
-
*
|
|
65
|
+
* Splits a document's data between a table and its `__$$locales` branch: each key named like a
|
|
66
|
+
* column of one of them is copied there, bookkeeping columns (`id`, `ownerId`, `locale`)
|
|
67
|
+
* included. Without a `locale`, or without a branch, everything goes to the table.
|
|
68
|
+
*
|
|
69
|
+
* ```ts
|
|
70
|
+
* // title localized, slug not
|
|
71
|
+
* prepareSchemaData(
|
|
72
|
+
* { title: 'Home', slug: 'home' },
|
|
73
|
+
* { mainTableName: 'pages', localesTableName: 'pages__$$locales', locale: 'en', tables }
|
|
74
|
+
* )
|
|
75
|
+
* // { mainData: { slug: 'home' }, localizedData: { title: 'Home' }, isLocalized: true }
|
|
76
|
+
* ```
|
|
71
77
|
*/
|
|
72
78
|
export function prepareSchemaData(data, options) {
|
|
73
|
-
const { mainTableName, localesTableName, locale, tables
|
|
79
|
+
const { mainTableName, localesTableName, locale, tables } = options;
|
|
74
80
|
if (locale && localesTableName in tables) {
|
|
75
|
-
// Handle localized fields
|
|
76
81
|
const unlocalizedColumns = getTableColumns(tables[mainTableName]);
|
|
77
82
|
const localizedColumns = getTableColumns(tables[localesTableName]);
|
|
78
83
|
return {
|
|
79
|
-
mainData: transformDataToSchema(data, unlocalizedColumns
|
|
80
|
-
localizedData: transformDataToSchema(data, localizedColumns
|
|
84
|
+
mainData: transformDataToSchema(data, unlocalizedColumns),
|
|
85
|
+
localizedData: transformDataToSchema(data, localizedColumns),
|
|
81
86
|
isLocalized: true
|
|
82
87
|
};
|
|
83
88
|
}
|
|
84
89
|
else {
|
|
85
|
-
// Handle non-localized fields
|
|
86
90
|
const columns = getTableColumns(tables[mainTableName]);
|
|
87
91
|
return {
|
|
88
|
-
mainData: transformDataToSchema(data, columns
|
|
92
|
+
mainData: transformDataToSchema(data, columns),
|
|
89
93
|
localizedData: {},
|
|
90
94
|
isLocalized: false
|
|
91
95
|
};
|
|
@@ -110,8 +114,7 @@ export function prepareSchemaData(data, options) {
|
|
|
110
114
|
* written.
|
|
111
115
|
*/
|
|
112
116
|
export function mergeContentRow(doc, contentTable, config, select) {
|
|
113
|
-
// A base row with no content row is as good as absent
|
|
114
|
-
// returns no result.
|
|
117
|
+
// A base row with no content row is as good as absent.
|
|
115
118
|
if (!doc[contentTable] || doc[contentTable].length === 0) {
|
|
116
119
|
throw new RimeError(RimeError.NOT_FOUND);
|
|
117
120
|
}
|
|
@@ -127,7 +130,7 @@ export function mergeContentRow(doc, contentTable, config, select) {
|
|
|
127
130
|
? pick([...select.filter((field) => rootProps.includes(field)), 'id', ...joined], doc)
|
|
128
131
|
: pick(['id', ...joined], doc);
|
|
129
132
|
// Filter out root props as they should come from the doc,
|
|
130
|
-
// plus the ownerId
|
|
133
|
+
// plus the ownerId which is equals to doc.id
|
|
131
134
|
const contentFields = omit([...rootProps, 'ownerId'], contentRow);
|
|
132
135
|
// `pick`/`omit` return generic Dic types, so TS can't statically confirm
|
|
133
136
|
// `id` survived — it always does, since we explicitly pick it above.
|
|
@@ -148,17 +151,20 @@ export function mergeContentRow(doc, contentTable, config, select) {
|
|
|
148
151
|
contentId: contentRow.id
|
|
149
152
|
};
|
|
150
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* The drizzle `columns` of a read with `select`: `id`, plus each selected path that is a column
|
|
156
|
+
* of `table` (`attributes.title` -> `attributes__title`). `undefined` without a `select`, which
|
|
157
|
+
* reads every column.
|
|
158
|
+
*/
|
|
151
159
|
export function columnsParams({ table, select }) {
|
|
152
160
|
// Create an object to hold the columns we want to select
|
|
153
161
|
const selectColumns = {};
|
|
154
162
|
// If select fields are specified, build the select columns object
|
|
155
163
|
if (select && select.length > 0) {
|
|
156
|
-
// Always include the ID column for the version
|
|
157
164
|
selectColumns.id = true;
|
|
158
165
|
// Process each requested field
|
|
159
166
|
for (const path of select) {
|
|
160
167
|
const sqlPath = pathToDatabaseColumn(path);
|
|
161
|
-
// If this column exists on the content table, add it to our select
|
|
162
168
|
if (sqlPath in table) {
|
|
163
169
|
selectColumns[sqlPath] = true;
|
|
164
170
|
}
|
|
@@ -167,27 +173,19 @@ export function columnsParams({ table, select }) {
|
|
|
167
173
|
return Object.keys(selectColumns).length ? selectColumns : undefined;
|
|
168
174
|
}
|
|
169
175
|
/**
|
|
170
|
-
*
|
|
171
|
-
* This transformation is needed because SQL databases don't support dots in column names.
|
|
172
|
-
*
|
|
173
|
-
* @param path - The document path with dot notation
|
|
174
|
-
* @returns The database column path with double underscore notation
|
|
176
|
+
* A document path as a column name: SQL names hold no dot, so `.` becomes `__`.
|
|
175
177
|
*
|
|
176
|
-
*
|
|
177
|
-
* //
|
|
178
|
-
*
|
|
178
|
+
* ```ts
|
|
179
|
+
* pathToDatabaseColumn('attributes.hero.title') // 'attributes__hero__title'
|
|
180
|
+
* ```
|
|
179
181
|
*/
|
|
180
182
|
export const pathToDatabaseColumn = (path) => path.replace(/\./g, '__');
|
|
181
183
|
/**
|
|
182
|
-
*
|
|
183
|
-
* This transforms database column names back to document property paths.
|
|
184
|
-
*
|
|
185
|
-
* @param path - The database column path with double underscore notation
|
|
186
|
-
* @returns The document path with dot notation
|
|
184
|
+
* A column name as a document path. A table key (it holds a `$`) stays as it is.
|
|
187
185
|
*
|
|
188
|
-
*
|
|
189
|
-
* //
|
|
190
|
-
*
|
|
186
|
+
* ```ts
|
|
187
|
+
* databaseColumnToPath('attributes__hero__title') // 'attributes.hero.title'
|
|
188
|
+
* ```
|
|
191
189
|
*/
|
|
192
190
|
export const databaseColumnToPath = (path) => isStructuralKey(path) ? path : path.replace(/__/g, '.');
|
|
193
191
|
/**
|
|
@@ -204,17 +202,11 @@ export const databaseColumnToPath = (path) => isStructuralKey(path) ? path : pat
|
|
|
204
202
|
*/
|
|
205
203
|
const isStructuralKey = (key) => key.includes('$');
|
|
206
204
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* This function takes an object with keys using database column naming (e.g., 'attributes__title')
|
|
210
|
-
* and transforms them to document path format (e.g., 'attributes.title') while preserving the values.
|
|
211
|
-
*
|
|
212
|
-
* @param obj - The object with database column keys
|
|
213
|
-
* @returns A new object with keys converted to document paths
|
|
205
|
+
* The object with each key turned from a column name into a document path.
|
|
214
206
|
*
|
|
215
|
-
*
|
|
216
|
-
* //
|
|
217
|
-
*
|
|
207
|
+
* ```ts
|
|
208
|
+
* transformDatabaseColumnsToPaths({ attributes__title: 'Home' }) // { 'attributes.title': 'Home' }
|
|
209
|
+
* ```
|
|
218
210
|
*/
|
|
219
211
|
export const transformDatabaseColumnsToPaths = (obj) => {
|
|
220
212
|
const result = {};
|
|
@@ -224,36 +216,19 @@ export const transformDatabaseColumnsToPaths = (obj) => {
|
|
|
224
216
|
return result;
|
|
225
217
|
};
|
|
226
218
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* @param params.fillNotNull - If true, adds default values for NOT NULL columns
|
|
237
|
-
* @returns A flat object with database column names and values
|
|
238
|
-
*
|
|
239
|
-
* @example
|
|
240
|
-
* // Returns { 'attributes__title': 'Home' }
|
|
241
|
-
* transformDataToSchema(
|
|
242
|
-
* { attributes: { title: 'Home' } },
|
|
243
|
-
* { 'attributes__title': { dataType: 'string', notNull: true } }
|
|
244
|
-
* );
|
|
245
|
-
*
|
|
246
|
-
* // With fillNotNull, provides defaults for missing NOT NULL columns
|
|
247
|
-
* transformDataToSchema(
|
|
248
|
-
* { attributes: {} },
|
|
249
|
-
* { 'attributes__title': { dataType: 'string', notNull: true } },
|
|
250
|
-
* { fillNotNull: true }
|
|
251
|
-
* ); // Returns { 'attributes__title': '' }
|
|
219
|
+
* The values of `data` for `columns`, keyed by column name: each column's path is read from the
|
|
220
|
+
* nested data (`attributes__title` from `data.attributes.title`). A missing value is left out,
|
|
221
|
+
* `null` is kept.
|
|
222
|
+
*
|
|
223
|
+
* ```ts
|
|
224
|
+
* transformDataToSchema({ attributes: { title: 'Home' } }, columns) // { attributes__title: 'Home' }
|
|
225
|
+
* transformDataToSchema({ attributes: {} }, columns) // {}
|
|
226
|
+
* transformDataToSchema({ attributes: null }, columns) // { attributes__title: null }
|
|
227
|
+
* ```
|
|
252
228
|
*/
|
|
253
|
-
export const transformDataToSchema = (data, columns
|
|
229
|
+
export const transformDataToSchema = (data, columns) => {
|
|
254
230
|
const result = {};
|
|
255
231
|
for (const column of Object.keys(columns)) {
|
|
256
|
-
const columnConfig = columns[column];
|
|
257
232
|
// Convert schema path (with __) to doc path (with .)
|
|
258
233
|
const docPath = databaseColumnToPath(column);
|
|
259
234
|
// Get value from nested path
|
|
@@ -265,45 +240,9 @@ export const transformDataToSchema = (data, columns, params = { fillNotNull: fal
|
|
|
265
240
|
break;
|
|
266
241
|
value = value[part];
|
|
267
242
|
}
|
|
268
|
-
|
|
269
|
-
if (value !== undefined && value !== null) {
|
|
243
|
+
if (value !== undefined) {
|
|
270
244
|
result[column] = value;
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
// Case 2: Value is null - use it unless we need to fill it
|
|
274
|
-
if (value === null && !params.fillNotNull) {
|
|
275
|
-
result[column] = null;
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
// Case 3: Add placeholders for missing or null values in not-null columns
|
|
279
|
-
if (params.fillNotNull && columnConfig.notNull) {
|
|
280
|
-
if (column === 'id') {
|
|
281
|
-
result[column] = randomId(32);
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
// A column with a default of its own takes it: the insert leaves it out
|
|
285
|
-
if (columnConfig.hasDefault)
|
|
286
|
-
continue;
|
|
287
|
-
console.warn(`No default value provided for ${column}, setting it with a placeholder`);
|
|
288
|
-
const empty = placeholder(columnConfig.dataType);
|
|
289
|
-
if (empty !== undefined) {
|
|
290
|
-
result[column] = empty;
|
|
291
|
-
}
|
|
292
245
|
}
|
|
293
246
|
}
|
|
294
247
|
return result;
|
|
295
248
|
};
|
|
296
|
-
/** A placeholder of a column's type, by drizzle's `dataType`: `'number double'`, `'object date'`… */
|
|
297
|
-
const placeholder = (dataType) => {
|
|
298
|
-
if (dataType.startsWith('string'))
|
|
299
|
-
return '';
|
|
300
|
-
if (dataType.startsWith('number'))
|
|
301
|
-
return 0;
|
|
302
|
-
if (dataType === 'boolean')
|
|
303
|
-
return false;
|
|
304
|
-
if (dataType === 'object date')
|
|
305
|
-
return new Date();
|
|
306
|
-
if (dataType === 'object json')
|
|
307
|
-
return {};
|
|
308
|
-
return undefined;
|
|
309
|
-
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the SQLite database and its migrations live, from the app root. Under `storage/`, which
|
|
3
|
+
* no URL reaches.
|
|
4
|
+
*
|
|
5
|
+
* ```
|
|
6
|
+
* storage/sqlite/app.sqlite
|
|
7
|
+
* storage/sqlite/20261001194217_dazzling_wallflower/migration.sql
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare const SQLITE_DIRECTORY = "storage/sqlite";
|
|
11
|
+
/** drizzle-kit's config, at the project root. */
|
|
12
|
+
export declare const DRIZZLE_CONFIG = "drizzle.config.ts";
|
|
13
|
+
/** The folder `rime db:move` moves to `SQLITE_DIRECTORY`. */
|
|
14
|
+
export declare const DB_MOVE_SOURCE = "db";
|
|
15
|
+
/** The package entry of the adapter's hooks, `AdapterHooks.module`. */
|
|
16
|
+
export declare const HOOKS_MODULE = "rimecms/adapter-sqlite/hooks";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the SQLite database and its migrations live, from the app root. Under `storage/`, which
|
|
3
|
+
* no URL reaches.
|
|
4
|
+
*
|
|
5
|
+
* ```
|
|
6
|
+
* storage/sqlite/app.sqlite
|
|
7
|
+
* storage/sqlite/20261001194217_dazzling_wallflower/migration.sql
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export const SQLITE_DIRECTORY = 'storage/sqlite';
|
|
11
|
+
/** drizzle-kit's config, at the project root. */
|
|
12
|
+
export const DRIZZLE_CONFIG = 'drizzle.config.ts';
|
|
13
|
+
/** The folder `rime db:move` moves to `SQLITE_DIRECTORY`. */
|
|
14
|
+
export const DB_MOVE_SOURCE = 'db';
|
|
15
|
+
/** The package entry of the adapter's hooks, `AdapterHooks.module`. */
|
|
16
|
+
export const HOOKS_MODULE = 'rimecms/adapter-sqlite/hooks';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Whether a drizzle config's content still names the old folder. */
|
|
2
|
+
export declare const namesSourceFolder: (content: string) => boolean;
|
|
3
|
+
/** Whether the project's `drizzle.config.ts` still names the old folder. */
|
|
4
|
+
export declare const drizzleConfigNamesSource: (root: string) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Moves `db/` to `storage/sqlite/`. `false` when there is no `db/`, so a second run moves nothing.
|
|
7
|
+
* An empty `storage/sqlite/` counts as absent. One holding a file throws, and nothing moves.
|
|
8
|
+
*/
|
|
9
|
+
export declare const moveDatabaseFolder: (root: string) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Points the paths of `drizzle.config.ts` that name the old folder at `storage/sqlite`, and
|
|
12
|
+
* answers each change. `[]` when the file is missing or names none.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* out: './db', // -> out: './storage/sqlite',
|
|
16
|
+
* url: 'file:./db/app.sqlite' // -> url: 'file:./storage/sqlite/app.sqlite'
|
|
17
|
+
* moveDrizzlePaths(root) // ["'./db' -> './storage/sqlite'", …]
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const moveDrizzlePaths: (root: string) => string[];
|
|
21
|
+
/**
|
|
22
|
+
* Adds `/storage` to `.gitignore` when no line there covers the whole folder. `false` when one
|
|
23
|
+
* does, or when there is no `.gitignore`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ignoreStorage: (root: string) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* `rime db:move`: moves the database folder, then points `drizzle.config.ts` at it, then makes
|
|
28
|
+
* `.gitignore` cover `storage/`. Loads no config and opens no database, so it runs in a deployed
|
|
29
|
+
* `app/` too.
|
|
30
|
+
*/
|
|
31
|
+
export declare const dbMove: () => void;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { logger } from '../core/logger.server.js';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmdirSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { DB_MOVE_SOURCE, DRIZZLE_CONFIG, SQLITE_DIRECTORY } from './constant.js';
|
|
5
|
+
/**
|
|
6
|
+
* A string that names the old folder, in any quotes: `'./db'`, `'db'`, `'./db/app.sqlite'`,
|
|
7
|
+
* `'db/app.sqlite'`, `'file:./db/app.sqlite'`. Not `'./dbx'` nor `'./data/db.sqlite'`. Its groups:
|
|
8
|
+
* the quote, `file:`, `./`, and the rest of the path.
|
|
9
|
+
*/
|
|
10
|
+
const SOURCE_STRING = /(['"`])(file:)?(\.\/)?db((?:\/[^'"`]*)?)\1/g;
|
|
11
|
+
/** Whether a drizzle config's content still names the old folder. */
|
|
12
|
+
export const namesSourceFolder = (content) => new RegExp(SOURCE_STRING.source).test(content);
|
|
13
|
+
/** Whether the project's `drizzle.config.ts` still names the old folder. */
|
|
14
|
+
export const drizzleConfigNamesSource = (root) => {
|
|
15
|
+
const file = path.join(root, DRIZZLE_CONFIG);
|
|
16
|
+
return existsSync(file) && namesSourceFolder(readFileSync(file, 'utf-8'));
|
|
17
|
+
};
|
|
18
|
+
/** A `.gitignore` line that keeps all of `storage/` out of git: `/storage`, `storage/`, … */
|
|
19
|
+
const IGNORES_STORAGE = /^\/?storage\/?[ \t]*$/m;
|
|
20
|
+
/**
|
|
21
|
+
* Moves `db/` to `storage/sqlite/`. `false` when there is no `db/`, so a second run moves nothing.
|
|
22
|
+
* An empty `storage/sqlite/` counts as absent. One holding a file throws, and nothing moves.
|
|
23
|
+
*/
|
|
24
|
+
export const moveDatabaseFolder = (root) => {
|
|
25
|
+
const from = path.join(root, DB_MOVE_SOURCE);
|
|
26
|
+
const to = path.join(root, SQLITE_DIRECTORY);
|
|
27
|
+
if (!existsSync(from))
|
|
28
|
+
return false;
|
|
29
|
+
if (existsSync(to)) {
|
|
30
|
+
if (readdirSync(to).length) {
|
|
31
|
+
throw new Error(`Both ${DB_MOVE_SOURCE}/ and ${SQLITE_DIRECTORY}/ hold files: keep one, then run again`);
|
|
32
|
+
}
|
|
33
|
+
rmdirSync(to);
|
|
34
|
+
}
|
|
35
|
+
mkdirSync(path.dirname(to), { recursive: true });
|
|
36
|
+
renameSync(from, to);
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Points the paths of `drizzle.config.ts` that name the old folder at `storage/sqlite`, and
|
|
41
|
+
* answers each change. `[]` when the file is missing or names none.
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* out: './db', // -> out: './storage/sqlite',
|
|
45
|
+
* url: 'file:./db/app.sqlite' // -> url: 'file:./storage/sqlite/app.sqlite'
|
|
46
|
+
* moveDrizzlePaths(root) // ["'./db' -> './storage/sqlite'", …]
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export const moveDrizzlePaths = (root) => {
|
|
50
|
+
const file = path.join(root, DRIZZLE_CONFIG);
|
|
51
|
+
if (!existsSync(file))
|
|
52
|
+
return [];
|
|
53
|
+
const changes = [];
|
|
54
|
+
const content = readFileSync(file, 'utf-8');
|
|
55
|
+
const next = content.replace(SOURCE_STRING, (whole, quote, scheme = '', dot = '', rest) => {
|
|
56
|
+
const moved = `${quote}${scheme}${dot}${SQLITE_DIRECTORY}${rest}${quote}`;
|
|
57
|
+
changes.push(`${whole} -> ${moved}`);
|
|
58
|
+
return moved;
|
|
59
|
+
});
|
|
60
|
+
if (changes.length) {
|
|
61
|
+
writeFileSync(file, next);
|
|
62
|
+
}
|
|
63
|
+
return changes;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Adds `/storage` to `.gitignore` when no line there covers the whole folder. `false` when one
|
|
67
|
+
* does, or when there is no `.gitignore`.
|
|
68
|
+
*/
|
|
69
|
+
export const ignoreStorage = (root) => {
|
|
70
|
+
const file = path.join(root, '.gitignore');
|
|
71
|
+
if (!existsSync(file))
|
|
72
|
+
return false;
|
|
73
|
+
const content = readFileSync(file, 'utf-8');
|
|
74
|
+
if (IGNORES_STORAGE.test(content))
|
|
75
|
+
return false;
|
|
76
|
+
writeFileSync(file, `${content.trimEnd()}\n/storage\n`);
|
|
77
|
+
return true;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* `rime db:move`: moves the database folder, then points `drizzle.config.ts` at it, then makes
|
|
81
|
+
* `.gitignore` cover `storage/`. Loads no config and opens no database, so it runs in a deployed
|
|
82
|
+
* `app/` too.
|
|
83
|
+
*/
|
|
84
|
+
export const dbMove = () => {
|
|
85
|
+
const root = process.cwd();
|
|
86
|
+
try {
|
|
87
|
+
logger.debug(moveDatabaseFolder(root)
|
|
88
|
+
? `[✓] ${DB_MOVE_SOURCE}/ moved to ${SQLITE_DIRECTORY}/`
|
|
89
|
+
: `[✓] No ${DB_MOVE_SOURCE}/ to move (skip)`);
|
|
90
|
+
const changes = moveDrizzlePaths(root);
|
|
91
|
+
logger.debug(changes.length
|
|
92
|
+
? `[✓] ${DRIZZLE_CONFIG}: ${changes.join(', ')}`
|
|
93
|
+
: `[✓] ${DRIZZLE_CONFIG} names no ${DB_MOVE_SOURCE}/ path, or there is none (skip)`);
|
|
94
|
+
logger.debug(ignoreStorage(root)
|
|
95
|
+
? '[✓] /storage added to .gitignore'
|
|
96
|
+
: '[✓] .gitignore already covers storage/, or there is none (skip)');
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
logger.error('[✗] Error while moving the database:', error);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The `drizzle.config.ts` `rime init` writes for a database named `name`. */
|
|
2
|
+
export declare const drizzleConfig: (name: string) => string;
|
|
3
|
+
/** Patches drizzle.config.ts's schema path line if it's stale (e.g. after RIME_CONFIG_DIR
|
|
4
|
+
* changes) — only that one line, since the rest of the file may carry real customizations
|
|
5
|
+
* (verbose, custom fields, etc.). Must run before generateSchema()'s own drizzle-kit
|
|
6
|
+
* generate/migrate shell-out, which reads this file from disk. No-op if the file doesn't
|
|
7
|
+
* exist — creating it from scratch needs a project name, which is `rime init`'s job. Returns
|
|
8
|
+
* whether it patched anything. */
|
|
9
|
+
export declare function regenerateDrizzleConfig(root?: string): boolean;
|