directus 9.23.1 → 9.23.4
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/app.js +25 -21
- package/dist/auth/auth.d.ts +3 -3
- package/dist/auth/auth.js +2 -0
- package/dist/auth/drivers/ldap.d.ts +1 -1
- package/dist/auth/drivers/ldap.js +57 -46
- package/dist/auth/drivers/local.d.ts +1 -1
- package/dist/auth/drivers/local.js +20 -17
- package/dist/auth/drivers/oauth2.d.ts +1 -1
- package/dist/auth/drivers/oauth2.js +44 -35
- package/dist/auth/drivers/openid.d.ts +1 -1
- package/dist/auth/drivers/openid.js +50 -41
- package/dist/auth/drivers/saml.d.ts +1 -1
- package/dist/auth/drivers/saml.js +20 -17
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +8 -7
- package/dist/cache.d.ts +9 -1
- package/dist/cache.js +66 -18
- package/dist/cli/commands/bootstrap/index.js +7 -6
- package/dist/cli/commands/init/index.js +3 -3
- package/dist/cli/commands/schema/apply.js +14 -15
- package/dist/cli/commands/schema/snapshot.js +2 -2
- package/dist/cli/utils/create-db-connection.d.ts +1 -1
- package/dist/cli/utils/create-db-connection.js +3 -2
- package/dist/cli/utils/create-env/index.d.ts +2 -2
- package/dist/cli/utils/create-env/index.js +1 -1
- package/dist/cli/utils/drivers.d.ts +1 -1
- package/dist/constants.d.ts +3 -2
- package/dist/constants.js +7 -7
- package/dist/controllers/activity.js +10 -11
- package/dist/controllers/assets.js +31 -25
- package/dist/controllers/auth.js +40 -26
- package/dist/controllers/collections.js +10 -10
- package/dist/controllers/dashboards.js +14 -11
- package/dist/controllers/extensions.js +3 -3
- package/dist/controllers/fields.js +20 -20
- package/dist/controllers/files.js +26 -20
- package/dist/controllers/flows.js +16 -13
- package/dist/controllers/folders.js +14 -11
- package/dist/controllers/graphql.js +6 -8
- package/dist/controllers/items.js +22 -19
- package/dist/controllers/not-found.d.ts +1 -1
- package/dist/controllers/not-found.js +1 -2
- package/dist/controllers/notifications.js +14 -11
- package/dist/controllers/operations.js +14 -11
- package/dist/controllers/panels.js +14 -11
- package/dist/controllers/permissions.js +14 -11
- package/dist/controllers/presets.js +14 -11
- package/dist/controllers/relations.js +10 -10
- package/dist/controllers/revisions.js +3 -3
- package/dist/controllers/roles.js +14 -11
- package/dist/controllers/schema.js +5 -5
- package/dist/controllers/server.js +7 -7
- package/dist/controllers/settings.js +2 -2
- package/dist/controllers/shares.js +21 -18
- package/dist/controllers/users.js +32 -36
- package/dist/controllers/utils.js +10 -15
- package/dist/controllers/webhooks.js +14 -11
- package/dist/database/helpers/fn/dialects/mssql.d.ts +1 -1
- package/dist/database/helpers/fn/dialects/mssql.js +10 -11
- package/dist/database/helpers/fn/dialects/mysql.d.ts +1 -1
- package/dist/database/helpers/fn/dialects/mysql.js +2 -3
- package/dist/database/helpers/fn/dialects/oracle.d.ts +1 -1
- package/dist/database/helpers/fn/dialects/oracle.js +10 -11
- package/dist/database/helpers/fn/dialects/postgres.d.ts +1 -1
- package/dist/database/helpers/fn/dialects/postgres.js +10 -11
- package/dist/database/helpers/fn/dialects/sqlite.d.ts +1 -1
- package/dist/database/helpers/fn/dialects/sqlite.js +10 -11
- package/dist/database/helpers/fn/types.d.ts +5 -6
- package/dist/database/helpers/fn/types.js +4 -5
- package/dist/database/helpers/geometry/dialects/mssql.d.ts +3 -3
- package/dist/database/helpers/geometry/dialects/mysql.d.ts +1 -1
- package/dist/database/helpers/geometry/dialects/oracle.d.ts +3 -3
- package/dist/database/helpers/geometry/dialects/postgres.d.ts +3 -3
- package/dist/database/helpers/geometry/dialects/postgres.js +1 -2
- package/dist/database/helpers/geometry/dialects/redshift.d.ts +2 -2
- package/dist/database/helpers/geometry/dialects/sqlite.d.ts +1 -1
- package/dist/database/helpers/geometry/types.d.ts +2 -2
- package/dist/database/helpers/geometry/types.js +1 -2
- package/dist/database/helpers/index.d.ts +5 -5
- package/dist/database/helpers/schema/dialects/cockroachdb.d.ts +1 -1
- package/dist/database/helpers/schema/dialects/mssql.d.ts +1 -1
- package/dist/database/helpers/schema/dialects/mysql.d.ts +1 -1
- package/dist/database/helpers/schema/dialects/mysql.js +1 -2
- package/dist/database/helpers/schema/dialects/oracle.d.ts +2 -2
- package/dist/database/helpers/schema/dialects/oracle.js +4 -6
- package/dist/database/helpers/schema/types.d.ts +4 -4
- package/dist/database/helpers/types.d.ts +1 -1
- package/dist/database/helpers/types.js +1 -0
- package/dist/database/index.d.ts +1 -1
- package/dist/database/index.js +13 -13
- package/dist/database/migrations/20201028A-remove-collection-foreign-keys.d.ts +1 -1
- package/dist/database/migrations/20201029A-remove-system-relations.d.ts +1 -1
- package/dist/database/migrations/20201029B-remove-system-collections.d.ts +1 -1
- package/dist/database/migrations/20201029C-remove-system-fields.d.ts +1 -1
- package/dist/database/migrations/20201105A-add-cascade-system-relations.d.ts +1 -1
- package/dist/database/migrations/20201105B-change-webhook-url-type.d.ts +1 -1
- package/dist/database/migrations/20210225A-add-relations-sort-field.d.ts +1 -1
- package/dist/database/migrations/20210225A-add-relations-sort-field.js +1 -2
- package/dist/database/migrations/20210304A-remove-locked-fields.d.ts +1 -1
- package/dist/database/migrations/20210312A-webhooks-collections-text.d.ts +1 -1
- package/dist/database/migrations/20210331A-add-refresh-interval.d.ts +1 -1
- package/dist/database/migrations/20210415A-make-filesize-nullable.d.ts +1 -1
- package/dist/database/migrations/20210416A-add-collections-accountability.d.ts +1 -1
- package/dist/database/migrations/20210422A-remove-files-interface.d.ts +1 -1
- package/dist/database/migrations/20210506A-rename-interfaces.d.ts +1 -1
- package/dist/database/migrations/20210510A-restructure-relations.d.ts +1 -1
- package/dist/database/migrations/20210518A-add-foreign-key-constraints.d.ts +1 -1
- package/dist/database/migrations/20210518A-add-foreign-key-constraints.js +1 -1
- package/dist/database/migrations/20210519A-add-system-fk-triggers.d.ts +1 -1
- package/dist/database/migrations/20210519A-add-system-fk-triggers.js +2 -2
- package/dist/database/migrations/20210521A-add-collections-icon-color.d.ts +1 -1
- package/dist/database/migrations/20210525A-add-insights.d.ts +1 -1
- package/dist/database/migrations/20210608A-add-deep-clone-config.d.ts +1 -1
- package/dist/database/migrations/20210626A-change-filesize-bigint.d.ts +1 -1
- package/dist/database/migrations/20210716A-add-conditions-to-fields.d.ts +1 -1
- package/dist/database/migrations/20210721A-add-default-folder.d.ts +1 -1
- package/dist/database/migrations/20210802A-replace-groups.d.ts +1 -1
- package/dist/database/migrations/20210803A-add-required-to-fields.d.ts +1 -1
- package/dist/database/migrations/20210805A-update-groups.d.ts +1 -1
- package/dist/database/migrations/20210805B-change-image-metadata-structure.d.ts +1 -1
- package/dist/database/migrations/20210805B-change-image-metadata-structure.js +15 -15
- package/dist/database/migrations/20210811A-add-geometry-config.d.ts +1 -1
- package/dist/database/migrations/20210831A-remove-limit-column.d.ts +1 -1
- package/dist/database/migrations/20210903A-add-auth-provider.d.ts +1 -1
- package/dist/database/migrations/20210907A-webhooks-collections-not-null.d.ts +1 -1
- package/dist/database/migrations/20210910A-move-module-setup.d.ts +1 -1
- package/dist/database/migrations/20210920A-webhooks-url-not-null.d.ts +1 -1
- package/dist/database/migrations/20210924A-add-collection-organization.d.ts +1 -1
- package/dist/database/migrations/20210927A-replace-fields-group.d.ts +1 -1
- package/dist/database/migrations/20210927B-replace-m2m-interface.d.ts +1 -1
- package/dist/database/migrations/20210929A-rename-login-action.d.ts +1 -1
- package/dist/database/migrations/20211007A-update-presets.d.ts +1 -1
- package/dist/database/migrations/20211007A-update-presets.js +7 -9
- package/dist/database/migrations/20211009A-add-auth-data.d.ts +1 -1
- package/dist/database/migrations/20211016A-add-webhook-headers.d.ts +1 -1
- package/dist/database/migrations/20211103A-set-unique-to-user-token.d.ts +1 -1
- package/dist/database/migrations/20211103B-update-special-geometry.d.ts +1 -1
- package/dist/database/migrations/20211104A-remove-collections-listing.d.ts +1 -1
- package/dist/database/migrations/20211118A-add-notifications.d.ts +1 -1
- package/dist/database/migrations/20211211A-add-shares.d.ts +1 -1
- package/dist/database/migrations/20211230A-add-project-descriptor.d.ts +1 -1
- package/dist/database/migrations/20220303A-remove-default-project-color.d.ts +1 -1
- package/dist/database/migrations/20220308A-add-bookmark-icon-and-color.d.ts +1 -1
- package/dist/database/migrations/20220314A-add-translation-strings.d.ts +1 -1
- package/dist/database/migrations/20220322A-rename-field-typecast-flags.d.ts +1 -1
- package/dist/database/migrations/20220323A-add-field-validation.d.ts +1 -1
- package/dist/database/migrations/20220325A-fix-typecast-flags.d.ts +1 -1
- package/dist/database/migrations/20220325B-add-default-language.d.ts +1 -1
- package/dist/database/migrations/20220402A-remove-default-value-panel-icon.d.ts +1 -1
- package/dist/database/migrations/20220429A-add-flows.d.ts +1 -1
- package/dist/database/migrations/20220429B-add-color-to-insights-icon.d.ts +1 -1
- package/dist/database/migrations/20220429C-drop-non-null-from-ip-of-activity.d.ts +1 -1
- package/dist/database/migrations/20220429D-drop-non-null-from-sender-of-notifications.d.ts +1 -1
- package/dist/database/migrations/20220614A-rename-hook-trigger-to-event.d.ts +1 -1
- package/dist/database/migrations/20220801A-update-notifications-timestamp-column.d.ts +1 -1
- package/dist/database/migrations/20220802A-add-custom-aspect-ratios.d.ts +1 -1
- package/dist/database/migrations/20220826A-add-origin-to-accountability.d.ts +1 -1
- package/dist/database/migrations/run.d.ts +1 -1
- package/dist/database/migrations/run.js +1 -1
- package/dist/database/run-ast.d.ts +3 -3
- package/dist/database/run-ast.js +21 -30
- package/dist/database/seeds/run.d.ts +1 -1
- package/dist/database/seeds/run.js +1 -2
- package/dist/database/system-data/app-access-permissions/index.d.ts +1 -1
- package/dist/database/system-data/collections/index.d.ts +1 -1
- package/dist/database/system-data/collections/index.js +2 -2
- package/dist/database/system-data/fields/collections.yaml +2 -0
- package/dist/database/system-data/fields/index.d.ts +1 -1
- package/dist/database/system-data/fields/index.js +3 -4
- package/dist/database/system-data/fields/settings.yaml +4 -0
- package/dist/database/system-data/relations/index.d.ts +1 -1
- package/dist/emitter.d.ts +1 -1
- package/dist/emitter.js +3 -0
- package/dist/env.js +11 -3
- package/dist/exceptions/database/dialects/mssql.d.ts +1 -1
- package/dist/exceptions/database/dialects/mssql.js +5 -6
- package/dist/exceptions/database/dialects/mysql.d.ts +1 -1
- package/dist/exceptions/database/dialects/mysql.js +19 -25
- package/dist/exceptions/database/dialects/oracle.d.ts +1 -1
- package/dist/exceptions/database/dialects/postgres.d.ts +1 -1
- package/dist/exceptions/database/dialects/sqlite.d.ts +1 -1
- package/dist/exceptions/database/translate.d.ts +1 -1
- package/dist/exceptions/database/value-out-of-range.js +1 -1
- package/dist/exceptions/range-not-satisfiable.js +2 -3
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.js +43 -33
- package/dist/flows.js +65 -46
- package/dist/logger.d.ts +2 -1
- package/dist/logger.js +35 -19
- package/dist/logger.test.d.ts +1 -0
- package/dist/mailer.js +16 -16
- package/dist/messenger.js +9 -7
- package/dist/middleware/authenticate.d.ts +1 -1
- package/dist/middleware/authenticate.js +13 -6
- package/dist/middleware/cache.d.ts +1 -1
- package/dist/middleware/cache.js +16 -16
- package/dist/middleware/check-ip.d.ts +1 -1
- package/dist/middleware/check-ip.js +1 -1
- package/dist/middleware/collection-exists.d.ts +1 -1
- package/dist/middleware/collection-exists.js +5 -5
- package/dist/middleware/cors.d.ts +1 -1
- package/dist/middleware/cors.js +7 -7
- package/dist/middleware/error-handler.d.ts +1 -1
- package/dist/middleware/error-handler.js +11 -12
- package/dist/middleware/extract-token.d.ts +1 -1
- package/dist/middleware/extract-token.js +2 -2
- package/dist/middleware/get-permissions.d.ts +1 -1
- package/dist/middleware/graphql.d.ts +1 -1
- package/dist/middleware/graphql.js +15 -9
- package/dist/middleware/rate-limiter-global.d.ts +5 -0
- package/dist/middleware/rate-limiter-global.js +48 -0
- package/dist/middleware/{rate-limiter.d.ts → rate-limiter-ip.d.ts} +2 -2
- package/dist/middleware/{rate-limiter.js → rate-limiter-ip.js} +5 -5
- package/dist/middleware/respond.d.ts +1 -1
- package/dist/middleware/respond.js +18 -19
- package/dist/middleware/sanitize-query.d.ts +1 -1
- package/dist/middleware/sanitize-query.js +1 -1
- package/dist/middleware/schema.d.ts +1 -1
- package/dist/middleware/use-collection.d.ts +1 -1
- package/dist/operations/condition/index.d.ts +1 -1
- package/dist/operations/exec/index.js +15 -4
- package/dist/operations/item-create/index.js +1 -2
- package/dist/operations/item-delete/index.d.ts +1 -1
- package/dist/operations/item-read/index.d.ts +1 -1
- package/dist/operations/item-update/index.d.ts +1 -1
- package/dist/operations/item-update/index.js +1 -2
- package/dist/operations/notification/index.js +1 -2
- package/dist/operations/request/index.js +19 -19
- package/dist/operations/trigger/index.js +2 -3
- package/dist/rate-limiter.d.ts +1 -1
- package/dist/rate-limiter.js +9 -9
- package/dist/request/validate-ip.js +2 -2
- package/dist/server.js +12 -13
- package/dist/services/activity.d.ts +1 -1
- package/dist/services/activity.js +17 -16
- package/dist/services/assets.d.ts +3 -3
- package/dist/services/assets.js +35 -37
- package/dist/services/authentication.d.ts +2 -2
- package/dist/services/authentication.js +22 -19
- package/dist/services/authorization.d.ts +3 -3
- package/dist/services/authorization.js +27 -31
- package/dist/services/collections.d.ts +5 -5
- package/dist/services/collections.js +54 -50
- package/dist/services/dashboards.d.ts +1 -1
- package/dist/services/fields.d.ts +5 -5
- package/dist/services/fields.js +50 -50
- package/dist/services/files.d.ts +1 -2
- package/dist/services/files.js +33 -27
- package/dist/services/flows.d.ts +2 -2
- package/dist/services/folders.d.ts +1 -1
- package/dist/services/graphql/index.d.ts +4 -4
- package/dist/services/graphql/index.js +259 -252
- package/dist/services/graphql/utils/add-path-to-validation-error.js +1 -2
- package/dist/services/graphql/utils/process-error.d.ts +2 -2
- package/dist/services/graphql/utils/process-error.js +11 -4
- package/dist/services/import-export.d.ts +3 -3
- package/dist/services/import-export.js +30 -27
- package/dist/services/items.d.ts +3 -3
- package/dist/services/items.js +42 -36
- package/dist/services/mail/index.d.ts +4 -4
- package/dist/services/mail/index.js +14 -10
- package/dist/services/meta.d.ts +3 -3
- package/dist/services/meta.js +11 -9
- package/dist/services/notifications.d.ts +3 -3
- package/dist/services/notifications.js +10 -9
- package/dist/services/operations.d.ts +2 -2
- package/dist/services/panels.d.ts +1 -1
- package/dist/services/payload.d.ts +3 -3
- package/dist/services/payload.js +124 -122
- package/dist/services/permissions.d.ts +3 -3
- package/dist/services/permissions.js +11 -11
- package/dist/services/presets.d.ts +1 -1
- package/dist/services/relations.d.ts +6 -6
- package/dist/services/relations.js +45 -43
- package/dist/services/revisions.d.ts +1 -1
- package/dist/services/revisions.js +3 -3
- package/dist/services/roles.d.ts +2 -2
- package/dist/services/roles.js +7 -7
- package/dist/services/schema.d.ts +3 -3
- package/dist/services/schema.js +9 -11
- package/dist/services/server.d.ts +3 -3
- package/dist/services/server.js +88 -32
- package/dist/services/settings.d.ts +1 -1
- package/dist/services/shares.d.ts +1 -1
- package/dist/services/shares.js +14 -15
- package/dist/services/specifications.d.ts +4 -4
- package/dist/services/specifications.js +137 -119
- package/dist/services/tfa.d.ts +2 -2
- package/dist/services/tfa.js +7 -5
- package/dist/services/users.d.ts +2 -6
- package/dist/services/users.js +37 -40
- package/dist/services/utils.d.ts +3 -3
- package/dist/services/utils.js +10 -8
- package/dist/services/webhooks.d.ts +2 -2
- package/dist/services/webhooks.js +2 -1
- package/dist/storage/register-locations.js +1 -1
- package/dist/types/assets.d.ts +1 -1
- package/dist/types/ast.d.ts +1 -1
- package/dist/types/auth.d.ts +2 -2
- package/dist/types/collection.d.ts +2 -2
- package/dist/types/events.d.ts +2 -2
- package/dist/types/graphql.d.ts +2 -2
- package/dist/types/items.d.ts +3 -3
- package/dist/types/services.d.ts +5 -5
- package/dist/types/snapshot.d.ts +4 -4
- package/dist/utils/apply-diff.d.ts +3 -3
- package/dist/utils/apply-diff.js +25 -28
- package/dist/utils/apply-query.d.ts +3 -3
- package/dist/utils/apply-query.js +10 -12
- package/dist/utils/apply-snapshot.d.ts +3 -3
- package/dist/utils/apply-snapshot.js +5 -6
- package/dist/utils/construct-flow-tree.d.ts +1 -1
- package/dist/utils/construct-flow-tree.js +2 -2
- package/dist/utils/dynamic-import.js +1 -1
- package/dist/utils/filter-items.d.ts +1 -1
- package/dist/utils/generate-hash.js +1 -1
- package/dist/utils/get-accountability-for-role.d.ts +2 -2
- package/dist/utils/get-accountability-for-role.js +1 -1
- package/dist/utils/get-ast-from-query.d.ts +3 -3
- package/dist/utils/get-ast-from-query.js +22 -28
- package/dist/utils/get-auth-providers.js +1 -1
- package/dist/utils/get-cache-headers.d.ts +1 -1
- package/dist/utils/get-cache-headers.js +6 -7
- package/dist/utils/get-cache-key.d.ts +1 -1
- package/dist/utils/get-cache-key.js +2 -3
- package/dist/utils/get-collection-from-alias.d.ts +1 -1
- package/dist/utils/get-collection-from-alias.js +1 -0
- package/dist/utils/get-column-path.d.ts +2 -2
- package/dist/utils/get-column-path.js +3 -4
- package/dist/utils/get-column.d.ts +4 -4
- package/dist/utils/get-column.js +4 -5
- package/dist/utils/get-default-value.d.ts +2 -2
- package/dist/utils/get-default-value.js +2 -3
- package/dist/utils/get-graphql-query-and-variables.d.ts +1 -1
- package/dist/utils/get-graphql-query-and-variables.js +1 -2
- package/dist/utils/get-graphql-type.d.ts +2 -2
- package/dist/utils/get-graphql-type.js +1 -1
- package/dist/utils/get-ip-from-req.d.ts +1 -1
- package/dist/utils/get-ip-from-req.js +2 -2
- package/dist/utils/get-local-type.d.ts +1 -1
- package/dist/utils/get-local-type.js +3 -3
- package/dist/utils/get-milliseconds.js +1 -2
- package/dist/utils/get-permissions.d.ts +1 -1
- package/dist/utils/get-permissions.js +12 -12
- package/dist/utils/get-relation-info.d.ts +1 -1
- package/dist/utils/get-relation-info.js +3 -5
- package/dist/utils/get-relation-type.d.ts +1 -1
- package/dist/utils/get-relation-type.js +3 -4
- package/dist/utils/get-schema.d.ts +2 -2
- package/dist/utils/get-schema.js +20 -22
- package/dist/utils/get-snapshot-diff.js +2 -3
- package/dist/utils/get-snapshot.d.ts +3 -3
- package/dist/utils/get-snapshot.js +6 -8
- package/dist/utils/is-directus-jwt.js +1 -1
- package/dist/utils/is-url-allowed.js +5 -2
- package/dist/utils/job-queue.js +2 -0
- package/dist/utils/jwt.d.ts +1 -1
- package/dist/utils/merge-permissions-for-share.d.ts +1 -1
- package/dist/utils/merge-permissions-for-share.js +3 -4
- package/dist/utils/merge-permissions.d.ts +3 -3
- package/dist/utils/reduce-schema.d.ts +1 -1
- package/dist/utils/reduce-schema.js +12 -12
- package/dist/utils/sanitize-query.d.ts +1 -1
- package/dist/utils/sanitize-query.js +27 -27
- package/dist/utils/sanitize-schema.d.ts +2 -2
- package/dist/utils/should-skip-cache.d.ts +7 -0
- package/dist/utils/should-skip-cache.js +21 -0
- package/dist/utils/should-skip-cache.test.d.ts +1 -0
- package/dist/utils/track.js +16 -16
- package/dist/utils/transformations.d.ts +1 -1
- package/dist/utils/transformations.js +2 -4
- package/dist/utils/url.js +7 -2
- package/dist/utils/user-name.d.ts +1 -1
- package/dist/utils/validate-diff.js +7 -8
- package/dist/utils/validate-keys.d.ts +2 -2
- package/dist/utils/validate-keys.js +1 -1
- package/dist/utils/validate-query.d.ts +1 -1
- package/dist/utils/validate-query.js +3 -3
- package/dist/utils/validate-storage.js +8 -8
- package/dist/webhooks.js +3 -3
- package/package.json +36 -37
- package/dist/utils/with-timeout.d.ts +0 -1
- package/dist/utils/with-timeout.js +0 -16
|
@@ -60,25 +60,25 @@ async function down(knex) {
|
|
|
60
60
|
if (Object.keys(prevMetadata).filter((key) => key !== 'icc' && key !== 'iptc').length > 0) {
|
|
61
61
|
// Put all data under 'exif' and rename/move keys afterwards
|
|
62
62
|
const newMetadata = { exif: prevMetadata };
|
|
63
|
-
if (newMetadata.exif
|
|
64
|
-
newMetadata.exif
|
|
65
|
-
delete newMetadata.exif
|
|
63
|
+
if (newMetadata.exif['ifd0']) {
|
|
64
|
+
newMetadata.exif['image'] = newMetadata.exif['ifd0'];
|
|
65
|
+
delete newMetadata.exif['ifd0'];
|
|
66
66
|
}
|
|
67
|
-
if (newMetadata.exif
|
|
68
|
-
newMetadata.exif
|
|
69
|
-
delete newMetadata.exif
|
|
67
|
+
if (newMetadata.exif['ifd1']) {
|
|
68
|
+
newMetadata.exif['thumbnail'] = newMetadata.exif['ifd1'];
|
|
69
|
+
delete newMetadata.exif['ifd1'];
|
|
70
70
|
}
|
|
71
|
-
if (newMetadata.exif
|
|
72
|
-
newMetadata.exif
|
|
73
|
-
delete newMetadata.exif
|
|
71
|
+
if (newMetadata.exif['interop']) {
|
|
72
|
+
newMetadata.exif['interoperability'] = newMetadata.exif['interop'];
|
|
73
|
+
delete newMetadata.exif['interop'];
|
|
74
74
|
}
|
|
75
|
-
if (newMetadata.exif
|
|
76
|
-
newMetadata.icc = newMetadata.exif
|
|
77
|
-
delete newMetadata.exif
|
|
75
|
+
if (newMetadata.exif['icc']) {
|
|
76
|
+
newMetadata.icc = newMetadata.exif['icc'];
|
|
77
|
+
delete newMetadata.exif['icc'];
|
|
78
78
|
}
|
|
79
|
-
if (newMetadata.exif
|
|
80
|
-
newMetadata.iptc = newMetadata.exif
|
|
81
|
-
delete newMetadata.exif
|
|
79
|
+
if (newMetadata.exif['iptc']) {
|
|
80
|
+
newMetadata.iptc = newMetadata.exif['iptc'];
|
|
81
|
+
delete newMetadata.exif['iptc'];
|
|
82
82
|
}
|
|
83
83
|
await knex('directus_files')
|
|
84
84
|
.update({ metadata: JSON.stringify(newMetadata) })
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.down = exports.up = void 0;
|
|
4
4
|
const utils_1 = require("@directus/shared/utils");
|
|
5
5
|
async function up(knex) {
|
|
6
|
-
var _a;
|
|
7
6
|
await knex.schema.alterTable('directus_presets', (table) => {
|
|
8
7
|
table.json('filter');
|
|
9
8
|
});
|
|
@@ -12,7 +11,7 @@ async function up(knex) {
|
|
|
12
11
|
.from('directus_presets');
|
|
13
12
|
for (const preset of presets) {
|
|
14
13
|
if (preset.filters) {
|
|
15
|
-
const oldFilters = (
|
|
14
|
+
const oldFilters = (typeof preset.filters === 'string' ? (0, utils_1.parseJSON)(preset.filters) : preset.filters) ?? [];
|
|
16
15
|
if (oldFilters.length === 0)
|
|
17
16
|
continue;
|
|
18
17
|
const newFilter = {
|
|
@@ -52,7 +51,6 @@ async function up(knex) {
|
|
|
52
51
|
}
|
|
53
52
|
exports.up = up;
|
|
54
53
|
async function down(knex) {
|
|
55
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
56
54
|
const { nanoid } = await import('nanoid');
|
|
57
55
|
await knex.schema.alterTable('directus_presets', (table) => {
|
|
58
56
|
table.json('filters');
|
|
@@ -62,14 +60,14 @@ async function down(knex) {
|
|
|
62
60
|
.from('directus_presets');
|
|
63
61
|
for (const preset of presets) {
|
|
64
62
|
if (preset.filter) {
|
|
65
|
-
const newFilter = (
|
|
63
|
+
const newFilter = (typeof preset.filter === 'string' ? (0, utils_1.parseJSON)(preset.filter) : preset.filter) ?? {};
|
|
66
64
|
if (Object.keys(newFilter).length === 0)
|
|
67
65
|
continue;
|
|
68
66
|
const oldFilters = [];
|
|
69
|
-
for (const filter of
|
|
70
|
-
const field =
|
|
71
|
-
const operator =
|
|
72
|
-
const value =
|
|
67
|
+
for (const filter of newFilter._and ?? []) {
|
|
68
|
+
const field = Object.keys(filter)?.[0];
|
|
69
|
+
const operator = Object.keys(Object.values(filter)?.[0] ?? {})?.[0];
|
|
70
|
+
const value = Object.values(Object.values(filter)?.[0] ?? {})?.[0];
|
|
73
71
|
if (!field || !operator || !value)
|
|
74
72
|
continue;
|
|
75
73
|
oldFilters.push({
|
|
@@ -89,7 +87,7 @@ async function down(knex) {
|
|
|
89
87
|
const layoutQuery = typeof preset.layout_query === 'string' ? (0, utils_1.parseJSON)(preset.layout_query) : preset.layout_query;
|
|
90
88
|
for (const [layout, query] of Object.entries(layoutQuery)) {
|
|
91
89
|
if (query.sort && Array.isArray(query.sort)) {
|
|
92
|
-
query.sort =
|
|
90
|
+
query.sort = query.sort?.[0] ?? null;
|
|
93
91
|
}
|
|
94
92
|
layoutQuery[layout] = query;
|
|
95
93
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Knex } from 'knex';
|
|
1
|
+
import type { Knex } from 'knex';
|
|
2
2
|
export default function run(database: Knex, direction: 'up' | 'down' | 'latest', log?: boolean): Promise<void>;
|
|
@@ -13,7 +13,7 @@ const dynamic_import_1 = require("../../utils/dynamic-import");
|
|
|
13
13
|
const format_title_1 = __importDefault(require("@directus/format-title"));
|
|
14
14
|
async function run(database, direction, log = true) {
|
|
15
15
|
let migrationFiles = await fs_extra_1.default.readdir(__dirname);
|
|
16
|
-
const customMigrationsPath = path_1.default.resolve(env_1.default
|
|
16
|
+
const customMigrationsPath = path_1.default.resolve(env_1.default['EXTENSIONS_PATH'], 'migrations');
|
|
17
17
|
let customMigrationFiles = ((await fs_extra_1.default.pathExists(customMigrationsPath)) && (await fs_extra_1.default.readdir(customMigrationsPath))) || [];
|
|
18
18
|
migrationFiles = migrationFiles.filter((file) => /^[0-9]+[A-Z]-[^.]+\.(?:js|ts)$/.test(file));
|
|
19
19
|
customMigrationFiles = customMigrationFiles.filter((file) => file.endsWith('.js'));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Item, SchemaOverview } from '@directus/shared/types';
|
|
2
|
-
import { Knex } from 'knex';
|
|
3
|
-
import { AST, NestedCollectionNode } from '../types/ast';
|
|
1
|
+
import type { Item, SchemaOverview } from '@directus/shared/types';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
|
+
import type { AST, NestedCollectionNode } from '../types/ast';
|
|
4
4
|
type RunASTOptions = {
|
|
5
5
|
/**
|
|
6
6
|
* Query override for the current level
|
package/dist/database/run-ast.js
CHANGED
|
@@ -42,7 +42,7 @@ const strip_function_1 = require("../utils/strip-function");
|
|
|
42
42
|
*/
|
|
43
43
|
async function runAST(originalAST, schema, options) {
|
|
44
44
|
const ast = (0, lodash_1.cloneDeep)(originalAST);
|
|
45
|
-
const knex =
|
|
45
|
+
const knex = options?.knex || (0, _1.default)();
|
|
46
46
|
if (ast.type === 'a2o') {
|
|
47
47
|
const results = {};
|
|
48
48
|
for (const collection of ast.names) {
|
|
@@ -51,7 +51,7 @@ async function runAST(originalAST, schema, options) {
|
|
|
51
51
|
return results;
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
|
-
return await run(ast.name, ast.children,
|
|
54
|
+
return await run(ast.name, ast.children, options?.query || ast.query);
|
|
55
55
|
}
|
|
56
56
|
async function run(collection, children, query) {
|
|
57
57
|
// Retrieve the database columns to select in the current AST
|
|
@@ -64,7 +64,7 @@ async function runAST(originalAST, schema, options) {
|
|
|
64
64
|
// Run the items through the special transforms
|
|
65
65
|
const payloadService = new payload_1.PayloadService(collection, { knex, schema });
|
|
66
66
|
let items = await payloadService.processValues('read', rawItems);
|
|
67
|
-
if (!items || items.length === 0)
|
|
67
|
+
if (!items || (Array.isArray(items) && items.length === 0))
|
|
68
68
|
return items;
|
|
69
69
|
// Apply the `_in` filters to the nested collection batches
|
|
70
70
|
const nestedNodes = applyParentFilters(schema, nestedCollectionNodes, items);
|
|
@@ -76,8 +76,8 @@ async function runAST(originalAST, schema, options) {
|
|
|
76
76
|
while (hasMore) {
|
|
77
77
|
const node = (0, lodash_1.merge)({}, nestedNode, {
|
|
78
78
|
query: {
|
|
79
|
-
limit: env_1.default
|
|
80
|
-
offset: batchCount * env_1.default
|
|
79
|
+
limit: env_1.default['RELATIONAL_BATCH_SIZE'],
|
|
80
|
+
offset: batchCount * env_1.default['RELATIONAL_BATCH_SIZE'],
|
|
81
81
|
page: null,
|
|
82
82
|
},
|
|
83
83
|
});
|
|
@@ -85,7 +85,7 @@ async function runAST(originalAST, schema, options) {
|
|
|
85
85
|
if (nestedItems) {
|
|
86
86
|
items = mergeWithParentItems(schema, nestedItems, items, nestedNode);
|
|
87
87
|
}
|
|
88
|
-
if (!nestedItems || nestedItems.length < env_1.default
|
|
88
|
+
if (!nestedItems || nestedItems.length < env_1.default['RELATIONAL_BATCH_SIZE']) {
|
|
89
89
|
hasMore = false;
|
|
90
90
|
}
|
|
91
91
|
batchCount++;
|
|
@@ -106,7 +106,7 @@ async function runAST(originalAST, schema, options) {
|
|
|
106
106
|
// to work (primary / foreign keys) even if they're not explicitly requested. After all fetching
|
|
107
107
|
// and nesting is done, we parse through the output structure, and filter out all non-requested
|
|
108
108
|
// fields
|
|
109
|
-
if (
|
|
109
|
+
if (options?.nested !== true && options?.stripNonRequested !== false) {
|
|
110
110
|
items = removeTemporaryFields(schema, items, originalAST, primaryKeyField);
|
|
111
111
|
}
|
|
112
112
|
return items;
|
|
@@ -114,7 +114,6 @@ async function runAST(originalAST, schema, options) {
|
|
|
114
114
|
}
|
|
115
115
|
exports.default = runAST;
|
|
116
116
|
async function parseCurrentLevel(schema, collection, children, query) {
|
|
117
|
-
var _a;
|
|
118
117
|
const primaryKeyField = schema.collections[collection].primary;
|
|
119
118
|
const columnsInCollection = Object.keys(schema.collections[collection].fields);
|
|
120
119
|
const columnsToSelectInternal = [];
|
|
@@ -138,7 +137,7 @@ async function parseCurrentLevel(schema, collection, children, query) {
|
|
|
138
137
|
}
|
|
139
138
|
nestedCollectionNodes.push(child);
|
|
140
139
|
}
|
|
141
|
-
const isAggregate = (
|
|
140
|
+
const isAggregate = (query.group || (query.aggregate && Object.keys(query.aggregate).length > 0)) ?? false;
|
|
142
141
|
/** Always fetch primary key in case there's a nested relation that needs it. Aggregate payloads
|
|
143
142
|
* can't have nested relational fields
|
|
144
143
|
*/
|
|
@@ -147,20 +146,16 @@ async function parseCurrentLevel(schema, collection, children, query) {
|
|
|
147
146
|
}
|
|
148
147
|
/** Make sure select list has unique values */
|
|
149
148
|
const columnsToSelect = [...new Set(columnsToSelectInternal)];
|
|
150
|
-
const fieldNodes = columnsToSelect.map((column) => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
name: column,
|
|
155
|
-
fieldKey: column,
|
|
156
|
-
};
|
|
149
|
+
const fieldNodes = columnsToSelect.map((column) => children.find((childNode) => (childNode.type === 'field' || childNode.type === 'functionField') && childNode.fieldKey === column) ?? {
|
|
150
|
+
type: 'field',
|
|
151
|
+
name: column,
|
|
152
|
+
fieldKey: column,
|
|
157
153
|
});
|
|
158
154
|
return { fieldNodes, nestedCollectionNodes, primaryKeyField };
|
|
159
155
|
}
|
|
160
156
|
function getColumnPreprocessor(knex, schema, table) {
|
|
161
157
|
const helpers = (0, helpers_1.getHelpers)(knex);
|
|
162
158
|
return function (fieldNode) {
|
|
163
|
-
var _a;
|
|
164
159
|
let alias = undefined;
|
|
165
160
|
if (fieldNode.name !== fieldNode.fieldKey) {
|
|
166
161
|
alias = fieldNode.fieldKey;
|
|
@@ -172,7 +167,7 @@ function getColumnPreprocessor(knex, schema, table) {
|
|
|
172
167
|
else {
|
|
173
168
|
field = schema.collections[fieldNode.relation.collection].fields[fieldNode.relation.field];
|
|
174
169
|
}
|
|
175
|
-
if (
|
|
170
|
+
if (field?.type?.startsWith('geometry')) {
|
|
176
171
|
return helpers.st.asText(table, field.field);
|
|
177
172
|
}
|
|
178
173
|
if (fieldNode.type === 'functionField') {
|
|
@@ -204,7 +199,7 @@ async function getDBQuery(schema, knex, table, fieldNodes, query) {
|
|
|
204
199
|
hasMultiRelationalSort = sortResult.hasMultiRelationalSort;
|
|
205
200
|
}
|
|
206
201
|
}
|
|
207
|
-
const { hasMultiRelationalFilter } =
|
|
202
|
+
const { hasMultiRelationalFilter } = (0, apply_query_1.default)(knex, table, dbQuery, queryCopy, schema, {
|
|
208
203
|
aliasMap,
|
|
209
204
|
isInnerQuery: true,
|
|
210
205
|
hasMultiRelationalSort,
|
|
@@ -279,7 +274,6 @@ async function getDBQuery(schema, knex, table, fieldNodes, query) {
|
|
|
279
274
|
return wrapperQuery;
|
|
280
275
|
}
|
|
281
276
|
function applyParentFilters(schema, nestedCollectionNodes, parentItem) {
|
|
282
|
-
var _a;
|
|
283
277
|
const parentItems = (0, utils_1.toArray)(parentItem);
|
|
284
278
|
for (const nestedNode of nestedCollectionNodes) {
|
|
285
279
|
if (!nestedNode.relation)
|
|
@@ -300,7 +294,7 @@ function applyParentFilters(schema, nestedCollectionNodes, parentItem) {
|
|
|
300
294
|
fieldKey: nestedNode.relation.field,
|
|
301
295
|
});
|
|
302
296
|
}
|
|
303
|
-
if (
|
|
297
|
+
if (nestedNode.relation.meta?.sort_field) {
|
|
304
298
|
nestedNode.children.push({
|
|
305
299
|
type: 'field',
|
|
306
300
|
name: nestedNode.relation.meta.sort_field,
|
|
@@ -331,7 +325,6 @@ function applyParentFilters(schema, nestedCollectionNodes, parentItem) {
|
|
|
331
325
|
return nestedCollectionNodes;
|
|
332
326
|
}
|
|
333
327
|
function mergeWithParentItems(schema, nestedItem, parentItem, nestedNode) {
|
|
334
|
-
var _a, _b, _c;
|
|
335
328
|
const nestedItems = (0, utils_1.toArray)(nestedItem);
|
|
336
329
|
const parentItems = (0, lodash_1.clone)((0, utils_1.toArray)(parentItem));
|
|
337
330
|
if (nestedNode.type === 'm2o') {
|
|
@@ -348,24 +341,23 @@ function mergeWithParentItems(schema, nestedItem, parentItem, nestedNode) {
|
|
|
348
341
|
if (!parentItem[nestedNode.fieldKey])
|
|
349
342
|
parentItem[nestedNode.fieldKey] = [];
|
|
350
343
|
const itemChildren = nestedItems.filter((nestedItem) => {
|
|
351
|
-
var _a;
|
|
352
344
|
if (nestedItem === null)
|
|
353
345
|
return false;
|
|
354
346
|
if (Array.isArray(nestedItem[nestedNode.relation.field]))
|
|
355
347
|
return true;
|
|
356
348
|
return (nestedItem[nestedNode.relation.field] ==
|
|
357
349
|
parentItem[schema.collections[nestedNode.relation.related_collection].primary] ||
|
|
358
|
-
|
|
350
|
+
nestedItem[nestedNode.relation.field]?.[schema.collections[nestedNode.relation.related_collection].primary] == parentItem[schema.collections[nestedNode.relation.related_collection].primary]);
|
|
359
351
|
});
|
|
360
352
|
parentItem[nestedNode.fieldKey].push(...itemChildren);
|
|
361
353
|
if (nestedNode.query.page && nestedNode.query.page > 1) {
|
|
362
|
-
parentItem[nestedNode.fieldKey] = parentItem[nestedNode.fieldKey].slice((
|
|
354
|
+
parentItem[nestedNode.fieldKey] = parentItem[nestedNode.fieldKey].slice((nestedNode.query.limit ?? 100) * (nestedNode.query.page - 1));
|
|
363
355
|
}
|
|
364
356
|
if (nestedNode.query.offset && nestedNode.query.offset >= 0) {
|
|
365
357
|
parentItem[nestedNode.fieldKey] = parentItem[nestedNode.fieldKey].slice(nestedNode.query.offset);
|
|
366
358
|
}
|
|
367
359
|
if (nestedNode.query.limit !== -1) {
|
|
368
|
-
parentItem[nestedNode.fieldKey] = parentItem[nestedNode.fieldKey].slice(0,
|
|
360
|
+
parentItem[nestedNode.fieldKey] = parentItem[nestedNode.fieldKey].slice(0, nestedNode.query.limit ?? 100);
|
|
369
361
|
}
|
|
370
362
|
parentItem[nestedNode.fieldKey] = parentItem[nestedNode.fieldKey].sort((a, b) => {
|
|
371
363
|
// This is pre-filled in get-ast-from-query
|
|
@@ -393,7 +385,7 @@ function mergeWithParentItems(schema, nestedItem, parentItem, nestedNode) {
|
|
|
393
385
|
}
|
|
394
386
|
else if (nestedNode.type === 'a2o') {
|
|
395
387
|
for (const parentItem of parentItems) {
|
|
396
|
-
if (!
|
|
388
|
+
if (!nestedNode.relation.meta?.one_collection_field) {
|
|
397
389
|
parentItem[nestedNode.fieldKey] = null;
|
|
398
390
|
continue;
|
|
399
391
|
}
|
|
@@ -411,7 +403,6 @@ function mergeWithParentItems(schema, nestedItem, parentItem, nestedNode) {
|
|
|
411
403
|
return Array.isArray(parentItem) ? parentItems : parentItems[0];
|
|
412
404
|
}
|
|
413
405
|
function removeTemporaryFields(schema, rawItem, ast, primaryKeyField, parentItem) {
|
|
414
|
-
var _a;
|
|
415
406
|
const rawItems = (0, lodash_1.cloneDeep)((0, utils_1.toArray)(rawItem));
|
|
416
407
|
const items = [];
|
|
417
408
|
if (ast.type === 'a2o') {
|
|
@@ -433,7 +424,7 @@ function removeTemporaryFields(schema, rawItem, ast, primaryKeyField, parentItem
|
|
|
433
424
|
}
|
|
434
425
|
}
|
|
435
426
|
for (const rawItem of rawItems) {
|
|
436
|
-
const relatedCollection = parentItem
|
|
427
|
+
const relatedCollection = parentItem?.[ast.relation.meta.one_collection_field];
|
|
437
428
|
if (rawItem === null || rawItem === undefined)
|
|
438
429
|
return rawItem;
|
|
439
430
|
let item = rawItem;
|
|
@@ -456,7 +447,7 @@ function removeTemporaryFields(schema, rawItem, ast, primaryKeyField, parentItem
|
|
|
456
447
|
}
|
|
457
448
|
}
|
|
458
449
|
// Make sure any requested aggregate fields are included
|
|
459
|
-
if (
|
|
450
|
+
if (ast.query?.aggregate) {
|
|
460
451
|
for (const [operation, aggregateFields] of Object.entries(ast.query.aggregate)) {
|
|
461
452
|
if (!fields)
|
|
462
453
|
continue;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Knex } from 'knex';
|
|
1
|
+
import type { Knex } from 'knex';
|
|
2
2
|
export default function runSeed(database: Knex): Promise<void>;
|
|
@@ -21,7 +21,6 @@ async function runSeed(database) {
|
|
|
21
21
|
const yamlRaw = await fs_extra_1.default.readFile(path_1.default.resolve(__dirname, tableSeedFile), 'utf8');
|
|
22
22
|
const seedData = js_yaml_1.default.load(yamlRaw);
|
|
23
23
|
await database.schema.createTable(seedData.table, (tableBuilder) => {
|
|
24
|
-
var _a;
|
|
25
24
|
for (const [columnName, columnInfo] of Object.entries(seedData.columns)) {
|
|
26
25
|
let column;
|
|
27
26
|
if (columnInfo.type === 'alias' || columnInfo.type === 'unknown')
|
|
@@ -38,7 +37,7 @@ async function runSeed(database) {
|
|
|
38
37
|
else if (columnInfo.type === 'hash') {
|
|
39
38
|
column = tableBuilder.string(columnName, 255);
|
|
40
39
|
}
|
|
41
|
-
else if (
|
|
40
|
+
else if (columnInfo.type?.startsWith('geometry')) {
|
|
42
41
|
column = helpers.st.createColumn(tableBuilder, { field: columnName, type: columnInfo.type });
|
|
43
42
|
}
|
|
44
43
|
else {
|