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
|
@@ -32,7 +32,7 @@ const buildRootTable = async ({ fields: incomingFields, tableName, rootName, has
|
|
|
32
32
|
const name = buildTableName({ owner: rootName, child: storage });
|
|
33
33
|
if (blocksRegister.includes(name))
|
|
34
34
|
return;
|
|
35
|
-
|
|
35
|
+
(relationsDic[rootName] ??= []).push(name);
|
|
36
36
|
const nested = await buildRootTable({
|
|
37
37
|
blocksRegister,
|
|
38
38
|
fields,
|
|
@@ -43,7 +43,6 @@ const buildRootTable = async ({ fields: incomingFields, tableName, rootName, has
|
|
|
43
43
|
locales,
|
|
44
44
|
rootName
|
|
45
45
|
});
|
|
46
|
-
relationsDic = nested.relationsDic;
|
|
47
46
|
if (nested.relationFieldsHasLocale)
|
|
48
47
|
relationFieldsHasLocale = true;
|
|
49
48
|
referenceJoins.push(...nested.referenceJoins);
|
|
@@ -52,9 +51,12 @@ const buildRootTable = async ({ fields: incomingFields, tableName, rootName, has
|
|
|
52
51
|
};
|
|
53
52
|
/**
|
|
54
53
|
* The columns of one table, and in `indexed` the ones a field asked `$index()` for.
|
|
54
|
+
* `withLocalized`: `true` keeps the localized leaves only (the locales branch), `false` the
|
|
55
|
+
* others (the table), `undefined` all of them (a table with no branch).
|
|
55
56
|
*/
|
|
56
57
|
const generateFieldsTemplates = async (fields, withLocalized, parentPath = '', indexed = []) => {
|
|
57
58
|
let templates = [];
|
|
59
|
+
/** Whether `field` is a column of the table being built: see `withLocalized`. */
|
|
58
60
|
const checkLocalized = (field) => {
|
|
59
61
|
return ((withLocalized && field.get.localized) ||
|
|
60
62
|
(!withLocalized && !field.get.localized) ||
|
|
@@ -85,6 +87,10 @@ const buildRootTable = async ({ fields: incomingFields, tableName, rootName, has
|
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
else if (field instanceof FormFieldBuilder) {
|
|
90
|
+
// Every table's `id` is `pk()` (`templateTable`): a field named `id` fills it, as an
|
|
91
|
+
// upload folder's path does, and declares no column of its own
|
|
92
|
+
if (!parentPath && field.name === 'id')
|
|
93
|
+
continue;
|
|
88
94
|
if (checkLocalized(field)) {
|
|
89
95
|
templates.push(toSchemaColumn(field, parentPath) + ',');
|
|
90
96
|
if (field.get.index) {
|
|
@@ -105,37 +111,24 @@ const buildRootTable = async ({ fields: incomingFields, tableName, rootName, has
|
|
|
105
111
|
};
|
|
106
112
|
// A child row is read by its owner. A field's `$index()` adds its own column below.
|
|
107
113
|
const indexed = hasParent || versionsOf ? ['ownerId'] : [];
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
table += templateTable(
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
const strFields = await generateFieldsTemplates(incomingFields, undefined, '', indexed);
|
|
129
|
-
if (hasParent) {
|
|
130
|
-
strFields.push(templateParent(rootName));
|
|
131
|
-
}
|
|
132
|
-
if (versionsOf) {
|
|
133
|
-
strFields.push(templateParent(versionsOf));
|
|
134
|
-
}
|
|
135
|
-
for (const column of featureColumns) {
|
|
136
|
-
strFields.push(templateDeclaredColumn(column) + ',');
|
|
137
|
-
}
|
|
138
|
-
table = templateTable(tableName, strFields.join('\n '), indexed);
|
|
114
|
+
// A locales branch takes the localized columns and the table keeps the others. With no
|
|
115
|
+
// branch, the table keeps them all.
|
|
116
|
+
const hasBranch = !!locales?.length && hasLocalizedField(incomingFields);
|
|
117
|
+
const branchName = buildTableName({ owner: tableName, branch: 'locales' });
|
|
118
|
+
const branchIndexed = [];
|
|
119
|
+
const localized = hasBranch
|
|
120
|
+
? await generateFieldsTemplates(incomingFields, true, '', branchIndexed)
|
|
121
|
+
: [];
|
|
122
|
+
const own = await generateFieldsTemplates(incomingFields, hasBranch ? false : undefined, '', indexed);
|
|
123
|
+
const tail = [
|
|
124
|
+
hasParent && templateParent(rootName),
|
|
125
|
+
versionsOf && templateParent(versionsOf),
|
|
126
|
+
...featureColumns.map((column) => templateDeclaredColumn(column) + ',')
|
|
127
|
+
].filter(Boolean);
|
|
128
|
+
let table = templateTable(tableName, [...own, ...tail].join('\n '), indexed);
|
|
129
|
+
if (hasBranch) {
|
|
130
|
+
(relationsDic[tableName] ??= []).push(branchName);
|
|
131
|
+
table += templateTable(branchName, [...localized, templateLocale(), templateParent(tableName)].join('\n '), ['ownerId', ...branchIndexed]);
|
|
139
132
|
}
|
|
140
133
|
return {
|
|
141
134
|
schema: [table, ...blocksTables].join('\n\n'),
|
|
@@ -68,26 +68,6 @@ export declare const templateDeclaredColumn: (column: ColumnDeclaration) => stri
|
|
|
68
68
|
* `declaredTableProperty`. No `pk()` default: a declaration says which column is the primary key.
|
|
69
69
|
*/
|
|
70
70
|
export declare const templateDeclaredTable: (table: TableDeclaration) => string;
|
|
71
|
-
/**
|
|
72
|
-
* Generates unique and required modifiers for a field
|
|
73
|
-
* Combines .unique() and .notNull() based on field configuration
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* // For a unique and required field:
|
|
78
|
-
* .unique().notNull()
|
|
79
|
-
*
|
|
80
|
-
* // For just a unique field:
|
|
81
|
-
* .unique()
|
|
82
|
-
*
|
|
83
|
-
* // For just a required field:
|
|
84
|
-
* .notNull()
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
export declare const templateUniqueRequired: (field: {
|
|
88
|
-
unique?: boolean;
|
|
89
|
-
required?: boolean;
|
|
90
|
-
}, defaultValue?: string | number | boolean | object | unknown[]) => string;
|
|
91
71
|
/**
|
|
92
72
|
* The addresses of a config with `$url`: one row per page and per locale, off its base table. An
|
|
93
73
|
* area has one row per locale, its slug and no parent.
|
|
@@ -100,7 +80,6 @@ export declare const templateUniqueRequired: (field: {
|
|
|
100
80
|
* ```
|
|
101
81
|
*/
|
|
102
82
|
export declare const templatePathsTable: (owner: TableName) => string;
|
|
103
|
-
/** Template rows Relation */
|
|
104
83
|
/**
|
|
105
84
|
* The drizzle relations of the whole schema. A read lists them in its `with` to load related rows
|
|
106
85
|
* in the same query, by the names given here.
|
|
@@ -137,7 +116,6 @@ export declare const templateRelations: (tree: Record<string, string[]>, referen
|
|
|
137
116
|
column: string;
|
|
138
117
|
to: string;
|
|
139
118
|
}[]) => string;
|
|
140
|
-
/** Templates Field Relations */
|
|
141
119
|
/**
|
|
142
120
|
* The junction column pointing at one target collection. The property is keyed by the slug, which
|
|
143
121
|
* is how the adapter reads it back; the SQL column and the referenced table carry the table name.
|
|
@@ -138,37 +138,6 @@ export const ${declaredTableProperty(table.slug)} = sqliteTable('${baseTableName
|
|
|
138
138
|
${table.columns.map(templateDeclaredColumn).join(',\n ')}
|
|
139
139
|
});
|
|
140
140
|
`;
|
|
141
|
-
/**
|
|
142
|
-
* Generates unique and required modifiers for a field
|
|
143
|
-
* Combines .unique() and .notNull() based on field configuration
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* // For a unique and required field:
|
|
148
|
-
* .unique().notNull()
|
|
149
|
-
*
|
|
150
|
-
* // For just a unique field:
|
|
151
|
-
* .unique()
|
|
152
|
-
*
|
|
153
|
-
* // For just a required field:
|
|
154
|
-
* .notNull()
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
export const templateUniqueRequired = (field, defaultValue) => {
|
|
158
|
-
const { unique, required } = field;
|
|
159
|
-
const defaultStr = required && defaultValue !== undefined ? `.default(${templateDefault(defaultValue)})` : '';
|
|
160
|
-
return `${unique ? '.unique()' : ''}${required ? `.notNull()${defaultStr}` : ''}`;
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* A default value as drizzle wants it written. A timestamp column takes a `Date`, which
|
|
164
|
-
* drizzle-kit stores as the same integer a number would have been.
|
|
165
|
-
*
|
|
166
|
-
* ```ts
|
|
167
|
-
* templateDefault('') // ""
|
|
168
|
-
* templateDefault(new Date(0)) // new Date(0)
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
const templateDefault = (value) => value instanceof Date ? `new Date(${value.getTime()})` : JSON.stringify(value);
|
|
172
141
|
/**
|
|
173
142
|
* The addresses of a config with `$url`: one row per page and per locale, off its base table. An
|
|
174
143
|
* area has one row per locale, its slug and no parent.
|
|
@@ -201,7 +170,6 @@ export const ${table} = sqliteTable('${table}', {
|
|
|
201
170
|
]);
|
|
202
171
|
`;
|
|
203
172
|
};
|
|
204
|
-
/** Template rows Relation */
|
|
205
173
|
/**
|
|
206
174
|
* The drizzle relations of the whole schema. A read lists them in its `with` to load related rows
|
|
207
175
|
* in the same query, by the names given here.
|
|
@@ -257,7 +225,6 @@ ${entries.join(',\n')}
|
|
|
257
225
|
}));
|
|
258
226
|
`;
|
|
259
227
|
};
|
|
260
|
-
/** Templates Field Relations */
|
|
261
228
|
/**
|
|
262
229
|
* The junction column pointing at one target collection. The property is keyed by the slug, which
|
|
263
230
|
* is how the adapter reads it back; the SQL column and the referenced table carry the table name.
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Dic } from '../../util/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Writes the schema file and brings the database to it: converts a pre-1.0 migrations folder,
|
|
4
|
+
* runs `drizzle-kit generate`, asks before applying a migration that loses a table or a column,
|
|
5
|
+
* then runs `migrate`. Only drizzle.config.ts is rewritten when the cache holds the same path and
|
|
6
|
+
* schema.
|
|
7
|
+
*/
|
|
2
8
|
declare const write: (schema: string) => void;
|
|
3
9
|
export default write;
|
|
4
10
|
/**
|
|
@@ -15,6 +15,12 @@ const DRIZZLE_KIT = {
|
|
|
15
15
|
bun: ['bun', 'drizzle-kit'],
|
|
16
16
|
deno: ['deno', 'run', '-A', 'npm:drizzle-kit']
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Writes the schema file and brings the database to it: converts a pre-1.0 migrations folder,
|
|
20
|
+
* runs `drizzle-kit generate`, asks before applying a migration that loses a table or a column,
|
|
21
|
+
* then runs `migrate`. Only drizzle.config.ts is rewritten when the cache holds the same path and
|
|
22
|
+
* schema.
|
|
23
|
+
*/
|
|
18
24
|
const write = (schema) => {
|
|
19
25
|
// drizzle-kit reads the schema path off drizzle.config.ts: current before anything runs it
|
|
20
26
|
regenerateDrizzleConfig();
|
|
@@ -33,6 +33,10 @@ export function adapterSqlite(database, options = {}) {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Opens the database and builds the `Adapter` handles over the generated schema, plus the SQL
|
|
38
|
+
* escape hatch: `db`, `tables`, `getTable`, `tableForSlug`, `schema`.
|
|
39
|
+
*/
|
|
36
40
|
const createAdapter = async (args) => {
|
|
37
41
|
const { database, driver, configCtx } = args;
|
|
38
42
|
const schema = (await import('$rime/schema'));
|
|
@@ -70,6 +74,7 @@ const createAdapter = async (args) => {
|
|
|
70
74
|
auth,
|
|
71
75
|
db,
|
|
72
76
|
tables: tables,
|
|
77
|
+
/** A generated table by its key in the schema: `pages__$blocks_hero`. */
|
|
73
78
|
getTable(key) {
|
|
74
79
|
return tables[key];
|
|
75
80
|
},
|
|
@@ -24,10 +24,7 @@ export const localeOrder = (configCtx, locale, fallback = true) => {
|
|
|
24
24
|
const order = [locale, localization.default, ...configCtx.getLocalesCodes()];
|
|
25
25
|
return order.filter((code, index) => order.indexOf(code) === index);
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
28
|
-
* Nothing written. `''` counts: a required localized column is `NOT NULL DEFAULT ''`, and that is
|
|
29
|
-
* what it holds when another field's write creates the locale's row.
|
|
30
|
-
*/
|
|
27
|
+
/** Nothing written: an empty text counts, and falls back like a column never written. */
|
|
31
28
|
const unwritten = (value) => value === undefined || value === null || value === '';
|
|
32
29
|
/**
|
|
33
30
|
* One row's worth of values out of the locales rows a read returned, taking each column from the
|
|
@@ -31,5 +31,11 @@ type Args = {
|
|
|
31
31
|
*/
|
|
32
32
|
rootTable?: any;
|
|
33
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* The drizzle `orderBy` of a list, from the REST `sort`: a document path, with `-` in front for
|
|
36
|
+
* descending (`-attributes.title`). A localized field orders by the value a read in `locale`
|
|
37
|
+
* shows, a field of a versioned prototype by the content row each document shows. No `sort`
|
|
38
|
+
* orders by `updatedAt`, newest first. A path the prototype cannot sort by throws.
|
|
39
|
+
*/
|
|
34
40
|
export declare const buildOrderByParam: ({ slug, locale, tables, configCtx, by, versions, contentWhere, rootTable: aliasedRoot }: Args) => SQL<unknown>[];
|
|
35
41
|
export {};
|
|
@@ -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[];
|