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
|
@@ -10,6 +10,12 @@ import { baseTableName, tableName } from './naming.server.js';
|
|
|
10
10
|
const resolvedValue = (order, valueIn) => order.length > 1
|
|
11
11
|
? sql `COALESCE(${sql.join(order.map((code) => sql `NULLIF(${valueIn(code)}, '')`), sql `, `)})`
|
|
12
12
|
: valueIn(order[0]);
|
|
13
|
+
/**
|
|
14
|
+
* The drizzle `orderBy` of a list, from the REST `sort`: a document path, with `-` in front for
|
|
15
|
+
* descending (`-attributes.title`). A localized field orders by the value a read in `locale`
|
|
16
|
+
* shows, a field of a versioned prototype by the content row each document shows. No `sort`
|
|
17
|
+
* orders by `updatedAt`, newest first. A path the prototype cannot sort by throws.
|
|
18
|
+
*/
|
|
13
19
|
export const buildOrderByParam = ({ slug, locale, tables, configCtx, by, versions, contentWhere, rootTable: aliasedRoot }) => {
|
|
14
20
|
// Presence in the schema, not a config member: a declared versions with no table is not one.
|
|
15
21
|
const hasShadow = !!versions && versions in tables;
|
|
@@ -54,7 +54,18 @@ export declare const readPrototype: ({ db, tables, configCtx }: DepsWithConfig,
|
|
|
54
54
|
* The versioned branch queries the base table and pulls one content row per document, because
|
|
55
55
|
* pagination and ordering are properties of the document rather than of one of its rows.
|
|
56
56
|
*/
|
|
57
|
-
export declare const findManyPrototypes: (
|
|
57
|
+
export declare const findManyPrototypes: (deps: DepsWithConfig, args: FindManyArgs) => Promise<RawDoc[]>;
|
|
58
|
+
/** What decides which documents a list holds; `findManyPrototypes` and `countPrototypes` share it. */
|
|
59
|
+
type ListArgs = {
|
|
60
|
+
slug: string;
|
|
61
|
+
versions?: VersionsTable;
|
|
62
|
+
query?: OperationQuery;
|
|
63
|
+
/** Per document, which content rows it may show — see `readPrototype`. */
|
|
64
|
+
content?: OperationQuery;
|
|
65
|
+
locale?: string;
|
|
66
|
+
};
|
|
67
|
+
/** How many documents `findManyPrototypes` lists for the same arguments, before paging. */
|
|
68
|
+
export declare const countPrototypes: (deps: DepsWithConfig, args: ListArgs) => Promise<number>;
|
|
58
69
|
type FindManyArgs = {
|
|
59
70
|
versions?: VersionsTable;
|
|
60
71
|
slug: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { normalizeQuery } from '../core/pipeline/query.js';
|
|
2
|
-
import { and, eq, inArray } from 'drizzle-orm';
|
|
2
|
+
import { and, eq, gt, inArray, notExists } from 'drizzle-orm';
|
|
3
|
+
import { alias } from 'drizzle-orm/sqlite-core';
|
|
3
4
|
import { RimeError } from '../core/errors/index.js';
|
|
4
5
|
import { baseTableName } from './naming.server.js';
|
|
5
6
|
import { buildOrderByParam } from './order-by.server.js';
|
|
@@ -98,14 +99,16 @@ export const readPrototype = async ({ db, tables, configCtx }, { slug, id, selec
|
|
|
98
99
|
* The versioned branch queries the base table and pulls one content row per document, because
|
|
99
100
|
* pagination and ordering are properties of the document rather than of one of its rows.
|
|
100
101
|
*/
|
|
101
|
-
export const findManyPrototypes = async (
|
|
102
|
-
const {
|
|
102
|
+
export const findManyPrototypes = async (deps, args) => {
|
|
103
|
+
const { db, tables, configCtx } = deps;
|
|
104
|
+
const { select, resolve, sort, limit, offset, locale, localeFallback, config, versions } = args;
|
|
103
105
|
// buildOrderByParam and buildWhereParam resolve fields against the config, so they take a
|
|
104
106
|
// prototype slug. Registration guarantees this one is registered, hence is one.
|
|
105
107
|
const slug = args.slug;
|
|
106
108
|
const table = baseTableName(slug);
|
|
107
|
-
const query = incomingQuery ? normalizeQuery(incomingQuery) : undefined;
|
|
108
109
|
const fallback = localeOrder(configCtx, locale, localeFallback);
|
|
110
|
+
// Which documents the list holds: the same filter `countPrototypes` counts with
|
|
111
|
+
const where = documentsWhere(deps, args);
|
|
109
112
|
// No versions: everything is on the base table, so this is one plain query.
|
|
110
113
|
if (!versions) {
|
|
111
114
|
const params = {
|
|
@@ -113,11 +116,8 @@ export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
|
|
|
113
116
|
orderBy: (t) => buildOrderByParam({ slug, locale, tables, configCtx, by: sort, rootTable: t }),
|
|
114
117
|
...pageParams(limit, offset)
|
|
115
118
|
};
|
|
116
|
-
if (
|
|
117
|
-
params.where = {
|
|
118
|
-
RAW: (t) => buildWhereParam({ query, slug, locale, db, configCtx, tables, rootTable: t })
|
|
119
|
-
};
|
|
120
|
-
}
|
|
119
|
+
if (where)
|
|
120
|
+
params.where = { RAW: where };
|
|
121
121
|
Object.keys(params).forEach((key) => params[key] === undefined && delete params[key]);
|
|
122
122
|
return await db.query[table].findMany({
|
|
123
123
|
columns: adapterUtil.columnsParams({ table: tables[table], select }),
|
|
@@ -134,26 +134,10 @@ export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
|
|
|
134
134
|
const contentTable = baseTableName(versionsSlug);
|
|
135
135
|
const withParam = buildWithParam({ table: contentTable, select, resolve, tables, config, locale, fallback }) ||
|
|
136
136
|
undefined;
|
|
137
|
-
// The caller's
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
.filter((one) => !!one)
|
|
142
|
-
.map((one) => buildWhereParam({
|
|
143
|
-
query: one,
|
|
144
|
-
slug: versionsSlug,
|
|
145
|
-
base: slug,
|
|
146
|
-
locale,
|
|
147
|
-
db,
|
|
148
|
-
configCtx,
|
|
149
|
-
tables,
|
|
150
|
-
rootTable
|
|
151
|
-
}))
|
|
152
|
-
// Only `undefined` drops out: `buildWhereParam` answers `false` for a degenerate query (an
|
|
153
|
-
// empty `and`/`or`), which goes to drizzle as is.
|
|
154
|
-
.filter((one) => one !== undefined);
|
|
155
|
-
return wheres.length > 1 ? and(...wheres) : wheres[0];
|
|
156
|
-
};
|
|
137
|
+
// The caller's filter and `content`, on the versions table. `where` keeps a document only when
|
|
138
|
+
// its newest allowed row matches, so the newest row passing both is that row: the join shows
|
|
139
|
+
// it, and the sort reads it.
|
|
140
|
+
const contentWhere = contentWhereOf(deps, { ...args, versions });
|
|
157
141
|
const params = {
|
|
158
142
|
...pageParams(limit, offset),
|
|
159
143
|
// The sortable columns are on the versions table, so the sort builder is handed it by name.
|
|
@@ -168,14 +152,9 @@ export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
|
|
|
168
152
|
rootTable: t
|
|
169
153
|
})
|
|
170
154
|
};
|
|
171
|
-
// Only the documents
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const contentRows = tables[contentTable];
|
|
175
|
-
params.where = {
|
|
176
|
-
RAW: (t) => inArray(t.id, db.select({ id: contentRows.ownerId }).from(contentRows).where(contentWhere(contentRows)))
|
|
177
|
-
};
|
|
178
|
-
}
|
|
155
|
+
// Only the documents whose shown row matches, before `limit` and `offset` cut the page
|
|
156
|
+
if (where)
|
|
157
|
+
params.where = { RAW: where };
|
|
179
158
|
Object.keys(params).forEach((key) => params[key] === undefined && delete params[key]);
|
|
180
159
|
const rawDocs = await db.query[table].findMany({
|
|
181
160
|
...params,
|
|
@@ -199,7 +178,9 @@ export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
|
|
|
199
178
|
}
|
|
200
179
|
catch (err) {
|
|
201
180
|
// A document left with no content row drops out of the result rather than failing the
|
|
202
|
-
// whole read. The `where` above
|
|
181
|
+
// whole read. The `where` above, present with a `query` or a `content` filter, keeps such a
|
|
182
|
+
// document off the page; without either, it is dropped after `limit`, and the page comes
|
|
183
|
+
// back one short.
|
|
203
184
|
if (err instanceof RimeError && err.code === RimeError.NOT_FOUND)
|
|
204
185
|
return false;
|
|
205
186
|
throw err;
|
|
@@ -207,6 +188,81 @@ export const findManyPrototypes = async ({ db, tables, configCtx }, args) => {
|
|
|
207
188
|
})
|
|
208
189
|
.filter(Boolean);
|
|
209
190
|
};
|
|
191
|
+
/**
|
|
192
|
+
* The caller's `query` and `content` on a versions table, `and`ed: both resolve against it.
|
|
193
|
+
* `undefined` when there is neither.
|
|
194
|
+
*/
|
|
195
|
+
const contentWhereOf = ({ db, tables, configCtx }, args) => {
|
|
196
|
+
const queries = [args.query, args.content].flatMap((one) => (one ? [normalizeQuery(one)] : []));
|
|
197
|
+
return (rootTable) => {
|
|
198
|
+
const wheres = queries
|
|
199
|
+
.map((query) => buildWhereParam({
|
|
200
|
+
query,
|
|
201
|
+
slug: args.versions.slug,
|
|
202
|
+
base: args.slug,
|
|
203
|
+
locale: args.locale,
|
|
204
|
+
db,
|
|
205
|
+
configCtx,
|
|
206
|
+
tables,
|
|
207
|
+
rootTable
|
|
208
|
+
}))
|
|
209
|
+
// Only `undefined` drops out: `buildWhereParam` answers `false` for a degenerate query (an
|
|
210
|
+
// empty `and`/`or`), which goes to drizzle as is.
|
|
211
|
+
.filter((one) => one !== undefined);
|
|
212
|
+
return wheres.length > 1 ? and(...wheres) : wheres[0];
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* `rowWhere`, kept to each document's newest row among those `content` allows: a row passes when
|
|
217
|
+
* no newer row of the same document is allowed.
|
|
218
|
+
*
|
|
219
|
+
* ```ts
|
|
220
|
+
* // news, latest (no `content`), ?where[status][equals]=draft
|
|
221
|
+
* // v.status = 'draft' and not exists (select id from news__versions newer
|
|
222
|
+
* // where newer.owner_id = v.owner_id and newer.updated_at > v.updated_at)
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
const newestOnly = (deps, args, rowWhere) => {
|
|
226
|
+
const newer = alias(deps.tables[baseTableName(args.versions.slug)], 'newer');
|
|
227
|
+
const allowed = contentWhereOf(deps, { ...args, query: undefined });
|
|
228
|
+
return (rows) => and(rowWhere(rows) || undefined, notExists(deps.db
|
|
229
|
+
.select({ id: newer.id })
|
|
230
|
+
.from(newer)
|
|
231
|
+
.where(and(eq(newer.ownerId, rows.ownerId), gt(newer.updatedAt, rows.updatedAt), allowed(newer) || undefined))));
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Which documents a list holds, as a filter on the base table: `query` itself without versions;
|
|
235
|
+
* with versions, the documents whose newest row among those `content` allows matches `query`.
|
|
236
|
+
* `undefined` when nothing narrows the list.
|
|
237
|
+
*
|
|
238
|
+
* ```ts
|
|
239
|
+
* // news, ?where[title][equals]=Hi, published rows only
|
|
240
|
+
* // news.id in (select owner_id from news__versions v where v.title = 'Hi'
|
|
241
|
+
* // and v.status = 'published' and not exists (a newer published row of the same news))
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
const documentsWhere = (deps, args) => {
|
|
245
|
+
const { db, tables, configCtx } = deps;
|
|
246
|
+
const { versions, query, content, locale } = args;
|
|
247
|
+
const slug = args.slug;
|
|
248
|
+
if (!versions) {
|
|
249
|
+
if (!query)
|
|
250
|
+
return undefined;
|
|
251
|
+
const parsed = normalizeQuery(query);
|
|
252
|
+
return (t) => buildWhereParam({ query: parsed, slug, locale, db, configCtx, tables, rootTable: t });
|
|
253
|
+
}
|
|
254
|
+
if (!query && !content)
|
|
255
|
+
return undefined;
|
|
256
|
+
const contentRows = tables[baseTableName(versions.slug)];
|
|
257
|
+
const rowWhere = newestOnly(deps, { ...args, versions }, contentWhereOf(deps, { ...args, versions }));
|
|
258
|
+
return (t) => inArray(t.id, db.select({ id: contentRows.ownerId }).from(contentRows).where(rowWhere(contentRows)));
|
|
259
|
+
};
|
|
260
|
+
/** How many documents `findManyPrototypes` lists for the same arguments, before paging. */
|
|
261
|
+
export const countPrototypes = async (deps, args) => {
|
|
262
|
+
const table = deps.tables[baseTableName(args.slug)];
|
|
263
|
+
const where = documentsWhere(deps, args);
|
|
264
|
+
return deps.db.$count(table, where?.(table));
|
|
265
|
+
};
|
|
210
266
|
/**
|
|
211
267
|
* `limit` and `offset` as SQLite takes them: an offset that is not a positive integer is none,
|
|
212
268
|
* and SQLite needs a limit beside an offset.
|
|
@@ -7,8 +7,8 @@ import type { Dic } from '../util/types.js';
|
|
|
7
7
|
*
|
|
8
8
|
* Prototypes register at boot. That is the whole reason this file exists: the adapter is handed
|
|
9
9
|
* the prototypes it will serve *once*, rather than working one out from a slug on every request.
|
|
10
|
-
* It also means a prototype whose
|
|
11
|
-
*
|
|
10
|
+
* It also means a prototype whose base table is missing fails at boot, in a place that names it.
|
|
11
|
+
* A missing versions, branch or child table fails on the first request that reads it.
|
|
12
12
|
*
|
|
13
13
|
* `config.type` decides which handle a slug gets:
|
|
14
14
|
*
|
|
@@ -7,8 +7,8 @@ import { baseTableName } from './naming.server.js';
|
|
|
7
7
|
*
|
|
8
8
|
* Prototypes register at boot. That is the whole reason this file exists: the adapter is handed
|
|
9
9
|
* the prototypes it will serve *once*, rather than working one out from a slug on every request.
|
|
10
|
-
* It also means a prototype whose
|
|
11
|
-
*
|
|
10
|
+
* It also means a prototype whose base table is missing fails at boot, in a place that names it.
|
|
11
|
+
* A missing versions, branch or child table fails on the first request that reads it.
|
|
12
12
|
*
|
|
13
13
|
* `config.type` decides which handle a slug gets:
|
|
14
14
|
*
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { AdapterDeps } from './types.server.js';
|
|
2
2
|
import type { BeforeOperationRelation, RelationRow } from '../fields/relation/index.js';
|
|
3
3
|
import type { PrototypeSlug } from '../core/prototype/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The junction rows of a prototype's relation fields, in its `__$relations` table: one row per
|
|
6
|
+
* related document, at the field's `path`, in `position` order, the target in a column of its
|
|
7
|
+
* own (`mediasId`).
|
|
8
|
+
*/
|
|
4
9
|
declare const createRelationsHandle: ({ db, tables }: AdapterDeps) => {
|
|
5
10
|
create: Create;
|
|
6
11
|
update: Update;
|
|
@@ -4,7 +4,17 @@ import { isWithin } from '../util/string.js';
|
|
|
4
4
|
import { and, eq, getTableColumns, inArray, isNull, or } from 'drizzle-orm';
|
|
5
5
|
import { transformDataToSchema } from './columns.server.js';
|
|
6
6
|
import { resolveRelationTarget } from './transform.server.js';
|
|
7
|
+
/**
|
|
8
|
+
* The junction rows of a prototype's relation fields, in its `__$relations` table: one row per
|
|
9
|
+
* related document, at the field's `path`, in `position` order, the target in a column of its
|
|
10
|
+
* own (`mediasId`).
|
|
11
|
+
*/
|
|
7
12
|
const createRelationsHandle = ({ db, tables }) => {
|
|
13
|
+
/**
|
|
14
|
+
* Deletes the junction rows at or below each of `paths`: `sections.1` takes `sections.1.image`,
|
|
15
|
+
* not `sections.10.image`. With `locale`, on a junction that has a `locale` column, only rows of
|
|
16
|
+
* that locale go; unlocalized rows stay.
|
|
17
|
+
*/
|
|
8
18
|
const deleteFromPaths = async ({ parentSlug, ownerId, paths, locale }) => {
|
|
9
19
|
if (paths.length === 0)
|
|
10
20
|
return true;
|
|
@@ -15,10 +25,8 @@ const createRelationsHandle = ({ db, tables }) => {
|
|
|
15
25
|
const table = tables[relationTableName];
|
|
16
26
|
if (!table)
|
|
17
27
|
return true;
|
|
18
|
-
// Only
|
|
19
|
-
//
|
|
20
|
-
// (see getAll's identical guard below). Without this check, eq(undefined,
|
|
21
|
-
// locale) produces SQL with a missing column reference.
|
|
28
|
+
// Only a junction holding a localized relation has a `locale` column (getAll checks the same).
|
|
29
|
+
// Unlike getAll, this keeps the rows of `locale` only, not the unlocalized ones.
|
|
22
30
|
const columns = Object.keys(getTableColumns(table));
|
|
23
31
|
const conditions = [eq(table.ownerId, ownerId)];
|
|
24
32
|
if (locale && columns.includes('locale')) {
|
|
@@ -36,6 +44,11 @@ const createRelationsHandle = ({ db, tables }) => {
|
|
|
36
44
|
await db.delete(table).where(inArray(table.id, toDelete));
|
|
37
45
|
return true;
|
|
38
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Inserts one junction row per relation that names a document, in order; one with no
|
|
49
|
+
* `documentId` is skipped. The first insert that fails throws, naming its path, and the rows
|
|
50
|
+
* before it stay written.
|
|
51
|
+
*/
|
|
39
52
|
const create = async ({ parentSlug, ownerId, relations }) => {
|
|
40
53
|
const relationTableName = tableName({
|
|
41
54
|
owner: baseTableName(parentSlug),
|
|
@@ -66,6 +79,10 @@ const createRelationsHandle = ({ db, tables }) => {
|
|
|
66
79
|
}
|
|
67
80
|
return true;
|
|
68
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* Writes each row's `path`, `position` and target, by its id. On a junction with a `locale`
|
|
84
|
+
* column, its `locale` too.
|
|
85
|
+
*/
|
|
69
86
|
const update = async ({ parentSlug, relations }) => {
|
|
70
87
|
const relationTableName = tableName({
|
|
71
88
|
owner: baseTableName(parentSlug),
|
|
@@ -90,6 +107,7 @@ const createRelationsHandle = ({ db, tables }) => {
|
|
|
90
107
|
}
|
|
91
108
|
return true;
|
|
92
109
|
};
|
|
110
|
+
/** Deletes the junction rows named by id. */
|
|
93
111
|
const deleteRelations = async ({ parentSlug, relations }) => {
|
|
94
112
|
const relationTableName = tableName({
|
|
95
113
|
owner: baseTableName(parentSlug),
|
|
@@ -111,14 +129,16 @@ const createRelationsHandle = ({ db, tables }) => {
|
|
|
111
129
|
}
|
|
112
130
|
return true;
|
|
113
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* Every junction row of `ownerId`, read as `relationTo` and `documentId`. With `locale`, the rows
|
|
134
|
+
* of that locale and the unlocalized ones.
|
|
135
|
+
*/
|
|
114
136
|
const getAll = async ({ parentSlug, ownerId, locale }) => {
|
|
115
137
|
const relationTableName = tableName({
|
|
116
138
|
owner: baseTableName(parentSlug),
|
|
117
139
|
child: { kind: 'rels' }
|
|
118
140
|
});
|
|
119
|
-
//
|
|
120
|
-
// relationTableName doesn't exist
|
|
121
|
-
// then there are no relations
|
|
141
|
+
// No relation field, no junction table: no rows.
|
|
122
142
|
if (!(relationTableName in tables)) {
|
|
123
143
|
return [];
|
|
124
144
|
}
|
|
@@ -3,7 +3,10 @@ import type { Dic } from '../util/types.js';
|
|
|
3
3
|
import { type TableName } from './naming.server.js';
|
|
4
4
|
/** Writes `row` over its stored row, and its localized values in `locale`. */
|
|
5
5
|
export declare const updateRepeatable: ({ db, tables }: AdapterDeps, table: TableName, row: Dic, locale?: string) => Promise<boolean>;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Deletes the row by id. Its locales row goes with it through the `ON DELETE CASCADE` foreign
|
|
8
|
+
* key, which needs foreign keys on (connect.server.ts).
|
|
9
|
+
*/
|
|
7
10
|
export declare const deleteRepeatable: ({ db, tables }: AdapterDeps, table: TableName, id: string) => Promise<boolean>;
|
|
8
11
|
/** Inserts `row` for `ownerId`, and its localized values in `locale`. The row gets a new id. */
|
|
9
12
|
export declare const createRepeatable: ({ db, tables }: AdapterDeps, table: TableName, row: Dic, ownerId: string, locale?: string) => Promise<boolean>;
|
|
@@ -41,7 +41,10 @@ export const updateRepeatable = async ({ db, tables }, table, row, locale) => {
|
|
|
41
41
|
}
|
|
42
42
|
return true;
|
|
43
43
|
};
|
|
44
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Deletes the row by id. Its locales row goes with it through the `ON DELETE CASCADE` foreign
|
|
46
|
+
* key, which needs foreign keys on (connect.server.ts).
|
|
47
|
+
*/
|
|
45
48
|
export const deleteRepeatable = async ({ db, tables }, table, id) => {
|
|
46
49
|
await db.delete(tables[table]).where(eq(tables[table].id, id));
|
|
47
50
|
return true;
|
|
@@ -31,6 +31,12 @@ export declare const pathsJoin: (args: {
|
|
|
31
31
|
locale?: string;
|
|
32
32
|
select?: string[];
|
|
33
33
|
}) => Dic;
|
|
34
|
+
/**
|
|
35
|
+
* The drizzle `with` of a read of `table`: which child tables, branches, junction rows, resolved
|
|
36
|
+
* references and addresses load with each row. Without `select`, all of them. With it, only where
|
|
37
|
+
* the selected paths are stored: a relation by its `path`, a blocks or tree field by the rows
|
|
38
|
+
* below it. `undefined` when a `select` joins nothing.
|
|
39
|
+
*/
|
|
34
40
|
export declare const buildWithParam: (args: {
|
|
35
41
|
table: TableName;
|
|
36
42
|
select?: string[];
|
|
@@ -56,11 +56,18 @@ export const pathsJoin = (args) => {
|
|
|
56
56
|
[paths]: { where: { locale: locale ?? '' }, columns: { slug: true, path: true, url: true } }
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* The drizzle `with` of a read of `table`: which child tables, branches, junction rows, resolved
|
|
61
|
+
* references and addresses load with each row. Without `select`, all of them. With it, only where
|
|
62
|
+
* the selected paths are stored: a relation by its `path`, a blocks or tree field by the rows
|
|
63
|
+
* below it. `undefined` when a `select` joins nothing.
|
|
64
|
+
*/
|
|
59
65
|
export const buildWithParam = (args) => {
|
|
60
66
|
const { table, select = [], resolve, locale, fallback, tables, config: documentConfig } = args;
|
|
61
67
|
// A child row — a block, a tree node — belongs to one locale. Its locales branch, and the
|
|
62
68
|
// document's, are read for every locale in the order and merged in `transform`.
|
|
63
69
|
const branchWhere = branchFilter(locale, fallback);
|
|
70
|
+
const read = { tables, locale, branchWhere };
|
|
64
71
|
// On the base table only: a versioned read joins it above the content row.
|
|
65
72
|
const paths = table === baseTableName(documentConfig.slug)
|
|
66
73
|
? pathsJoin({ base: table, tables, locale, select })
|
|
@@ -101,24 +108,8 @@ export const buildWithParam = (args) => {
|
|
|
101
108
|
else if (fieldConfig && storageKinds(fieldConfig).length) {
|
|
102
109
|
for (const kind of storageKinds(fieldConfig)) {
|
|
103
110
|
childPaths[kind].push(path);
|
|
104
|
-
for (const
|
|
105
|
-
|
|
106
|
-
continue;
|
|
107
|
-
let params = { orderBy: { position: 'asc' } };
|
|
108
|
-
const columns = getColumns(tables[childTable]);
|
|
109
|
-
const hasLocale = Object.keys(columns).includes('locale');
|
|
110
|
-
if (locale && hasLocale) {
|
|
111
|
-
params = { ...params, where: { locale } };
|
|
112
|
-
}
|
|
113
|
-
withParam[childTable] = params;
|
|
114
|
-
// Its locales branch with it.
|
|
115
|
-
const localesTable = tableName({ owner: childTable, branch: 'locales' });
|
|
116
|
-
if (locale && localesTable in tables) {
|
|
117
|
-
withParam[childTable] = {
|
|
118
|
-
...withParam[childTable],
|
|
119
|
-
with: { [localesTable]: { where: branchWhere } }
|
|
120
|
-
};
|
|
121
|
-
}
|
|
111
|
+
for (const child of childTableNames(table, kind, tables)) {
|
|
112
|
+
withParam[child] ??= childJoin(child, read);
|
|
122
113
|
}
|
|
123
114
|
}
|
|
124
115
|
}
|
|
@@ -153,119 +144,71 @@ export const buildWithParam = (args) => {
|
|
|
153
144
|
if (relationPaths.length) {
|
|
154
145
|
withParam[rels] = { where: { OR: relationPaths }, orderBy: { path: 'asc', position: 'asc' } };
|
|
155
146
|
}
|
|
156
|
-
// 2.
|
|
157
|
-
if (childPaths.blocks.length
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
if (!withParam[treeTable]) {
|
|
161
|
-
withParam[treeTable] = {
|
|
162
|
-
where: { OR: childPaths.blocks.map(below) },
|
|
163
|
-
orderBy: { position: 'asc' }
|
|
164
|
-
};
|
|
165
|
-
// Handle localized trees
|
|
166
|
-
const localesTreeTable = tableName({ owner: treeTable, branch: 'locales' });
|
|
167
|
-
if (locale && localesTreeTable in tables) {
|
|
168
|
-
withParam[treeTable] = {
|
|
169
|
-
...withParam[treeTable],
|
|
170
|
-
with: {
|
|
171
|
-
[localesTreeTable]: {
|
|
172
|
-
where: branchWhere
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
}
|
|
147
|
+
// 2. The trees inside the selected blocks, by the rows below them.
|
|
148
|
+
if (childPaths.blocks.length) {
|
|
149
|
+
for (const child of childTableNames(table, 'tree', tables)) {
|
|
150
|
+
withParam[child] ??= childJoin(child, read, { OR: childPaths.blocks.map(below) });
|
|
178
151
|
}
|
|
179
152
|
}
|
|
180
|
-
// 3.
|
|
181
|
-
if (childPaths.tree.length
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
if (!withParam[blocksTable]) {
|
|
185
|
-
withParam[blocksTable] = {
|
|
186
|
-
where: { OR: childPaths.tree.map(below) },
|
|
187
|
-
orderBy: { position: 'asc' }
|
|
188
|
-
};
|
|
189
|
-
// Handle localized blocks
|
|
190
|
-
const localesBlockTable = tableName({ owner: blocksTable, branch: 'locales' });
|
|
191
|
-
if (locale && localesBlockTable in tables) {
|
|
192
|
-
withParam[blocksTable] = {
|
|
193
|
-
...withParam[blocksTable],
|
|
194
|
-
with: {
|
|
195
|
-
[localesBlockTable]: {
|
|
196
|
-
where: branchWhere
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
}
|
|
153
|
+
// 3. The blocks inside the selected trees, by the rows below them.
|
|
154
|
+
if (childPaths.tree.length) {
|
|
155
|
+
for (const child of childTableNames(table, 'blocks', tables)) {
|
|
156
|
+
withParam[child] ??= childJoin(child, read, { OR: childPaths.tree.map(below) });
|
|
202
157
|
}
|
|
203
158
|
}
|
|
204
|
-
// If withParam is empty
|
|
205
159
|
if (Object.keys(withParam).length === 0) {
|
|
206
160
|
return undefined;
|
|
207
161
|
}
|
|
208
162
|
return withParam;
|
|
209
163
|
};
|
|
210
|
-
/** The filter on a locales branch: every locale in the fallback order, else the one requested. */
|
|
211
164
|
/**
|
|
212
165
|
* Rows stored below a container: `layout` -> `layout.0.image`, not `layoutCover` nor
|
|
213
166
|
* `layoutXcover`. A range, not `LIKE`, where `_` would match any character: `/` is the character
|
|
214
167
|
* after `.`.
|
|
215
168
|
*/
|
|
216
169
|
const below = (path) => ({ path: { gte: `${path}.`, lt: `${path}/` } });
|
|
170
|
+
/** The filter on a locales branch: every locale in the fallback order, else the one requested. */
|
|
217
171
|
const branchFilter = (locale, fallback) => fallback && fallback.length > 1 ? { locale: { in: fallback } } : { locale };
|
|
172
|
+
/**
|
|
173
|
+
* How a child table joins its owner in a read: its rows by `position`, with its locales branch.
|
|
174
|
+
* `where` picks the rows; without it, those of `locale` when the table has a `locale` column.
|
|
175
|
+
*
|
|
176
|
+
* ```ts
|
|
177
|
+
* childJoin('pages__$blocks_hero', { tables, locale: 'en', branchWhere: { locale: 'en' } })
|
|
178
|
+
* // { orderBy: { position: 'asc' }, where: { locale: 'en' },
|
|
179
|
+
* // with: { 'pages__$blocks_hero__$$locales': { where: { locale: 'en' } } } }
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
const childJoin = (child, read, where) => {
|
|
183
|
+
const { tables, locale, branchWhere } = read;
|
|
184
|
+
const branch = tableName({ owner: child, branch: 'locales' });
|
|
185
|
+
const rows = where ?? (locale && 'locale' in getColumns(tables[child]) ? { locale } : undefined);
|
|
186
|
+
const join = { orderBy: { position: 'asc' } };
|
|
187
|
+
if (rows)
|
|
188
|
+
join.where = rows;
|
|
189
|
+
if (locale && branch in tables)
|
|
190
|
+
join.with = { [branch]: { where: branchWhere } };
|
|
191
|
+
return join;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* The `with` of a read without `select`: every child table of `table` and its locales branch, the
|
|
195
|
+
* table's own branch, and its junction rows. A child row is kept to `locale` when its table has a
|
|
196
|
+
* `locale` column.
|
|
197
|
+
*/
|
|
218
198
|
const buildFullWithParam = ({ table, locale, fallback, tables }) => {
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
params = { ...params, where: { locale } };
|
|
229
|
-
}
|
|
230
|
-
return [key, params];
|
|
231
|
-
}));
|
|
232
|
-
if (locale) {
|
|
233
|
-
const localesTableName = tableName({ owner: table, branch: 'locales' });
|
|
234
|
-
if (localesTableName in tables) {
|
|
235
|
-
withParam[localesTableName] = { where: branchWhere };
|
|
236
|
-
}
|
|
237
|
-
for (const blocksTable of blocksTables) {
|
|
238
|
-
const localesBlockTable = tableName({ owner: blocksTable, branch: 'locales' });
|
|
239
|
-
if (localesBlockTable in tables) {
|
|
240
|
-
withParam[blocksTable] = {
|
|
241
|
-
...withParam[blocksTable],
|
|
242
|
-
with: {
|
|
243
|
-
[localesBlockTable]: {
|
|
244
|
-
where: branchWhere
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
for (const treeTable of treeTables) {
|
|
251
|
-
const localesTreeTable = tableName({ owner: treeTable, branch: 'locales' });
|
|
252
|
-
if (localesTreeTable in tables) {
|
|
253
|
-
withParam[treeTable] = {
|
|
254
|
-
...withParam[treeTable],
|
|
255
|
-
with: {
|
|
256
|
-
[localesTreeTable]: {
|
|
257
|
-
where: branchWhere
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}
|
|
199
|
+
const read = { tables, locale, branchWhere: branchFilter(locale, fallback) };
|
|
200
|
+
const children = [
|
|
201
|
+
...childTableNames(table, 'blocks', tables),
|
|
202
|
+
...childTableNames(table, 'tree', tables)
|
|
203
|
+
];
|
|
204
|
+
const withParam = Object.fromEntries(children.map((child) => [child, childJoin(child, read)]));
|
|
205
|
+
const branch = tableName({ owner: table, branch: 'locales' });
|
|
206
|
+
if (locale && branch in tables) {
|
|
207
|
+
withParam[branch] = { where: read.branchWhere };
|
|
263
208
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
withParam[
|
|
267
|
-
orderBy: { path: 'asc', position: 'asc' }
|
|
268
|
-
};
|
|
209
|
+
const rels = tableName({ owner: table, child: { kind: 'rels' } });
|
|
210
|
+
if (rels in tables) {
|
|
211
|
+
withParam[rels] = { orderBy: { path: 'asc', position: 'asc' } };
|
|
269
212
|
}
|
|
270
213
|
return withParam;
|
|
271
214
|
};
|
|
@@ -11,6 +11,7 @@ import { declaredTableProperty } from './naming.server.js';
|
|
|
11
11
|
*/
|
|
12
12
|
export const createTableHandles = (args) => {
|
|
13
13
|
const { db, tables } = args;
|
|
14
|
+
/** The handle of the declared table `slug` (`$authUsers`). Throws when the schema has none. */
|
|
14
15
|
const get = (slug) => {
|
|
15
16
|
const name = declaredTableProperty(slug);
|
|
16
17
|
const table = tables[name];
|
|
@@ -38,6 +39,10 @@ export const createTableHandles = (args) => {
|
|
|
38
39
|
return and(...built);
|
|
39
40
|
};
|
|
40
41
|
return {
|
|
42
|
+
/**
|
|
43
|
+
* The rows matching every condition of `where`, with only the `select` columns when given.
|
|
44
|
+
* An empty `where` reads every row; no `limit`, or 0, reads them all.
|
|
45
|
+
*/
|
|
41
46
|
find: async ({ where = {}, select, limit } = {}) => {
|
|
42
47
|
const columns = select?.length
|
|
43
48
|
? Object.fromEntries(select.map((name) => [name, columnOf(name)]))
|
|
@@ -50,9 +55,11 @@ export const createTableHandles = (args) => {
|
|
|
50
55
|
query = query.limit(limit);
|
|
51
56
|
return (await query);
|
|
52
57
|
},
|
|
58
|
+
/** Writes `data` on the rows matching `where`; an empty `where` is refused. */
|
|
53
59
|
update: async ({ where, data }) => {
|
|
54
60
|
await db.update(table).set(data).where(writeFilter(where, 'update'));
|
|
55
61
|
},
|
|
62
|
+
/** Deletes the rows matching `where`; an empty `where` is refused. */
|
|
56
63
|
delete: async ({ where }) => {
|
|
57
64
|
await db.delete(table).where(writeFilter(where, 'delete'));
|
|
58
65
|
}
|
|
@@ -34,12 +34,18 @@ export const createTransformHandle = (args) => {
|
|
|
34
34
|
...merged
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* One raw row of a read as the four piles core builds a document from: `base` (the row's own
|
|
39
|
+
* columns as document paths, localized values merged in the fallback order, and its address),
|
|
40
|
+
* `blocks` and `tree` (child rows, their locales merged), and `relations` (junction rows as
|
|
41
|
+
* `relationTo`/`documentId`).
|
|
42
|
+
*/
|
|
37
43
|
const rows = async (args) => {
|
|
38
44
|
const { slug, locale, localeFallback } = args;
|
|
39
45
|
const order = localeOrder(configCtx, locale, localeFallback) ?? [];
|
|
40
46
|
let doc = args.doc;
|
|
41
|
-
// The table this document's content is in
|
|
42
|
-
//
|
|
47
|
+
// The table this document's content is in: the versions table of a versioned config, else
|
|
48
|
+
// its own.
|
|
43
49
|
const tableName = baseTableName(configCtx.getBySlug(slug)._versions?.slug ?? slug);
|
|
44
50
|
const tableNameRelationFields = buildTableName({ owner: tableName, child: { kind: 'rels' } });
|
|
45
51
|
// The addresses hang off the base row, whether or not the content is on a versions table.
|