@strapi/core 5.37.0 → 5.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Strapi.js.map +1 -1
- package/dist/Strapi.mjs.map +1 -1
- package/dist/compile.js.map +1 -1
- package/dist/compile.mjs.map +1 -1
- package/dist/configuration/config-loader.js.map +1 -1
- package/dist/configuration/config-loader.mjs.map +1 -1
- package/dist/configuration/get-dirs.js.map +1 -1
- package/dist/configuration/get-dirs.mjs +1 -1
- package/dist/configuration/get-dirs.mjs.map +1 -1
- package/dist/configuration/index.js.map +1 -1
- package/dist/configuration/index.mjs.map +1 -1
- package/dist/configuration/urls.js.map +1 -1
- package/dist/configuration/urls.mjs.map +1 -1
- package/dist/container.js.map +1 -1
- package/dist/container.mjs.map +1 -1
- package/dist/core-api/controller/collection-type.js.map +1 -1
- package/dist/core-api/controller/collection-type.mjs.map +1 -1
- package/dist/core-api/controller/index.js.map +1 -1
- package/dist/core-api/controller/index.mjs.map +1 -1
- package/dist/core-api/controller/single-type.js.map +1 -1
- package/dist/core-api/controller/single-type.mjs.map +1 -1
- package/dist/core-api/controller/transform.js.map +1 -1
- package/dist/core-api/controller/transform.mjs.map +1 -1
- package/dist/core-api/routes/index.js.map +1 -1
- package/dist/core-api/routes/index.mjs.map +1 -1
- package/dist/core-api/routes/validation/attributes.js.map +1 -1
- package/dist/core-api/routes/validation/attributes.mjs +1 -1
- package/dist/core-api/routes/validation/attributes.mjs.map +1 -1
- package/dist/core-api/routes/validation/common.js.map +1 -1
- package/dist/core-api/routes/validation/common.mjs.map +1 -1
- package/dist/core-api/routes/validation/component.js.map +1 -1
- package/dist/core-api/routes/validation/component.mjs.map +1 -1
- package/dist/core-api/routes/validation/constants.js.map +1 -1
- package/dist/core-api/routes/validation/constants.mjs.map +1 -1
- package/dist/core-api/routes/validation/content-type.js.map +1 -1
- package/dist/core-api/routes/validation/content-type.mjs.map +1 -1
- package/dist/core-api/routes/validation/mappers.js.map +1 -1
- package/dist/core-api/routes/validation/mappers.mjs.map +1 -1
- package/dist/core-api/routes/validation/utils.js.map +1 -1
- package/dist/core-api/routes/validation/utils.mjs.map +1 -1
- package/dist/core-api/service/collection-type.js.map +1 -1
- package/dist/core-api/service/collection-type.mjs.map +1 -1
- package/dist/core-api/service/core-service.js.map +1 -1
- package/dist/core-api/service/core-service.mjs.map +1 -1
- package/dist/core-api/service/index.js.map +1 -1
- package/dist/core-api/service/index.mjs.map +1 -1
- package/dist/core-api/service/pagination.js.map +1 -1
- package/dist/core-api/service/pagination.mjs +1 -1
- package/dist/core-api/service/pagination.mjs.map +1 -1
- package/dist/core-api/service/single-type.js.map +1 -1
- package/dist/core-api/service/single-type.mjs.map +1 -1
- package/dist/domain/content-type/index.js.map +1 -1
- package/dist/domain/content-type/index.mjs.map +1 -1
- package/dist/domain/content-type/validator.js.map +1 -1
- package/dist/domain/content-type/validator.mjs.map +1 -1
- package/dist/domain/module/index.js.map +1 -1
- package/dist/domain/module/index.mjs.map +1 -1
- package/dist/domain/module/validation.js.map +1 -1
- package/dist/domain/module/validation.mjs.map +1 -1
- package/dist/ee/index.js.map +1 -1
- package/dist/ee/index.mjs +2 -2
- package/dist/ee/index.mjs.map +1 -1
- package/dist/ee/license.js.map +1 -1
- package/dist/ee/license.mjs.map +1 -1
- package/dist/factories.js +4 -4
- package/dist/factories.js.map +1 -1
- package/dist/factories.mjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/loaders/admin.js.map +1 -1
- package/dist/loaders/admin.mjs.map +1 -1
- package/dist/loaders/apis.js.map +1 -1
- package/dist/loaders/apis.mjs.map +1 -1
- package/dist/loaders/components.js.map +1 -1
- package/dist/loaders/components.mjs.map +1 -1
- package/dist/loaders/index.js.map +1 -1
- package/dist/loaders/index.mjs.map +1 -1
- package/dist/loaders/middlewares.js.map +1 -1
- package/dist/loaders/middlewares.mjs.map +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
- package/dist/loaders/plugins/get-user-plugins-config.js.map +1 -1
- package/dist/loaders/plugins/get-user-plugins-config.mjs.map +1 -1
- package/dist/loaders/plugins/index.js.map +1 -1
- package/dist/loaders/plugins/index.mjs +1 -1
- package/dist/loaders/plugins/index.mjs.map +1 -1
- package/dist/loaders/policies.js.map +1 -1
- package/dist/loaders/policies.mjs.map +1 -1
- package/dist/loaders/sanitizers.js.map +1 -1
- package/dist/loaders/sanitizers.mjs.map +1 -1
- package/dist/loaders/src-index.js.map +1 -1
- package/dist/loaders/src-index.mjs.map +1 -1
- package/dist/loaders/validators.js.map +1 -1
- package/dist/loaders/validators.mjs.map +1 -1
- package/dist/middlewares/body.js.map +1 -1
- package/dist/middlewares/body.mjs.map +1 -1
- package/dist/middlewares/compression.js.map +1 -1
- package/dist/middlewares/compression.mjs.map +1 -1
- package/dist/middlewares/cors.js.map +1 -1
- package/dist/middlewares/cors.mjs.map +1 -1
- package/dist/middlewares/errors.js.map +1 -1
- package/dist/middlewares/errors.mjs.map +1 -1
- package/dist/middlewares/favicon.js.map +1 -1
- package/dist/middlewares/favicon.mjs.map +1 -1
- package/dist/middlewares/index.js.map +1 -1
- package/dist/middlewares/index.mjs.map +1 -1
- package/dist/middlewares/ip.js.map +1 -1
- package/dist/middlewares/ip.mjs.map +1 -1
- package/dist/middlewares/logger.js.map +1 -1
- package/dist/middlewares/logger.mjs.map +1 -1
- package/dist/middlewares/powered-by.js.map +1 -1
- package/dist/middlewares/powered-by.mjs.map +1 -1
- package/dist/middlewares/public.js.map +1 -1
- package/dist/middlewares/public.mjs.map +1 -1
- package/dist/middlewares/query.js.map +1 -1
- package/dist/middlewares/query.mjs.map +1 -1
- package/dist/middlewares/response-time.js.map +1 -1
- package/dist/middlewares/response-time.mjs.map +1 -1
- package/dist/middlewares/responses.js.map +1 -1
- package/dist/middlewares/responses.mjs.map +1 -1
- package/dist/middlewares/security.js.map +1 -1
- package/dist/middlewares/security.mjs.map +1 -1
- package/dist/middlewares/session.js.map +1 -1
- package/dist/middlewares/session.mjs.map +1 -1
- package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -1
- package/dist/migrations/database/5.0.0-discard-drafts.js +508 -3
- package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -1
- package/dist/migrations/database/5.0.0-discard-drafts.mjs +509 -4
- package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -1
- package/dist/migrations/draft-publish.js.map +1 -1
- package/dist/migrations/draft-publish.mjs.map +1 -1
- package/dist/migrations/first-published-at.js.map +1 -1
- package/dist/migrations/first-published-at.mjs.map +1 -1
- package/dist/migrations/i18n.js.map +1 -1
- package/dist/migrations/i18n.mjs.map +1 -1
- package/dist/migrations/index.mjs +2 -2
- package/dist/package.json.js +12 -12
- package/dist/package.json.mjs +17 -17
- package/dist/providers/admin.js.map +1 -1
- package/dist/providers/admin.mjs.map +1 -1
- package/dist/providers/coreStore.js.map +1 -1
- package/dist/providers/coreStore.mjs.map +1 -1
- package/dist/providers/cron.js.map +1 -1
- package/dist/providers/cron.mjs.map +1 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs.map +1 -1
- package/dist/providers/provider.js.map +1 -1
- package/dist/providers/provider.mjs.map +1 -1
- package/dist/providers/registries.js.map +1 -1
- package/dist/providers/registries.mjs.map +1 -1
- package/dist/providers/session-manager.js.map +1 -1
- package/dist/providers/session-manager.mjs.map +1 -1
- package/dist/providers/telemetry.js.map +1 -1
- package/dist/providers/telemetry.mjs.map +1 -1
- package/dist/providers/webhooks.js.map +1 -1
- package/dist/providers/webhooks.mjs.map +1 -1
- package/dist/registries/apis.js.map +1 -1
- package/dist/registries/apis.mjs.map +1 -1
- package/dist/registries/components.js.map +1 -1
- package/dist/registries/components.mjs.map +1 -1
- package/dist/registries/content-types.js.map +1 -1
- package/dist/registries/content-types.mjs +2 -2
- package/dist/registries/content-types.mjs.map +1 -1
- package/dist/registries/controllers.js.map +1 -1
- package/dist/registries/controllers.mjs +2 -2
- package/dist/registries/controllers.mjs.map +1 -1
- package/dist/registries/custom-fields.js.map +1 -1
- package/dist/registries/custom-fields.mjs.map +1 -1
- package/dist/registries/hooks.js.map +1 -1
- package/dist/registries/hooks.mjs +1 -1
- package/dist/registries/hooks.mjs.map +1 -1
- package/dist/registries/middlewares.js.map +1 -1
- package/dist/registries/middlewares.mjs +2 -2
- package/dist/registries/middlewares.mjs.map +1 -1
- package/dist/registries/models.js.map +1 -1
- package/dist/registries/models.mjs.map +1 -1
- package/dist/registries/modules.js.map +1 -1
- package/dist/registries/modules.mjs +1 -1
- package/dist/registries/modules.mjs.map +1 -1
- package/dist/registries/namespace.js.map +1 -1
- package/dist/registries/namespace.mjs.map +1 -1
- package/dist/registries/plugins.js.map +1 -1
- package/dist/registries/plugins.mjs.map +1 -1
- package/dist/registries/policies.js.map +1 -1
- package/dist/registries/policies.mjs +2 -2
- package/dist/registries/policies.mjs.map +1 -1
- package/dist/registries/sanitizers.js.map +1 -1
- package/dist/registries/sanitizers.mjs.map +1 -1
- package/dist/registries/services.js.map +1 -1
- package/dist/registries/services.mjs +2 -2
- package/dist/registries/services.mjs.map +1 -1
- package/dist/registries/validators.js.map +1 -1
- package/dist/registries/validators.mjs.map +1 -1
- package/dist/services/auth/index.js.map +1 -1
- package/dist/services/auth/index.mjs.map +1 -1
- package/dist/services/config.js.map +1 -1
- package/dist/services/config.mjs +1 -1
- package/dist/services/config.mjs.map +1 -1
- package/dist/services/content-api/index.js.map +1 -1
- package/dist/services/content-api/index.mjs +1 -1
- package/dist/services/content-api/index.mjs.map +1 -1
- package/dist/services/content-api/permissions/engine.js.map +1 -1
- package/dist/services/content-api/permissions/engine.mjs.map +1 -1
- package/dist/services/content-api/permissions/index.js.map +1 -1
- package/dist/services/content-api/permissions/index.mjs.map +1 -1
- package/dist/services/content-api/permissions/providers/action.js.map +1 -1
- package/dist/services/content-api/permissions/providers/action.mjs.map +1 -1
- package/dist/services/content-api/permissions/providers/condition.js.map +1 -1
- package/dist/services/content-api/permissions/providers/condition.mjs.map +1 -1
- package/dist/services/content-source-maps.js.map +1 -1
- package/dist/services/content-source-maps.mjs.map +1 -1
- package/dist/services/core-store.js.map +1 -1
- package/dist/services/core-store.mjs.map +1 -1
- package/dist/services/cron.js.map +1 -1
- package/dist/services/cron.mjs.map +1 -1
- package/dist/services/custom-fields.js.map +1 -1
- package/dist/services/custom-fields.mjs.map +1 -1
- package/dist/services/document-service/attributes/index.js.map +1 -1
- package/dist/services/document-service/attributes/index.mjs.map +1 -1
- package/dist/services/document-service/attributes/transforms.js.map +1 -1
- package/dist/services/document-service/attributes/transforms.mjs.map +1 -1
- package/dist/services/document-service/common.js.map +1 -1
- package/dist/services/document-service/common.mjs.map +1 -1
- package/dist/services/document-service/components.js.map +1 -1
- package/dist/services/document-service/components.mjs.map +1 -1
- package/dist/services/document-service/draft-and-publish.js.map +1 -1
- package/dist/services/document-service/draft-and-publish.mjs.map +1 -1
- package/dist/services/document-service/entries.js.map +1 -1
- package/dist/services/document-service/entries.mjs +2 -2
- package/dist/services/document-service/entries.mjs.map +1 -1
- package/dist/services/document-service/events.js +1 -6
- package/dist/services/document-service/events.js.map +1 -1
- package/dist/services/document-service/events.mjs +1 -6
- package/dist/services/document-service/events.mjs.map +1 -1
- package/dist/services/document-service/first-published-at.js.map +1 -1
- package/dist/services/document-service/first-published-at.mjs.map +1 -1
- package/dist/services/document-service/index.js.map +1 -1
- package/dist/services/document-service/index.mjs.map +1 -1
- package/dist/services/document-service/internationalization.js.map +1 -1
- package/dist/services/document-service/internationalization.mjs.map +1 -1
- package/dist/services/document-service/middlewares/errors.js.map +1 -1
- package/dist/services/document-service/middlewares/errors.mjs.map +1 -1
- package/dist/services/document-service/middlewares/middleware-manager.js.map +1 -1
- package/dist/services/document-service/middlewares/middleware-manager.mjs.map +1 -1
- package/dist/services/document-service/params.js.map +1 -1
- package/dist/services/document-service/params.mjs.map +1 -1
- package/dist/services/document-service/repository.js +0 -2
- package/dist/services/document-service/repository.js.map +1 -1
- package/dist/services/document-service/repository.mjs +4 -6
- package/dist/services/document-service/repository.mjs.map +1 -1
- package/dist/services/document-service/transform/data.js.map +1 -1
- package/dist/services/document-service/transform/data.mjs.map +1 -1
- package/dist/services/document-service/transform/fields.js.map +1 -1
- package/dist/services/document-service/transform/fields.mjs.map +1 -1
- package/dist/services/document-service/transform/id-map.js.map +1 -1
- package/dist/services/document-service/transform/id-map.mjs.map +1 -1
- package/dist/services/document-service/transform/id-transform.js.map +1 -1
- package/dist/services/document-service/transform/id-transform.mjs.map +1 -1
- package/dist/services/document-service/transform/populate.js.map +1 -1
- package/dist/services/document-service/transform/populate.mjs.map +1 -1
- package/dist/services/document-service/transform/query.js.map +1 -1
- package/dist/services/document-service/transform/query.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -1
- package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -1
- package/dist/services/document-service/transform/relations/transform/data-ids.mjs +1 -1
- package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/transform/default-locale.js.map +1 -1
- package/dist/services/document-service/transform/relations/transform/default-locale.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -1
- package/dist/services/document-service/transform/relations/utils/dp.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -1
- package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -1
- package/dist/services/document-service/transform/relations/utils/map-relation.js.map +1 -1
- package/dist/services/document-service/transform/relations/utils/map-relation.mjs.map +1 -1
- package/dist/services/document-service/utils/bidirectional-relations.js.map +1 -1
- package/dist/services/document-service/utils/bidirectional-relations.mjs.map +1 -1
- package/dist/services/document-service/utils/clean-component-join-table.js.map +1 -1
- package/dist/services/document-service/utils/clean-component-join-table.mjs.map +1 -1
- package/dist/services/document-service/utils/ordered-parallel.js.map +1 -1
- package/dist/services/document-service/utils/ordered-parallel.mjs.map +1 -1
- package/dist/services/document-service/utils/populate.js.map +1 -1
- package/dist/services/document-service/utils/populate.mjs.map +1 -1
- package/dist/services/document-service/utils/unidirectional-relations.js.map +1 -1
- package/dist/services/document-service/utils/unidirectional-relations.mjs.map +1 -1
- package/dist/services/entity-service/index.js.map +1 -1
- package/dist/services/entity-service/index.mjs +1 -1
- package/dist/services/entity-service/index.mjs.map +1 -1
- package/dist/services/entity-validator/blocks-validator.js.map +1 -1
- package/dist/services/entity-validator/blocks-validator.mjs.map +1 -1
- package/dist/services/entity-validator/index.js.map +1 -1
- package/dist/services/entity-validator/index.mjs +1 -1
- package/dist/services/entity-validator/index.mjs.map +1 -1
- package/dist/services/entity-validator/validators.js.map +1 -1
- package/dist/services/entity-validator/validators.mjs.map +1 -1
- package/dist/services/errors.js.map +1 -1
- package/dist/services/errors.mjs.map +1 -1
- package/dist/services/event-hub.js.map +1 -1
- package/dist/services/event-hub.mjs.map +1 -1
- package/dist/services/features.js.map +1 -1
- package/dist/services/features.mjs.map +1 -1
- package/dist/services/fs.js.map +1 -1
- package/dist/services/fs.mjs.map +1 -1
- package/dist/services/metrics/admin-user-hash.js.map +1 -1
- package/dist/services/metrics/admin-user-hash.mjs.map +1 -1
- package/dist/services/metrics/index.js.map +1 -1
- package/dist/services/metrics/index.mjs.map +1 -1
- package/dist/services/metrics/is-truthy.js.map +1 -1
- package/dist/services/metrics/is-truthy.mjs.map +1 -1
- package/dist/services/metrics/middleware.js.map +1 -1
- package/dist/services/metrics/middleware.mjs.map +1 -1
- package/dist/services/metrics/rate-limiter.js.map +1 -1
- package/dist/services/metrics/rate-limiter.mjs.map +1 -1
- package/dist/services/metrics/sender.js.map +1 -1
- package/dist/services/metrics/sender.mjs.map +1 -1
- package/dist/services/query-params.js.map +1 -1
- package/dist/services/query-params.mjs.map +1 -1
- package/dist/services/reloader.js.map +1 -1
- package/dist/services/reloader.mjs.map +1 -1
- package/dist/services/request-context.js.map +1 -1
- package/dist/services/request-context.mjs.map +1 -1
- package/dist/services/server/admin-api.js.map +1 -1
- package/dist/services/server/admin-api.mjs.map +1 -1
- package/dist/services/server/api.js.map +1 -1
- package/dist/services/server/api.mjs.map +1 -1
- package/dist/services/server/compose-endpoint.js +1 -3
- package/dist/services/server/compose-endpoint.js.map +1 -1
- package/dist/services/server/compose-endpoint.mjs +1 -3
- package/dist/services/server/compose-endpoint.mjs.map +1 -1
- package/dist/services/server/content-api.js.map +1 -1
- package/dist/services/server/content-api.mjs.map +1 -1
- package/dist/services/server/http-server.js.map +1 -1
- package/dist/services/server/http-server.mjs.map +1 -1
- package/dist/services/server/index.js.map +1 -1
- package/dist/services/server/index.mjs.map +1 -1
- package/dist/services/server/koa.js.map +1 -1
- package/dist/services/server/koa.mjs.map +1 -1
- package/dist/services/server/middleware.js.map +1 -1
- package/dist/services/server/middleware.mjs.map +1 -1
- package/dist/services/server/policy.js.map +1 -1
- package/dist/services/server/policy.mjs.map +1 -1
- package/dist/services/server/register-middlewares.js.map +1 -1
- package/dist/services/server/register-middlewares.mjs.map +1 -1
- package/dist/services/server/register-routes.js.map +1 -1
- package/dist/services/server/register-routes.mjs.map +1 -1
- package/dist/services/server/routing.js.map +1 -1
- package/dist/services/server/routing.mjs.map +1 -1
- package/dist/services/session-manager.js.map +1 -1
- package/dist/services/session-manager.mjs.map +1 -1
- package/dist/services/utils/conditional-fields.js.map +1 -1
- package/dist/services/utils/conditional-fields.mjs.map +1 -1
- package/dist/services/utils/dynamic-zones.js.map +1 -1
- package/dist/services/utils/dynamic-zones.mjs.map +1 -1
- package/dist/services/webhook-runner.js.map +1 -1
- package/dist/services/webhook-runner.mjs.map +1 -1
- package/dist/services/webhook-store.js.map +1 -1
- package/dist/services/webhook-store.mjs.map +1 -1
- package/dist/services/worker-queue.js.map +1 -1
- package/dist/services/worker-queue.mjs.map +1 -1
- package/dist/utils/convert-custom-field-type.js.map +1 -1
- package/dist/utils/convert-custom-field-type.mjs.map +1 -1
- package/dist/utils/cron.js.map +1 -1
- package/dist/utils/cron.mjs.map +1 -1
- package/dist/utils/fetch.js.map +1 -1
- package/dist/utils/fetch.mjs.map +1 -1
- package/dist/utils/filepath-to-prop-path.js.map +1 -1
- package/dist/utils/filepath-to-prop-path.mjs.map +1 -1
- package/dist/utils/is-initialized.js.map +1 -1
- package/dist/utils/is-initialized.mjs.map +1 -1
- package/dist/utils/lifecycles.js.map +1 -1
- package/dist/utils/lifecycles.mjs.map +1 -1
- package/dist/utils/load-config-file.js.map +1 -1
- package/dist/utils/load-config-file.mjs.map +1 -1
- package/dist/utils/load-files.js.map +1 -1
- package/dist/utils/load-files.mjs.map +1 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/open-browser.mjs.map +1 -1
- package/dist/utils/resolve-working-dirs.js.map +1 -1
- package/dist/utils/resolve-working-dirs.mjs.map +1 -1
- package/dist/utils/signals.js.map +1 -1
- package/dist/utils/signals.mjs.map +1 -1
- package/dist/utils/startup-logger.js.map +1 -1
- package/dist/utils/startup-logger.mjs.map +1 -1
- package/dist/utils/transform-content-types-to-models.js.map +1 -1
- package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
- package/dist/utils/update-notifier/index.js.map +1 -1
- package/dist/utils/update-notifier/index.mjs.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-map.js","sources":["../../../../src/services/document-service/transform/id-map.ts"],"sourcesContent":["import type { Core, Data, UID } from '@strapi/types';\nimport { async, contentTypes } from '@strapi/utils';\n\nconst hasDraftAndPublish = (uid: UID.CollectionType) => {\n const model = strapi.getModel(uid);\n return contentTypes.hasDraftAndPublish(model);\n};\n\n/**\n * TODO: Find a better way to encode keys than this\n * This converts an object into a string by joining its keys and values,\n * so it can be used as a key in a Map.\n *\n * @example\n * const obj = { a: 1, b: 2 };\n * const key = encodeKey(obj);\n * ^ \"a:::1&&b:::2\"\n */\nconst encodeKey = (obj: any) => {\n // Ignore status field for models without draft and publish\n if (!hasDraftAndPublish(obj.uid)) {\n delete obj.status;\n }\n\n // Sort keys to always keep the same order when encoding\n const keys = Object.keys(obj).sort();\n return keys.map((key) => `${key}:::${obj[key]}`).join('&&');\n};\n\ninterface KeyFields {\n uid: string;\n documentId: Data.ID;\n locale?: string | null;\n status?: 'draft' | 'published';\n}\n\nexport interface IdMap {\n loadedIds: Map<string, string>;\n toLoadIds: Map<string, KeyFields>;\n // Make the Keys type to be the params of add\n add(keys: KeyFields): void;\n load(): Promise<void>;\n get(keys: KeyFields): string | undefined;\n clear(): void;\n}\n\n/**\n * Holds a registry of document ids and their corresponding entity ids.\n */\nconst createIdMap = ({ strapi }: { strapi: Core.Strapi }): IdMap => {\n const loadedIds = new Map();\n const toLoadIds = new Map();\n\n return {\n loadedIds,\n toLoadIds,\n /**\n * Register a new document id and its corresponding entity id.\n */\n add(keyFields: KeyFields) {\n const key = encodeKey({ status: 'published', locale: null, ...keyFields });\n\n // If the id is already loaded, do nothing\n if (loadedIds.has(key)) return;\n // If the id is already in the toLoadIds, do nothing\n if (toLoadIds.has(key)) return;\n\n // Add the id to the toLoadIds\n toLoadIds.set(key, keyFields);\n },\n\n /**\n * Load all ids from the registry.\n */\n async load() {\n // Document Id to Entry Id queries are batched by its uid and locale\n // TODO: Add publication state too\n const loadIdValues = Array.from(toLoadIds.values());\n\n // 1. Group ids to query together\n const idsByUidAndLocale = loadIdValues.reduce((acc, { documentId, ...rest }) => {\n const key = encodeKey(rest);\n const ids = acc[key] || { ...rest, documentIds: [] };\n ids.documentIds.push(documentId);\n return { ...acc, [key]: ids };\n }, {});\n\n // 2. Query ids\n await async.map(\n Object.values(idsByUidAndLocale),\n async ({ uid, locale, documentIds, status }: any) => {\n const findParams = {\n select: ['id', 'documentId', 'locale', 'publishedAt'],\n where: {\n documentId: { $in: documentIds },\n locale: locale || null,\n },\n } as any;\n\n if (hasDraftAndPublish(uid)) {\n findParams.where.publishedAt = status === 'draft' ? null : { $ne: null };\n }\n\n const result = await strapi?.db?.query(uid).findMany(findParams);\n\n // 3. Store result in loadedIds\n result?.forEach(({ documentId, id, locale, publishedAt }: any) => {\n const key = encodeKey({\n documentId,\n uid,\n locale,\n status: publishedAt ? 'published' : 'draft',\n });\n loadedIds.set(key, id);\n });\n }\n );\n\n // 4. Clear toLoadIds\n toLoadIds.clear();\n },\n\n /**\n * Get the entity id for a given document id.\n */\n get(keys: KeyFields) {\n const key = encodeKey({ status: 'published', locale: null, ...keys });\n return loadedIds.get(key);\n },\n\n /**\n * Clear the registry.\n */\n clear() {\n loadedIds.clear();\n toLoadIds.clear();\n },\n };\n};\n\nexport { createIdMap };\n"],"names":["hasDraftAndPublish","uid","model","strapi","getModel","contentTypes","encodeKey","obj","status","keys","Object","sort","map","key","join","createIdMap","loadedIds","Map","toLoadIds","add","keyFields","locale","has","set","load","loadIdValues","Array","from","values","idsByUidAndLocale","reduce","acc","documentId","rest","ids","documentIds","push","async","findParams","select","where","$in","publishedAt","$ne","result","db","query","findMany","forEach","id","clear","get"],"mappings":";;;;AAGA,MAAMA,qBAAqB,CAACC,GAAAA,GAAAA;IAC1B,MAAMC,KAAAA,GAAQC,
|
|
1
|
+
{"version":3,"file":"id-map.js","sources":["../../../../src/services/document-service/transform/id-map.ts"],"sourcesContent":["import type { Core, Data, UID } from '@strapi/types';\nimport { async, contentTypes } from '@strapi/utils';\n\nconst hasDraftAndPublish = (uid: UID.CollectionType) => {\n const model = strapi.getModel(uid);\n return contentTypes.hasDraftAndPublish(model);\n};\n\n/**\n * TODO: Find a better way to encode keys than this\n * This converts an object into a string by joining its keys and values,\n * so it can be used as a key in a Map.\n *\n * @example\n * const obj = { a: 1, b: 2 };\n * const key = encodeKey(obj);\n * ^ \"a:::1&&b:::2\"\n */\nconst encodeKey = (obj: any) => {\n // Ignore status field for models without draft and publish\n if (!hasDraftAndPublish(obj.uid)) {\n delete obj.status;\n }\n\n // Sort keys to always keep the same order when encoding\n const keys = Object.keys(obj).sort();\n return keys.map((key) => `${key}:::${obj[key]}`).join('&&');\n};\n\ninterface KeyFields {\n uid: string;\n documentId: Data.ID;\n locale?: string | null;\n status?: 'draft' | 'published';\n}\n\nexport interface IdMap {\n loadedIds: Map<string, string>;\n toLoadIds: Map<string, KeyFields>;\n // Make the Keys type to be the params of add\n add(keys: KeyFields): void;\n load(): Promise<void>;\n get(keys: KeyFields): string | undefined;\n clear(): void;\n}\n\n/**\n * Holds a registry of document ids and their corresponding entity ids.\n */\nconst createIdMap = ({ strapi }: { strapi: Core.Strapi }): IdMap => {\n const loadedIds = new Map();\n const toLoadIds = new Map();\n\n return {\n loadedIds,\n toLoadIds,\n /**\n * Register a new document id and its corresponding entity id.\n */\n add(keyFields: KeyFields) {\n const key = encodeKey({ status: 'published', locale: null, ...keyFields });\n\n // If the id is already loaded, do nothing\n if (loadedIds.has(key)) return;\n // If the id is already in the toLoadIds, do nothing\n if (toLoadIds.has(key)) return;\n\n // Add the id to the toLoadIds\n toLoadIds.set(key, keyFields);\n },\n\n /**\n * Load all ids from the registry.\n */\n async load() {\n // Document Id to Entry Id queries are batched by its uid and locale\n // TODO: Add publication state too\n const loadIdValues = Array.from(toLoadIds.values());\n\n // 1. Group ids to query together\n const idsByUidAndLocale = loadIdValues.reduce((acc, { documentId, ...rest }) => {\n const key = encodeKey(rest);\n const ids = acc[key] || { ...rest, documentIds: [] };\n ids.documentIds.push(documentId);\n return { ...acc, [key]: ids };\n }, {});\n\n // 2. Query ids\n await async.map(\n Object.values(idsByUidAndLocale),\n async ({ uid, locale, documentIds, status }: any) => {\n const findParams = {\n select: ['id', 'documentId', 'locale', 'publishedAt'],\n where: {\n documentId: { $in: documentIds },\n locale: locale || null,\n },\n } as any;\n\n if (hasDraftAndPublish(uid)) {\n findParams.where.publishedAt = status === 'draft' ? null : { $ne: null };\n }\n\n const result = await strapi?.db?.query(uid).findMany(findParams);\n\n // 3. Store result in loadedIds\n result?.forEach(({ documentId, id, locale, publishedAt }: any) => {\n const key = encodeKey({\n documentId,\n uid,\n locale,\n status: publishedAt ? 'published' : 'draft',\n });\n loadedIds.set(key, id);\n });\n }\n );\n\n // 4. Clear toLoadIds\n toLoadIds.clear();\n },\n\n /**\n * Get the entity id for a given document id.\n */\n get(keys: KeyFields) {\n const key = encodeKey({ status: 'published', locale: null, ...keys });\n return loadedIds.get(key);\n },\n\n /**\n * Clear the registry.\n */\n clear() {\n loadedIds.clear();\n toLoadIds.clear();\n },\n };\n};\n\nexport { createIdMap };\n"],"names":["hasDraftAndPublish","uid","model","strapi","getModel","contentTypes","encodeKey","obj","status","keys","Object","sort","map","key","join","createIdMap","loadedIds","Map","toLoadIds","add","keyFields","locale","has","set","load","loadIdValues","Array","from","values","idsByUidAndLocale","reduce","acc","documentId","rest","ids","documentIds","push","async","findParams","select","where","$in","publishedAt","$ne","result","db","query","findMany","forEach","id","clear","get"],"mappings":";;;;AAGA,MAAMA,qBAAqB,CAACC,GAAAA,GAAAA;IAC1B,MAAMC,KAAAA,GAAQC,MAAAA,CAAOC,QAAQ,CAACH,GAAAA,CAAAA;IAC9B,OAAOI,wBAAAA,CAAaL,kBAAkB,CAACE,KAAAA,CAAAA;AACzC,CAAA;AAEA;;;;;;;;;IAUA,MAAMI,YAAY,CAACC,GAAAA,GAAAA;;AAEjB,IAAA,IAAI,CAACP,kBAAAA,CAAmBO,GAAAA,CAAIN,GAAG,CAAA,EAAG;AAChC,QAAA,OAAOM,IAAIC,MAAM;AACnB,IAAA;;AAGA,IAAA,MAAMC,IAAAA,GAAOC,MAAAA,CAAOD,IAAI,CAACF,KAAKI,IAAI,EAAA;AAClC,IAAA,OAAOF,IAAAA,CAAKG,GAAG,CAAC,CAACC,MAAQ,CAAA,EAAGA,GAAAA,CAAI,GAAG,EAAEN,GAAG,CAACM,GAAAA,CAAI,CAAA,CAAE,CAAA,CAAEC,IAAI,CAAC,IAAA,CAAA;AACxD,CAAA;AAmBA;;AAEC,UACKC,WAAAA,GAAc,C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C,IAAe,EAAA;AACjB,YAAA,MAAMI,MAAMP,SAAAA,CAAU;gBAAEE,MAAAA,EAAQ,WAAA;gBAAaa,MAAAA,EAAQ,IAAA;AAAM,gBAAA,GAAGZ;AAAK,aAAA,CAAA;YACnE,OAAOO,SAAAA,CAAUmC,GAAG,CAACtC,GAAAA,CAAAA;AACvB,QAAA,CAAA;AAEA;;QAGAqC,KAAAA,CAAAA,GAAAA;AACElC,YAAAA,SAAAA,CAAUkC,KAAK,EAAA;AACfhC,YAAAA,SAAAA,CAAUgC,KAAK,EAAA;AACjB,QAAA;AACF,KAAA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-map.mjs","sources":["../../../../src/services/document-service/transform/id-map.ts"],"sourcesContent":["import type { Core, Data, UID } from '@strapi/types';\nimport { async, contentTypes } from '@strapi/utils';\n\nconst hasDraftAndPublish = (uid: UID.CollectionType) => {\n const model = strapi.getModel(uid);\n return contentTypes.hasDraftAndPublish(model);\n};\n\n/**\n * TODO: Find a better way to encode keys than this\n * This converts an object into a string by joining its keys and values,\n * so it can be used as a key in a Map.\n *\n * @example\n * const obj = { a: 1, b: 2 };\n * const key = encodeKey(obj);\n * ^ \"a:::1&&b:::2\"\n */\nconst encodeKey = (obj: any) => {\n // Ignore status field for models without draft and publish\n if (!hasDraftAndPublish(obj.uid)) {\n delete obj.status;\n }\n\n // Sort keys to always keep the same order when encoding\n const keys = Object.keys(obj).sort();\n return keys.map((key) => `${key}:::${obj[key]}`).join('&&');\n};\n\ninterface KeyFields {\n uid: string;\n documentId: Data.ID;\n locale?: string | null;\n status?: 'draft' | 'published';\n}\n\nexport interface IdMap {\n loadedIds: Map<string, string>;\n toLoadIds: Map<string, KeyFields>;\n // Make the Keys type to be the params of add\n add(keys: KeyFields): void;\n load(): Promise<void>;\n get(keys: KeyFields): string | undefined;\n clear(): void;\n}\n\n/**\n * Holds a registry of document ids and their corresponding entity ids.\n */\nconst createIdMap = ({ strapi }: { strapi: Core.Strapi }): IdMap => {\n const loadedIds = new Map();\n const toLoadIds = new Map();\n\n return {\n loadedIds,\n toLoadIds,\n /**\n * Register a new document id and its corresponding entity id.\n */\n add(keyFields: KeyFields) {\n const key = encodeKey({ status: 'published', locale: null, ...keyFields });\n\n // If the id is already loaded, do nothing\n if (loadedIds.has(key)) return;\n // If the id is already in the toLoadIds, do nothing\n if (toLoadIds.has(key)) return;\n\n // Add the id to the toLoadIds\n toLoadIds.set(key, keyFields);\n },\n\n /**\n * Load all ids from the registry.\n */\n async load() {\n // Document Id to Entry Id queries are batched by its uid and locale\n // TODO: Add publication state too\n const loadIdValues = Array.from(toLoadIds.values());\n\n // 1. Group ids to query together\n const idsByUidAndLocale = loadIdValues.reduce((acc, { documentId, ...rest }) => {\n const key = encodeKey(rest);\n const ids = acc[key] || { ...rest, documentIds: [] };\n ids.documentIds.push(documentId);\n return { ...acc, [key]: ids };\n }, {});\n\n // 2. Query ids\n await async.map(\n Object.values(idsByUidAndLocale),\n async ({ uid, locale, documentIds, status }: any) => {\n const findParams = {\n select: ['id', 'documentId', 'locale', 'publishedAt'],\n where: {\n documentId: { $in: documentIds },\n locale: locale || null,\n },\n } as any;\n\n if (hasDraftAndPublish(uid)) {\n findParams.where.publishedAt = status === 'draft' ? null : { $ne: null };\n }\n\n const result = await strapi?.db?.query(uid).findMany(findParams);\n\n // 3. Store result in loadedIds\n result?.forEach(({ documentId, id, locale, publishedAt }: any) => {\n const key = encodeKey({\n documentId,\n uid,\n locale,\n status: publishedAt ? 'published' : 'draft',\n });\n loadedIds.set(key, id);\n });\n }\n );\n\n // 4. Clear toLoadIds\n toLoadIds.clear();\n },\n\n /**\n * Get the entity id for a given document id.\n */\n get(keys: KeyFields) {\n const key = encodeKey({ status: 'published', locale: null, ...keys });\n return loadedIds.get(key);\n },\n\n /**\n * Clear the registry.\n */\n clear() {\n loadedIds.clear();\n toLoadIds.clear();\n },\n };\n};\n\nexport { createIdMap };\n"],"names":["hasDraftAndPublish","uid","model","strapi","getModel","contentTypes","encodeKey","obj","status","keys","Object","sort","map","key","join","createIdMap","loadedIds","Map","toLoadIds","add","keyFields","locale","has","set","load","loadIdValues","Array","from","values","idsByUidAndLocale","reduce","acc","documentId","rest","ids","documentIds","push","async","findParams","select","where","$in","publishedAt","$ne","result","db","query","findMany","forEach","id","clear","get"],"mappings":";;AAGA,MAAMA,qBAAqB,CAACC,GAAAA,GAAAA;IAC1B,MAAMC,KAAAA,GAAQC,
|
|
1
|
+
{"version":3,"file":"id-map.mjs","sources":["../../../../src/services/document-service/transform/id-map.ts"],"sourcesContent":["import type { Core, Data, UID } from '@strapi/types';\nimport { async, contentTypes } from '@strapi/utils';\n\nconst hasDraftAndPublish = (uid: UID.CollectionType) => {\n const model = strapi.getModel(uid);\n return contentTypes.hasDraftAndPublish(model);\n};\n\n/**\n * TODO: Find a better way to encode keys than this\n * This converts an object into a string by joining its keys and values,\n * so it can be used as a key in a Map.\n *\n * @example\n * const obj = { a: 1, b: 2 };\n * const key = encodeKey(obj);\n * ^ \"a:::1&&b:::2\"\n */\nconst encodeKey = (obj: any) => {\n // Ignore status field for models without draft and publish\n if (!hasDraftAndPublish(obj.uid)) {\n delete obj.status;\n }\n\n // Sort keys to always keep the same order when encoding\n const keys = Object.keys(obj).sort();\n return keys.map((key) => `${key}:::${obj[key]}`).join('&&');\n};\n\ninterface KeyFields {\n uid: string;\n documentId: Data.ID;\n locale?: string | null;\n status?: 'draft' | 'published';\n}\n\nexport interface IdMap {\n loadedIds: Map<string, string>;\n toLoadIds: Map<string, KeyFields>;\n // Make the Keys type to be the params of add\n add(keys: KeyFields): void;\n load(): Promise<void>;\n get(keys: KeyFields): string | undefined;\n clear(): void;\n}\n\n/**\n * Holds a registry of document ids and their corresponding entity ids.\n */\nconst createIdMap = ({ strapi }: { strapi: Core.Strapi }): IdMap => {\n const loadedIds = new Map();\n const toLoadIds = new Map();\n\n return {\n loadedIds,\n toLoadIds,\n /**\n * Register a new document id and its corresponding entity id.\n */\n add(keyFields: KeyFields) {\n const key = encodeKey({ status: 'published', locale: null, ...keyFields });\n\n // If the id is already loaded, do nothing\n if (loadedIds.has(key)) return;\n // If the id is already in the toLoadIds, do nothing\n if (toLoadIds.has(key)) return;\n\n // Add the id to the toLoadIds\n toLoadIds.set(key, keyFields);\n },\n\n /**\n * Load all ids from the registry.\n */\n async load() {\n // Document Id to Entry Id queries are batched by its uid and locale\n // TODO: Add publication state too\n const loadIdValues = Array.from(toLoadIds.values());\n\n // 1. Group ids to query together\n const idsByUidAndLocale = loadIdValues.reduce((acc, { documentId, ...rest }) => {\n const key = encodeKey(rest);\n const ids = acc[key] || { ...rest, documentIds: [] };\n ids.documentIds.push(documentId);\n return { ...acc, [key]: ids };\n }, {});\n\n // 2. Query ids\n await async.map(\n Object.values(idsByUidAndLocale),\n async ({ uid, locale, documentIds, status }: any) => {\n const findParams = {\n select: ['id', 'documentId', 'locale', 'publishedAt'],\n where: {\n documentId: { $in: documentIds },\n locale: locale || null,\n },\n } as any;\n\n if (hasDraftAndPublish(uid)) {\n findParams.where.publishedAt = status === 'draft' ? null : { $ne: null };\n }\n\n const result = await strapi?.db?.query(uid).findMany(findParams);\n\n // 3. Store result in loadedIds\n result?.forEach(({ documentId, id, locale, publishedAt }: any) => {\n const key = encodeKey({\n documentId,\n uid,\n locale,\n status: publishedAt ? 'published' : 'draft',\n });\n loadedIds.set(key, id);\n });\n }\n );\n\n // 4. Clear toLoadIds\n toLoadIds.clear();\n },\n\n /**\n * Get the entity id for a given document id.\n */\n get(keys: KeyFields) {\n const key = encodeKey({ status: 'published', locale: null, ...keys });\n return loadedIds.get(key);\n },\n\n /**\n * Clear the registry.\n */\n clear() {\n loadedIds.clear();\n toLoadIds.clear();\n },\n };\n};\n\nexport { createIdMap };\n"],"names":["hasDraftAndPublish","uid","model","strapi","getModel","contentTypes","encodeKey","obj","status","keys","Object","sort","map","key","join","createIdMap","loadedIds","Map","toLoadIds","add","keyFields","locale","has","set","load","loadIdValues","Array","from","values","idsByUidAndLocale","reduce","acc","documentId","rest","ids","documentIds","push","async","findParams","select","where","$in","publishedAt","$ne","result","db","query","findMany","forEach","id","clear","get"],"mappings":";;AAGA,MAAMA,qBAAqB,CAACC,GAAAA,GAAAA;IAC1B,MAAMC,KAAAA,GAAQC,MAAAA,CAAOC,QAAQ,CAACH,GAAAA,CAAAA;IAC9B,OAAOI,YAAAA,CAAaL,kBAAkB,CAACE,KAAAA,CAAAA;AACzC,CAAA;AAEA;;;;;;;;;IAUA,MAAMI,YAAY,CAACC,GAAAA,GAAAA;;AAEjB,IAAA,IAAI,CAACP,kBAAAA,CAAmBO,GAAAA,CAAIN,GAAG,CAAA,EAAG;AAChC,QAAA,OAAOM,IAAIC,MAAM;AACnB,IAAA;;AAGA,IAAA,MAAMC,IAAAA,GAAOC,MAAAA,CAAOD,IAAI,CAACF,KAAKI,IAAI,EAAA;AAClC,IAAA,OAAOF,IAAAA,CAAKG,GAAG,CAAC,CAACC,MAAQ,CAAA,EAAGA,GAAAA,CAAI,GAAG,EAAEN,GAAG,CAACM,GAAAA,CAAI,CAAA,CAAE,CAAA,CAAEC,IAAI,CAAC,IAAA,CAAA;AACxD,CAAA;AAmBA;;AAEC,UACKC,WAAAA,GAAc,CAAC,EAAEZ,MAAAA,EAAAA,OAAM,EAA2B,GAAA;AACtD,IAAA,MAAMa,YAAY,IAAIC,GAAAA,EAAAA;AACtB,IAAA,MAAMC,YAAY,IAAID,GAAAA,EAAAA;IAEtB,OAAO;AACLD,QAAAA,SAAAA;AACAE,QAAAA,SAAAA;AACA;;AAEC,QACDC,KAAIC,SAAoB,EAAA;AACtB,YAAA,MAAMP,MAAMP,SAAAA,CAAU;gBAAEE,MAAAA,EAAQ,WAAA;gBAAaa,MAAAA,EAAQ,IAAA;AAAM,gBAAA,GAAGD;AAAU,aAAA,CAAA;;YAGxE,IAAIJ,SAAAA,CAAUM,GAAG,CAACT,GAAAA,CAAAA,EAAM;;YAExB,IAAIK,SAAAA,CAAUI,GAAG,C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"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID, Modules } from '@strapi/types';\n\nimport { transformData } from './data';\nimport { transformFields } from './fields';\nimport { transformPopulate } from './populate';\n\n/**\n * Transform input of a query to map document ids to entity ids.\n */\nasync function transformParamsDocumentId(\n uid: UID.Schema,\n query: Modules.Documents.Params.All\n): Promise<Modules.Documents.Params.All> {\n // Transform relational documentIds to entity ids\n let data = query.data;\n if (query.data) {\n data = await transformData(query.data, {\n locale: query.locale,\n status: query.status,\n uid,\n });\n }\n\n // Make sure documentId is always present in the response\n let fields = query.fields;\n if (query.fields) {\n fields = transformFields(query.fields) as typeof query.fields;\n }\n\n let populate = query.populate;\n if (query.populate) {\n populate = (await transformPopulate(query.populate, { uid })) as typeof query.populate;\n }\n\n return {\n ...query,\n data,\n fields,\n populate,\n };\n}\n\nconst curriedTransformParamsDocumentId = curry(transformParamsDocumentId);\n\nexport { curriedTransformParamsDocumentId as transformParamsDocumentId };\n"],"names":["transformParamsDocumentId","uid","query","data","transformData","locale","status","fields","transformFields","populate","transformPopulate","curriedTransformParamsDocumentId","curry"],"mappings":";;;;;;;AAQA;;AAEC,IACD,eAAeA,yBAAAA,CACbC,GAAe,EACfC,KAAmC,EAAA;;IAGnC,IAAIC,MAAAA,GAAOD,MAAMC,IAAI;IACrB,IAAID,KAAAA,CAAMC,IAAI,EAAE;AACdA,QAAAA,MAAAA,GAAO,MAAMC,kBAAAA,CAAcF,
|
|
1
|
+
{"version":3,"file":"id-transform.js","sources":["../../../../src/services/document-service/transform/id-transform.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID, Modules } from '@strapi/types';\n\nimport { transformData } from './data';\nimport { transformFields } from './fields';\nimport { transformPopulate } from './populate';\n\n/**\n * Transform input of a query to map document ids to entity ids.\n */\nasync function transformParamsDocumentId(\n uid: UID.Schema,\n query: Modules.Documents.Params.All\n): Promise<Modules.Documents.Params.All> {\n // Transform relational documentIds to entity ids\n let data = query.data;\n if (query.data) {\n data = await transformData(query.data, {\n locale: query.locale,\n status: query.status,\n uid,\n });\n }\n\n // Make sure documentId is always present in the response\n let fields = query.fields;\n if (query.fields) {\n fields = transformFields(query.fields) as typeof query.fields;\n }\n\n let populate = query.populate;\n if (query.populate) {\n populate = (await transformPopulate(query.populate, { uid })) as typeof query.populate;\n }\n\n return {\n ...query,\n data,\n fields,\n populate,\n };\n}\n\nconst curriedTransformParamsDocumentId = curry(transformParamsDocumentId);\n\nexport { curriedTransformParamsDocumentId as transformParamsDocumentId };\n"],"names":["transformParamsDocumentId","uid","query","data","transformData","locale","status","fields","transformFields","populate","transformPopulate","curriedTransformParamsDocumentId","curry"],"mappings":";;;;;;;AAQA;;AAEC,IACD,eAAeA,yBAAAA,CACbC,GAAe,EACfC,KAAmC,EAAA;;IAGnC,IAAIC,MAAAA,GAAOD,MAAMC,IAAI;IACrB,IAAID,KAAAA,CAAMC,IAAI,EAAE;AACdA,QAAAA,MAAAA,GAAO,MAAMC,kBAAAA,CAAcF,KAAAA,CAAMC,IAAI,EAAE;AACrCE,YAAAA,MAAAA,EAAQH,MAAMG,MAAM;AACpBC,YAAAA,MAAAA,EAAQJ,MAAMI,MAAM;AACpBL,YAAAA;AACF,SAAA,CAAA;AACF,IAAA;;IAGA,IAAIM,QAAAA,GAASL,MAAMK,MAAM;IACzB,IAAIL,KAAAA,CAAMK,MAAM,EAAE;QAChBA,QAAAA,GAASC,sBAAAA,CAAgBN,MAAMK,MAAM,CAAA;AACvC,IAAA;IAEA,IAAIE,UAAAA,GAAWP,MAAMO,QAAQ;IAC7B,IAAIP,KAAAA,CAAMO,QAAQ,EAAE;AAClBA,QAAAA,UAAAA,GAAY,MAAMC,0BAAAA,CAAkBR,KAAAA,CAAMO,QAAQ,EAAE;AAAER,YAAAA;AAAI,SAAA,CAAA;AAC5D,IAAA;IAEA,OAAO;AACL,QAAA,GAAGC,KAAK;AACRC,cAAAA,MAAAA;AACAI,gBAAAA,QAAAA;AACAE,kBAAAA;AACF,KAAA;AACF;AAEA,MAAME,mCAAmCC,QAAAA,CAAMZ,yBAAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-transform.mjs","sources":["../../../../src/services/document-service/transform/id-transform.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID, Modules } from '@strapi/types';\n\nimport { transformData } from './data';\nimport { transformFields } from './fields';\nimport { transformPopulate } from './populate';\n\n/**\n * Transform input of a query to map document ids to entity ids.\n */\nasync function transformParamsDocumentId(\n uid: UID.Schema,\n query: Modules.Documents.Params.All\n): Promise<Modules.Documents.Params.All> {\n // Transform relational documentIds to entity ids\n let data = query.data;\n if (query.data) {\n data = await transformData(query.data, {\n locale: query.locale,\n status: query.status,\n uid,\n });\n }\n\n // Make sure documentId is always present in the response\n let fields = query.fields;\n if (query.fields) {\n fields = transformFields(query.fields) as typeof query.fields;\n }\n\n let populate = query.populate;\n if (query.populate) {\n populate = (await transformPopulate(query.populate, { uid })) as typeof query.populate;\n }\n\n return {\n ...query,\n data,\n fields,\n populate,\n };\n}\n\nconst curriedTransformParamsDocumentId = curry(transformParamsDocumentId);\n\nexport { curriedTransformParamsDocumentId as transformParamsDocumentId };\n"],"names":["transformParamsDocumentId","uid","query","data","transformData","locale","status","fields","transformFields","populate","transformPopulate","curriedTransformParamsDocumentId","curry"],"mappings":";;;;;AAQA;;AAEC,IACD,eAAeA,yBAAAA,CACbC,GAAe,EACfC,KAAmC,EAAA;;IAGnC,IAAIC,IAAAA,GAAOD,MAAMC,IAAI;IACrB,IAAID,KAAAA,CAAMC,IAAI,EAAE;AACdA,QAAAA,IAAAA,GAAO,MAAMC,aAAAA,CAAcF,
|
|
1
|
+
{"version":3,"file":"id-transform.mjs","sources":["../../../../src/services/document-service/transform/id-transform.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID, Modules } from '@strapi/types';\n\nimport { transformData } from './data';\nimport { transformFields } from './fields';\nimport { transformPopulate } from './populate';\n\n/**\n * Transform input of a query to map document ids to entity ids.\n */\nasync function transformParamsDocumentId(\n uid: UID.Schema,\n query: Modules.Documents.Params.All\n): Promise<Modules.Documents.Params.All> {\n // Transform relational documentIds to entity ids\n let data = query.data;\n if (query.data) {\n data = await transformData(query.data, {\n locale: query.locale,\n status: query.status,\n uid,\n });\n }\n\n // Make sure documentId is always present in the response\n let fields = query.fields;\n if (query.fields) {\n fields = transformFields(query.fields) as typeof query.fields;\n }\n\n let populate = query.populate;\n if (query.populate) {\n populate = (await transformPopulate(query.populate, { uid })) as typeof query.populate;\n }\n\n return {\n ...query,\n data,\n fields,\n populate,\n };\n}\n\nconst curriedTransformParamsDocumentId = curry(transformParamsDocumentId);\n\nexport { curriedTransformParamsDocumentId as transformParamsDocumentId };\n"],"names":["transformParamsDocumentId","uid","query","data","transformData","locale","status","fields","transformFields","populate","transformPopulate","curriedTransformParamsDocumentId","curry"],"mappings":";;;;;AAQA;;AAEC,IACD,eAAeA,yBAAAA,CACbC,GAAe,EACfC,KAAmC,EAAA;;IAGnC,IAAIC,IAAAA,GAAOD,MAAMC,IAAI;IACrB,IAAID,KAAAA,CAAMC,IAAI,EAAE;AACdA,QAAAA,IAAAA,GAAO,MAAMC,aAAAA,CAAcF,KAAAA,CAAMC,IAAI,EAAE;AACrCE,YAAAA,MAAAA,EAAQH,MAAMG,MAAM;AACpBC,YAAAA,MAAAA,EAAQJ,MAAMI,MAAM;AACpBL,YAAAA;AACF,SAAA,CAAA;AACF,IAAA;;IAGA,IAAIM,MAAAA,GAASL,MAAMK,MAAM;IACzB,IAAIL,KAAAA,CAAMK,MAAM,EAAE;QAChBA,MAAAA,GAASC,eAAAA,CAAgBN,MAAMK,MAAM,CAAA;AACvC,IAAA;IAEA,IAAIE,QAAAA,GAAWP,MAAMO,QAAQ;IAC7B,IAAIP,KAAAA,CAAMO,QAAQ,EAAE;AAClBA,QAAAA,QAAAA,GAAY,MAAMC,iBAAAA,CAAkBR,KAAAA,CAAMO,QAAQ,EAAE;AAAER,YAAAA;AAAI,SAAA,CAAA;AAC5D,IAAA;IAEA,OAAO;AACL,QAAA,GAAGC,KAAK;AACRC,QAAAA,IAAAA;AACAI,QAAAA,MAAAA;AACAE,QAAAA;AACF,KAAA;AACF;AAEA,MAAME,mCAAmCC,KAAAA,CAAMZ,yBAAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate.js","sources":["../../../../src/services/document-service/transform/populate.ts"],"sourcesContent":["import { traverse } from '@strapi/utils';\nimport type { UID } from '@strapi/types';\n\nimport { type Data } from './types';\nimport { transformFields } from './fields';\n\nexport const transformPopulate = async (data: Data, opts: { uid: UID.Schema }) => {\n return traverse.traverseQueryPopulate(\n async ({ attribute, key, value }, { set }) => {\n if (!value || typeof value !== 'object' || attribute?.type !== 'relation') {\n return;\n }\n\n /*\n If the attribute is a relation\n Look for fields in the value\n and apply the relevant transformation to these objects\n */\n if ('fields' in value && Array.isArray(value.fields)) {\n value.fields = transformFields(value.fields);\n }\n\n set(key, value);\n },\n { schema: strapi.getModel(opts.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n"],"names":["transformPopulate","data","opts","traverse","traverseQueryPopulate","attribute","key","value","set","type","Array","isArray","fields","transformFields","schema","strapi","getModel","uid","bind"],"mappings":";;;;;AAMO,MAAMA,
|
|
1
|
+
{"version":3,"file":"populate.js","sources":["../../../../src/services/document-service/transform/populate.ts"],"sourcesContent":["import { traverse } from '@strapi/utils';\nimport type { UID } from '@strapi/types';\n\nimport { type Data } from './types';\nimport { transformFields } from './fields';\n\nexport const transformPopulate = async (data: Data, opts: { uid: UID.Schema }) => {\n return traverse.traverseQueryPopulate(\n async ({ attribute, key, value }, { set }) => {\n if (!value || typeof value !== 'object' || attribute?.type !== 'relation') {\n return;\n }\n\n /*\n If the attribute is a relation\n Look for fields in the value\n and apply the relevant transformation to these objects\n */\n if ('fields' in value && Array.isArray(value.fields)) {\n value.fields = transformFields(value.fields);\n }\n\n set(key, value);\n },\n { schema: strapi.getModel(opts.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n"],"names":["transformPopulate","data","opts","traverse","traverseQueryPopulate","attribute","key","value","set","type","Array","isArray","fields","transformFields","schema","strapi","getModel","uid","bind"],"mappings":";;;;;AAMO,MAAMA,iBAAAA,GAAoB,OAAOC,IAAAA,EAAYC,IAAAA,GAAAA;AAClD,IAAA,OAAOC,oBAAAA,CAASC,qBAAqB,CACnC,OAAO,EAAEC,SAAS,EAAEC,GAAG,EAAEC,KAAK,EAAE,EAAE,EAAEC,GAAG,EAAE,GAAA;AACvC,QAAA,IAAI,CAACD,KAAAA,IAAS,OAAOA,UAAU,QAAA,IAAYF,SAAAA,EAAWI,SAAS,UAAA,EAAY;AACzE,YAAA;AACF,QAAA;AAEA;;;;SAKA,IAAI,YAAYF,KAAAA,IAASG,KAAAA,CAAMC,OAAO,CAACJ,KAAAA,CAAMK,MAAM,CAAA,EAAG;AACpDL,YAAAA,KAAAA,CAAMK,MAAM,GAAGC,sBAAAA,CAAgBN,KAAAA,CAAMK,MAAM,CAAA;AAC7C,QAAA;AAEAJ,QAAAA,GAAAA,CAAIF,GAAAA,EAAKC,KAAAA,CAAAA;IACX,CAAA,EACA;AAAEO,QAAAA,MAAAA,EAAQC,MAAAA,CAAOC,QAAQ,CAACd,IAAAA,CAAKe,GAAG,CAAA;AAAGD,QAAAA,QAAAA,EAAUD,MAAAA,CAAOC,QAAQ,CAACE,IAAI,CAACH,MAAAA;KAAQ,EAC5Ed,IAAAA,CAAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate.mjs","sources":["../../../../src/services/document-service/transform/populate.ts"],"sourcesContent":["import { traverse } from '@strapi/utils';\nimport type { UID } from '@strapi/types';\n\nimport { type Data } from './types';\nimport { transformFields } from './fields';\n\nexport const transformPopulate = async (data: Data, opts: { uid: UID.Schema }) => {\n return traverse.traverseQueryPopulate(\n async ({ attribute, key, value }, { set }) => {\n if (!value || typeof value !== 'object' || attribute?.type !== 'relation') {\n return;\n }\n\n /*\n If the attribute is a relation\n Look for fields in the value\n and apply the relevant transformation to these objects\n */\n if ('fields' in value && Array.isArray(value.fields)) {\n value.fields = transformFields(value.fields);\n }\n\n set(key, value);\n },\n { schema: strapi.getModel(opts.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n"],"names":["transformPopulate","data","opts","traverse","traverseQueryPopulate","attribute","key","value","set","type","Array","isArray","fields","transformFields","schema","strapi","getModel","uid","bind"],"mappings":";;;AAMO,MAAMA,
|
|
1
|
+
{"version":3,"file":"populate.mjs","sources":["../../../../src/services/document-service/transform/populate.ts"],"sourcesContent":["import { traverse } from '@strapi/utils';\nimport type { UID } from '@strapi/types';\n\nimport { type Data } from './types';\nimport { transformFields } from './fields';\n\nexport const transformPopulate = async (data: Data, opts: { uid: UID.Schema }) => {\n return traverse.traverseQueryPopulate(\n async ({ attribute, key, value }, { set }) => {\n if (!value || typeof value !== 'object' || attribute?.type !== 'relation') {\n return;\n }\n\n /*\n If the attribute is a relation\n Look for fields in the value\n and apply the relevant transformation to these objects\n */\n if ('fields' in value && Array.isArray(value.fields)) {\n value.fields = transformFields(value.fields);\n }\n\n set(key, value);\n },\n { schema: strapi.getModel(opts.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n"],"names":["transformPopulate","data","opts","traverse","traverseQueryPopulate","attribute","key","value","set","type","Array","isArray","fields","transformFields","schema","strapi","getModel","uid","bind"],"mappings":";;;AAMO,MAAMA,iBAAAA,GAAoB,OAAOC,IAAAA,EAAYC,IAAAA,GAAAA;AAClD,IAAA,OAAOC,QAAAA,CAASC,qBAAqB,CACnC,OAAO,EAAEC,SAAS,EAAEC,GAAG,EAAEC,KAAK,EAAE,EAAE,EAAEC,GAAG,EAAE,GAAA;AACvC,QAAA,IAAI,CAACD,KAAAA,IAAS,OAAOA,UAAU,QAAA,IAAYF,SAAAA,EAAWI,SAAS,UAAA,EAAY;AACzE,YAAA;AACF,QAAA;AAEA;;;;SAKA,IAAI,YAAYF,KAAAA,IAASG,KAAAA,CAAMC,OAAO,CAACJ,KAAAA,CAAMK,MAAM,CAAA,EAAG;AACpDL,YAAAA,KAAAA,CAAMK,MAAM,GAAGC,eAAAA,CAAgBN,KAAAA,CAAMK,MAAM,CAAA;AAC7C,QAAA;AAEAJ,QAAAA,GAAAA,CAAIF,GAAAA,EAAKC,KAAAA,CAAAA;IACX,CAAA,EACA;AAAEO,QAAAA,MAAAA,EAAQC,MAAAA,CAAOC,QAAQ,CAACd,IAAAA,CAAKe,GAAG,CAAA;AAAGD,QAAAA,QAAAA,EAAUD,MAAAA,CAAOC,QAAQ,CAACE,IAAI,CAACH,MAAAA;KAAQ,EAC5Ed,IAAAA,CAAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sources":["../../../../src/services/document-service/transform/query.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\nimport { curry, assoc } from 'lodash/fp';\nimport { parseHasPublishedVersion, getHasPublishedVersionCondition } from '../draft-and-publish';\n\nimport { pickAllowedQueryParams } from '../params';\n\nconst transformParamsToQuery = curry((uid: UID.Schema, params: any) => {\n const allowlisted = pickAllowedQueryParams(params ?? {});\n const query = strapi.get('query-params').transform(uid, allowlisted);\n\n // Parse and validate hasPublishedVersion if provided (from allowlisted params only)\n const hasPublishedVersion = parseHasPublishedVersion(allowlisted?.hasPublishedVersion);\n\n // If hasPublishedVersion is set, wrap the existing filters function to also\n // apply the hasPublishedVersion condition. This ensures the condition is\n // applied to both root and nested (populate) queries.\n if (hasPublishedVersion !== undefined) {\n const existingFilters = query.filters;\n\n query.filters = ({ meta, ...rest }: { meta: { uid: UID.Schema } }) => {\n // Get the existing filters result (from status param)\n let existingResult = {};\n if (typeof existingFilters === 'function') {\n existingResult = existingFilters({ meta, ...rest }) || {};\n } else if (existingFilters) {\n existingResult = existingFilters;\n }\n\n // Get the hasPublishedVersion condition for this specific model\n const hasPublishedCondition = getHasPublishedVersionCondition(meta.uid, hasPublishedVersion);\n\n // Merge both conditions\n if (hasPublishedCondition) {\n const conditions = [existingResult, hasPublishedCondition].filter(\n (c) => Object.keys(c).length\n );\n return { $and: conditions };\n }\n\n return existingResult;\n };\n }\n\n return assoc('where', { ...params?.lookup, ...query.where }, query);\n});\n\nexport { transformParamsToQuery };\n"],"names":["transformParamsToQuery","curry","uid","params","allowlisted","pickAllowedQueryParams","query","strapi","get","transform","hasPublishedVersion","parseHasPublishedVersion","undefined","existingFilters","filters","meta","rest","existingResult","hasPublishedCondition","getHasPublishedVersionCondition","conditions","filter","c","Object","keys","length","$and","assoc","lookup","where"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"query.js","sources":["../../../../src/services/document-service/transform/query.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\nimport { curry, assoc } from 'lodash/fp';\nimport { parseHasPublishedVersion, getHasPublishedVersionCondition } from '../draft-and-publish';\n\nimport { pickAllowedQueryParams } from '../params';\n\nconst transformParamsToQuery = curry((uid: UID.Schema, params: any) => {\n const allowlisted = pickAllowedQueryParams(params ?? {});\n const query = strapi.get('query-params').transform(uid, allowlisted);\n\n // Parse and validate hasPublishedVersion if provided (from allowlisted params only)\n const hasPublishedVersion = parseHasPublishedVersion(allowlisted?.hasPublishedVersion);\n\n // If hasPublishedVersion is set, wrap the existing filters function to also\n // apply the hasPublishedVersion condition. This ensures the condition is\n // applied to both root and nested (populate) queries.\n if (hasPublishedVersion !== undefined) {\n const existingFilters = query.filters;\n\n query.filters = ({ meta, ...rest }: { meta: { uid: UID.Schema } }) => {\n // Get the existing filters result (from status param)\n let existingResult = {};\n if (typeof existingFilters === 'function') {\n existingResult = existingFilters({ meta, ...rest }) || {};\n } else if (existingFilters) {\n existingResult = existingFilters;\n }\n\n // Get the hasPublishedVersion condition for this specific model\n const hasPublishedCondition = getHasPublishedVersionCondition(meta.uid, hasPublishedVersion);\n\n // Merge both conditions\n if (hasPublishedCondition) {\n const conditions = [existingResult, hasPublishedCondition].filter(\n (c) => Object.keys(c).length\n );\n return { $and: conditions };\n }\n\n return existingResult;\n };\n }\n\n return assoc('where', { ...params?.lookup, ...query.where }, query);\n});\n\nexport { transformParamsToQuery };\n"],"names":["transformParamsToQuery","curry","uid","params","allowlisted","pickAllowedQueryParams","query","strapi","get","transform","hasPublishedVersion","parseHasPublishedVersion","undefined","existingFilters","filters","meta","rest","existingResult","hasPublishedCondition","getHasPublishedVersionCondition","conditions","filter","c","Object","keys","length","$and","assoc","lookup","where"],"mappings":";;;;;;AAOA,MAAMA,sBAAAA,GAAyBC,QAAAA,CAAM,CAACC,GAAAA,EAAiBC,QAAAA,GAAAA;IACrD,MAAMC,WAAAA,GAAcC,6BAAAA,CAAuBF,QAAAA,IAAU,EAAC,CAAA;AACtD,IAAA,MAAMG,QAAQC,MAAAA,CAAOC,GAAG,CAAC,cAAA,CAAA,CAAgBC,SAAS,CAACP,GAAAA,EAAKE,WAAAA,CAAAA;;IAGxD,MAAMM,mBAAAA,GAAsBC,yCAAyBP,WAAAA,EAAaM,mBAAAA,CAAAA;;;;AAKlE,IAAA,IAAIA,wBAAwBE,SAAAA,EAAW;QACrC,MAAMC,eAAAA,GAAkBP,MAAMQ,OAAO;AAErCR,QAAAA,KAAAA,CAAMQ,OAAO,GAAG,CAAC,EAAEC,IAAI,EAAE,GAAGC,IAAAA,EAAqC,GAAA;;AAE/D,YAAA,IAAIC,iBAAiB,EAAC;YACtB,IAAI,OAAOJ,oBAAoB,UAAA,EAAY;AACzCI,gBAAAA,cAAAA,GAAiBJ,eAAAA,CAAgB;AAAEE,oBAAAA,IAAAA;AAAM,oBAAA,GAAGC;AAAK,iBAAA,CAAA,IAAM,EAAC;AAC1D,YAAA,CAAA,MAAO,IAAIH,eAAAA,EAAiB;gBAC1BI,cAAAA,GAAiBJ,eAAAA;AACnB,YAAA;;AAGA,YAAA,MAAMK,qBAAAA,GAAwBC,+CAAAA,CAAgCJ,IAAAA,CAAKb,GAAG,EAAEQ,mBAAAA,CAAAA;;AAGxE,YAAA,IAAIQ,qBAAAA,EAAuB;AACzB,gBAAA,MAAME,UAAAA,GAAa;AAACH,oBAAAA,cAAAA;AAAgBC,oBAAAA;iBAAsB,CAACG,MAAM,CAC/D,CAACC,CAAAA,GAAMC,OAAOC,IAAI,CAACF,GAAGG,MAAM,CAAA;gBAE9B,OAAO;oBAAEC,IAAAA,EAAMN;AAAW,iBAAA;AAC5B,YAAA;YAEA,OAAOH,cAAAA;AACT,QAAA,CAAA;AACF,IAAA;AAEA,IAAA,OAAOU,SAAM,OAAA,EAAS;AAAE,QAAA,GAAGxB,UAAQyB,MAAM;AAAE,QAAA,GAAGtB,MAAMuB;KAAM,EAAGvB,KAAAA,CAAAA;AAC/D,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.mjs","sources":["../../../../src/services/document-service/transform/query.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\nimport { curry, assoc } from 'lodash/fp';\nimport { parseHasPublishedVersion, getHasPublishedVersionCondition } from '../draft-and-publish';\n\nimport { pickAllowedQueryParams } from '../params';\n\nconst transformParamsToQuery = curry((uid: UID.Schema, params: any) => {\n const allowlisted = pickAllowedQueryParams(params ?? {});\n const query = strapi.get('query-params').transform(uid, allowlisted);\n\n // Parse and validate hasPublishedVersion if provided (from allowlisted params only)\n const hasPublishedVersion = parseHasPublishedVersion(allowlisted?.hasPublishedVersion);\n\n // If hasPublishedVersion is set, wrap the existing filters function to also\n // apply the hasPublishedVersion condition. This ensures the condition is\n // applied to both root and nested (populate) queries.\n if (hasPublishedVersion !== undefined) {\n const existingFilters = query.filters;\n\n query.filters = ({ meta, ...rest }: { meta: { uid: UID.Schema } }) => {\n // Get the existing filters result (from status param)\n let existingResult = {};\n if (typeof existingFilters === 'function') {\n existingResult = existingFilters({ meta, ...rest }) || {};\n } else if (existingFilters) {\n existingResult = existingFilters;\n }\n\n // Get the hasPublishedVersion condition for this specific model\n const hasPublishedCondition = getHasPublishedVersionCondition(meta.uid, hasPublishedVersion);\n\n // Merge both conditions\n if (hasPublishedCondition) {\n const conditions = [existingResult, hasPublishedCondition].filter(\n (c) => Object.keys(c).length\n );\n return { $and: conditions };\n }\n\n return existingResult;\n };\n }\n\n return assoc('where', { ...params?.lookup, ...query.where }, query);\n});\n\nexport { transformParamsToQuery };\n"],"names":["transformParamsToQuery","curry","uid","params","allowlisted","pickAllowedQueryParams","query","strapi","get","transform","hasPublishedVersion","parseHasPublishedVersion","undefined","existingFilters","filters","meta","rest","existingResult","hasPublishedCondition","getHasPublishedVersionCondition","conditions","filter","c","Object","keys","length","$and","assoc","lookup","where"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"query.mjs","sources":["../../../../src/services/document-service/transform/query.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\nimport { curry, assoc } from 'lodash/fp';\nimport { parseHasPublishedVersion, getHasPublishedVersionCondition } from '../draft-and-publish';\n\nimport { pickAllowedQueryParams } from '../params';\n\nconst transformParamsToQuery = curry((uid: UID.Schema, params: any) => {\n const allowlisted = pickAllowedQueryParams(params ?? {});\n const query = strapi.get('query-params').transform(uid, allowlisted);\n\n // Parse and validate hasPublishedVersion if provided (from allowlisted params only)\n const hasPublishedVersion = parseHasPublishedVersion(allowlisted?.hasPublishedVersion);\n\n // If hasPublishedVersion is set, wrap the existing filters function to also\n // apply the hasPublishedVersion condition. This ensures the condition is\n // applied to both root and nested (populate) queries.\n if (hasPublishedVersion !== undefined) {\n const existingFilters = query.filters;\n\n query.filters = ({ meta, ...rest }: { meta: { uid: UID.Schema } }) => {\n // Get the existing filters result (from status param)\n let existingResult = {};\n if (typeof existingFilters === 'function') {\n existingResult = existingFilters({ meta, ...rest }) || {};\n } else if (existingFilters) {\n existingResult = existingFilters;\n }\n\n // Get the hasPublishedVersion condition for this specific model\n const hasPublishedCondition = getHasPublishedVersionCondition(meta.uid, hasPublishedVersion);\n\n // Merge both conditions\n if (hasPublishedCondition) {\n const conditions = [existingResult, hasPublishedCondition].filter(\n (c) => Object.keys(c).length\n );\n return { $and: conditions };\n }\n\n return existingResult;\n };\n }\n\n return assoc('where', { ...params?.lookup, ...query.where }, query);\n});\n\nexport { transformParamsToQuery };\n"],"names":["transformParamsToQuery","curry","uid","params","allowlisted","pickAllowedQueryParams","query","strapi","get","transform","hasPublishedVersion","parseHasPublishedVersion","undefined","existingFilters","filters","meta","rest","existingResult","hasPublishedCondition","getHasPublishedVersionCondition","conditions","filter","c","Object","keys","length","$and","assoc","lookup","where"],"mappings":";;;;AAOA,MAAMA,sBAAAA,GAAyBC,KAAAA,CAAM,CAACC,GAAAA,EAAiBC,MAAAA,GAAAA;IACrD,MAAMC,WAAAA,GAAcC,sBAAAA,CAAuBF,MAAAA,IAAU,EAAC,CAAA;AACtD,IAAA,MAAMG,QAAQC,MAAAA,CAAOC,GAAG,CAAC,cAAA,CAAA,CAAgBC,SAAS,CAACP,GAAAA,EAAKE,WAAAA,CAAAA;;IAGxD,MAAMM,mBAAAA,GAAsBC,yBAAyBP,WAAAA,EAAaM,mBAAAA,CAAAA;;;;AAKlE,IAAA,IAAIA,wBAAwBE,SAAAA,EAAW;QACrC,MAAMC,eAAAA,GAAkBP,MAAMQ,OAAO;AAErCR,QAAAA,KAAAA,CAAMQ,OAAO,GAAG,CAAC,EAAEC,IAAI,EAAE,GAAGC,IAAAA,EAAqC,GAAA;;AAE/D,YAAA,IAAIC,iBAAiB,EAAC;YACtB,IAAI,OAAOJ,oBAAoB,UAAA,EAAY;AACzCI,gBAAAA,cAAAA,GAAiBJ,eAAAA,CAAgB;AAAEE,oBAAAA,IAAAA;AAAM,oBAAA,GAAGC;AAAK,iBAAA,CAAA,IAAM,EAAC;AAC1D,YAAA,CAAA,MAAO,IAAIH,eAAAA,EAAiB;gBAC1BI,cAAAA,GAAiBJ,eAAAA;AACnB,YAAA;;AAGA,YAAA,MAAMK,qBAAAA,GAAwBC,+BAAAA,CAAgCJ,IAAAA,CAAKb,GAAG,EAAEQ,mBAAAA,CAAAA;;AAGxE,YAAA,IAAIQ,qBAAAA,EAAuB;AACzB,gBAAA,MAAME,UAAAA,GAAa;AAACH,oBAAAA,cAAAA;AAAgBC,oBAAAA;iBAAsB,CAACG,MAAM,CAC/D,CAACC,CAAAA,GAAMC,OAAOC,IAAI,CAACF,GAAGG,MAAM,CAAA;gBAE9B,OAAO;oBAAEC,IAAAA,EAAMN;AAAW,iBAAA;AAC5B,YAAA;YAEA,OAAOH,cAAAA;AACT,QAAA,CAAA;AACF,IAAA;AAEA,IAAA,OAAOU,MAAM,OAAA,EAAS;AAAE,QAAA,GAAGxB,QAAQyB,MAAM;AAAE,QAAA,GAAGtB,MAAMuB;KAAM,EAAGvB,KAAAA,CAAAA;AAC/D,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-ids.js","sources":["../../../../../../src/services/document-service/transform/relations/extract/data-ids.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID } from '@strapi/types';\nimport { relations } from '@strapi/utils';\nimport { IdMap } from '../../id-map';\nimport { getRelationTargetLocale } from '../utils/i18n';\nimport { getRelationTargetStatus } from '../utils/dp';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\nimport { LongHandDocument } from '../utils/types';\n\nconst { isPolymorphic } = relations;\n\ninterface Options {\n uid: UID.Schema;\n locale?: string | null;\n status?: 'draft' | 'published';\n}\n\n/**\n * Load a relation documentId into the idMap.\n */\nconst addRelationDocId = curry(\n (idMap: IdMap, source: Options, targetUid: UID.Schema, relation: LongHandDocument) => {\n const targetLocale = getRelationTargetLocale(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceLocale: source.locale,\n });\n\n const targetStatus = getRelationTargetStatus(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceStatus: source.status,\n });\n\n targetStatus.forEach((status) => {\n idMap.add({\n uid: targetUid,\n documentId: relation.documentId,\n locale: targetLocale,\n status,\n });\n });\n }\n);\n\n/**\n * Iterate over all relations of a data object and extract all relational document ids.\n * Those will later be transformed to entity ids.\n */\nconst extractDataIds = (idMap: IdMap, data: Record<string, any>, source: Options) => {\n return traverseEntityRelations(\n async ({ attribute, value }) => {\n if (!attribute) {\n return;\n }\n const isPolymorphicRelation = isPolymorphic(attribute);\n const addDocId = addRelationDocId(idMap, source);\n\n return mapRelation((relation) => {\n if (!relation || !relation.documentId) {\n return relation;\n }\n\n // Regular relations will always target the same target\n // if its a polymorphic relation we need to get it from the data itself\n const targetUid = isPolymorphicRelation ? relation.__type : attribute.target;\n\n addDocId(targetUid, relation);\n\n // Handle positional arguments\n const position = relation.position;\n\n // The positional relation target uid can be different for polymorphic relations\n let positionTargetUid = targetUid;\n if (isPolymorphicRelation && position?.__type) {\n positionTargetUid = position.__type;\n }\n\n if (position?.before) {\n addDocId(positionTargetUid, { ...relation, ...position, documentId: position.before });\n }\n\n if (position?.after) {\n addDocId(positionTargetUid, { ...relation, ...position, documentId: position.after });\n }\n\n return relation;\n }, value as any);\n },\n { schema: strapi.getModel(source.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { extractDataIds };\n"],"names":["isPolymorphic","relations","addRelationDocId","curry","idMap","source","targetUid","relation","targetLocale","getRelationTargetLocale","sourceUid","uid","sourceLocale","locale","targetStatus","getRelationTargetStatus","sourceStatus","status","forEach","add","documentId","extractDataIds","data","traverseEntityRelations","attribute","value","isPolymorphicRelation","addDocId","mapRelation","__type","target","position","positionTargetUid","before","after","schema","strapi","getModel","bind"],"mappings":";;;;;;;;AAUA,MAAM,EAAEA,aAAa,EAAE,GAAGC,qBAAAA;AAQ1B;;AAEC,IACD,MAAMC,
|
|
1
|
+
{"version":3,"file":"data-ids.js","sources":["../../../../../../src/services/document-service/transform/relations/extract/data-ids.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID } from '@strapi/types';\nimport { relations } from '@strapi/utils';\nimport { IdMap } from '../../id-map';\nimport { getRelationTargetLocale } from '../utils/i18n';\nimport { getRelationTargetStatus } from '../utils/dp';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\nimport { LongHandDocument } from '../utils/types';\n\nconst { isPolymorphic } = relations;\n\ninterface Options {\n uid: UID.Schema;\n locale?: string | null;\n status?: 'draft' | 'published';\n}\n\n/**\n * Load a relation documentId into the idMap.\n */\nconst addRelationDocId = curry(\n (idMap: IdMap, source: Options, targetUid: UID.Schema, relation: LongHandDocument) => {\n const targetLocale = getRelationTargetLocale(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceLocale: source.locale,\n });\n\n const targetStatus = getRelationTargetStatus(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceStatus: source.status,\n });\n\n targetStatus.forEach((status) => {\n idMap.add({\n uid: targetUid,\n documentId: relation.documentId,\n locale: targetLocale,\n status,\n });\n });\n }\n);\n\n/**\n * Iterate over all relations of a data object and extract all relational document ids.\n * Those will later be transformed to entity ids.\n */\nconst extractDataIds = (idMap: IdMap, data: Record<string, any>, source: Options) => {\n return traverseEntityRelations(\n async ({ attribute, value }) => {\n if (!attribute) {\n return;\n }\n const isPolymorphicRelation = isPolymorphic(attribute);\n const addDocId = addRelationDocId(idMap, source);\n\n return mapRelation((relation) => {\n if (!relation || !relation.documentId) {\n return relation;\n }\n\n // Regular relations will always target the same target\n // if its a polymorphic relation we need to get it from the data itself\n const targetUid = isPolymorphicRelation ? relation.__type : attribute.target;\n\n addDocId(targetUid, relation);\n\n // Handle positional arguments\n const position = relation.position;\n\n // The positional relation target uid can be different for polymorphic relations\n let positionTargetUid = targetUid;\n if (isPolymorphicRelation && position?.__type) {\n positionTargetUid = position.__type;\n }\n\n if (position?.before) {\n addDocId(positionTargetUid, { ...relation, ...position, documentId: position.before });\n }\n\n if (position?.after) {\n addDocId(positionTargetUid, { ...relation, ...position, documentId: position.after });\n }\n\n return relation;\n }, value as any);\n },\n { schema: strapi.getModel(source.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { extractDataIds };\n"],"names":["isPolymorphic","relations","addRelationDocId","curry","idMap","source","targetUid","relation","targetLocale","getRelationTargetLocale","sourceUid","uid","sourceLocale","locale","targetStatus","getRelationTargetStatus","sourceStatus","status","forEach","add","documentId","extractDataIds","data","traverseEntityRelations","attribute","value","isPolymorphicRelation","addDocId","mapRelation","__type","target","position","positionTargetUid","before","after","schema","strapi","getModel","bind"],"mappings":";;;;;;;;AAUA,MAAM,EAAEA,aAAa,EAAE,GAAGC,qBAAAA;AAQ1B;;AAEC,IACD,MAAMC,gBAAAA,GAAmBC,QAAAA,CACvB,CAACC,KAAAA,EAAcC,QAAiBC,SAAAA,EAAuBC,QAAAA,GAAAA;IACrD,MAAMC,YAAAA,GAAeC,6BAAwBF,QAAAA,EAAU;AACrDD,QAAAA,SAAAA;AACAI,QAAAA,SAAAA,EAAWL,OAAOM,GAAG;AACrBC,QAAAA,YAAAA,EAAcP,OAAOQ;AACvB,KAAA,CAAA;IAEA,MAAMC,YAAAA,GAAeC,2BAAwBR,QAAAA,EAAU;AACrDD,QAAAA,SAAAA;AACAI,QAAAA,SAAAA,EAAWL,OAAOM,GAAG;AACrBK,QAAAA,YAAAA,EAAcX,OAAOY;AACvB,KAAA,CAAA;IAEAH,YAAAA,CAAaI,OAAO,CAAC,CAACD,MAAAA,GAAAA;AACpBb,QAAAA,KAAAA,CAAMe,GAAG,CAAC;YACRR,GAAAA,EAAKL,SAAAA;AACLc,YAAAA,UAAAA,EAAYb,SAASa,UAAU;YAC/BP,MAAAA,EAAQL,YAAAA;AACRS,YAAAA;AACF,SAAA,CAAA;AACF,IAAA,CAAA,CAAA;AACF,CAAA,CAAA;AAGF;;;AAGC,IACD,MAAMI,cAAAA,GAAiB,CAACjB,KAAAA,EAAckB,IAAAA,EAA2BjB,MAAAA,GAAAA;AAC/D,IAAA,OAAOkB,oCACL,OAAO,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAA;AACzB,QAAA,IAAI,CAACD,SAAAA,EAAW;AACd,YAA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A,QAAAA,EAAUD,MAAAA,CAAOC,QAAQ,CAACC,IAAI,CAACF,MAAAA;KAAQ,EAC9Ed,IAAAA,CAAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-ids.mjs","sources":["../../../../../../src/services/document-service/transform/relations/extract/data-ids.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID } from '@strapi/types';\nimport { relations } from '@strapi/utils';\nimport { IdMap } from '../../id-map';\nimport { getRelationTargetLocale } from '../utils/i18n';\nimport { getRelationTargetStatus } from '../utils/dp';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\nimport { LongHandDocument } from '../utils/types';\n\nconst { isPolymorphic } = relations;\n\ninterface Options {\n uid: UID.Schema;\n locale?: string | null;\n status?: 'draft' | 'published';\n}\n\n/**\n * Load a relation documentId into the idMap.\n */\nconst addRelationDocId = curry(\n (idMap: IdMap, source: Options, targetUid: UID.Schema, relation: LongHandDocument) => {\n const targetLocale = getRelationTargetLocale(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceLocale: source.locale,\n });\n\n const targetStatus = getRelationTargetStatus(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceStatus: source.status,\n });\n\n targetStatus.forEach((status) => {\n idMap.add({\n uid: targetUid,\n documentId: relation.documentId,\n locale: targetLocale,\n status,\n });\n });\n }\n);\n\n/**\n * Iterate over all relations of a data object and extract all relational document ids.\n * Those will later be transformed to entity ids.\n */\nconst extractDataIds = (idMap: IdMap, data: Record<string, any>, source: Options) => {\n return traverseEntityRelations(\n async ({ attribute, value }) => {\n if (!attribute) {\n return;\n }\n const isPolymorphicRelation = isPolymorphic(attribute);\n const addDocId = addRelationDocId(idMap, source);\n\n return mapRelation((relation) => {\n if (!relation || !relation.documentId) {\n return relation;\n }\n\n // Regular relations will always target the same target\n // if its a polymorphic relation we need to get it from the data itself\n const targetUid = isPolymorphicRelation ? relation.__type : attribute.target;\n\n addDocId(targetUid, relation);\n\n // Handle positional arguments\n const position = relation.position;\n\n // The positional relation target uid can be different for polymorphic relations\n let positionTargetUid = targetUid;\n if (isPolymorphicRelation && position?.__type) {\n positionTargetUid = position.__type;\n }\n\n if (position?.before) {\n addDocId(positionTargetUid, { ...relation, ...position, documentId: position.before });\n }\n\n if (position?.after) {\n addDocId(positionTargetUid, { ...relation, ...position, documentId: position.after });\n }\n\n return relation;\n }, value as any);\n },\n { schema: strapi.getModel(source.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { extractDataIds };\n"],"names":["isPolymorphic","relations","addRelationDocId","curry","idMap","source","targetUid","relation","targetLocale","getRelationTargetLocale","sourceUid","uid","sourceLocale","locale","targetStatus","getRelationTargetStatus","sourceStatus","status","forEach","add","documentId","extractDataIds","data","traverseEntityRelations","attribute","value","isPolymorphicRelation","addDocId","mapRelation","__type","target","position","positionTargetUid","before","after","schema","strapi","getModel","bind"],"mappings":";;;;;;AAUA,MAAM,EAAEA,aAAa,EAAE,GAAGC,SAAAA;AAQ1B;;AAEC,IACD,MAAMC,
|
|
1
|
+
{"version":3,"file":"data-ids.mjs","sources":["../../../../../../src/services/document-service/transform/relations/extract/data-ids.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID } from '@strapi/types';\nimport { relations } from '@strapi/utils';\nimport { IdMap } from '../../id-map';\nimport { getRelationTargetLocale } from '../utils/i18n';\nimport { getRelationTargetStatus } from '../utils/dp';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\nimport { LongHandDocument } from '../utils/types';\n\nconst { isPolymorphic } = relations;\n\ninterface Options {\n uid: UID.Schema;\n locale?: string | null;\n status?: 'draft' | 'published';\n}\n\n/**\n * Load a relation documentId into the idMap.\n */\nconst addRelationDocId = curry(\n (idMap: IdMap, source: Options, targetUid: UID.Schema, relation: LongHandDocument) => {\n const targetLocale = getRelationTargetLocale(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceLocale: source.locale,\n });\n\n const targetStatus = getRelationTargetStatus(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceStatus: source.status,\n });\n\n targetStatus.forEach((status) => {\n idMap.add({\n uid: targetUid,\n documentId: relation.documentId,\n locale: targetLocale,\n status,\n });\n });\n }\n);\n\n/**\n * Iterate over all relations of a data object and extract all relational document ids.\n * Those will later be transformed to entity ids.\n */\nconst extractDataIds = (idMap: IdMap, data: Record<string, any>, source: Options) => {\n return traverseEntityRelations(\n async ({ attribute, value }) => {\n if (!attribute) {\n return;\n }\n const isPolymorphicRelation = isPolymorphic(attribute);\n const addDocId = addRelationDocId(idMap, source);\n\n return mapRelation((relation) => {\n if (!relation || !relation.documentId) {\n return relation;\n }\n\n // Regular relations will always target the same target\n // if its a polymorphic relation we need to get it from the data itself\n const targetUid = isPolymorphicRelation ? relation.__type : attribute.target;\n\n addDocId(targetUid, relation);\n\n // Handle positional arguments\n const position = relation.position;\n\n // The positional relation target uid can be different for polymorphic relations\n let positionTargetUid = targetUid;\n if (isPolymorphicRelation && position?.__type) {\n positionTargetUid = position.__type;\n }\n\n if (position?.before) {\n addDocId(positionTargetUid, { ...relation, ...position, documentId: position.before });\n }\n\n if (position?.after) {\n addDocId(positionTargetUid, { ...relation, ...position, documentId: position.after });\n }\n\n return relation;\n }, value as any);\n },\n { schema: strapi.getModel(source.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { extractDataIds };\n"],"names":["isPolymorphic","relations","addRelationDocId","curry","idMap","source","targetUid","relation","targetLocale","getRelationTargetLocale","sourceUid","uid","sourceLocale","locale","targetStatus","getRelationTargetStatus","sourceStatus","status","forEach","add","documentId","extractDataIds","data","traverseEntityRelations","attribute","value","isPolymorphicRelation","addDocId","mapRelation","__type","target","position","positionTargetUid","before","after","schema","strapi","getModel","bind"],"mappings":";;;;;;AAUA,MAAM,EAAEA,aAAa,EAAE,GAAGC,SAAAA;AAQ1B;;AAEC,IACD,MAAMC,gBAAAA,GAAmBC,KAAAA,CACvB,CAACC,KAAAA,EAAc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AE5EH,YAAAA,QAAAA,CAASrB,SAAAA,EAAWC,QAAAA,CAAAA;;YAGpB,MAAMwB,QAAAA,GAAWxB,SAASwB,QAAQ;;AAGlC,YAAA,IAAIC,iBAAAA,GAAoB1B,SAAAA;YACxB,IAAIoB,qBAAAA,IAAyBK,UAAUF,MAAAA,EAAQ;AAC7CG,gBAAAA,iBAAAA,GAAoBD,SAASF,MAAM;AACrC,YAAA;AAEA,YAAA,IAAIE,UAAUE,MAAAA,EAAQ;AACpBN,gBAAAA,QAAAA,CAASK,iBAAAA,EAAmB;AAAE,oBAAA,GAAGzB,QAAQ;AAAE,oBAAA,GAAGwB,QAAQ;AAAEX,oBAAAA,UAAAA,EAAYW,SAASE;AAAO,iBAAA,CAAA;AACtF,YAAA;AAEA,YAAA,IAAIF,UAAUG,KAAAA,EAAO;AACnBP,gBAAAA,QAAAA,CAASK,iBAAAA,EAAmB;AAAE,oBAAA,GAAGzB,QAAQ;AAAE,oBAAA,GAAGwB,QAAQ;AAAEX,oBAAAA,UAAAA,EAAYW,SAASG;AAAM,iBAAA,CAAA;AACrF,YAAA;YAEA,OAAO3B,QAAAA;QACT,CAAA,EAAGkB,KAAAA,CAAAA;IACL,CAAA,EACA;AAAEU,QAAAA,MAAAA,EAAQC,MAAAA,CAAOC,QAAQ,CAAChC,MAAAA,CAAOM,GAAG,CAAA;AAAG0B,QAAAA,QAAAA,EAAUD,MAAAA,CAAOC,QAAQ,CAACC,IAAI,CAACF,MAAAA;KAAQ,EAC9Ed,IAAAA,CAAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-ids.js","sources":["../../../../../../src/services/document-service/transform/relations/transform/data-ids.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID } from '@strapi/types';\nimport { errors, relations } from '@strapi/utils';\n\nimport { ID, LongHandDocument } from '../utils/types';\nimport { IdMap } from '../../id-map';\nimport { getRelationTargetLocale } from '../utils/i18n';\nimport { getRelationTargetStatus } from '../utils/dp';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\n\nconst { isPolymorphic } = relations;\n\ninterface Options {\n uid: UID.Schema;\n locale?: string | null;\n status?: 'draft' | 'published';\n allowMissingId?: boolean; // Whether to ignore missing ids and not throw any error\n}\n\n/**\n * Get the entry ids for a given documentId.\n */\nconst getRelationIds = curry(\n (idMap: IdMap, source: Options, targetUid: UID.Schema, relation: LongHandDocument) => {\n // locale to connect to\n const targetLocale = getRelationTargetLocale(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceLocale: source.locale,\n });\n\n // status(es) to connect to\n const targetStatus = getRelationTargetStatus(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceStatus: source.status,\n });\n\n const ids: ID[] = [];\n\n // Find mapping between documentID -> id(s).\n // There are scenarios where a single documentID can map to multiple ids.\n // e.g when connecting Non DP -> DP and connecting to both the draft and publish version at the same time\n for (const tStatus of targetStatus) {\n const entryId = idMap.get({\n uid: targetUid,\n documentId: relation.documentId,\n locale: targetLocale,\n status: tStatus,\n });\n\n if (entryId) ids.push(entryId);\n }\n\n if (!ids.length && !source.allowMissingId) {\n throw new errors.ValidationError(\n `Document with id \"${relation.documentId}\", locale \"${targetLocale}\" not found`\n );\n }\n\n return ids;\n }\n);\n\n/**\n * Iterate over all relations of a data object and transform all relational document ids to entity ids.\n */\nconst transformDataIdsVisitor = (idMap: IdMap, data: Record<string, any>, source: Options) => {\n return traverseEntityRelations(\n async ({ key, value, attribute }, { set }) => {\n if (!attribute) {\n return;\n }\n const isPolymorphicRelation = isPolymorphic(attribute);\n const getIds = getRelationIds(idMap, source);\n\n // Transform the relation documentId to entity id\n const newRelation = await mapRelation((relation) => {\n if (!relation || !relation.documentId) {\n return relation;\n }\n\n // Find relational attributes, and return the document ids\n // if its a polymorphic relation we need to get it from the data itself\n const targetUid: UID.Schema = isPolymorphicRelation ? relation.__type : attribute.target;\n const ids: ID[] = getIds(targetUid, relation);\n\n // Handle positional arguments\n const position = { ...relation.position };\n\n // The positional relation target uid can be different for polymorphic relations\n let positionTargetUid: UID.Schema = targetUid;\n if (isPolymorphicRelation && position?.__type) {\n positionTargetUid = position.__type;\n }\n\n if (position.before) {\n const beforeRelation = { ...relation, ...position, documentId: position.before };\n const beforeIds: ID[] = getIds(positionTargetUid, beforeRelation);\n position.before = beforeIds.at(0);\n }\n\n if (position.after) {\n const afterRelation = { ...relation, ...position, documentId: position.after };\n position.after = getIds(positionTargetUid, afterRelation).at(0);\n }\n\n // Transform all ids to new relations\n return ids?.map((id) => {\n const newRelation = { id } as typeof relation;\n\n if (relation.position) {\n newRelation.position = position;\n }\n\n // Insert type if its a polymorphic relation\n if (isPolymorphicRelation) {\n newRelation.__type = targetUid;\n }\n\n return newRelation;\n });\n }, value as any);\n\n set(key, newRelation as any);\n },\n { schema: strapi.getModel(source.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { transformDataIdsVisitor };\n"],"names":["isPolymorphic","relations","getRelationIds","curry","idMap","source","targetUid","relation","targetLocale","getRelationTargetLocale","sourceUid","uid","sourceLocale","locale","targetStatus","getRelationTargetStatus","sourceStatus","status","ids","tStatus","entryId","get","documentId","push","length","allowMissingId","errors","ValidationError","transformDataIdsVisitor","data","traverseEntityRelations","key","value","attribute","set","isPolymorphicRelation","getIds","newRelation","mapRelation","__type","target","position","positionTargetUid","before","beforeRelation","beforeIds","at","after","afterRelation","map","id","schema","strapi","getModel","bind"],"mappings":";;;;;;;;AAWA,MAAM,EAAEA,aAAa,EAAE,GAAGC,qBAAAA;AAS1B;;AAEC,IACD,MAAMC,
|
|
1
|
+
{"version":3,"file":"data-ids.js","sources":["../../../../../../src/services/document-service/transform/relations/transform/data-ids.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID } from '@strapi/types';\nimport { errors, relations } from '@strapi/utils';\n\nimport { ID, LongHandDocument } from '../utils/types';\nimport { IdMap } from '../../id-map';\nimport { getRelationTargetLocale } from '../utils/i18n';\nimport { getRelationTargetStatus } from '../utils/dp';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\n\nconst { isPolymorphic } = relations;\n\ninterface Options {\n uid: UID.Schema;\n locale?: string | null;\n status?: 'draft' | 'published';\n allowMissingId?: boolean; // Whether to ignore missing ids and not throw any error\n}\n\n/**\n * Get the entry ids for a given documentId.\n */\nconst getRelationIds = curry(\n (idMap: IdMap, source: Options, targetUid: UID.Schema, relation: LongHandDocument) => {\n // locale to connect to\n const targetLocale = getRelationTargetLocale(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceLocale: source.locale,\n });\n\n // status(es) to connect to\n const targetStatus = getRelationTargetStatus(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceStatus: source.status,\n });\n\n const ids: ID[] = [];\n\n // Find mapping between documentID -> id(s).\n // There are scenarios where a single documentID can map to multiple ids.\n // e.g when connecting Non DP -> DP and connecting to both the draft and publish version at the same time\n for (const tStatus of targetStatus) {\n const entryId = idMap.get({\n uid: targetUid,\n documentId: relation.documentId,\n locale: targetLocale,\n status: tStatus,\n });\n\n if (entryId) ids.push(entryId);\n }\n\n if (!ids.length && !source.allowMissingId) {\n throw new errors.ValidationError(\n `Document with id \"${relation.documentId}\", locale \"${targetLocale}\" not found`\n );\n }\n\n return ids;\n }\n);\n\n/**\n * Iterate over all relations of a data object and transform all relational document ids to entity ids.\n */\nconst transformDataIdsVisitor = (idMap: IdMap, data: Record<string, any>, source: Options) => {\n return traverseEntityRelations(\n async ({ key, value, attribute }, { set }) => {\n if (!attribute) {\n return;\n }\n const isPolymorphicRelation = isPolymorphic(attribute);\n const getIds = getRelationIds(idMap, source);\n\n // Transform the relation documentId to entity id\n const newRelation = await mapRelation((relation) => {\n if (!relation || !relation.documentId) {\n return relation;\n }\n\n // Find relational attributes, and return the document ids\n // if its a polymorphic relation we need to get it from the data itself\n const targetUid: UID.Schema = isPolymorphicRelation ? relation.__type : attribute.target;\n const ids: ID[] = getIds(targetUid, relation);\n\n // Handle positional arguments\n const position = { ...relation.position };\n\n // The positional relation target uid can be different for polymorphic relations\n let positionTargetUid: UID.Schema = targetUid;\n if (isPolymorphicRelation && position?.__type) {\n positionTargetUid = position.__type;\n }\n\n if (position.before) {\n const beforeRelation = { ...relation, ...position, documentId: position.before };\n const beforeIds: ID[] = getIds(positionTargetUid, beforeRelation);\n position.before = beforeIds.at(0);\n }\n\n if (position.after) {\n const afterRelation = { ...relation, ...position, documentId: position.after };\n position.after = getIds(positionTargetUid, afterRelation).at(0);\n }\n\n // Transform all ids to new relations\n return ids?.map((id) => {\n const newRelation = { id } as typeof relation;\n\n if (relation.position) {\n newRelation.position = position;\n }\n\n // Insert type if its a polymorphic relation\n if (isPolymorphicRelation) {\n newRelation.__type = targetUid;\n }\n\n return newRelation;\n });\n }, value as any);\n\n set(key, newRelation as any);\n },\n { schema: strapi.getModel(source.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { transformDataIdsVisitor };\n"],"names":["isPolymorphic","relations","getRelationIds","curry","idMap","source","targetUid","relation","targetLocale","getRelationTargetLocale","sourceUid","uid","sourceLocale","locale","targetStatus","getRelationTargetStatus","sourceStatus","status","ids","tStatus","entryId","get","documentId","push","length","allowMissingId","errors","ValidationError","transformDataIdsVisitor","data","traverseEntityRelations","key","value","attribute","set","isPolymorphicRelation","getIds","newRelation","mapRelation","__type","target","position","positionTargetUid","before","beforeRelation","beforeIds","at","after","afterRelation","map","id","schema","strapi","getModel","bind"],"mappings":";;;;;;;;AAWA,MAAM,EAAEA,aAAa,EAAE,GAAGC,qBAAAA;AAS1B;;AAEC,IACD,MAAMC,cAAAA,GAAiBC,QAAAA,CACrB,CAACC,KAAAA,EAAcC,QAAiBC,SAAAA,EAAuBC,QAAAA,GAAAA;;IAErD,MAAMC,YAAAA,GAAeC,6BAAwBF,QAAAA,EAAU;AACrDD,QAAAA,SAAAA;AACAI,QAAAA,SAAAA,EAAWL,OAAOM,GAAG;AACrBC,QAAAA,YAAAA,EAAcP,OAAOQ;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AK+B,IAAI,CAACC,EAAAA,GAAAA;AACf,gBAAA,MAAMb,WAAAA,GAAc;AAAEa,oBAAAA;AAAG,iBAAA;gBAEzB,IAAI3C,QAAAA,CAASkC,QAAQ,EAAE;AACrBJ,oBAAAA,WAAAA,CAAYI,QAAQ,GAAGA,QAAAA;AACzB,gBAAA;;AAGA,gBAAA,IAAIN,qBAAAA,EAAuB;AACzBE,oBAAAA,WAAAA,CAAYE,MAAM,GAAGjC,SAAAA;AACvB,gBAAA;gBAEA,OAAO+B,WAAAA;AACT,YAAA,CAAA,CAAA;QACF,CAAA,EAAGL,KAAAA,CAAAA;AAEHE,QAAAA,GAAAA,CAAIH,GAAAA,EAAKM,WAAAA,CAAAA;IACX,CAAA,EACA;AAAEc,QAAAA,MAAAA,EAAQC,MAAAA,CAAOC,QAAQ,CAAChD,MAAAA,CAAOM,GAAG,CAAA;AAAG0C,QAAAA,QAAAA,EAAUD,MAAAA,CAAOC,QAAQ,CAACC,IAAI,CAACF,MAAAA;KAAQ,EAC9EvB,IAAAA,CAAAA;AAEJ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { curry } from 'lodash/fp';
|
|
2
|
-
import {
|
|
2
|
+
import { relations, errors } from '@strapi/utils';
|
|
3
3
|
import { getRelationTargetLocale } from '../utils/i18n.mjs';
|
|
4
4
|
import { getRelationTargetStatus } from '../utils/dp.mjs';
|
|
5
5
|
import { traverseEntityRelations as traverseEntityRelationsCurried, mapRelation as mapRelationCurried } from '../utils/map-relation.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-ids.mjs","sources":["../../../../../../src/services/document-service/transform/relations/transform/data-ids.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID } from '@strapi/types';\nimport { errors, relations } from '@strapi/utils';\n\nimport { ID, LongHandDocument } from '../utils/types';\nimport { IdMap } from '../../id-map';\nimport { getRelationTargetLocale } from '../utils/i18n';\nimport { getRelationTargetStatus } from '../utils/dp';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\n\nconst { isPolymorphic } = relations;\n\ninterface Options {\n uid: UID.Schema;\n locale?: string | null;\n status?: 'draft' | 'published';\n allowMissingId?: boolean; // Whether to ignore missing ids and not throw any error\n}\n\n/**\n * Get the entry ids for a given documentId.\n */\nconst getRelationIds = curry(\n (idMap: IdMap, source: Options, targetUid: UID.Schema, relation: LongHandDocument) => {\n // locale to connect to\n const targetLocale = getRelationTargetLocale(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceLocale: source.locale,\n });\n\n // status(es) to connect to\n const targetStatus = getRelationTargetStatus(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceStatus: source.status,\n });\n\n const ids: ID[] = [];\n\n // Find mapping between documentID -> id(s).\n // There are scenarios where a single documentID can map to multiple ids.\n // e.g when connecting Non DP -> DP and connecting to both the draft and publish version at the same time\n for (const tStatus of targetStatus) {\n const entryId = idMap.get({\n uid: targetUid,\n documentId: relation.documentId,\n locale: targetLocale,\n status: tStatus,\n });\n\n if (entryId) ids.push(entryId);\n }\n\n if (!ids.length && !source.allowMissingId) {\n throw new errors.ValidationError(\n `Document with id \"${relation.documentId}\", locale \"${targetLocale}\" not found`\n );\n }\n\n return ids;\n }\n);\n\n/**\n * Iterate over all relations of a data object and transform all relational document ids to entity ids.\n */\nconst transformDataIdsVisitor = (idMap: IdMap, data: Record<string, any>, source: Options) => {\n return traverseEntityRelations(\n async ({ key, value, attribute }, { set }) => {\n if (!attribute) {\n return;\n }\n const isPolymorphicRelation = isPolymorphic(attribute);\n const getIds = getRelationIds(idMap, source);\n\n // Transform the relation documentId to entity id\n const newRelation = await mapRelation((relation) => {\n if (!relation || !relation.documentId) {\n return relation;\n }\n\n // Find relational attributes, and return the document ids\n // if its a polymorphic relation we need to get it from the data itself\n const targetUid: UID.Schema = isPolymorphicRelation ? relation.__type : attribute.target;\n const ids: ID[] = getIds(targetUid, relation);\n\n // Handle positional arguments\n const position = { ...relation.position };\n\n // The positional relation target uid can be different for polymorphic relations\n let positionTargetUid: UID.Schema = targetUid;\n if (isPolymorphicRelation && position?.__type) {\n positionTargetUid = position.__type;\n }\n\n if (position.before) {\n const beforeRelation = { ...relation, ...position, documentId: position.before };\n const beforeIds: ID[] = getIds(positionTargetUid, beforeRelation);\n position.before = beforeIds.at(0);\n }\n\n if (position.after) {\n const afterRelation = { ...relation, ...position, documentId: position.after };\n position.after = getIds(positionTargetUid, afterRelation).at(0);\n }\n\n // Transform all ids to new relations\n return ids?.map((id) => {\n const newRelation = { id } as typeof relation;\n\n if (relation.position) {\n newRelation.position = position;\n }\n\n // Insert type if its a polymorphic relation\n if (isPolymorphicRelation) {\n newRelation.__type = targetUid;\n }\n\n return newRelation;\n });\n }, value as any);\n\n set(key, newRelation as any);\n },\n { schema: strapi.getModel(source.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { transformDataIdsVisitor };\n"],"names":["isPolymorphic","relations","getRelationIds","curry","idMap","source","targetUid","relation","targetLocale","getRelationTargetLocale","sourceUid","uid","sourceLocale","locale","targetStatus","getRelationTargetStatus","sourceStatus","status","ids","tStatus","entryId","get","documentId","push","length","allowMissingId","errors","ValidationError","transformDataIdsVisitor","data","traverseEntityRelations","key","value","attribute","set","isPolymorphicRelation","getIds","newRelation","mapRelation","__type","target","position","positionTargetUid","before","beforeRelation","beforeIds","at","after","afterRelation","map","id","schema","strapi","getModel","bind"],"mappings":";;;;;;AAWA,MAAM,EAAEA,aAAa,EAAE,GAAGC,SAAAA;AAS1B;;AAEC,IACD,MAAMC,
|
|
1
|
+
{"version":3,"file":"data-ids.mjs","sources":["../../../../../../src/services/document-service/transform/relations/transform/data-ids.ts"],"sourcesContent":["import { curry } from 'lodash/fp';\n\nimport type { UID } from '@strapi/types';\nimport { errors, relations } from '@strapi/utils';\n\nimport { ID, LongHandDocument } from '../utils/types';\nimport { IdMap } from '../../id-map';\nimport { getRelationTargetLocale } from '../utils/i18n';\nimport { getRelationTargetStatus } from '../utils/dp';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\n\nconst { isPolymorphic } = relations;\n\ninterface Options {\n uid: UID.Schema;\n locale?: string | null;\n status?: 'draft' | 'published';\n allowMissingId?: boolean; // Whether to ignore missing ids and not throw any error\n}\n\n/**\n * Get the entry ids for a given documentId.\n */\nconst getRelationIds = curry(\n (idMap: IdMap, source: Options, targetUid: UID.Schema, relation: LongHandDocument) => {\n // locale to connect to\n const targetLocale = getRelationTargetLocale(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceLocale: source.locale,\n });\n\n // status(es) to connect to\n const targetStatus = getRelationTargetStatus(relation, {\n targetUid,\n sourceUid: source.uid,\n sourceStatus: source.status,\n });\n\n const ids: ID[] = [];\n\n // Find mapping between documentID -> id(s).\n // There are scenarios where a single documentID can map to multiple ids.\n // e.g when connecting Non DP -> DP and connecting to both the draft and publish version at the same time\n for (const tStatus of targetStatus) {\n const entryId = idMap.get({\n uid: targetUid,\n documentId: relation.documentId,\n locale: targetLocale,\n status: tStatus,\n });\n\n if (entryId) ids.push(entryId);\n }\n\n if (!ids.length && !source.allowMissingId) {\n throw new errors.ValidationError(\n `Document with id \"${relation.documentId}\", locale \"${targetLocale}\" not found`\n );\n }\n\n return ids;\n }\n);\n\n/**\n * Iterate over all relations of a data object and transform all relational document ids to entity ids.\n */\nconst transformDataIdsVisitor = (idMap: IdMap, data: Record<string, any>, source: Options) => {\n return traverseEntityRelations(\n async ({ key, value, attribute }, { set }) => {\n if (!attribute) {\n return;\n }\n const isPolymorphicRelation = isPolymorphic(attribute);\n const getIds = getRelationIds(idMap, source);\n\n // Transform the relation documentId to entity id\n const newRelation = await mapRelation((relation) => {\n if (!relation || !relation.documentId) {\n return relation;\n }\n\n // Find relational attributes, and return the document ids\n // if its a polymorphic relation we need to get it from the data itself\n const targetUid: UID.Schema = isPolymorphicRelation ? relation.__type : attribute.target;\n const ids: ID[] = getIds(targetUid, relation);\n\n // Handle positional arguments\n const position = { ...relation.position };\n\n // The positional relation target uid can be different for polymorphic relations\n let positionTargetUid: UID.Schema = targetUid;\n if (isPolymorphicRelation && position?.__type) {\n positionTargetUid = position.__type;\n }\n\n if (position.before) {\n const beforeRelation = { ...relation, ...position, documentId: position.before };\n const beforeIds: ID[] = getIds(positionTargetUid, beforeRelation);\n position.before = beforeIds.at(0);\n }\n\n if (position.after) {\n const afterRelation = { ...relation, ...position, documentId: position.after };\n position.after = getIds(positionTargetUid, afterRelation).at(0);\n }\n\n // Transform all ids to new relations\n return ids?.map((id) => {\n const newRelation = { id } as typeof relation;\n\n if (relation.position) {\n newRelation.position = position;\n }\n\n // Insert type if its a polymorphic relation\n if (isPolymorphicRelation) {\n newRelation.__type = targetUid;\n }\n\n return newRelation;\n });\n }, value as any);\n\n set(key, newRelation as any);\n },\n { schema: strapi.getModel(source.uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { transformDataIdsVisitor };\n"],"names":["isPolymorphic","relations","getRelationIds","curry","idMap","source","targetUid","relation","targetLocale","getRelationTargetLocale","sourceUid","uid","sourceLocale","locale","targetStatus","getRelationTargetStatus","sourceStatus","status","ids","tStatus","entryId","get","documentId","push","length","allowMissingId","errors","ValidationError","transformDataIdsVisitor","data","traverseEntityRelations","key","value","attribute","set","isPolymorphicRelation","getIds","newRelation","mapRelation","__type","target","position","positionTargetUid","before","beforeRelation","beforeIds","at","after","afterRelation","map","id","schema","strapi","getModel","bind"],"mappings":";;;;;;AAWA,MAAM,EAAEA,aAAa,EAAE,GAAGC,SAAAA;AAS1B;;AAEC,IACD,MAAMC,cAAAA,GAAiBC,KAAAA,CACrB,CAACC,KAAAA,EAAcC,QAAiBC,SAAAA,EAAuBC,QAAAA,GAAAA;;IAErD,MAAMC,YAAAA,GAAeC,wBAAwBF,QAAAA,EAAU;AACrDD,QAAAA,SAAAA;AACAI,QAAAA,SAAAA,EAAWL,OAAOM,GAAG;AACrBC,QAAAA,YAAAA,EAAcP,OAAOQ;AACvB,KAAA,CAAA;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AAAA,GAAAA;AACf,gBAAA,MAAMb,WAAAA,GAAc;AAAEa,oBAAAA;AAAG,iBAAA;gBAEzB,IAAI3C,QAAAA,CAASkC,QAAQ,EAAE;AACrBJ,oBAAAA,WAAAA,CAAYI,QAAQ,GAAGA,QAAAA;AACzB,gBAAA;;AAGA,gBAAA,IAAIN,qBAAAA,EAAuB;AACzBE,oBAAAA,WAAAA,CAAYE,MAAM,GAAGjC,SAAAA;AACvB,gBAAA;gBAEA,OAAO+B,WAAAA;AACT,YAAA,CAAA,CAAA;QACF,CAAA,EAAGL,KAAAA,CAAAA;AAEHE,QAAAA,GAAAA,CAAIH,GAAAA,EAAKM,WAAAA,CAAAA;IACX,CAAA,EACA;AAAEc,QAAAA,MAAAA,EAAQC,MAAAA,CAAOC,QAAQ,CAAChD,MAAAA,CAAOM,GAAG,CAAA;AAAG0C,QAAAA,QAAAA,EAAUD,MAAAA,CAAOC,QAAQ,CAACC,IAAI,CAACF,MAAAA;KAAQ,EAC9EvB,IAAAA,CAAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-locale.js","sources":["../../../../../../src/services/document-service/transform/relations/transform/default-locale.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\nimport { getDefaultLocale, isLocalizedContentType } from '../utils/i18n';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\n\n/**\n * In scenarios like Non i18n CT -> i18n CT\n * relations can be connected to multiple locales,\n * in case user does not provide the locale, this sets it to the default one.\n */\nconst setDefaultLocaleToRelations = (data: Record<string, any>, uid: UID.Schema) => {\n // I18n CT -> anything will already have a locale set (source locale)\n if (isLocalizedContentType(uid)) {\n return data;\n }\n\n // Store the default locale to avoid multiple calls\n let defaultLocale: string;\n\n /**\n * Traverse the entity input data and set the default locale to relations\n */\n return traverseEntityRelations(\n async ({ key, value }, { set }) => {\n /**\n * Assign default locale on long hand expressed relations\n * e.g { documentId } -> { documentId, locale }\n */\n const relation = await mapRelation(async (relation) => {\n if (!relation || !relation?.documentId || relation?.locale) {\n return relation;\n }\n\n // Set default locale if not provided\n if (!defaultLocale) {\n defaultLocale = await getDefaultLocale();\n }\n\n // Assign default locale to the positional argument\n const position = relation.position;\n if (position && typeof position === 'object' && !position.locale) {\n relation.position.locale = defaultLocale;\n }\n\n return { ...relation, locale: defaultLocale };\n }, value as any);\n\n // @ts-expect-error - fix type\n set(key, relation);\n },\n { schema: strapi.getModel(uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { setDefaultLocaleToRelations };\n"],"names":["setDefaultLocaleToRelations","data","uid","isLocalizedContentType","defaultLocale","traverseEntityRelations","key","value","set","relation","mapRelation","documentId","locale","getDefaultLocale","position","schema","strapi","getModel","bind"],"mappings":";;;;;AAKA;;;;IAKA,MAAMA,
|
|
1
|
+
{"version":3,"file":"default-locale.js","sources":["../../../../../../src/services/document-service/transform/relations/transform/default-locale.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\nimport { getDefaultLocale, isLocalizedContentType } from '../utils/i18n';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\n\n/**\n * In scenarios like Non i18n CT -> i18n CT\n * relations can be connected to multiple locales,\n * in case user does not provide the locale, this sets it to the default one.\n */\nconst setDefaultLocaleToRelations = (data: Record<string, any>, uid: UID.Schema) => {\n // I18n CT -> anything will already have a locale set (source locale)\n if (isLocalizedContentType(uid)) {\n return data;\n }\n\n // Store the default locale to avoid multiple calls\n let defaultLocale: string;\n\n /**\n * Traverse the entity input data and set the default locale to relations\n */\n return traverseEntityRelations(\n async ({ key, value }, { set }) => {\n /**\n * Assign default locale on long hand expressed relations\n * e.g { documentId } -> { documentId, locale }\n */\n const relation = await mapRelation(async (relation) => {\n if (!relation || !relation?.documentId || relation?.locale) {\n return relation;\n }\n\n // Set default locale if not provided\n if (!defaultLocale) {\n defaultLocale = await getDefaultLocale();\n }\n\n // Assign default locale to the positional argument\n const position = relation.position;\n if (position && typeof position === 'object' && !position.locale) {\n relation.position.locale = defaultLocale;\n }\n\n return { ...relation, locale: defaultLocale };\n }, value as any);\n\n // @ts-expect-error - fix type\n set(key, relation);\n },\n { schema: strapi.getModel(uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { setDefaultLocaleToRelations };\n"],"names":["setDefaultLocaleToRelations","data","uid","isLocalizedContentType","defaultLocale","traverseEntityRelations","key","value","set","relation","mapRelation","documentId","locale","getDefaultLocale","position","schema","strapi","getModel","bind"],"mappings":";;;;;AAKA;;;;IAKA,MAAMA,2BAAAA,GAA8B,CAACC,IAAAA,EAA2BC,GAAAA,GAAAA;;AAE9D,IAAA,IAAIC,4BAAuBD,GAAAA,CAAAA,EAAM;QAC/B,OAAOD,IAAAA;AACT,IAAA;;IAGA,IAAIG,aAAAA;AAEJ;;MAGA,OAAOC,mCAAAA,CACL,OAAO,EAAEC,GAAG,EAAEC,KAAK,EAAE,EAAE,EAAEC,GAAG,EAAE,GAAA;AAC5B;;;AAGC,UACD,MAAMC,QAAAA,GAAW,MAAMC,uBAAAA,CAAY,OAAOD,QAAAA,GAAAA;AACxC,YAAA,IAAI,CAACA,QAAAA,IAAY,CAACA,QAAAA,EAAUE,UAAAA,IAAcF,UAAUG,MAAAA,EAAQ;gBAC1D,OAAOH,QAAAA;AACT,YAAA;;AAGA,YAAA,IAAI,CAACL,aAAAA,EAAe;AAClBA,gBAAAA,aAAAA,GAAgB,MAAMS,qBAAAA,EAAAA;AACxB,YAAA;;YAGA,MAAMC,QAAAA,GAAWL,SAASK,QAAQ;AAClC,YAAA,IAAIA,YAAY,OAAOA,QAAAA,KAAa,YAAY,CAACA,QAAAA,CAASF,MAAM,EAAE;gBAChEH,QAAAA,CAASK,QAAQ,CAACF,MAAM,GAAGR,aAAAA;AAC7B,YAAA;YAEA,OAAO;AAAE,gBAAA,GAAGK,QAAQ;gBAAEG,MAAAA,EAAQR;AAAc,aAAA;QAC9C,CAAA,EAAGG,KAAAA,CAAAA;;AAGHC,QAAAA,GAAAA,CAAIF,GAAAA,EAAKG,QAAAA,CAAAA;IACX,CAAA,EACA;QAAEM,MAAAA,EAAQC,MAAAA,CAAOC,QAAQ,CAACf,GAAAA,CAAAA;AAAMe,QAAAA,QAAAA,EAAUD,MAAAA,CAAOC,QAAQ,CAACC,IAAI,CAACF,MAAAA;KAAQ,EACvEf,IAAAA,CAAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-locale.mjs","sources":["../../../../../../src/services/document-service/transform/relations/transform/default-locale.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\nimport { getDefaultLocale, isLocalizedContentType } from '../utils/i18n';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\n\n/**\n * In scenarios like Non i18n CT -> i18n CT\n * relations can be connected to multiple locales,\n * in case user does not provide the locale, this sets it to the default one.\n */\nconst setDefaultLocaleToRelations = (data: Record<string, any>, uid: UID.Schema) => {\n // I18n CT -> anything will already have a locale set (source locale)\n if (isLocalizedContentType(uid)) {\n return data;\n }\n\n // Store the default locale to avoid multiple calls\n let defaultLocale: string;\n\n /**\n * Traverse the entity input data and set the default locale to relations\n */\n return traverseEntityRelations(\n async ({ key, value }, { set }) => {\n /**\n * Assign default locale on long hand expressed relations\n * e.g { documentId } -> { documentId, locale }\n */\n const relation = await mapRelation(async (relation) => {\n if (!relation || !relation?.documentId || relation?.locale) {\n return relation;\n }\n\n // Set default locale if not provided\n if (!defaultLocale) {\n defaultLocale = await getDefaultLocale();\n }\n\n // Assign default locale to the positional argument\n const position = relation.position;\n if (position && typeof position === 'object' && !position.locale) {\n relation.position.locale = defaultLocale;\n }\n\n return { ...relation, locale: defaultLocale };\n }, value as any);\n\n // @ts-expect-error - fix type\n set(key, relation);\n },\n { schema: strapi.getModel(uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { setDefaultLocaleToRelations };\n"],"names":["setDefaultLocaleToRelations","data","uid","isLocalizedContentType","defaultLocale","traverseEntityRelations","key","value","set","relation","mapRelation","documentId","locale","getDefaultLocale","position","schema","strapi","getModel","bind"],"mappings":";;;AAKA;;;;IAKA,MAAMA,
|
|
1
|
+
{"version":3,"file":"default-locale.mjs","sources":["../../../../../../src/services/document-service/transform/relations/transform/default-locale.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\n\nimport { getDefaultLocale, isLocalizedContentType } from '../utils/i18n';\nimport { mapRelation, traverseEntityRelations } from '../utils/map-relation';\n\n/**\n * In scenarios like Non i18n CT -> i18n CT\n * relations can be connected to multiple locales,\n * in case user does not provide the locale, this sets it to the default one.\n */\nconst setDefaultLocaleToRelations = (data: Record<string, any>, uid: UID.Schema) => {\n // I18n CT -> anything will already have a locale set (source locale)\n if (isLocalizedContentType(uid)) {\n return data;\n }\n\n // Store the default locale to avoid multiple calls\n let defaultLocale: string;\n\n /**\n * Traverse the entity input data and set the default locale to relations\n */\n return traverseEntityRelations(\n async ({ key, value }, { set }) => {\n /**\n * Assign default locale on long hand expressed relations\n * e.g { documentId } -> { documentId, locale }\n */\n const relation = await mapRelation(async (relation) => {\n if (!relation || !relation?.documentId || relation?.locale) {\n return relation;\n }\n\n // Set default locale if not provided\n if (!defaultLocale) {\n defaultLocale = await getDefaultLocale();\n }\n\n // Assign default locale to the positional argument\n const position = relation.position;\n if (position && typeof position === 'object' && !position.locale) {\n relation.position.locale = defaultLocale;\n }\n\n return { ...relation, locale: defaultLocale };\n }, value as any);\n\n // @ts-expect-error - fix type\n set(key, relation);\n },\n { schema: strapi.getModel(uid), getModel: strapi.getModel.bind(strapi) },\n data\n );\n};\n\nexport { setDefaultLocaleToRelations };\n"],"names":["setDefaultLocaleToRelations","data","uid","isLocalizedContentType","defaultLocale","traverseEntityRelations","key","value","set","relation","mapRelation","documentId","locale","getDefaultLocale","position","schema","strapi","getModel","bind"],"mappings":";;;AAKA;;;;IAKA,MAAMA,2BAAAA,GAA8B,CAACC,IAAAA,EAA2BC,GAAAA,GAAAA;;AAE9D,IAAA,IAAIC,uBAAuBD,GAAAA,CAAAA,EAAM;QAC/B,OAAOD,IAAAA;AACT,IAAA;;IAGA,IAAIG,aAAAA;AAEJ;;MAGA,OAAOC,8BAAAA,CACL,OAAO,EAAEC,GAAG,EAAEC,KAAK,EAAE,EAAE,EAAEC,GAAG,EAAE,GAAA;AAC5B;;;AAGC,UACD,MAAMC,QAAAA,GAAW,MAAMC,kBAAAA,CAAY,OAAOD,QAAAA,GAAAA;AACxC,YAAA,IAAI,CAACA,QAAAA,IAAY,CAACA,QAAAA,EAAUE,UAAAA,IAAcF,UAAUG,MAAAA,EAAQ;gBAC1D,OAAOH,QAAAA;AACT,YAAA;;AAGA,YAAA,IAAI,CAACL,aAAAA,EAAe;AAClBA,gBAAAA,aAAAA,GAAgB,MAAMS,gBAAAA,EAAAA;AACxB,YAAA;;YAGA,MAAMC,QAAAA,GAAWL,SAASK,QAAQ;AAClC,YAAA,IAAIA,YAAY,OAAOA,QAAAA,KAAa,YAAY,CAACA,QAAAA,CAASF,MAAM,EAAE;gBAChEH,QAAAA,CAASK,QAAQ,CAACF,MAAM,GAAGR,aAAAA;AAC7B,YAAA;YAEA,OAAO;AAAE,gBAAA,GAAGK,QAAQ;gBAAEG,MAAAA,EAAQR;AAAc,aAAA;QAC9C,CAAA,EAAGG,KAAAA,CAAAA;;AAGHC,QAAAA,GAAAA,CAAIF,GAAAA,EAAKG,QAAAA,CAAAA;IACX,CAAA,EACA;QAAEM,MAAAA,EAAQC,MAAAA,CAAOC,QAAQ,CAACf,GAAAA,CAAAA;AAAMe,QAAAA,QAAAA,EAAUD,MAAAA,CAAOC,QAAQ,CAACC,IAAI,CAACF,MAAAA;KAAQ,EACvEf,IAAAA,CAAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dp.js","sources":["../../../../../../src/services/document-service/transform/relations/utils/dp.ts"],"sourcesContent":["import { isNil } from 'lodash/fp';\n\nimport { contentTypes } from '@strapi/utils';\nimport type { UID } from '@strapi/types';\n\nimport { LongHandDocument } from './types';\n\ntype Status = 'draft' | 'published';\n\nexport const getRelationTargetStatus = (\n relation: Pick<LongHandDocument, 'documentId' | 'status'>,\n opts: {\n targetUid: UID.Schema;\n sourceUid: UID.Schema;\n sourceStatus?: Status;\n }\n): Status[] => {\n // Ignore if the target content type does not have draft and publish enabled\n const targetContentType = strapi.getModel(opts.targetUid);\n const sourceContentType = strapi.getModel(opts.sourceUid);\n\n const targetHasDP = contentTypes.hasDraftAndPublish(targetContentType);\n const sourceHasDP = contentTypes.hasDraftAndPublish(sourceContentType);\n\n if (!targetHasDP) {\n return ['published'];\n }\n\n /**\n * If both source and target have DP enabled,\n * connect it to the same status as the source status\n */\n if (sourceHasDP && !isNil(opts.sourceStatus)) {\n return [opts.sourceStatus];\n }\n\n /**\n * Use the status from the relation if it's set\n */\n if (relation.status) {\n switch (relation.status) {\n case 'published':\n return ['published'];\n default:\n // Default to draft if it's an invalid status (e.g. modified)\n return ['draft'];\n }\n }\n\n /**\n * If DP is disabled and relation does not specify any status\n * Connect to both draft and published versions\n */\n if (!sourceHasDP) {\n return ['draft', 'published'];\n }\n\n // Default to draft as a fallback\n return ['draft'];\n};\n"],"names":["getRelationTargetStatus","relation","opts","targetContentType","strapi","getModel","targetUid","sourceContentType","sourceUid","targetHasDP","contentTypes","hasDraftAndPublish","sourceHasDP","isNil","sourceStatus","status"],"mappings":";;;;;AASO,MAAMA,
|
|
1
|
+
{"version":3,"file":"dp.js","sources":["../../../../../../src/services/document-service/transform/relations/utils/dp.ts"],"sourcesContent":["import { isNil } from 'lodash/fp';\n\nimport { contentTypes } from '@strapi/utils';\nimport type { UID } from '@strapi/types';\n\nimport { LongHandDocument } from './types';\n\ntype Status = 'draft' | 'published';\n\nexport const getRelationTargetStatus = (\n relation: Pick<LongHandDocument, 'documentId' | 'status'>,\n opts: {\n targetUid: UID.Schema;\n sourceUid: UID.Schema;\n sourceStatus?: Status;\n }\n): Status[] => {\n // Ignore if the target content type does not have draft and publish enabled\n const targetContentType = strapi.getModel(opts.targetUid);\n const sourceContentType = strapi.getModel(opts.sourceUid);\n\n const targetHasDP = contentTypes.hasDraftAndPublish(targetContentType);\n const sourceHasDP = contentTypes.hasDraftAndPublish(sourceContentType);\n\n if (!targetHasDP) {\n return ['published'];\n }\n\n /**\n * If both source and target have DP enabled,\n * connect it to the same status as the source status\n */\n if (sourceHasDP && !isNil(opts.sourceStatus)) {\n return [opts.sourceStatus];\n }\n\n /**\n * Use the status from the relation if it's set\n */\n if (relation.status) {\n switch (relation.status) {\n case 'published':\n return ['published'];\n default:\n // Default to draft if it's an invalid status (e.g. modified)\n return ['draft'];\n }\n }\n\n /**\n * If DP is disabled and relation does not specify any status\n * Connect to both draft and published versions\n */\n if (!sourceHasDP) {\n return ['draft', 'published'];\n }\n\n // Default to draft as a fallback\n return ['draft'];\n};\n"],"names":["getRelationTargetStatus","relation","opts","targetContentType","strapi","getModel","targetUid","sourceContentType","sourceUid","targetHasDP","contentTypes","hasDraftAndPublish","sourceHasDP","isNil","sourceStatus","status"],"mappings":";;;;;AASO,MAAMA,uBAAAA,GAA0B,CACrCC,QAAAA,EACAC,IAAAA,GAAAA;;AAOA,IAAA,MAAMC,iBAAAA,GAAoBC,MAAAA,CAAOC,QAAQ,CAACH,KAAKI,SAAS,CAAA;AACxD,IAAA,MAAMC,iBAAAA,GAAoBH,MAAAA,CAAOC,QAAQ,CAACH,KAAKM,SAAS,CAAA;IAExD,MAAMC,WAAAA,GAAcC,wBAAAA,CAAaC,kBAAkB,CAACR,iBAAAA,CAAAA;IACpD,MAAMS,WAAAA,GAAcF,wBAAAA,CAAaC,kBAAkB,CAACJ,iBAAAA,CAAAA;AAEpD,IAAA,IAAI,CAACE,WAAAA,EAAa;QAChB,OAAO;AAAC,YAAA;AAAY,SAAA;AACtB,IAAA;AAEA;;;AAGC,MACD,IAAIG,WAAAA,IAAe,CAACC,QAAAA,CAAMX,IAAAA,CAAKY,YAAY,CAAA,EAAG;QAC5C,OAAO;AAACZ,YAAAA,IAAAA,CAAKY;AAAa,SAAA;AAC5B,IAAA;AAEA;;MAGA,IAAIb,QAAAA,CAASc,MAAM,EAAE;AACnB,QAAA,OAAQd,SAASc,MAAM;YACrB,KAAK,WAAA;gBACH,OAAO;AAAC,oBAAA;AAAY,iBAAA;AACtB,YAAA;;gBAEE,OAAO;AAAC,oBAAA;AAAQ,iBAAA;AACpB;AACF,IAAA;AAEA;;;MAIA,IAAI,CAACH,WAAAA,EAAa;QAChB,OAAO;AAAC,YAAA,OAAA;AAAS,YAAA;AAAY,SAAA;AAC/B,IAAA;;IAGA,OAAO;AAAC,QAAA;AAAQ,KAAA;AAClB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dp.mjs","sources":["../../../../../../src/services/document-service/transform/relations/utils/dp.ts"],"sourcesContent":["import { isNil } from 'lodash/fp';\n\nimport { contentTypes } from '@strapi/utils';\nimport type { UID } from '@strapi/types';\n\nimport { LongHandDocument } from './types';\n\ntype Status = 'draft' | 'published';\n\nexport const getRelationTargetStatus = (\n relation: Pick<LongHandDocument, 'documentId' | 'status'>,\n opts: {\n targetUid: UID.Schema;\n sourceUid: UID.Schema;\n sourceStatus?: Status;\n }\n): Status[] => {\n // Ignore if the target content type does not have draft and publish enabled\n const targetContentType = strapi.getModel(opts.targetUid);\n const sourceContentType = strapi.getModel(opts.sourceUid);\n\n const targetHasDP = contentTypes.hasDraftAndPublish(targetContentType);\n const sourceHasDP = contentTypes.hasDraftAndPublish(sourceContentType);\n\n if (!targetHasDP) {\n return ['published'];\n }\n\n /**\n * If both source and target have DP enabled,\n * connect it to the same status as the source status\n */\n if (sourceHasDP && !isNil(opts.sourceStatus)) {\n return [opts.sourceStatus];\n }\n\n /**\n * Use the status from the relation if it's set\n */\n if (relation.status) {\n switch (relation.status) {\n case 'published':\n return ['published'];\n default:\n // Default to draft if it's an invalid status (e.g. modified)\n return ['draft'];\n }\n }\n\n /**\n * If DP is disabled and relation does not specify any status\n * Connect to both draft and published versions\n */\n if (!sourceHasDP) {\n return ['draft', 'published'];\n }\n\n // Default to draft as a fallback\n return ['draft'];\n};\n"],"names":["getRelationTargetStatus","relation","opts","targetContentType","strapi","getModel","targetUid","sourceContentType","sourceUid","targetHasDP","contentTypes","hasDraftAndPublish","sourceHasDP","isNil","sourceStatus","status"],"mappings":";;;AASO,MAAMA,
|
|
1
|
+
{"version":3,"file":"dp.mjs","sources":["../../../../../../src/services/document-service/transform/relations/utils/dp.ts"],"sourcesContent":["import { isNil } from 'lodash/fp';\n\nimport { contentTypes } from '@strapi/utils';\nimport type { UID } from '@strapi/types';\n\nimport { LongHandDocument } from './types';\n\ntype Status = 'draft' | 'published';\n\nexport const getRelationTargetStatus = (\n relation: Pick<LongHandDocument, 'documentId' | 'status'>,\n opts: {\n targetUid: UID.Schema;\n sourceUid: UID.Schema;\n sourceStatus?: Status;\n }\n): Status[] => {\n // Ignore if the target content type does not have draft and publish enabled\n const targetContentType = strapi.getModel(opts.targetUid);\n const sourceContentType = strapi.getModel(opts.sourceUid);\n\n const targetHasDP = contentTypes.hasDraftAndPublish(targetContentType);\n const sourceHasDP = contentTypes.hasDraftAndPublish(sourceContentType);\n\n if (!targetHasDP) {\n return ['published'];\n }\n\n /**\n * If both source and target have DP enabled,\n * connect it to the same status as the source status\n */\n if (sourceHasDP && !isNil(opts.sourceStatus)) {\n return [opts.sourceStatus];\n }\n\n /**\n * Use the status from the relation if it's set\n */\n if (relation.status) {\n switch (relation.status) {\n case 'published':\n return ['published'];\n default:\n // Default to draft if it's an invalid status (e.g. modified)\n return ['draft'];\n }\n }\n\n /**\n * If DP is disabled and relation does not specify any status\n * Connect to both draft and published versions\n */\n if (!sourceHasDP) {\n return ['draft', 'published'];\n }\n\n // Default to draft as a fallback\n return ['draft'];\n};\n"],"names":["getRelationTargetStatus","relation","opts","targetContentType","strapi","getModel","targetUid","sourceContentType","sourceUid","targetHasDP","contentTypes","hasDraftAndPublish","sourceHasDP","isNil","sourceStatus","status"],"mappings":";;;AASO,MAAMA,uBAAAA,GAA0B,CACrCC,QAAAA,EACAC,IAAAA,GAAAA;;AAOA,IAAA,MAAMC,iBAAAA,GAAoBC,MAAAA,CAAOC,QAAQ,CAACH,KAAKI,SAAS,CAAA;AACxD,IAAA,MAAMC,iBAAAA,GAAoBH,MAAAA,CAAOC,QAAQ,CAACH,KAAKM,SAAS,CAAA;IAExD,MAAMC,WAAAA,GAAcC,YAAAA,CAAaC,kBAAkB,CAACR,iBAAAA,CAAAA;IACpD,MAAMS,WAAAA,GAAcF,YAAAA,CAAaC,kBAAkB,CAACJ,iBAAAA,CAAAA;AAEpD,IAAA,IAAI,CAACE,WAAAA,EAAa;QAChB,OAAO;AAAC,YAAA;AAAY,SAAA;AACtB,IAAA;AAEA;;;AAGC,MACD,IAAIG,WAAAA,IAAe,CAACC,KAAAA,CAAMX,IAAAA,CAAKY,YAAY,CAAA,EAAG;QAC5C,OAAO;AAACZ,YAAAA,IAAAA,CAAKY;AAAa,SAAA;AAC5B,IAAA;AAEA;;MAGA,IAAIb,QAAAA,CAASc,MAAM,EAAE;AACnB,QAAA,OAAQd,SAASc,MAAM;YACrB,KAAK,WAAA;gBACH,OAAO;AAAC,oBAAA;AAAY,iBAAA;AACtB,YAAA;;gBAEE,OAAO;AAAC,oBAAA;AAAQ,iBAAA;AACpB;AACF,IAAA;AAEA;;;MAIA,IAAI,CAACH,WAAAA,EAAa;QAChB,OAAO;AAAC,YAAA,OAAA;AAAS,YAAA;AAAY,SAAA;AAC/B,IAAA;;IAGA,OAAO;AAAC,QAAA;AAAQ,KAAA;AAClB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sources":["../../../../../../src/services/document-service/transform/relations/utils/i18n.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\nimport { LongHandDocument } from './types';\n\nexport const isLocalizedContentType = (uid: UID.Schema) => {\n const model = strapi.getModel(uid);\n return strapi.plugin('i18n').service('content-types').isLocalizedContentType(model);\n};\n\nexport const getDefaultLocale = () => {\n return strapi.plugin('i18n').service('locales').getDefaultLocale();\n};\n\nexport const getRelationTargetLocale = (\n relation: LongHandDocument,\n opts: {\n targetUid: UID.Schema;\n sourceUid: UID.Schema;\n sourceLocale?: string | null;\n }\n) => {\n const targetLocale = relation.locale || opts.sourceLocale;\n\n const isTargetLocalized = isLocalizedContentType(opts.targetUid);\n const isSourceLocalized = isLocalizedContentType(opts.sourceUid);\n\n // Both source and target locales should match\n if (isSourceLocalized && isTargetLocalized) {\n return opts.sourceLocale;\n }\n\n if (isTargetLocalized) {\n return targetLocale;\n }\n\n return null;\n};\n"],"names":["isLocalizedContentType","uid","model","strapi","getModel","plugin","service","getDefaultLocale","getRelationTargetLocale","relation","opts","targetLocale","locale","sourceLocale","isTargetLocalized","targetUid","isSourceLocalized","sourceUid"],"mappings":";;AAGO,MAAMA,yBAAyB,CAACC,GAAAA,GAAAA;IACrC,MAAMC,KAAAA,GAAQC,
|
|
1
|
+
{"version":3,"file":"i18n.js","sources":["../../../../../../src/services/document-service/transform/relations/utils/i18n.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\nimport { LongHandDocument } from './types';\n\nexport const isLocalizedContentType = (uid: UID.Schema) => {\n const model = strapi.getModel(uid);\n return strapi.plugin('i18n').service('content-types').isLocalizedContentType(model);\n};\n\nexport const getDefaultLocale = () => {\n return strapi.plugin('i18n').service('locales').getDefaultLocale();\n};\n\nexport const getRelationTargetLocale = (\n relation: LongHandDocument,\n opts: {\n targetUid: UID.Schema;\n sourceUid: UID.Schema;\n sourceLocale?: string | null;\n }\n) => {\n const targetLocale = relation.locale || opts.sourceLocale;\n\n const isTargetLocalized = isLocalizedContentType(opts.targetUid);\n const isSourceLocalized = isLocalizedContentType(opts.sourceUid);\n\n // Both source and target locales should match\n if (isSourceLocalized && isTargetLocalized) {\n return opts.sourceLocale;\n }\n\n if (isTargetLocalized) {\n return targetLocale;\n }\n\n return null;\n};\n"],"names":["isLocalizedContentType","uid","model","strapi","getModel","plugin","service","getDefaultLocale","getRelationTargetLocale","relation","opts","targetLocale","locale","sourceLocale","isTargetLocalized","targetUid","isSourceLocalized","sourceUid"],"mappings":";;AAGO,MAAMA,yBAAyB,CAACC,GAAAA,GAAAA;IACrC,MAAMC,KAAAA,GAAQC,MAAAA,CAAOC,QAAQ,CAACH,GAAAA,CAAAA;IAC9B,OAAOE,MAAAA,CAAOE,MAAM,CAAC,MAAA,CAAA,CAAQC,OAAO,CAAC,eAAA,CAAA,CAAiBN,sBAAsB,CAACE,KAAAA,CAAAA;AAC/E;MAEaK,gBAAAA,GAAmB,IAAA;AAC9B,IAAA,OAAOJ,OAAOE,MAAM,CAAC,QAAQC,OAAO,CAAC,WAAWC,gBAAgB,EAAA;AAClE;AAEO,MAAMC,uBAAAA,GAA0B,CACrCC,QAAAA,EACAC,IAAAA,GAAAA;AAMA,IAAA,MAAMC,YAAAA,GAAeF,QAAAA,CAASG,MAAM,IAAIF,KAAKG,YAAY;IAEzD,MAAMC,iBAAAA,GAAoBd,sBAAAA,CAAuBU,IAAAA,CAAKK,SAAS,CAAA;IAC/D,MAAMC,iBAAAA,GAAoBhB,sBAAAA,CAAuBU,IAAAA,CAAKO,SAAS,CAAA;;AAG/D,IAAA,IAAID,qBAAqBF,iBAAAA,EAAmB;AAC1C,QAAA,OAAOJ,KAAKG,YAAY;AAC1B,IAAA;AAEA,IAAA,IAAIC,iBAAAA,EAAmB;QACrB,OAAOH,YAAAA;AACT,IAAA;IAEA,OAAO,IAAA;AACT;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.mjs","sources":["../../../../../../src/services/document-service/transform/relations/utils/i18n.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\nimport { LongHandDocument } from './types';\n\nexport const isLocalizedContentType = (uid: UID.Schema) => {\n const model = strapi.getModel(uid);\n return strapi.plugin('i18n').service('content-types').isLocalizedContentType(model);\n};\n\nexport const getDefaultLocale = () => {\n return strapi.plugin('i18n').service('locales').getDefaultLocale();\n};\n\nexport const getRelationTargetLocale = (\n relation: LongHandDocument,\n opts: {\n targetUid: UID.Schema;\n sourceUid: UID.Schema;\n sourceLocale?: string | null;\n }\n) => {\n const targetLocale = relation.locale || opts.sourceLocale;\n\n const isTargetLocalized = isLocalizedContentType(opts.targetUid);\n const isSourceLocalized = isLocalizedContentType(opts.sourceUid);\n\n // Both source and target locales should match\n if (isSourceLocalized && isTargetLocalized) {\n return opts.sourceLocale;\n }\n\n if (isTargetLocalized) {\n return targetLocale;\n }\n\n return null;\n};\n"],"names":["isLocalizedContentType","uid","model","strapi","getModel","plugin","service","getDefaultLocale","getRelationTargetLocale","relation","opts","targetLocale","locale","sourceLocale","isTargetLocalized","targetUid","isSourceLocalized","sourceUid"],"mappings":"AAGO,MAAMA,yBAAyB,CAACC,GAAAA,GAAAA;IACrC,MAAMC,KAAAA,GAAQC,
|
|
1
|
+
{"version":3,"file":"i18n.mjs","sources":["../../../../../../src/services/document-service/transform/relations/utils/i18n.ts"],"sourcesContent":["import type { UID } from '@strapi/types';\nimport { LongHandDocument } from './types';\n\nexport const isLocalizedContentType = (uid: UID.Schema) => {\n const model = strapi.getModel(uid);\n return strapi.plugin('i18n').service('content-types').isLocalizedContentType(model);\n};\n\nexport const getDefaultLocale = () => {\n return strapi.plugin('i18n').service('locales').getDefaultLocale();\n};\n\nexport const getRelationTargetLocale = (\n relation: LongHandDocument,\n opts: {\n targetUid: UID.Schema;\n sourceUid: UID.Schema;\n sourceLocale?: string | null;\n }\n) => {\n const targetLocale = relation.locale || opts.sourceLocale;\n\n const isTargetLocalized = isLocalizedContentType(opts.targetUid);\n const isSourceLocalized = isLocalizedContentType(opts.sourceUid);\n\n // Both source and target locales should match\n if (isSourceLocalized && isTargetLocalized) {\n return opts.sourceLocale;\n }\n\n if (isTargetLocalized) {\n return targetLocale;\n }\n\n return null;\n};\n"],"names":["isLocalizedContentType","uid","model","strapi","getModel","plugin","service","getDefaultLocale","getRelationTargetLocale","relation","opts","targetLocale","locale","sourceLocale","isTargetLocalized","targetUid","isSourceLocalized","sourceUid"],"mappings":"AAGO,MAAMA,yBAAyB,CAACC,GAAAA,GAAAA;IACrC,MAAMC,KAAAA,GAAQC,MAAAA,CAAOC,QAAQ,CAACH,GAAAA,CAAAA;IAC9B,OAAOE,MAAAA,CAAOE,MAAM,CAAC,MAAA,CAAA,CAAQC,OAAO,CAAC,eAAA,CAAA,CAAiBN,sBAAsB,CAACE,KAAAA,CAAAA;AAC/E;MAEaK,gBAAAA,GAAmB,IAAA;AAC9B,IAAA,OAAOJ,OAAOE,MAAM,CAAC,QAAQC,OAAO,CAAC,WAAWC,gBAAgB,EAAA;AAClE;AAEO,MAAMC,uBAAAA,GAA0B,CACrCC,QAAAA,EACAC,IAAAA,GAAAA;AAMA,IAAA,MAAMC,YAAAA,GAAeF,QAAAA,CAASG,MAAM,IAAIF,KAAKG,YAAY;IAEzD,MAAMC,iBAAAA,GAAoBd,sBAAAA,CAAuBU,IAAAA,CAAKK,SAAS,CAAA;IAC/D,MAAMC,iBAAAA,GAAoBhB,sBAAAA,CAAuBU,IAAAA,CAAKO,SAAS,CAAA;;AAG/D,IAAA,IAAID,qBAAqBF,iBAAAA,EAAmB;AAC1C,QAAA,OAAOJ,KAAKG,YAAY;AAC1B,IAAA;AAEA,IAAA,IAAIC,iBAAAA,EAAmB;QACrB,OAAOH,YAAAA;AACT,IAAA;IAEA,OAAO,IAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-relation.js","sources":["../../../../../../src/services/document-service/transform/relations/utils/map-relation.ts"],"sourcesContent":["/* eslint-disable node/no-callback-literal */\nimport { isObject, curry, isNil } from 'lodash/fp';\n\nimport { traverseEntity, async } from '@strapi/utils';\n\nimport { Relation } from './types';\n\nconst isNumeric = (value: any): value is number => {\n if (Array.isArray(value)) return false; // Handle [1, 'docId'] case\n const parsed = parseInt(value, 10);\n return !Number.isNaN(parsed);\n};\n\nconst toArray = (value: any) => {\n // Keep value as it is if it's a nullish value\n if (isNil(value)) return value;\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n\n/**\n * There are multiple ways to create Strapi relations.\n * This is a utility to traverse and transform relation data\n *\n *\n * For consistency and ease of use, the response will always be an object with the following shape:\n * { set: [{...}], connect: [{...}], disconnect: [{...}] }\n *\n * @example\n * transformRelationData({\n * onLongHand: (relation) => {\n * // Change the id of the relation\n * return { id: 'other' };\n * },\n * }, relation)\n */\nconst mapRelation = async (\n callback: (relation: any) => any,\n rel: Relation,\n isRecursive = false\n): Promise<Relation> => {\n let relation: Relation = rel;\n\n const wrapInSet = (value: any) => {\n // Ignore wrapping if it's a recursive call\n if (isRecursive) {\n return value;\n }\n return { set: toArray(value) };\n };\n\n // undefined | null\n if (isNil(relation)) {\n return callback(relation);\n }\n\n // LongHand[] | ShortHand[]\n if (Array.isArray(relation)) {\n return async\n .map(relation, (r: Relation) => mapRelation(callback, r, true))\n .then((result: any) => result.flat().filter(Boolean))\n .then(wrapInSet);\n }\n\n // LongHand\n if (isObject(relation)) {\n // { id: 1 } || { documentId: 1 }\n if ('id' in relation || 'documentId' in relation) {\n const result = await callback(relation);\n return wrapInSet(result);\n }\n\n // If not connecting anything, return default visitor\n if (!relation.set && !relation.disconnect && !relation.connect) {\n return callback(relation);\n }\n\n // { set }\n if (relation.set) {\n const set: any = await mapRelation(callback, relation.set, true);\n relation = { ...relation, set: toArray(set) };\n }\n\n // { disconnect}\n if (relation.disconnect) {\n const disconnect: any = await mapRelation(callback, relation.disconnect, true);\n relation = { ...relation, disconnect: toArray(disconnect) };\n }\n\n // { connect }\n if (relation.connect) {\n // Transform the relation to connect\n const connect: any = await mapRelation(callback, relation.connect, true);\n relation = { ...relation, connect: toArray(connect) };\n }\n\n return relation;\n }\n\n // ShortHand\n if (isNumeric(relation)) {\n const result = await callback({ id: relation });\n return wrapInSet(result);\n }\n\n if (typeof relation === 'string') {\n const result = await callback({ documentId: relation });\n return wrapInSet(result);\n }\n\n // Anything else\n return callback(relation);\n};\n\ntype TraverseEntity = Parameters<typeof traverseEntity>;\n\n/**\n * Utility function, same as `traverseEntity` but only for relations.\n */\nconst traverseEntityRelations = async (\n visitor: TraverseEntity[0],\n options: TraverseEntity[1],\n data: TraverseEntity[2]\n) => {\n return traverseEntity(\n async (options, utils) => {\n const { attribute } = options;\n\n if (!attribute) {\n return;\n }\n\n if (attribute.type !== 'relation') {\n return;\n }\n\n // TODO: Handle join columns\n if (attribute.useJoinTable === false) {\n return;\n }\n\n return visitor(options, utils);\n },\n options,\n data\n );\n};\n\nconst mapRelationCurried = curry(mapRelation);\nconst traverseEntityRelationsCurried = curry(traverseEntityRelations);\n\nexport {\n mapRelationCurried as mapRelation,\n traverseEntityRelationsCurried as traverseEntityRelations,\n};\n"],"names":["isNumeric","value","Array","isArray","parsed","parseInt","Number","isNaN","toArray","isNil","mapRelation","callback","rel","isRecursive","relation","wrapInSet","set","async","map","r","then","result","flat","filter","Boolean","isObject","disconnect","connect","id","documentId","traverseEntityRelations","visitor","options","data","traverseEntity","utils","attribute","type","useJoinTable","mapRelationCurried","curry","traverseEntityRelationsCurried"],"mappings":";;;;;AAOA,MAAMA,YAAY,CAACC,KAAAA,GAAAA;AACjB,IAAA,IAAIC,MAAMC,OAAO,CAACF,
|
|
1
|
+
{"version":3,"file":"map-relation.js","sources":["../../../../../../src/services/document-service/transform/relations/utils/map-relation.ts"],"sourcesContent":["/* eslint-disable node/no-callback-literal */\nimport { isObject, curry, isNil } from 'lodash/fp';\n\nimport { traverseEntity, async } from '@strapi/utils';\n\nimport { Relation } from './types';\n\nconst isNumeric = (value: any): value is number => {\n if (Array.isArray(value)) return false; // Handle [1, 'docId'] case\n const parsed = parseInt(value, 10);\n return !Number.isNaN(parsed);\n};\n\nconst toArray = (value: any) => {\n // Keep value as it is if it's a nullish value\n if (isNil(value)) return value;\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n\n/**\n * There are multiple ways to create Strapi relations.\n * This is a utility to traverse and transform relation data\n *\n *\n * For consistency and ease of use, the response will always be an object with the following shape:\n * { set: [{...}], connect: [{...}], disconnect: [{...}] }\n *\n * @example\n * transformRelationData({\n * onLongHand: (relation) => {\n * // Change the id of the relation\n * return { id: 'other' };\n * },\n * }, relation)\n */\nconst mapRelation = async (\n callback: (relation: any) => any,\n rel: Relation,\n isRecursive = false\n): Promise<Relation> => {\n let relation: Relation = rel;\n\n const wrapInSet = (value: any) => {\n // Ignore wrapping if it's a recursive call\n if (isRecursive) {\n return value;\n }\n return { set: toArray(value) };\n };\n\n // undefined | null\n if (isNil(relation)) {\n return callback(relation);\n }\n\n // LongHand[] | ShortHand[]\n if (Array.isArray(relation)) {\n return async\n .map(relation, (r: Relation) => mapRelation(callback, r, true))\n .then((result: any) => result.flat().filter(Boolean))\n .then(wrapInSet);\n }\n\n // LongHand\n if (isObject(relation)) {\n // { id: 1 } || { documentId: 1 }\n if ('id' in relation || 'documentId' in relation) {\n const result = await callback(relation);\n return wrapInSet(result);\n }\n\n // If not connecting anything, return default visitor\n if (!relation.set && !relation.disconnect && !relation.connect) {\n return callback(relation);\n }\n\n // { set }\n if (relation.set) {\n const set: any = await mapRelation(callback, relation.set, true);\n relation = { ...relation, set: toArray(set) };\n }\n\n // { disconnect}\n if (relation.disconnect) {\n const disconnect: any = await mapRelation(callback, relation.disconnect, true);\n relation = { ...relation, disconnect: toArray(disconnect) };\n }\n\n // { connect }\n if (relation.connect) {\n // Transform the relation to connect\n const connect: any = await mapRelation(callback, relation.connect, true);\n relation = { ...relation, connect: toArray(connect) };\n }\n\n return relation;\n }\n\n // ShortHand\n if (isNumeric(relation)) {\n const result = await callback({ id: relation });\n return wrapInSet(result);\n }\n\n if (typeof relation === 'string') {\n const result = await callback({ documentId: relation });\n return wrapInSet(result);\n }\n\n // Anything else\n return callback(relation);\n};\n\ntype TraverseEntity = Parameters<typeof traverseEntity>;\n\n/**\n * Utility function, same as `traverseEntity` but only for relations.\n */\nconst traverseEntityRelations = async (\n visitor: TraverseEntity[0],\n options: TraverseEntity[1],\n data: TraverseEntity[2]\n) => {\n return traverseEntity(\n async (options, utils) => {\n const { attribute } = options;\n\n if (!attribute) {\n return;\n }\n\n if (attribute.type !== 'relation') {\n return;\n }\n\n // TODO: Handle join columns\n if (attribute.useJoinTable === false) {\n return;\n }\n\n return visitor(options, utils);\n },\n options,\n data\n );\n};\n\nconst mapRelationCurried = curry(mapRelation);\nconst traverseEntityRelationsCurried = curry(traverseEntityRelations);\n\nexport {\n mapRelationCurried as mapRelation,\n traverseEntityRelationsCurried as traverseEntityRelations,\n};\n"],"names":["isNumeric","value","Array","isArray","parsed","parseInt","Number","isNaN","toArray","isNil","mapRelation","callback","rel","isRecursive","relation","wrapInSet","set","async","map","r","then","result","flat","filter","Boolean","isObject","disconnect","connect","id","documentId","traverseEntityRelations","visitor","options","data","traverseEntity","utils","attribute","type","useJoinTable","mapRelationCurried","curry","traverseEntityRelationsCurried"],"mappings":";;;;;AAOA,MAAMA,YAAY,CAACC,KAAAA,GAAAA;AACjB,IAAA,IAAIC,MAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAO;IACjC,MAAMG,MAAAA,GAASC,SAASJ,KAAAA,EAAO,EAAA,CAAA;IAC/B,OAAO,CAACK,MAAAA,CAAOC,KAAK,CAACH,MAAAA,CAAAA;AACvB,CAAA;AAEA,MAAMI,UAAU,CAACP,KAAAA,GAAAA;;IAEf,IAAIQ,QAAAA,CAAMR,QAAQ,OAAOA,KAAAA;AACzB,IAAA,IAAIC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAOA,KAAAA;IAEjC,OAAO;AAACA,QAAAA;AAAM,KAAA;AAChB,CAAA;AAEA;;;;;;;;;;;;;;;AAeC,IACD,MAAMS,WAAAA,GAAc,OAClBC,QAAAA,EACAC,GAAAA,EACAC,cAAc,KAAK,GAAA;AAEnB,IAAA,IAAIC,QAAAA,GAAqBF,GAAAA;AAEzB,IAAA,MAAMG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