rimecms 1.3.0 → 1.4.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/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/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 +6 -0
- package/dist/adapter-sqlite/index.server.js +5 -0
- 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 +36 -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 +5 -6
- package/dist/core/auth/better-auth-tables.server.js +5 -6
- 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 +2 -6
- 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/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/codegen.server.js +8 -2
- 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 +13 -4
- 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 +5 -0
- package/dist/core/dev/cli/commands/build.js +17 -2
- package/dist/core/dev/cli/commands/clear.server.d.ts +1 -0
- package/dist/core/dev/cli/commands/clear.server.js +3 -2
- 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 +7 -0
- package/dist/core/dev/cli/commands/init.server.js +34 -7
- package/dist/core/dev/cli/index.js +16 -14
- 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 +2 -1
- package/dist/core/dev/cli/templates/init.js +17 -9
- package/dist/core/dev/cli/util/package-manager.server.d.ts +6 -1
- package/dist/core/dev/cli/util/package-manager.server.js +14 -10
- 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/ensure.server.d.ts +5 -0
- package/dist/core/dev/ensure.server.js +11 -6
- 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 +13 -1
- 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.d.ts +131 -0
- 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/index.d.ts +7 -0
- 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/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 +1 -1
- package/dist/panel/style/index.css +21 -6
- 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 +12 -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
package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.js
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getValueAtPath, setValueAtPath } from '
|
|
1
|
+
import { getValueAtPath, setValueAtPath } from '../../util/object.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* The document an update leaves: each field the update did not send takes the stored value. A
|
|
4
|
+
* field sent empty stays empty, so a field cleared on purpose stays cleared.
|
|
5
5
|
*
|
|
6
6
|
* ```ts
|
|
7
|
-
* //
|
|
7
|
+
* // stored: { title: 'A', intro: 'B' }
|
|
8
8
|
* fallbackDataFromOriginal({ data: { title: 'C' }, … }) // { title: 'C', intro: 'B' }
|
|
9
9
|
* fallbackDataFromOriginal({ data: { title: 'C', intro: null }, … }) // { title: 'C', intro: null }
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
12
12
|
* A list sent — blocks, tree items, relations — is the update's as sent: nothing is taken into it
|
|
13
|
-
* from the
|
|
13
|
+
* from the stored list.
|
|
14
14
|
*/
|
|
15
15
|
export const fallbackDataFromOriginal = (args) => {
|
|
16
16
|
const { original, configMap, ignore } = args;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* The same map as `buildDataConfigMap`, over the document as it is now rather than as it is being
|
|
3
3
|
* sent — on `context.originalConfigMap`.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* field the caller did not send
|
|
5
|
+
* Read where a save compares with what is stored: `prepareDataForNewVersion` to carry forward a
|
|
6
|
+
* field the caller did not send, `validateFields` to check the document the update leaves, and
|
|
7
|
+
* `saveBlocks` and `saveTreeBlocks` for the rows a save replaces.
|
|
7
8
|
*/
|
|
8
9
|
export declare const buildOriginalDocConfigMap: import("../types.js").Hook<"raw", "create" | "update", "before">;
|
|
@@ -5,8 +5,9 @@ import { buildConfigMap } from '../config-map/index.js';
|
|
|
5
5
|
* The same map as `buildDataConfigMap`, over the document as it is now rather than as it is being
|
|
6
6
|
* sent — on `context.originalConfigMap`.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* field the caller did not send
|
|
8
|
+
* Read where a save compares with what is stored: `prepareDataForNewVersion` to carry forward a
|
|
9
|
+
* field the caller did not send, `validateFields` to check the document the update leaves, and
|
|
10
|
+
* `saveBlocks` and `saveTreeBlocks` for the rows a save replaces.
|
|
10
11
|
*/
|
|
11
12
|
export const buildOriginalDocConfigMap = Hooks.beforeUpsert(async function buildOriginalDocConfigMap(args) {
|
|
12
13
|
const { originalDoc } = args.context;
|
|
@@ -16,7 +16,8 @@ export declare const withoutUnreadableFields: <T extends Dic>(doc: T, fields: Fi
|
|
|
16
16
|
* each value to the field's own `hooks.beforeRead`. An empty value stays empty: a default is what
|
|
17
17
|
* a new document starts with, never what a read shows.
|
|
18
18
|
*
|
|
19
|
-
* A system read is rime's own and keeps every field.
|
|
19
|
+
* A system read is rime's own and keeps every field. The fields are walked on a copy of the
|
|
20
|
+
* document's top level; nested objects are the read's own, built for it by buildDocument. A
|
|
20
21
|
* config-map key is already normalized, so it splits straight into its segments.
|
|
21
22
|
*/
|
|
22
23
|
export declare const processDocumentFields: import("../types.js").Hook<"raw", "read", "before">;
|
|
@@ -21,7 +21,8 @@ export const withoutUnreadableFields = (doc, fields, user) => {
|
|
|
21
21
|
* each value to the field's own `hooks.beforeRead`. An empty value stays empty: a default is what
|
|
22
22
|
* a new document starts with, never what a read shows.
|
|
23
23
|
*
|
|
24
|
-
* A system read is rime's own and keeps every field.
|
|
24
|
+
* A system read is rime's own and keeps every field. The fields are walked on a copy of the
|
|
25
|
+
* document's top level; nested objects are the read's own, built for it by buildDocument. A
|
|
25
26
|
* config-map key is already normalized, so it splits straight into its segments.
|
|
26
27
|
*/
|
|
27
28
|
export const processDocumentFields = Hooks.beforeRead(async function processDocumentFields(args) {
|
|
@@ -44,14 +45,8 @@ export const processDocumentFields = Hooks.beforeRead(async function processDocu
|
|
|
44
45
|
}
|
|
45
46
|
if (config.type === 'blocks') {
|
|
46
47
|
const blocks = getAt(doc, parts);
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// * blocks: [ { ... }, undefined, { ... } ]
|
|
50
|
-
// * Because blocks are populated based on path.position
|
|
51
|
-
// Case residual : a block type has been removed but was including a relation, this gives ex :
|
|
52
|
-
// * blocks: [ { id:..., values,... }, { image: {...}} ]
|
|
53
|
-
// ^
|
|
54
|
-
// * the image has been placed but the block doesn't exist anymore
|
|
48
|
+
// A block row whose table is gone reads as `undefined`, and a relation of a removed block
|
|
49
|
+
// type reads as an object without `id`: both are dropped, and the rest renumbered.
|
|
55
50
|
if (blocks) {
|
|
56
51
|
const withoutResidualBlock = blocks
|
|
57
52
|
.filter((b) => b && 'id' in b) // get only blocks that have .id
|
|
@@ -9,6 +9,10 @@ import { isObjectLiteral } from '../../../util/object.js';
|
|
|
9
9
|
export const sortDocumentProps = Hooks.beforeRead(async function sortDocumentProps(args) {
|
|
10
10
|
return { ...args, doc: sortDocumentKeys(args.doc) };
|
|
11
11
|
});
|
|
12
|
+
/**
|
|
13
|
+
* The document with its keys sorted at every depth: `id`, `title`, `status` first, the
|
|
14
|
+
* bookkeeping keys (`locale` … `_thumbnail`) last in that order, the rest alphabetical.
|
|
15
|
+
*/
|
|
12
16
|
function sortDocumentKeys(obj) {
|
|
13
17
|
const specificOrder = ['id', 'title', 'status'];
|
|
14
18
|
const endOrder = [
|
|
@@ -30,14 +34,12 @@ function sortDocumentKeys(obj) {
|
|
|
30
34
|
'_thumbnail'
|
|
31
35
|
];
|
|
32
36
|
function sortObjectKeys(obj) {
|
|
33
|
-
// If not an object or is null, return the value as-is
|
|
34
37
|
if (!obj || typeof obj !== 'object')
|
|
35
38
|
return obj;
|
|
36
39
|
// A list: each list or plain object in it is sorted, anything else (a Date) kept as it is
|
|
37
40
|
if (Array.isArray(obj)) {
|
|
38
41
|
return obj.map((item) => Array.isArray(item) || isObjectLiteral(item) ? sortObjectKeys(item) : item);
|
|
39
42
|
}
|
|
40
|
-
// Sort the keys
|
|
41
43
|
const keys = Object.keys(obj).sort((a, b) => {
|
|
42
44
|
const aIndexSpecific = specificOrder.indexOf(a);
|
|
43
45
|
const bIndexSpecific = specificOrder.indexOf(b);
|
|
@@ -59,7 +61,6 @@ function sortDocumentKeys(obj) {
|
|
|
59
61
|
return -1;
|
|
60
62
|
return a.localeCompare(b);
|
|
61
63
|
});
|
|
62
|
-
// Create new object with sorted keys
|
|
63
64
|
const sorted = {};
|
|
64
65
|
keys.forEach((key) => {
|
|
65
66
|
const shouldOrder = Array.isArray(obj[key]) || isObjectLiteral(obj[key]);
|
|
@@ -4,13 +4,27 @@
|
|
|
4
4
|
*
|
|
5
5
|
* A field the caller may not write is deleted from **both** the data and `context.configMap`,
|
|
6
6
|
* with every field below it. Leaving its path in the map would make the dropped write look like an
|
|
7
|
-
* explicit "nothing here any more" and delete the existing rows.
|
|
7
|
+
* explicit "nothing here any more" and delete the existing rows. On a create, such a field that
|
|
8
|
+
* has a default is stored with it instead, unchecked, and a required one without a default
|
|
9
|
+
* refuses the create with a 403.
|
|
8
10
|
*
|
|
9
11
|
* ```ts
|
|
10
12
|
* // group('meta').access({ update: isAdmin }).fields(blocks('gallery', [image]))
|
|
11
13
|
* // an editor: PATCH { meta: { gallery: [] } } -> data {}, configMap {}: the gallery stays
|
|
12
14
|
* ```
|
|
13
15
|
*
|
|
16
|
+
* An update is checked as the document it leaves: `validate` reads that document, and `required`
|
|
17
|
+
* holds on it, sent value or stored. Only the sent values run their hooks.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* // text('title').required(), text('summary').required(), stored { title: 'Home', summary: '' }
|
|
21
|
+
* // PATCH { title: 'Home 2' } -> summary: required_field
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* A unique value may be shared by a document and its own versions only. On a config with drafts,
|
|
25
|
+
* the other documents count by their published version, so a publish checks every unique value
|
|
26
|
+
* of the version it puts live, sent or not.
|
|
27
|
+
*
|
|
14
28
|
* A staff request with `?skipValidation=true` may leave required fields empty; a locale copy
|
|
15
29
|
* (`context.isLocaleCopy`) skips every check, its values were validated where they came from.
|
|
16
30
|
*/
|
|
@@ -3,12 +3,16 @@ import { isStaff } from '../../auth/access.js';
|
|
|
3
3
|
import { PARAMS } from '../../constants.js';
|
|
4
4
|
import { RimeError, RimeFormError } from '../../errors/index.js';
|
|
5
5
|
import { logger } from '../../logger.server.js';
|
|
6
|
+
import { VERSIONS_STATUS } from '../../prototype/shared/versions/constant.js';
|
|
6
7
|
import { missingRelations } from '../../../fields/relation/exists.server.js';
|
|
7
8
|
import { isRelationField } from '../../../fields/relation/index.js';
|
|
8
9
|
import { isFormField } from '../../fields/util.js';
|
|
9
|
-
import { walkFields } from '../../fields/walk.js';
|
|
10
|
-
import { deleteValueAtPath, getValueAtPath, isObjectLiteral, setValueAtPath } from '../../../util/object.js';
|
|
10
|
+
import { walkFields, walkValues } from '../../fields/walk.js';
|
|
11
|
+
import { deleteValueAtPath, getValueAtPath, isObjectLiteral, setValueAtPath, withDefaultValues } from '../../../util/object.js';
|
|
11
12
|
import { isWithin } from '../../../util/string.js';
|
|
13
|
+
import { buildConfigMap } from '../config-map/index.js';
|
|
14
|
+
import { fallbackDataFromOriginal } from '../fallback-data-from-original.js';
|
|
15
|
+
import { isSaved } from '../persist/repeatable.server.js';
|
|
12
16
|
import { withoutDeniedFields } from '../without-denied-fields.js';
|
|
13
17
|
/**
|
|
14
18
|
* Checks each field's write access, then runs its `validate`, checks that each relation names
|
|
@@ -16,13 +20,27 @@ import { withoutDeniedFields } from '../without-denied-fields.js';
|
|
|
16
20
|
*
|
|
17
21
|
* A field the caller may not write is deleted from **both** the data and `context.configMap`,
|
|
18
22
|
* with every field below it. Leaving its path in the map would make the dropped write look like an
|
|
19
|
-
* explicit "nothing here any more" and delete the existing rows.
|
|
23
|
+
* explicit "nothing here any more" and delete the existing rows. On a create, such a field that
|
|
24
|
+
* has a default is stored with it instead, unchecked, and a required one without a default
|
|
25
|
+
* refuses the create with a 403.
|
|
20
26
|
*
|
|
21
27
|
* ```ts
|
|
22
28
|
* // group('meta').access({ update: isAdmin }).fields(blocks('gallery', [image]))
|
|
23
29
|
* // an editor: PATCH { meta: { gallery: [] } } -> data {}, configMap {}: the gallery stays
|
|
24
30
|
* ```
|
|
25
31
|
*
|
|
32
|
+
* An update is checked as the document it leaves: `validate` reads that document, and `required`
|
|
33
|
+
* holds on it, sent value or stored. Only the sent values run their hooks.
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* // text('title').required(), text('summary').required(), stored { title: 'Home', summary: '' }
|
|
37
|
+
* // PATCH { title: 'Home 2' } -> summary: required_field
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* A unique value may be shared by a document and its own versions only. On a config with drafts,
|
|
41
|
+
* the other documents count by their published version, so a publish checks every unique value
|
|
42
|
+
* of the version it puts live, sent or not.
|
|
43
|
+
*
|
|
26
44
|
* A staff request with `?skipValidation=true` may leave required fields empty; a locale copy
|
|
27
45
|
* (`context.isLocaleCopy`) skips every check, its values were validated where they came from.
|
|
28
46
|
*/
|
|
@@ -32,7 +50,6 @@ export const validateFields = Hooks.beforeUpsert(async function validateFields(a
|
|
|
32
50
|
const { rime, user } = event.locals;
|
|
33
51
|
const locale = args.context.params.locale || args.event.locals.locale;
|
|
34
52
|
const slug = args.config.slug;
|
|
35
|
-
const isCollection = rime.config.isCollection(slug);
|
|
36
53
|
// The panel's bulk upload sends a file before its other fields: a staff request may leave
|
|
37
54
|
// required fields empty with ?skipValidation=true
|
|
38
55
|
const mayLeaveRequired = isStaff(user) && event.url.searchParams.get(PARAMS.SKIP_VALIDATION) === 'true';
|
|
@@ -45,16 +62,16 @@ export const validateFields = Hooks.beforeUpsert(async function validateFields(a
|
|
|
45
62
|
/****************************************************/
|
|
46
63
|
/* Access
|
|
47
64
|
/****************************************************/
|
|
48
|
-
// A denied field leaves the data, and the map with every key below it. It is never validated
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
65
|
+
// A denied field leaves the data, and the map with every key below it. It is never validated.
|
|
66
|
+
// A create writes its default, or leaves its column empty without one; an update leaves the
|
|
67
|
+
// stored column as it is. Inside a stored list row, an update writes back the stored value
|
|
68
|
+
// instead, unchecked.
|
|
52
69
|
//
|
|
53
70
|
// FormFieldBuilder's default `access.create` is `(user) => !!user`, so an anonymous create is
|
|
54
71
|
// denied most fields.
|
|
55
72
|
const { originalDoc, originalConfigMap } = args.context;
|
|
56
73
|
const allowed = skipAccess
|
|
57
|
-
? { data: args.data, configMap: { ...args.context.configMap }, kept: [] }
|
|
74
|
+
? { data: args.data, configMap: { ...args.context.configMap }, kept: [], missing: [] }
|
|
58
75
|
: withoutDeniedFields({
|
|
59
76
|
data: args.data,
|
|
60
77
|
configMap: args.context.configMap ?? {},
|
|
@@ -63,12 +80,55 @@ export const validateFields = Hooks.beforeUpsert(async function validateFields(a
|
|
|
63
80
|
id: originalDoc?.id,
|
|
64
81
|
stored: operation === 'update' && originalDoc && originalConfigMap
|
|
65
82
|
? { doc: originalDoc, configMap: originalConfigMap }
|
|
66
|
-
: undefined
|
|
83
|
+
: undefined,
|
|
84
|
+
event
|
|
67
85
|
});
|
|
86
|
+
// A create that leaves a required field it may not write empty, without a default, is refused
|
|
87
|
+
if (allowed.missing.length && !skipRequired) {
|
|
88
|
+
const paths = allowed.missing.map((path) => `\`${path}\``).join(', ');
|
|
89
|
+
logger.warn(`${slug}: a create was refused, ${paths} is required, has no default and is closed to this caller. Give it a defaultValue or open its access.create.`);
|
|
90
|
+
throw new RimeError(RimeError.UNAUTHORIZED, `may not create: ${paths} is required and closed to you`);
|
|
91
|
+
}
|
|
68
92
|
// Own copy: the steps below write into it
|
|
69
93
|
let output = { ...allowed.data };
|
|
70
94
|
const configMap = allowed.configMap;
|
|
95
|
+
// A versions collection holds the versions of a collection's documents: a unique value is looked
|
|
96
|
+
// up on that collection, which reads each document's published version (its newest without
|
|
97
|
+
// drafts). The document this save writes is left out: the one updated, or the owner of a new
|
|
98
|
+
// version row. A create has none yet.
|
|
99
|
+
//
|
|
100
|
+
// `$pages__versions` create { slug: 'about', ownerId: 'p1' }
|
|
101
|
+
// -> pages where slug = 'about' and id != 'p1'
|
|
102
|
+
// Only a collection can be a versions collection
|
|
103
|
+
const { _shadowOf: shadowOf } = args.config;
|
|
104
|
+
const uniqueSlug = (shadowOf ?? slug);
|
|
105
|
+
const checksUnique = !skipUnique && rime.config.isCollection(uniqueSlug);
|
|
106
|
+
const ownId = shadowOf ? args.data.ownerId : originalDoc?.id;
|
|
107
|
+
/** Whether another document holds `value` at `key`. */
|
|
108
|
+
const isTaken = async (key, value) => {
|
|
109
|
+
if (operation === 'update' && !ownId) {
|
|
110
|
+
throw new RimeError(RimeError.OPERATION_ERROR, 'missing originalDoc @validateFields');
|
|
111
|
+
}
|
|
112
|
+
// An object, never re-parsed: `a+b` is looked up as is
|
|
113
|
+
const sameValue = { [key]: { equals: value } };
|
|
114
|
+
const where = ownId ? { and: [sameValue, { id: { not_equals: ownId } }] } : sameValue;
|
|
115
|
+
const existing = await rime
|
|
116
|
+
.collection(uniqueSlug)
|
|
117
|
+
.system()
|
|
118
|
+
.find({ locale, query: { where }, select: ['id'] });
|
|
119
|
+
return existing.length > 0;
|
|
120
|
+
};
|
|
121
|
+
// The document this save leaves: on an update, what it sends over what is stored
|
|
122
|
+
const merged = operation === 'update' && originalDoc && originalConfigMap
|
|
123
|
+
? withStoredRows(fallbackDataFromOriginal({
|
|
124
|
+
data: allowed.data,
|
|
125
|
+
original: originalDoc,
|
|
126
|
+
configMap: originalConfigMap,
|
|
127
|
+
ignore: []
|
|
128
|
+
}), originalDoc, args.config.fields)
|
|
129
|
+
: allowed.data;
|
|
71
130
|
for (const [key, config] of Object.entries(configMap)) {
|
|
131
|
+
// A kept value, a stored one or a create's default, is written unchecked
|
|
72
132
|
if (allowed.kept.some((path) => isWithin(key, path)))
|
|
73
133
|
continue;
|
|
74
134
|
let value = getValueAtPath(key, output);
|
|
@@ -85,7 +145,7 @@ export const validateFields = Hooks.beforeUpsert(async function validateFields(a
|
|
|
85
145
|
if (config.get.validate && value !== undefined && value !== null && !skipHooks) {
|
|
86
146
|
try {
|
|
87
147
|
const valid = config.use.validate(value, {
|
|
88
|
-
data:
|
|
148
|
+
data: merged,
|
|
89
149
|
operation,
|
|
90
150
|
id: operation === 'update' ? args.context.originalDoc?.id : undefined,
|
|
91
151
|
user: user,
|
|
@@ -114,29 +174,9 @@ export const validateFields = Hooks.beforeUpsert(async function validateFields(a
|
|
|
114
174
|
}
|
|
115
175
|
// Unique: another document holds the value this save writes. An empty value has nothing to
|
|
116
176
|
// collide with, and a value `validate` refused is reported as that.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (isUnique && isCollection && !skipUnique && hasValue && !errors[key]) {
|
|
120
|
-
// An object, never re-parsed: `a+b` is looked up as is
|
|
121
|
-
const sameValue = { [key]: { equals: value } };
|
|
122
|
-
let where;
|
|
123
|
-
switch (operation) {
|
|
124
|
-
case 'create':
|
|
125
|
-
where = sameValue;
|
|
126
|
-
break;
|
|
127
|
-
case 'update':
|
|
128
|
-
if (!args.context.originalDoc) {
|
|
129
|
-
throw new RimeError(RimeError.OPERATION_ERROR, 'missing originalDoc @validateFields');
|
|
130
|
-
}
|
|
131
|
-
where = { and: [sameValue, { id: { not_equals: args.context.originalDoc.id } }] };
|
|
132
|
-
}
|
|
133
|
-
const existing = await rime
|
|
134
|
-
.collection(slug)
|
|
135
|
-
.system()
|
|
136
|
-
.find({ locale, query: { where }, select: ['id'] });
|
|
137
|
-
if (existing.length) {
|
|
177
|
+
if (checksUnique && isUnique(config) && hasValue(value) && !errors[key]) {
|
|
178
|
+
if (await isTaken(key, value))
|
|
138
179
|
errors[key] = RimeFormError.UNIQUE_FIELD;
|
|
139
|
-
}
|
|
140
180
|
}
|
|
141
181
|
// A relation names documents that exist. Checked here, before anything is written: a stale
|
|
142
182
|
// id fails the save, it is never dropped from it.
|
|
@@ -145,21 +185,37 @@ export const validateFields = Hooks.beforeUpsert(async function validateFields(a
|
|
|
145
185
|
if (missing.length)
|
|
146
186
|
errors[key] = RimeFormError.RELATION_NOT_FOUND;
|
|
147
187
|
}
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
188
|
+
// A required value left empty without the check takes the field's own default, else nothing
|
|
189
|
+
// is written: a create leaves the column empty, and an update leaves the stored column as it
|
|
190
|
+
// is. The key stays in the map, so a list or a relation sent empty is emptied.
|
|
191
|
+
if (skipRequired && config.get.required && config.use.isEmpty(value)) {
|
|
192
|
+
const fallback = config.use.defaultValue({ event });
|
|
193
|
+
output =
|
|
194
|
+
fallback === null || fallback === undefined
|
|
195
|
+
? deleteValueAtPath(output, key)
|
|
196
|
+
: setValueAtPath(key, output, fallback);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// A publish puts every value of the version live, sent or stored: each unique one is checked
|
|
200
|
+
const publishes = !!args.config.versions?.draft && allowed.data.status === VERSIONS_STATUS.PUBLISHED;
|
|
201
|
+
if (checksUnique && publishes) {
|
|
202
|
+
for (const [key, config] of Object.entries(buildConfigMap(merged, args.config.fields))) {
|
|
203
|
+
if (key in configMap || errors[key] || !isUnique(config))
|
|
204
|
+
continue;
|
|
205
|
+
const value = getValueAtPath(key, merged);
|
|
206
|
+
if (hasValue(value) && (await isTaken(key, value)))
|
|
207
|
+
errors[key] = RimeFormError.UNIQUE_FIELD;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Required: the document as saved holds a value, sent or stored. A sent value is read after its
|
|
211
|
+
// hooks.
|
|
212
|
+
if (!skipRequired) {
|
|
213
|
+
for (const [key, config] of Object.entries(buildConfigMap(merged, args.config.fields))) {
|
|
214
|
+
if (!config.get.required)
|
|
215
|
+
continue;
|
|
216
|
+
const value = getValueAtPath(key, key in configMap ? output : merged);
|
|
217
|
+
if (config.use.isEmpty(value))
|
|
161
218
|
errors[key] = RimeFormError.REQUIRED_FIELD;
|
|
162
|
-
}
|
|
163
219
|
}
|
|
164
220
|
}
|
|
165
221
|
// A group or tab sent as `null` clears every column below it: a required one is missing
|
|
@@ -180,6 +236,10 @@ export const validateFields = Hooks.beforeUpsert(async function validateFields(a
|
|
|
180
236
|
}
|
|
181
237
|
};
|
|
182
238
|
});
|
|
239
|
+
/** Whether the field says `.unique()`: only text, email and slug can. */
|
|
240
|
+
const isUnique = (config) => !!config.get.unique;
|
|
241
|
+
/** A value a unique lookup can collide with: an empty one has nothing to collide with. */
|
|
242
|
+
const hasValue = (value) => value !== undefined && value !== null && value !== '';
|
|
183
243
|
/**
|
|
184
244
|
* The paths of the required fields below a container `data` holds as `null`. Blocks and tree rows
|
|
185
245
|
* are left out: their fields are not columns of the document.
|
|
@@ -203,3 +263,38 @@ const requiredUnderNull = (data, fields) => [...walkFields(fields, { determinate
|
|
|
203
263
|
}
|
|
204
264
|
return false;
|
|
205
265
|
});
|
|
266
|
+
/**
|
|
267
|
+
* `data` with each saved row it sends laid over the stored row of the same `id`, wherever that row
|
|
268
|
+
* sat: the fields the row leaves out take their stored values. A new row, and a block sent as
|
|
269
|
+
* another type, stay as sent.
|
|
270
|
+
*
|
|
271
|
+
* ```ts
|
|
272
|
+
* // stored { layout: [{ id: 'b1', type: 'hero', title: 'Home', label: 'Go' }] }
|
|
273
|
+
* withStoredRows({ layout: [{ id: 'b1', type: 'hero', label: 'Start' }] }, stored, fields)
|
|
274
|
+
* // { layout: [{ id: 'b1', type: 'hero', title: 'Home', label: 'Start' }] }
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
const withStoredRows = (data, stored, fields) => {
|
|
278
|
+
const storedRows = new Map();
|
|
279
|
+
for (const { row } of savedRows(fields, stored))
|
|
280
|
+
storedRows.set(row.id, row);
|
|
281
|
+
let output = data;
|
|
282
|
+
for (const { path, row } of savedRows(fields, data)) {
|
|
283
|
+
const storedRow = storedRows.get(row.id);
|
|
284
|
+
if (!storedRow || storedRow.type !== row.type)
|
|
285
|
+
continue;
|
|
286
|
+
// `layout.0:hero` is set at `layout.0`: setValueAtPath drops the block type
|
|
287
|
+
output = setValueAtPath(path, output, withDefaultValues(row, storedRow));
|
|
288
|
+
}
|
|
289
|
+
return output;
|
|
290
|
+
};
|
|
291
|
+
/** Every saved block and tree item of `data`, at any depth, with the path it sits at. */
|
|
292
|
+
function* savedRows(fields, data) {
|
|
293
|
+
for (const { field, path, value } of walkValues(fields, data)) {
|
|
294
|
+
for (const node of field.use.nodesFor(value)) {
|
|
295
|
+
if (node.storage && isObjectLiteral(node.value) && isSaved(node.value)) {
|
|
296
|
+
yield { path: `${path}.${node.segment}`, row: node.value };
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
@@ -5,5 +5,10 @@ type ExtractBlocksArgs = {
|
|
|
5
5
|
data: Dic;
|
|
6
6
|
configMap: ConfigMap;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Every block of every blocks field in the map, as one flat list. Each block's `path` and
|
|
10
|
+
* `position` come from where it sits in the data; a block list nested in a block is left out of
|
|
11
|
+
* its parent row and listed as rows of its own.
|
|
12
|
+
*/
|
|
8
13
|
export declare function extractBlocks({ data, configMap }: ExtractBlocksArgs): GenericBlock[];
|
|
9
14
|
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { normalizeFieldPath } from '../../../../util/string.js';
|
|
2
2
|
import { getValueAtPath } from '../../../../util/object.js';
|
|
3
|
+
/**
|
|
4
|
+
* Every block of every blocks field in the map, as one flat list. Each block's `path` and
|
|
5
|
+
* `position` come from where it sits in the data; a block list nested in a block is left out of
|
|
6
|
+
* its parent row and listed as rows of its own.
|
|
7
|
+
*/
|
|
3
8
|
export function extractBlocks({ data, configMap }) {
|
|
4
9
|
const blocks = [];
|
|
5
10
|
Object.entries(configMap).forEach(([path, config]) => {
|
|
@@ -3,13 +3,9 @@ import type { GenericBlock, PrototypeSlug } from '../../../prototype/types.js';
|
|
|
3
3
|
import type { Dic } from '../../../../util/types.js';
|
|
4
4
|
import type { OperationContext } from '../../types.js';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* This function handles the complete lifecycle of block persistence:
|
|
10
|
-
* 1. Extract blocks from form data
|
|
11
|
-
* 2. Compare with existing blocks to determine changes
|
|
12
|
-
* 3. Execute database operations (create/update/delete)
|
|
6
|
+
* Writes a save's blocks: compares the stored blocks inside the paths the save replaces with the
|
|
7
|
+
* blocks it sends, then deletes, adds and updates rows. Answers the diff, whose deleted rows
|
|
8
|
+
* `saveRelations` reads to drop their relations.
|
|
13
9
|
*/
|
|
14
10
|
export declare const saveBlocks: (args: {
|
|
15
11
|
context: OperationContext;
|
|
@@ -2,16 +2,11 @@ import { RimeError } from '../../../errors/index.js';
|
|
|
2
2
|
import { diffRepeatables, replacedPaths, withinPaths } from '../repeatable.server.js';
|
|
3
3
|
import { extractBlocks } from './extract.server.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* This function handles the complete lifecycle of block persistence:
|
|
9
|
-
* 1. Extract blocks from form data
|
|
10
|
-
* 2. Compare with existing blocks to determine changes
|
|
11
|
-
* 3. Execute database operations (create/update/delete)
|
|
5
|
+
* Writes a save's blocks: compares the stored blocks inside the paths the save replaces with the
|
|
6
|
+
* blocks it sends, then deletes, adds and updates rows. Answers the diff, whose deleted rows
|
|
7
|
+
* `saveRelations` reads to drop their relations.
|
|
12
8
|
*/
|
|
13
9
|
export const saveBlocks = async (args) => {
|
|
14
|
-
//
|
|
15
10
|
const { context, ownerId, data, incomingPaths, adapter, ownerSlug } = args;
|
|
16
11
|
const { locale } = context.params;
|
|
17
12
|
const { originalDoc: original, configMap, originalConfigMap } = context;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** No locale on either side reads as `null`. */
|
|
2
2
|
const sameLocale = (existing, incoming) => (existing.locale ?? null) === (incoming.locale ?? null);
|
|
3
|
+
/** Whether the stored row must change to become the incoming one: place, document or locale. */
|
|
3
4
|
const needUpdate = (existing, incoming) => existing.position !== incoming.position ||
|
|
4
5
|
existing.documentId !== incoming.documentId ||
|
|
5
6
|
existing.path !== incoming.path ||
|
|
@@ -7,5 +7,6 @@ type Args = {
|
|
|
7
7
|
configMap: ConfigMap;
|
|
8
8
|
locale: string | undefined;
|
|
9
9
|
};
|
|
10
|
+
/** The junction rows the data names, one per document, numbered in each list from 0. */
|
|
10
11
|
export declare const extractRelations: ({ ownerId, data, configMap, locale }: Args) => BeforeOperationRelation[];
|
|
11
12
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isRelationField } from '../../../../fields/relation/index.js';
|
|
2
2
|
import { Relation } from '../../../../fields/relation/relation.js';
|
|
3
3
|
import { getValueAtPath, isObjectLiteral } from '../../../../util/object.js';
|
|
4
|
+
/** The junction rows the data names, one per document, numbered in each list from 0. */
|
|
4
5
|
export const extractRelations = ({ ownerId, data, configMap, locale }) => {
|
|
5
6
|
const relations = [];
|
|
6
7
|
// The config map keys every field the document holds; relations are the ones stored as junction
|
|
@@ -32,6 +33,7 @@ export const extractRelations = ({ ownerId, data, configMap, locale }) => {
|
|
|
32
33
|
}
|
|
33
34
|
return relations;
|
|
34
35
|
};
|
|
36
|
+
/** The id an entry names: a bare id, a ref's document, or a document read and sent back. */
|
|
35
37
|
const documentIdOf = (entry) => {
|
|
36
38
|
if (typeof entry === 'string')
|
|
37
39
|
return entry || null;
|
|
@@ -3,6 +3,12 @@ import type { GenericBlock, PrototypeSlug, TreeBlock } from '../../../prototype/
|
|
|
3
3
|
import type { Dic, WithRequired } from '../../../../util/types.js';
|
|
4
4
|
import type { ConfigMap } from '../../config-map/types.js';
|
|
5
5
|
import { type RepeatablesDiff } from '../repeatable.server.js';
|
|
6
|
+
/**
|
|
7
|
+
* Writes a save's relations: drops the relations under the block and tree rows the save
|
|
8
|
+
* deleted, moves the other locales' relations under the rows it moved, then compares the stored
|
|
9
|
+
* relations inside the paths the save replaces (a group's own path excluded) with the ones the
|
|
10
|
+
* data names, and deletes, updates and adds rows.
|
|
11
|
+
*/
|
|
6
12
|
export declare const saveRelations: (args: {
|
|
7
13
|
data: Dic;
|
|
8
14
|
configMap: ConfigMap;
|
|
@@ -1,23 +1,47 @@
|
|
|
1
|
-
import { replacedPaths, withinPaths } from '../repeatable.server.js';
|
|
1
|
+
import { movedPath, placeOf, replacedPaths, withinPaths } from '../repeatable.server.js';
|
|
2
2
|
import { defineRelationsDiff } from './diff.server.js';
|
|
3
3
|
import { extractRelations } from './extract.server.js';
|
|
4
|
+
/**
|
|
5
|
+
* Writes a save's relations: drops the relations under the block and tree rows the save
|
|
6
|
+
* deleted, moves the other locales' relations under the rows it moved, then compares the stored
|
|
7
|
+
* relations inside the paths the save replaces (a group's own path excluded) with the ones the
|
|
8
|
+
* data names, and deletes, updates and adds rows.
|
|
9
|
+
*/
|
|
4
10
|
export const saveRelations = async (args) => {
|
|
5
11
|
const { configMap, incomingPaths, blocksDiff, treeDiff, adapter, locale, ownerSlug, ownerId, data } = args;
|
|
6
|
-
/**
|
|
12
|
+
/** A blocks or tree row is every locale's when its list field is not localized. */
|
|
13
|
+
const isShared = (row) => {
|
|
14
|
+
// A tree item's list is its tree: `menu.0._children.1._children` -> `menu`
|
|
15
|
+
const list = configMap[row.path.replace(/(\.\d+\._children)+$/, '')];
|
|
16
|
+
return !!list && !list.get.localized;
|
|
17
|
+
};
|
|
18
|
+
// The relations under a removed row go with it: in every locale when its list is shared, in the
|
|
19
|
+
// request locale when the list is localized
|
|
20
|
+
const removed = [...blocksDiff.toDelete, ...treeDiff.toDelete];
|
|
7
21
|
await adapter.relations.deleteFromPaths({
|
|
8
22
|
parentSlug: ownerSlug,
|
|
9
23
|
ownerId,
|
|
10
|
-
paths:
|
|
11
|
-
locale
|
|
24
|
+
paths: removed.filter(isShared).map(placeOf)
|
|
12
25
|
});
|
|
13
|
-
/** Delete relations from deletedTreeItems */
|
|
14
26
|
await adapter.relations.deleteFromPaths({
|
|
15
27
|
parentSlug: ownerSlug,
|
|
16
28
|
ownerId,
|
|
17
|
-
paths:
|
|
29
|
+
paths: removed.filter((row) => !isShared(row)).map(placeOf),
|
|
18
30
|
locale
|
|
19
31
|
});
|
|
20
|
-
|
|
32
|
+
// The data places the request locale's relations. The other locales' relations under a moved
|
|
33
|
+
// row of a shared list move with it.
|
|
34
|
+
const moves = [...blocksDiff.moved, ...treeDiff.moved].filter(isShared);
|
|
35
|
+
if (locale && moves.length) {
|
|
36
|
+
// `getAll` with no locale answers every locale's rows
|
|
37
|
+
const followed = (await adapter.relations.getAll({ parentSlug: ownerSlug, ownerId })).flatMap((row) => {
|
|
38
|
+
const path = row.locale && row.locale !== locale ? movedPath(row.path, moves) : null;
|
|
39
|
+
return path ? [{ ...row, path }] : [];
|
|
40
|
+
});
|
|
41
|
+
if (followed.length) {
|
|
42
|
+
await adapter.relations.update({ parentSlug: ownerSlug, relations: followed });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
21
45
|
const incomingRelations = extractRelations({
|
|
22
46
|
ownerId,
|
|
23
47
|
data,
|
|
@@ -31,7 +55,6 @@ export const saveRelations = async (args) => {
|
|
|
31
55
|
locale: locale
|
|
32
56
|
})
|
|
33
57
|
.then((relations) => withinPaths(relations, replacedPaths(incomingPaths, configMap)));
|
|
34
|
-
/** get difference between them */
|
|
35
58
|
const relationsDiff = defineRelationsDiff({
|
|
36
59
|
existingRelations,
|
|
37
60
|
incomingRelations,
|