directus 9.23.1 → 9.23.3
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 +14 -10
- 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 +39 -28
- package/dist/auth/drivers/local.d.ts +1 -1
- package/dist/auth/drivers/local.js +13 -10
- package/dist/auth/drivers/oauth2.d.ts +1 -1
- package/dist/auth/drivers/oauth2.js +20 -13
- package/dist/auth/drivers/openid.d.ts +1 -1
- package/dist/auth/drivers/openid.js +21 -14
- package/dist/auth/drivers/saml.d.ts +1 -1
- package/dist/auth/drivers/saml.js +10 -7
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +4 -4
- package/dist/cache.d.ts +9 -1
- package/dist/cache.js +57 -14
- package/dist/cli/commands/bootstrap/index.js +2 -2
- 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 +2 -1
- package/dist/cli/utils/create-env/index.d.ts +2 -2
- package/dist/cli/utils/drivers.d.ts +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +2 -3
- package/dist/controllers/activity.js +1 -2
- package/dist/controllers/assets.js +14 -9
- package/dist/controllers/auth.js +29 -15
- package/dist/controllers/dashboards.js +5 -2
- package/dist/controllers/fields.js +4 -4
- package/dist/controllers/files.js +10 -5
- package/dist/controllers/flows.js +5 -2
- package/dist/controllers/folders.js +5 -2
- package/dist/controllers/graphql.js +2 -4
- package/dist/controllers/items.js +5 -2
- package/dist/controllers/not-found.d.ts +1 -1
- package/dist/controllers/not-found.js +1 -2
- package/dist/controllers/notifications.js +5 -2
- package/dist/controllers/operations.js +5 -2
- package/dist/controllers/panels.js +5 -2
- package/dist/controllers/permissions.js +5 -2
- package/dist/controllers/presets.js +5 -2
- package/dist/controllers/roles.js +5 -2
- package/dist/controllers/shares.js +8 -5
- package/dist/controllers/users.js +16 -20
- package/dist/controllers/utils.js +6 -11
- package/dist/controllers/webhooks.js +5 -2
- 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 -5
- package/dist/database/helpers/fn/types.js +5 -4
- 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 +8 -8
- 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/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/run-ast.d.ts +3 -3
- package/dist/database/run-ast.js +17 -26
- 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/fields/collections.yaml +2 -0
- package/dist/database/system-data/fields/index.d.ts +1 -1
- package/dist/database/system-data/fields/index.js +1 -2
- 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 +10 -2
- 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 +33 -23
- package/dist/flows.js +42 -25
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +19 -3
- package/dist/messenger.js +8 -6
- package/dist/middleware/authenticate.d.ts +1 -1
- package/dist/middleware/authenticate.js +12 -5
- package/dist/middleware/cache.d.ts +1 -1
- package/dist/middleware/cache.js +5 -5
- 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 +2 -2
- package/dist/middleware/cors.d.ts +1 -1
- package/dist/middleware/error-handler.d.ts +1 -1
- package/dist/middleware/error-handler.js +9 -10
- package/dist/middleware/extract-token.d.ts +1 -1
- package/dist/middleware/get-permissions.d.ts +1 -1
- package/dist/middleware/graphql.d.ts +1 -1
- package/dist/middleware/graphql.js +3 -3
- 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} +3 -3
- package/dist/middleware/respond.d.ts +1 -1
- package/dist/middleware/respond.js +6 -7
- package/dist/middleware/sanitize-query.d.ts +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 +14 -3
- 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 +8 -8
- package/dist/server.js +8 -9
- package/dist/services/activity.d.ts +1 -1
- package/dist/services/activity.js +7 -6
- package/dist/services/assets.d.ts +3 -3
- package/dist/services/assets.js +33 -35
- package/dist/services/authentication.d.ts +2 -2
- package/dist/services/authentication.js +13 -10
- 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 +52 -48
- package/dist/services/dashboards.d.ts +1 -1
- package/dist/services/fields.d.ts +5 -5
- package/dist/services/fields.js +48 -48
- package/dist/services/files.d.ts +1 -2
- package/dist/services/files.js +27 -21
- 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 +172 -167
- 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 +25 -22
- 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 +9 -5
- package/dist/services/meta.d.ts +3 -3
- package/dist/services/meta.js +10 -9
- package/dist/services/notifications.d.ts +3 -3
- package/dist/services/notifications.js +7 -6
- 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/roles.d.ts +2 -2
- package/dist/services/roles.js +2 -2
- 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 +69 -13
- package/dist/services/settings.d.ts +1 -1
- package/dist/services/shares.d.ts +1 -1
- package/dist/services/shares.js +5 -6
- package/dist/services/specifications.d.ts +4 -4
- package/dist/services/specifications.js +132 -116
- package/dist/services/tfa.d.ts +2 -2
- package/dist/services/tfa.js +7 -5
- package/dist/services/users.d.ts +3 -3
- package/dist/services/users.js +17 -17
- 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/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 +8 -11
- 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/filter-items.d.ts +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-cache-headers.d.ts +1 -1
- package/dist/utils/get-cache-headers.js +3 -4
- 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-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 +1 -2
- 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-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 +1 -1
- 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 +19 -21
- 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/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/redact-header-cookies.d.ts +1 -0
- package/dist/utils/redact-header-cookies.js +11 -0
- package/dist/utils/redact-header-cookies.test.d.ts +1 -0
- 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 +1 -1
- 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/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 +2 -2
- package/dist/webhooks.js +1 -1
- package/package.json +36 -37
- package/dist/utils/with-timeout.d.ts +0 -1
- package/dist/utils/with-timeout.js +0 -16
package/dist/types/assets.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResizeOptions, Sharp } from 'sharp';
|
|
1
|
+
import type { ResizeOptions, Sharp } from 'sharp';
|
|
2
2
|
export declare const TransformationMethods: readonly ["toFormat", "jpeg", "png", "tiff", "webp", "resize", "extend", "extract", "trim", "rotate", "flip", "flop", "sharpen", "median", "blur", "flatten", "gamma", "negate", "normalise", "normalize", "clahe", "convolve", "threshold", "linear", "recomb", "modulate", "tint", "greyscale", "grayscale", "toColorspace", "toColourspace", "removeAlpha", "ensureAlpha", "extractChannel", "bandbool"];
|
|
3
3
|
type AllowedSharpMethods = Pick<Sharp, (typeof TransformationMethods)[number]>;
|
|
4
4
|
export type TransformationMap = {
|
package/dist/types/ast.d.ts
CHANGED
package/dist/types/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Field } from '@directus/shared/types';
|
|
2
|
+
import type { Table } from 'knex-schema-inspector/dist/types/table';
|
|
3
3
|
export type CollectionMeta = {
|
|
4
4
|
collection: string;
|
|
5
5
|
note: string | null;
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActionHandler, FilterHandler, InitHandler } from '@directus/shared/types';
|
|
2
|
-
import { ScheduledTask } from 'node-cron';
|
|
1
|
+
import type { ActionHandler, FilterHandler, InitHandler } from '@directus/shared/types';
|
|
2
|
+
import type { ScheduledTask } from 'node-cron';
|
|
3
3
|
export type EventHandler = {
|
|
4
4
|
type: 'filter';
|
|
5
5
|
name: string;
|
package/dist/types/graphql.d.ts
CHANGED
package/dist/types/items.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* I know this looks a little silly, but it allows us to explicitly differentiate between when we're
|
|
3
3
|
* expecting an item vs any other generic object.
|
|
4
4
|
*/
|
|
5
|
-
import { BaseException } from '@directus/shared/exceptions';
|
|
6
|
-
import { EventContext } from '@directus/shared/types';
|
|
5
|
+
import type { BaseException } from '@directus/shared/exceptions';
|
|
6
|
+
import type { EventContext } from '@directus/shared/types';
|
|
7
7
|
export type Item = Record<string, any>;
|
|
8
8
|
export type PrimaryKey = string | number;
|
|
9
9
|
export type Alterations = {
|
|
@@ -31,7 +31,7 @@ export type MutationOptions = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Allow disabling the emitting of hooks. Useful if a custom hook is fired (like files.upload)
|
|
33
33
|
*/
|
|
34
|
-
emitEvents?: boolean;
|
|
34
|
+
emitEvents?: boolean | undefined;
|
|
35
35
|
/**
|
|
36
36
|
* To bypass the emitting of action events if emitEvents is enabled
|
|
37
37
|
* Can be used to queue up the nested events from item service's create, update and delete
|
package/dist/types/services.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Item, PrimaryKey } from './items';
|
|
1
|
+
import type { Accountability, Query, SchemaOverview } from '@directus/shared/types';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
|
+
import type { Item, PrimaryKey } from './items';
|
|
4
4
|
export type AbstractServiceOptions = {
|
|
5
5
|
knex?: Knex;
|
|
6
|
-
accountability?: Accountability | null;
|
|
6
|
+
accountability?: Accountability | null | undefined;
|
|
7
7
|
schema: SchemaOverview;
|
|
8
8
|
};
|
|
9
9
|
export interface AbstractService {
|
|
10
10
|
knex: Knex;
|
|
11
|
-
accountability: Accountability | null;
|
|
11
|
+
accountability: Accountability | null | undefined;
|
|
12
12
|
createOne(data: Partial<Item>): Promise<PrimaryKey>;
|
|
13
13
|
createMany(data: Partial<Item>[]): Promise<PrimaryKey[]>;
|
|
14
14
|
readOne(key: PrimaryKey, query?: Query): Promise<Item>;
|
package/dist/types/snapshot.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { DatabaseClient } from './database';
|
|
1
|
+
import type { Field, FieldMeta, Relation, RelationMeta } from '@directus/shared/types';
|
|
2
|
+
import type { Diff } from 'deep-diff';
|
|
3
|
+
import type { Collection } from './collection';
|
|
4
|
+
import type { DatabaseClient } from './database';
|
|
5
5
|
export type Snapshot = {
|
|
6
6
|
version: number;
|
|
7
7
|
directus: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SchemaOverview } from '@directus/shared/types';
|
|
2
|
-
import { Knex } from 'knex';
|
|
3
|
-
import { Snapshot, SnapshotDiff, SnapshotField } from '../types';
|
|
1
|
+
import type { SchemaOverview } from '@directus/shared/types';
|
|
4
2
|
import { Diff } from 'deep-diff';
|
|
3
|
+
import type { Knex } from 'knex';
|
|
4
|
+
import { Snapshot, SnapshotDiff, SnapshotField } from '../types';
|
|
5
5
|
export declare function applyDiff(currentSnapshot: Snapshot, snapshotDiff: SnapshotDiff, options?: {
|
|
6
6
|
database?: Knex;
|
|
7
7
|
schema?: SchemaOverview;
|
package/dist/utils/apply-diff.js
CHANGED
|
@@ -4,19 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.isNestedMetaUpdate = exports.applyDiff = void 0;
|
|
7
|
-
const services_1 = require("../services");
|
|
8
|
-
const types_1 = require("../types");
|
|
9
|
-
const get_schema_1 = require("./get-schema");
|
|
10
|
-
const database_1 = __importDefault(require("../database"));
|
|
11
7
|
const deep_diff_1 = require("deep-diff");
|
|
12
8
|
const lodash_1 = require("lodash");
|
|
13
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
14
|
-
const emitter_1 = __importDefault(require("../emitter"));
|
|
15
9
|
const cache_1 = require("../cache");
|
|
10
|
+
const database_1 = __importDefault(require("../database"));
|
|
11
|
+
const emitter_1 = __importDefault(require("../emitter"));
|
|
12
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
13
|
+
const services_1 = require("../services");
|
|
14
|
+
const types_1 = require("../types");
|
|
15
|
+
const get_schema_1 = require("./get-schema");
|
|
16
16
|
async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const schema = (_b = options === null || options === void 0 ? void 0 : options.schema) !== null && _b !== void 0 ? _b : (await (0, get_schema_1.getSchema)({ database, bypassCache: true }));
|
|
17
|
+
const database = options?.database ?? (0, database_1.default)();
|
|
18
|
+
const schema = options?.schema ?? (await (0, get_schema_1.getSchema)({ database, bypassCache: true }));
|
|
20
19
|
const nestedActionEvents = [];
|
|
21
20
|
const mutationOptions = {
|
|
22
21
|
autoPurgeSystemCache: false,
|
|
@@ -24,24 +23,23 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
24
23
|
};
|
|
25
24
|
await database.transaction(async (trx) => {
|
|
26
25
|
const collectionsService = new services_1.CollectionsService({ knex: trx, schema });
|
|
27
|
-
const getNestedCollectionsToCreate = (currentLevelCollection) => snapshotDiff.collections.filter(({ diff }) =>
|
|
28
|
-
const getNestedCollectionsToDelete = (currentLevelCollection) => snapshotDiff.collections.filter(({ diff }) =>
|
|
26
|
+
const getNestedCollectionsToCreate = (currentLevelCollection) => snapshotDiff.collections.filter(({ diff }) => diff[0].rhs?.meta?.group === currentLevelCollection);
|
|
27
|
+
const getNestedCollectionsToDelete = (currentLevelCollection) => snapshotDiff.collections.filter(({ diff }) => diff[0].lhs?.meta?.group === currentLevelCollection);
|
|
29
28
|
const createCollections = async (collections) => {
|
|
30
29
|
for (const { collection, diff } of collections) {
|
|
31
|
-
if (
|
|
30
|
+
if (diff?.[0].kind === types_1.DiffKind.NEW && diff[0].rhs) {
|
|
32
31
|
// We'll nest the to-be-created fields in the same collection creation, to prevent
|
|
33
32
|
// creating a collection without a primary key
|
|
34
33
|
const fields = snapshotDiff.fields
|
|
35
34
|
.filter((fieldDiff) => fieldDiff.collection === collection)
|
|
36
35
|
.map((fieldDiff) => fieldDiff.diff[0].rhs)
|
|
37
36
|
.map((fieldDiff) => {
|
|
38
|
-
var _a, _b, _c, _d, _e;
|
|
39
37
|
// Casts field type to UUID when applying non-PostgreSQL schema onto PostgreSQL database.
|
|
40
38
|
// This is needed because they snapshots UUID fields as char/varchar with length 36.
|
|
41
|
-
if (['char', 'varchar'].includes(String(
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
(
|
|
39
|
+
if (['char', 'varchar'].includes(String(fieldDiff.schema?.data_type).toLowerCase()) &&
|
|
40
|
+
fieldDiff.schema?.max_length === 36 &&
|
|
41
|
+
(fieldDiff.schema?.is_primary_key ||
|
|
42
|
+
(fieldDiff.schema?.foreign_key_table && fieldDiff.schema?.foreign_key_column))) {
|
|
45
43
|
return (0, lodash_1.merge)(fieldDiff, { type: 'uuid', schema: { data_type: 'uuid', max_length: null } });
|
|
46
44
|
}
|
|
47
45
|
else {
|
|
@@ -66,7 +64,7 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
66
64
|
};
|
|
67
65
|
const deleteCollections = async (collections) => {
|
|
68
66
|
for (const { collection, diff } of collections) {
|
|
69
|
-
if (
|
|
67
|
+
if (diff?.[0].kind === types_1.DiffKind.DELETE) {
|
|
70
68
|
const relations = schema.relations.filter((r) => r.related_collection === collection || r.collection === collection);
|
|
71
69
|
if (relations.length > 0) {
|
|
72
70
|
const relationsService = new services_1.RelationsService({ knex: trx, schema });
|
|
@@ -95,13 +93,12 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
95
93
|
};
|
|
96
94
|
// Finds all collections that need to be created
|
|
97
95
|
const filterCollectionsForCreation = ({ diff }) => {
|
|
98
|
-
var _a;
|
|
99
96
|
// Check new collections only
|
|
100
97
|
const isNewCollection = diff[0].kind === types_1.DiffKind.NEW;
|
|
101
98
|
if (!isNewCollection)
|
|
102
99
|
return false;
|
|
103
100
|
// Create now if no group
|
|
104
|
-
const groupName =
|
|
101
|
+
const groupName = diff[0].rhs.meta?.group;
|
|
105
102
|
if (!groupName)
|
|
106
103
|
return true;
|
|
107
104
|
// Check if parent collection already exists in schema
|
|
@@ -124,9 +121,9 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
124
121
|
// then continue with nested collections recursively
|
|
125
122
|
await createCollections(snapshotDiff.collections.filter(filterCollectionsForCreation));
|
|
126
123
|
// delete top level collections (no group) first, then continue with nested collections recursively
|
|
127
|
-
await deleteCollections(snapshotDiff.collections.filter(({ diff }) =>
|
|
124
|
+
await deleteCollections(snapshotDiff.collections.filter(({ diff }) => diff[0].kind === types_1.DiffKind.DELETE && diff[0].lhs.meta?.group === null));
|
|
128
125
|
for (const { collection, diff } of snapshotDiff.collections) {
|
|
129
|
-
if (
|
|
126
|
+
if (diff?.[0].kind === types_1.DiffKind.EDIT || diff?.[0].kind === types_1.DiffKind.ARRAY) {
|
|
130
127
|
const currentCollection = currentSnapshot.collections.find((field) => {
|
|
131
128
|
return field.collection === collection;
|
|
132
129
|
});
|
|
@@ -150,7 +147,7 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
150
147
|
schema: await (0, get_schema_1.getSchema)({ database: trx, bypassCache: true }),
|
|
151
148
|
});
|
|
152
149
|
for (const { collection, field, diff } of snapshotDiff.fields) {
|
|
153
|
-
if (
|
|
150
|
+
if (diff?.[0].kind === types_1.DiffKind.NEW && !isNestedMetaUpdate(diff?.[0])) {
|
|
154
151
|
try {
|
|
155
152
|
await fieldsService.createField(collection, diff[0].rhs, undefined, mutationOptions);
|
|
156
153
|
}
|
|
@@ -159,7 +156,7 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
159
156
|
throw err;
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
|
-
if (
|
|
159
|
+
if (diff?.[0].kind === types_1.DiffKind.EDIT || diff?.[0].kind === types_1.DiffKind.ARRAY || isNestedMetaUpdate(diff?.[0])) {
|
|
163
160
|
const currentField = currentSnapshot.fields.find((snapshotField) => {
|
|
164
161
|
return snapshotField.collection === collection && snapshotField.field === field;
|
|
165
162
|
});
|
|
@@ -177,7 +174,7 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
177
174
|
}
|
|
178
175
|
}
|
|
179
176
|
}
|
|
180
|
-
if (
|
|
177
|
+
if (diff?.[0].kind === types_1.DiffKind.DELETE && !isNestedMetaUpdate(diff?.[0])) {
|
|
181
178
|
try {
|
|
182
179
|
await fieldsService.deleteField(collection, field, mutationOptions);
|
|
183
180
|
}
|
|
@@ -199,7 +196,7 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
199
196
|
for (const diffEdit of diff) {
|
|
200
197
|
(0, lodash_1.set)(structure, diffEdit.path, undefined);
|
|
201
198
|
}
|
|
202
|
-
if (
|
|
199
|
+
if (diff?.[0].kind === types_1.DiffKind.NEW) {
|
|
203
200
|
try {
|
|
204
201
|
await relationsService.createOne(diff[0].rhs, mutationOptions);
|
|
205
202
|
}
|
|
@@ -208,7 +205,7 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
208
205
|
throw err;
|
|
209
206
|
}
|
|
210
207
|
}
|
|
211
|
-
if (
|
|
208
|
+
if (diff?.[0].kind === types_1.DiffKind.EDIT || diff?.[0].kind === types_1.DiffKind.ARRAY) {
|
|
212
209
|
const currentRelation = currentSnapshot.relations.find((relation) => {
|
|
213
210
|
return relation.collection === collection && relation.field === field;
|
|
214
211
|
});
|
|
@@ -226,7 +223,7 @@ async function applyDiff(currentSnapshot, snapshotDiff, options) {
|
|
|
226
223
|
}
|
|
227
224
|
}
|
|
228
225
|
}
|
|
229
|
-
if (
|
|
226
|
+
if (diff?.[0].kind === types_1.DiffKind.DELETE) {
|
|
230
227
|
try {
|
|
231
228
|
await relationsService.deleteOne(collection, field, mutationOptions);
|
|
232
229
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Aggregate, Filter, Query, SchemaOverview } from '@directus/shared/types';
|
|
2
|
-
import { Knex } from 'knex';
|
|
1
|
+
import type { Aggregate, Filter, Query, SchemaOverview } from '@directus/shared/types';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
3
|
import { AliasMap } from './get-column-path';
|
|
4
4
|
export declare const generateAlias: (size?: number | undefined) => string;
|
|
5
5
|
/**
|
|
@@ -8,7 +8,7 @@ export declare const generateAlias: (size?: number | undefined) => string;
|
|
|
8
8
|
export default function applyQuery(knex: Knex, collection: string, dbQuery: Knex.QueryBuilder, query: Query, schema: SchemaOverview, options?: {
|
|
9
9
|
aliasMap?: AliasMap;
|
|
10
10
|
isInnerQuery?: boolean;
|
|
11
|
-
hasMultiRelationalSort?: boolean;
|
|
11
|
+
hasMultiRelationalSort?: boolean | undefined;
|
|
12
12
|
}): {
|
|
13
13
|
query: Knex.QueryBuilder<any, any>;
|
|
14
14
|
hasMultiRelationalFilter: boolean;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applyAggregate = exports.applySearch = exports.applyFilter = exports.applyOffset = exports.applyLimit = exports.applySort = exports.generateAlias = void 0;
|
|
7
|
+
const utils_1 = require("@directus/shared/utils");
|
|
7
8
|
const lodash_1 = require("lodash");
|
|
8
9
|
const uuid_validate_1 = __importDefault(require("uuid-validate"));
|
|
9
10
|
const helpers_1 = require("../database/helpers");
|
|
@@ -11,7 +12,6 @@ const invalid_query_1 = require("../exceptions/invalid-query");
|
|
|
11
12
|
const get_column_1 = require("./get-column");
|
|
12
13
|
const get_column_path_1 = require("./get-column-path");
|
|
13
14
|
const get_relation_info_1 = require("./get-relation-info");
|
|
14
|
-
const utils_1 = require("@directus/shared/utils");
|
|
15
15
|
const strip_function_1 = require("./strip-function");
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
const non_secure_1 = require("nanoid/non-secure");
|
|
@@ -20,8 +20,7 @@ exports.generateAlias = (0, non_secure_1.customAlphabet)('abcdefghijklmnopqrstuv
|
|
|
20
20
|
* Apply the Query to a given Knex query builder instance
|
|
21
21
|
*/
|
|
22
22
|
function applyQuery(knex, collection, dbQuery, query, schema, options) {
|
|
23
|
-
|
|
24
|
-
const aliasMap = (_a = options === null || options === void 0 ? void 0 : options.aliasMap) !== null && _a !== void 0 ? _a : Object.create(null);
|
|
23
|
+
const aliasMap = options?.aliasMap ?? Object.create(null);
|
|
25
24
|
let hasMultiRelationalFilter = false;
|
|
26
25
|
applyLimit(knex, dbQuery, query.limit);
|
|
27
26
|
if (query.offset) {
|
|
@@ -30,7 +29,7 @@ function applyQuery(knex, collection, dbQuery, query, schema, options) {
|
|
|
30
29
|
if (query.page && query.limit && query.limit !== -1) {
|
|
31
30
|
applyOffset(knex, dbQuery, query.limit * (query.page - 1));
|
|
32
31
|
}
|
|
33
|
-
if (query.sort && !
|
|
32
|
+
if (query.sort && !options?.isInnerQuery && !options?.hasMultiRelationalSort) {
|
|
34
33
|
applySort(knex, schema, dbQuery, query.sort, collection, aliasMap);
|
|
35
34
|
}
|
|
36
35
|
if (query.search) {
|
|
@@ -54,7 +53,6 @@ function addJoin({ path, collection, aliasMap, rootQuery, schema, relations, kne
|
|
|
54
53
|
followRelation(path);
|
|
55
54
|
return hasMultiRelational;
|
|
56
55
|
function followRelation(pathParts, parentCollection = collection, parentFields) {
|
|
57
|
-
var _a, _b, _c;
|
|
58
56
|
/**
|
|
59
57
|
* For A2M fields, the path can contain an optional collection scope <field>:<scope>
|
|
60
58
|
*/
|
|
@@ -64,12 +62,12 @@ function addJoin({ path, collection, aliasMap, rootQuery, schema, relations, kne
|
|
|
64
62
|
return;
|
|
65
63
|
}
|
|
66
64
|
const existingAlias = parentFields
|
|
67
|
-
?
|
|
68
|
-
:
|
|
65
|
+
? aliasMap[`${parentFields}.${pathParts[0]}`]?.alias
|
|
66
|
+
: aliasMap[pathParts[0]]?.alias;
|
|
69
67
|
if (!existingAlias) {
|
|
70
68
|
const alias = (0, exports.generateAlias)();
|
|
71
69
|
const aliasKey = parentFields ? `${parentFields}.${pathParts[0]}` : pathParts[0];
|
|
72
|
-
const aliasedParentCollection =
|
|
70
|
+
const aliasedParentCollection = aliasMap[parentFields ?? '']?.alias || parentCollection;
|
|
73
71
|
aliasMap[aliasKey] = { alias, collection: '' };
|
|
74
72
|
if (relationType === 'm2o') {
|
|
75
73
|
rootQuery.leftJoin({ [alias]: relation.related_collection }, `${aliasedParentCollection}.${relation.field}`, `${alias}.${schema.collections[relation.related_collection].primary}`);
|
|
@@ -136,7 +134,7 @@ function applySort(knex, schema, rootQuery, rootSort, collection, aliasMap, retu
|
|
|
136
134
|
if (column.length === 1) {
|
|
137
135
|
const pathRoot = column[0].split(':')[0];
|
|
138
136
|
const { relation, relationType } = (0, get_relation_info_1.getRelationInfo)(relations, collection, pathRoot);
|
|
139
|
-
if (!relation || ['m2o', 'a2o'].includes(relationType
|
|
137
|
+
if (!relation || ['m2o', 'a2o'].includes(relationType ?? '')) {
|
|
140
138
|
return {
|
|
141
139
|
order,
|
|
142
140
|
column: returnRecords ? column[0] : (0, get_column_1.getColumn)(knex, collection, column[0], false, schema),
|
|
@@ -225,7 +223,6 @@ function applyFilter(knex, schema, rootQuery, rootFilter, collection, aliasMap)
|
|
|
225
223
|
}
|
|
226
224
|
}
|
|
227
225
|
function addWhereClauses(knex, dbQuery, filter, collection, logical = 'and') {
|
|
228
|
-
var _a;
|
|
229
226
|
for (const [key, value] of Object.entries(filter)) {
|
|
230
227
|
if (key === '_or' || key === '_and') {
|
|
231
228
|
// If the _or array contains an empty object (full permissions), we should short-circuit and ignore all other
|
|
@@ -267,7 +264,7 @@ function applyFilter(knex, schema, rootQuery, rootFilter, collection, aliasMap)
|
|
|
267
264
|
.whereNotNull(column);
|
|
268
265
|
applyQuery(knex, relation.collection, subQueryKnex, { filter }, schema);
|
|
269
266
|
};
|
|
270
|
-
const childKey =
|
|
267
|
+
const childKey = Object.keys(value)?.[0];
|
|
271
268
|
if (childKey === '_none') {
|
|
272
269
|
dbQuery[logical].whereNotIn(pkField, subQueryBuilder(Object.values(value)[0]));
|
|
273
270
|
continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SchemaOverview } from '@directus/shared/types';
|
|
2
|
-
import { Knex } from 'knex';
|
|
3
|
-
import { Snapshot, SnapshotDiff } from '../types';
|
|
1
|
+
import type { SchemaOverview } from '@directus/shared/types';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
|
+
import type { Snapshot, SnapshotDiff } from '../types';
|
|
4
4
|
export declare function applySnapshot(snapshot: Snapshot, options?: {
|
|
5
5
|
database?: Knex;
|
|
6
6
|
schema?: SchemaOverview;
|
|
@@ -11,13 +11,12 @@ const get_schema_1 = require("./get-schema");
|
|
|
11
11
|
const get_snapshot_1 = require("./get-snapshot");
|
|
12
12
|
const get_snapshot_diff_1 = require("./get-snapshot-diff");
|
|
13
13
|
async function applySnapshot(snapshot, options) {
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const schema = (_b = options === null || options === void 0 ? void 0 : options.schema) !== null && _b !== void 0 ? _b : (await (0, get_schema_1.getSchema)({ database, bypassCache: true }));
|
|
14
|
+
const database = options?.database ?? (0, database_1.default)();
|
|
15
|
+
const schema = options?.schema ?? (await (0, get_schema_1.getSchema)({ database, bypassCache: true }));
|
|
17
16
|
const { systemCache } = (0, cache_1.getCache)();
|
|
18
|
-
const current =
|
|
19
|
-
const snapshotDiff =
|
|
17
|
+
const current = options?.current ?? (await (0, get_snapshot_1.getSnapshot)({ database, schema }));
|
|
18
|
+
const snapshotDiff = options?.diff ?? (0, get_snapshot_diff_1.getSnapshotDiff)(current, snapshot);
|
|
20
19
|
await (0, apply_diff_1.applyDiff)(current, snapshotDiff, { database, schema });
|
|
21
|
-
await
|
|
20
|
+
await systemCache?.clear();
|
|
22
21
|
}
|
|
23
22
|
exports.applySnapshot = applySnapshot;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Flow, FlowRaw } from '@directus/shared/types';
|
|
1
|
+
import type { Flow, FlowRaw } from '@directus/shared/types';
|
|
2
2
|
export declare function constructFlowTree(flow: FlowRaw): Flow;
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.constructFlowTree = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
function constructFlowTree(flow) {
|
|
6
|
-
|
|
7
|
-
const rootOperation = (_a = flow.operations.find((operation) => operation.id === flow.operation)) !== null && _a !== void 0 ? _a : null;
|
|
6
|
+
const rootOperation = flow.operations.find((operation) => operation.id === flow.operation) ?? null;
|
|
8
7
|
const operationTree = constructOperationTree(rootOperation, flow.operations);
|
|
9
8
|
const flowTree = {
|
|
10
9
|
...(0, lodash_1.omit)(flow, 'operations'),
|
|
11
10
|
operation: operationTree,
|
|
11
|
+
options: flow.options ?? {},
|
|
12
12
|
};
|
|
13
13
|
return flowTree;
|
|
14
14
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Query } from '@directus/shared/types';
|
|
1
|
+
import type { Query } from '@directus/shared/types';
|
|
2
2
|
export declare function filterItems(items: Record<string, any>[], filter: Query['filter']): Record<string, any>[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Accountability, SchemaOverview } from '@directus/shared/types';
|
|
2
|
-
import { Knex } from 'knex';
|
|
1
|
+
import type { Accountability, SchemaOverview } from '@directus/shared/types';
|
|
2
|
+
import type { Knex } from 'knex';
|
|
3
3
|
export declare function getAccountabilityForRole(role: null | string, context: {
|
|
4
4
|
accountability: null | Accountability;
|
|
5
5
|
schema: SchemaOverview;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAccountabilityForRole = void 0;
|
|
4
|
-
const get_permissions_1 = require("./get-permissions");
|
|
5
4
|
const exceptions_1 = require("../exceptions");
|
|
5
|
+
const get_permissions_1 = require("./get-permissions");
|
|
6
6
|
async function getAccountabilityForRole(role, context) {
|
|
7
7
|
let generatedAccountability = context.accountability;
|
|
8
8
|
if (role === null) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate an AST based on a given collection and query
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import type { Accountability, PermissionsAction, Query, SchemaOverview } from '@directus/shared/types';
|
|
5
|
+
import type { Knex } from 'knex';
|
|
6
|
+
import type { AST } from '../types';
|
|
7
7
|
type GetASTOptions = {
|
|
8
8
|
accountability?: Accountability | null;
|
|
9
9
|
action?: PermissionsAction;
|