@strapi/core 0.0.0-experimental.3f7b2587c5e3d548262671895cf11d8bf8c9166e → 0.0.0-experimental.45c1b845d32b56e7c14f4155ec0d4a2d2774c77e
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.
Potentially problematic release.
This version of @strapi/core might be problematic. Click here for more details.
- package/dist/Strapi.d.ts.map +1 -1
- package/dist/Strapi.js +8 -4
- package/dist/Strapi.js.map +1 -1
- package/dist/Strapi.mjs +7 -3
- package/dist/Strapi.mjs.map +1 -1
- package/dist/configuration/index.d.ts.map +1 -1
- package/dist/configuration/index.js +4 -4
- package/dist/configuration/index.js.map +1 -1
- package/dist/configuration/index.mjs +1 -1
- package/dist/configuration/index.mjs.map +1 -1
- package/dist/configuration/urls.d.ts +8 -0
- package/dist/configuration/urls.d.ts.map +1 -0
- package/dist/configuration/urls.js +68 -0
- package/dist/configuration/urls.js.map +1 -0
- package/dist/configuration/urls.mjs +66 -0
- package/dist/configuration/urls.mjs.map +1 -0
- package/dist/core-api/controller/collection-type.d.ts +1 -1
- package/dist/core-api/controller/collection-type.d.ts.map +1 -1
- package/dist/core-api/controller/collection-type.js +9 -20
- package/dist/core-api/controller/collection-type.js.map +1 -1
- package/dist/core-api/controller/collection-type.mjs +8 -20
- package/dist/core-api/controller/collection-type.mjs.map +1 -1
- package/dist/core-api/controller/index.d.ts.map +1 -1
- package/dist/core-api/controller/index.js +8 -3
- package/dist/core-api/controller/index.js.map +1 -1
- package/dist/core-api/controller/index.mjs +8 -3
- package/dist/core-api/controller/index.mjs.map +1 -1
- package/dist/core-api/controller/single-type.d.ts +1 -1
- package/dist/core-api/controller/single-type.d.ts.map +1 -1
- package/dist/core-api/controller/single-type.js +6 -11
- package/dist/core-api/controller/single-type.js.map +1 -1
- package/dist/core-api/controller/single-type.mjs +5 -11
- package/dist/core-api/controller/single-type.mjs.map +1 -1
- package/dist/core-api/controller/transform.d.ts +9 -17
- package/dist/core-api/controller/transform.d.ts.map +1 -1
- package/dist/core-api/controller/transform.js +9 -14
- package/dist/core-api/controller/transform.js.map +1 -1
- package/dist/core-api/controller/transform.mjs +9 -14
- package/dist/core-api/controller/transform.mjs.map +1 -1
- package/dist/core-api/service/collection-type.d.ts +28 -5
- package/dist/core-api/service/collection-type.d.ts.map +1 -1
- package/dist/core-api/service/collection-type.js +47 -49
- package/dist/core-api/service/collection-type.js.map +1 -1
- package/dist/core-api/service/collection-type.mjs +47 -50
- package/dist/core-api/service/collection-type.mjs.map +1 -1
- package/dist/core-api/service/core-service.d.ts +4 -0
- package/dist/core-api/service/core-service.d.ts.map +1 -0
- package/dist/core-api/service/core-service.js +12 -0
- package/dist/core-api/service/core-service.js.map +1 -0
- package/dist/core-api/service/core-service.mjs +12 -0
- package/dist/core-api/service/core-service.mjs.map +1 -0
- package/dist/core-api/service/index.js +2 -2
- package/dist/core-api/service/index.js.map +1 -1
- package/dist/core-api/service/index.mjs +4 -4
- package/dist/core-api/service/index.mjs.map +1 -1
- package/dist/core-api/service/pagination.d.ts +1 -5
- package/dist/core-api/service/pagination.d.ts.map +1 -1
- package/dist/core-api/service/pagination.js +0 -11
- package/dist/core-api/service/pagination.js.map +1 -1
- package/dist/core-api/service/pagination.mjs +0 -11
- package/dist/core-api/service/pagination.mjs.map +1 -1
- package/dist/core-api/service/single-type.d.ts +14 -8
- package/dist/core-api/service/single-type.d.ts.map +1 -1
- package/dist/core-api/service/single-type.js +35 -50
- package/dist/core-api/service/single-type.js.map +1 -1
- package/dist/core-api/service/single-type.mjs +34 -50
- package/dist/core-api/service/single-type.mjs.map +1 -1
- package/dist/domain/content-type/index.d.ts.map +1 -1
- package/dist/domain/content-type/index.js +3 -0
- package/dist/domain/content-type/index.js.map +1 -1
- package/dist/domain/content-type/index.mjs +3 -0
- package/dist/domain/content-type/index.mjs.map +1 -1
- package/dist/domain/content-type/validator.d.ts.map +1 -1
- package/dist/domain/content-type/validator.js +1 -1
- package/dist/domain/content-type/validator.js.map +1 -1
- package/dist/domain/content-type/validator.mjs +2 -2
- package/dist/domain/content-type/validator.mjs.map +1 -1
- package/dist/domain/module/index.d.ts.map +1 -1
- package/dist/domain/module/index.js +2 -3
- package/dist/domain/module/index.js.map +1 -1
- package/dist/domain/module/index.mjs +2 -3
- package/dist/domain/module/index.mjs.map +1 -1
- package/dist/factories.d.ts.map +1 -1
- package/dist/factories.js +2 -12
- package/dist/factories.js.map +1 -1
- package/dist/factories.mjs +2 -12
- package/dist/factories.mjs.map +1 -1
- package/dist/loaders/apis.js +1 -1
- package/dist/loaders/apis.js.map +1 -1
- package/dist/loaders/apis.mjs +2 -2
- package/dist/loaders/apis.mjs.map +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.js +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.js.map +1 -1
- package/dist/loaders/plugins/get-enabled-plugins.mjs +2 -2
- package/dist/loaders/plugins/get-enabled-plugins.mjs.map +1 -1
- package/dist/registries/config.d.ts +2 -2
- package/dist/registries/config.d.ts.map +1 -1
- package/dist/registries/config.js +14 -6
- package/dist/registries/config.js.map +1 -1
- package/dist/registries/config.mjs +15 -5
- package/dist/registries/config.mjs.map +1 -1
- package/dist/registries/content-types.d.ts.map +1 -1
- package/dist/registries/content-types.js +1 -2
- package/dist/registries/content-types.js.map +1 -1
- package/dist/registries/content-types.mjs +1 -2
- package/dist/registries/content-types.mjs.map +1 -1
- package/dist/services/document-service/common.d.ts +4 -0
- package/dist/services/document-service/common.d.ts.map +1 -0
- package/dist/services/document-service/common.js +7 -0
- package/dist/services/document-service/common.js.map +1 -0
- package/dist/services/document-service/common.mjs +7 -0
- package/dist/services/document-service/common.mjs.map +1 -0
- package/dist/services/document-service/draft-and-publish.d.ts +10 -0
- package/dist/services/document-service/draft-and-publish.d.ts.map +1 -0
- package/dist/services/document-service/draft-and-publish.js +69 -0
- package/dist/services/document-service/draft-and-publish.js.map +1 -0
- package/dist/services/document-service/draft-and-publish.mjs +69 -0
- package/dist/services/document-service/draft-and-publish.mjs.map +1 -0
- package/dist/services/document-service/{document-service.d.ts → index.d.ts} +2 -4
- package/dist/services/document-service/index.d.ts.map +1 -0
- package/dist/services/document-service/index.js +22 -0
- package/dist/services/document-service/index.js.map +1 -0
- package/dist/services/document-service/index.mjs +22 -0
- package/dist/services/document-service/index.mjs.map +1 -0
- package/dist/services/document-service/internationalization.d.ts +8 -0
- package/dist/services/document-service/internationalization.d.ts.map +1 -0
- package/dist/services/document-service/internationalization.js +54 -0
- package/dist/services/document-service/internationalization.js.map +1 -0
- package/dist/services/document-service/internationalization.mjs +54 -0
- package/dist/services/document-service/internationalization.mjs.map +1 -0
- package/dist/services/document-service/middlewares.d.ts +8 -0
- package/dist/services/document-service/middlewares.d.ts.map +1 -0
- package/dist/services/document-service/middlewares.js +46 -0
- package/dist/services/document-service/middlewares.js.map +1 -0
- package/dist/services/document-service/middlewares.mjs +46 -0
- package/dist/services/document-service/middlewares.mjs.map +1 -0
- package/dist/services/document-service/repository.d.ts +3 -0
- package/dist/services/document-service/repository.d.ts.map +1 -0
- package/dist/services/document-service/repository.js +304 -0
- package/dist/services/document-service/repository.js.map +1 -0
- package/dist/services/document-service/repository.mjs +304 -0
- package/dist/services/document-service/repository.mjs.map +1 -0
- package/dist/services/document-service/transform/data.d.ts +5 -0
- package/dist/services/document-service/transform/data.d.ts.map +1 -0
- package/dist/services/document-service/transform/data.js +13 -0
- package/dist/services/document-service/transform/data.js.map +1 -0
- package/dist/services/document-service/transform/data.mjs +13 -0
- package/dist/services/document-service/transform/data.mjs.map +1 -0
- package/dist/services/document-service/transform/fields.d.ts +5 -0
- package/dist/services/document-service/transform/fields.d.ts.map +1 -0
- package/dist/services/document-service/transform/fields.js +24 -0
- package/dist/services/document-service/transform/fields.js.map +1 -0
- package/dist/services/document-service/transform/fields.mjs +24 -0
- package/dist/services/document-service/transform/fields.mjs.map +1 -0
- package/dist/services/document-service/transform/filters.d.ts +3 -0
- package/dist/services/document-service/transform/filters.d.ts.map +1 -0
- package/dist/services/document-service/transform/id-map.d.ts +23 -0
- package/dist/services/document-service/transform/id-map.d.ts.map +1 -0
- package/dist/services/document-service/transform/id-map.js +78 -0
- package/dist/services/document-service/transform/id-map.js.map +1 -0
- package/dist/services/document-service/transform/id-map.mjs +78 -0
- package/dist/services/document-service/transform/id-map.mjs.map +1 -0
- package/dist/services/document-service/transform/id-transform.d.ts +5 -0
- package/dist/services/document-service/transform/id-transform.d.ts.map +1 -0
- package/dist/services/document-service/transform/id-transform.js +33 -0
- package/dist/services/document-service/transform/id-transform.js.map +1 -0
- package/dist/services/document-service/transform/id-transform.mjs +33 -0
- package/dist/services/document-service/transform/id-transform.mjs.map +1 -0
- package/dist/services/document-service/transform/populate.d.ts +6 -0
- package/dist/services/document-service/transform/populate.d.ts.map +1 -0
- package/dist/services/document-service/transform/populate.js +21 -0
- package/dist/services/document-service/transform/populate.js.map +1 -0
- package/dist/services/document-service/transform/populate.mjs +21 -0
- package/dist/services/document-service/transform/populate.mjs.map +1 -0
- package/dist/services/document-service/transform/relations/extract/data-ids.d.ts +13 -0
- package/dist/services/document-service/transform/relations/extract/data-ids.d.ts.map +1 -0
- package/dist/services/document-service/transform/relations/extract/data-ids.js +90 -0
- package/dist/services/document-service/transform/relations/extract/data-ids.js.map +1 -0
- package/dist/services/document-service/transform/relations/extract/data-ids.mjs +90 -0
- package/dist/services/document-service/transform/relations/extract/data-ids.mjs.map +1 -0
- package/dist/services/document-service/transform/relations/transform/data-ids.d.ts +10 -0
- package/dist/services/document-service/transform/relations/transform/data-ids.d.ts.map +1 -0
- package/dist/services/document-service/transform/relations/transform/data-ids.js +141 -0
- package/dist/services/document-service/transform/relations/transform/data-ids.js.map +1 -0
- package/dist/services/document-service/transform/relations/transform/data-ids.mjs +141 -0
- package/dist/services/document-service/transform/relations/transform/data-ids.mjs.map +1 -0
- package/dist/services/document-service/transform/relations/transform/output-ids.d.ts +4 -0
- package/dist/services/document-service/transform/relations/transform/output-ids.d.ts.map +1 -0
- package/dist/services/document-service/transform/relations/utils/data.d.ts +4 -0
- package/dist/services/document-service/transform/relations/utils/data.d.ts.map +1 -0
- package/dist/services/document-service/transform/relations/utils/data.js +12 -0
- package/dist/services/document-service/transform/relations/utils/data.js.map +1 -0
- package/dist/services/document-service/transform/relations/utils/data.mjs +12 -0
- package/dist/services/document-service/transform/relations/utils/data.mjs.map +1 -0
- package/dist/services/document-service/transform/relations/utils/dp.d.ts +10 -0
- package/dist/services/document-service/transform/relations/utils/dp.d.ts.map +1 -0
- package/dist/services/document-service/transform/relations/utils/dp.js +25 -0
- package/dist/services/document-service/transform/relations/utils/dp.js.map +1 -0
- package/dist/services/document-service/transform/relations/utils/dp.mjs +25 -0
- package/dist/services/document-service/transform/relations/utils/dp.mjs.map +1 -0
- package/dist/services/document-service/transform/relations/utils/i18n.d.ts +10 -0
- package/dist/services/document-service/transform/relations/utils/i18n.d.ts.map +1 -0
- package/dist/services/document-service/transform/relations/utils/i18n.js +31 -0
- package/dist/services/document-service/transform/relations/utils/i18n.js.map +1 -0
- package/dist/services/document-service/transform/relations/utils/i18n.mjs +31 -0
- package/dist/services/document-service/transform/relations/utils/i18n.mjs.map +1 -0
- package/dist/services/document-service/transform/relations/utils/types.d.ts +15 -0
- package/dist/services/document-service/transform/relations/utils/types.d.ts.map +1 -0
- package/dist/services/document-service/transform/sort.d.ts +5 -0
- package/dist/services/document-service/transform/sort.d.ts.map +1 -0
- package/dist/services/document-service/transform/types.d.ts +13 -0
- package/dist/services/document-service/transform/types.d.ts.map +1 -0
- package/dist/services/document-service/transform/utils.d.ts +9 -0
- package/dist/services/document-service/transform/utils.d.ts.map +1 -0
- package/dist/services/document-service/utils/populate.d.ts +3 -0
- package/dist/services/document-service/utils/populate.d.ts.map +1 -0
- package/dist/services/document-service/utils/populate.js +41 -0
- package/dist/services/document-service/utils/populate.js.map +1 -0
- package/dist/services/document-service/utils/populate.mjs +41 -0
- package/dist/services/document-service/utils/populate.mjs.map +1 -0
- package/dist/services/entity-service/components.js +8 -8
- package/dist/services/entity-service/components.js.map +1 -1
- package/dist/services/entity-service/components.mjs +9 -9
- package/dist/services/entity-service/components.mjs.map +1 -1
- package/dist/services/entity-service/index.d.ts.map +1 -1
- package/dist/services/entity-service/index.js +3 -3
- package/dist/services/entity-service/index.js.map +1 -1
- package/dist/services/entity-service/index.mjs +3 -3
- package/dist/services/entity-service/index.mjs.map +1 -1
- package/dist/services/entity-service/params.d.ts +4 -4
- package/dist/services/entity-service/params.d.ts.map +1 -1
- package/dist/services/entity-service/params.js +1 -1
- package/dist/services/entity-service/params.js.map +1 -1
- package/dist/services/entity-service/params.mjs +1 -1
- package/dist/services/entity-service/params.mjs.map +1 -1
- package/dist/services/entity-validator/blocks-validator.d.ts.map +1 -1
- package/dist/services/entity-validator/blocks-validator.js +22 -2
- package/dist/services/entity-validator/blocks-validator.js.map +1 -1
- package/dist/services/entity-validator/blocks-validator.mjs +22 -2
- package/dist/services/entity-validator/blocks-validator.mjs.map +1 -1
- package/dist/services/entity-validator/validators.d.ts.map +1 -1
- package/dist/services/entity-validator/validators.js +7 -8
- package/dist/services/entity-validator/validators.js.map +1 -1
- package/dist/services/entity-validator/validators.mjs +7 -8
- package/dist/services/entity-validator/validators.mjs.map +1 -1
- package/dist/services/server/compose-endpoint.d.ts.map +1 -1
- package/dist/services/server/compose-endpoint.js +3 -0
- package/dist/services/server/compose-endpoint.js.map +1 -1
- package/dist/services/server/compose-endpoint.mjs +3 -0
- package/dist/services/server/compose-endpoint.mjs.map +1 -1
- package/dist/services/webhook-store.js +2 -2
- package/dist/services/webhook-store.js.map +1 -1
- package/dist/services/webhook-store.mjs +2 -2
- package/dist/services/webhook-store.mjs.map +1 -1
- package/dist/utils/load-config-file.js +1 -1
- package/dist/utils/load-config-file.js.map +1 -1
- package/dist/utils/load-config-file.mjs +2 -2
- package/dist/utils/load-config-file.mjs.map +1 -1
- package/dist/utils/transform-content-types-to-models.d.ts +174 -3
- package/dist/utils/transform-content-types-to-models.d.ts.map +1 -1
- package/dist/utils/transform-content-types-to-models.js +80 -41
- package/dist/utils/transform-content-types-to-models.js.map +1 -1
- package/dist/utils/transform-content-types-to-models.mjs +79 -41
- package/dist/utils/transform-content-types-to-models.mjs.map +1 -1
- package/package.json +14 -14
- package/dist/core-api/service/get-fetch-params.d.ts +0 -7
- package/dist/core-api/service/get-fetch-params.d.ts.map +0 -1
- package/dist/core-api/service/get-fetch-params.js +0 -14
- package/dist/core-api/service/get-fetch-params.js.map +0 -1
- package/dist/core-api/service/get-fetch-params.mjs +0 -14
- package/dist/core-api/service/get-fetch-params.mjs.map +0 -1
- package/dist/services/document-service/document-engine.d.ts +0 -8
- package/dist/services/document-service/document-engine.d.ts.map +0 -1
- package/dist/services/document-service/document-engine.js +0 -200
- package/dist/services/document-service/document-engine.js.map +0 -1
- package/dist/services/document-service/document-engine.mjs +0 -201
- package/dist/services/document-service/document-engine.mjs.map +0 -1
- package/dist/services/document-service/document-service.d.ts.map +0 -1
- package/dist/services/document-service/document-service.js +0 -132
- package/dist/services/document-service/document-service.js.map +0 -1
- package/dist/services/document-service/document-service.mjs +0 -132
- package/dist/services/document-service/document-service.mjs.map +0 -1
- package/dist/services/document-service/middlewares/defaults/draft-and-publish.d.ts +0 -26
- package/dist/services/document-service/middlewares/defaults/draft-and-publish.d.ts.map +0 -1
- package/dist/services/document-service/middlewares/defaults/draft-and-publish.js +0 -58
- package/dist/services/document-service/middlewares/defaults/draft-and-publish.js.map +0 -1
- package/dist/services/document-service/middlewares/defaults/draft-and-publish.mjs +0 -58
- package/dist/services/document-service/middlewares/defaults/draft-and-publish.mjs.map +0 -1
- package/dist/services/document-service/middlewares/defaults/index.d.ts +0 -3
- package/dist/services/document-service/middlewares/defaults/index.d.ts.map +0 -1
- package/dist/services/document-service/middlewares/defaults/index.js +0 -82
- package/dist/services/document-service/middlewares/defaults/index.js.map +0 -1
- package/dist/services/document-service/middlewares/defaults/index.mjs +0 -82
- package/dist/services/document-service/middlewares/defaults/index.mjs.map +0 -1
- package/dist/services/document-service/middlewares/defaults/locales.d.ts +0 -18
- package/dist/services/document-service/middlewares/defaults/locales.d.ts.map +0 -1
- package/dist/services/document-service/middlewares/defaults/locales.js +0 -50
- package/dist/services/document-service/middlewares/defaults/locales.js.map +0 -1
- package/dist/services/document-service/middlewares/defaults/locales.mjs +0 -50
- package/dist/services/document-service/middlewares/defaults/locales.mjs.map +0 -1
- package/dist/services/document-service/middlewares/index.d.ts +0 -11
- package/dist/services/document-service/middlewares/index.d.ts.map +0 -1
- package/dist/services/document-service/middlewares/index.js +0 -59
- package/dist/services/document-service/middlewares/index.js.map +0 -1
- package/dist/services/document-service/middlewares/index.mjs +0 -59
- package/dist/services/document-service/middlewares/index.mjs.map +0 -1
|
@@ -1,6 +1,177 @@
|
|
|
1
|
-
import { Model } from '@strapi/database';
|
|
2
|
-
import { Schema } from '@strapi/types';
|
|
1
|
+
import { type Model } from '@strapi/database';
|
|
2
|
+
import { Schema, Attribute } from '@strapi/types';
|
|
3
3
|
import { createId } from '@paralleldrive/cuid2';
|
|
4
|
+
/**
|
|
5
|
+
* Because strapi/database models don't know about things like components or dynamic zones, we use this file to convert them
|
|
6
|
+
* to a relations format that it recognizes
|
|
7
|
+
*
|
|
8
|
+
* Therefore we have to keep an additional set of helpers/extensions to the database naming methods
|
|
9
|
+
*/
|
|
10
|
+
export declare const COMPONENT_JOIN_TABLE_SUFFIX = "components";
|
|
11
|
+
export declare const DZ_JOIN_TABLE_SUFFIX = "components";
|
|
12
|
+
export declare const COMPONENT_INVERSE_COLUMN_NAME = "component";
|
|
13
|
+
export declare const COMPONENT_TYPE_COLUMN = "component_type";
|
|
14
|
+
export declare const ENTITY = "entity";
|
|
15
|
+
export declare const getComponentJoinTableName: (collectionName: string) => string;
|
|
16
|
+
export declare const getDzJoinTableName: (collectionName: string) => string;
|
|
17
|
+
export type LoadedContentTypeModel = Schema.ContentType & Required<Pick<Schema.ContentType, 'collectionName' | 'uid' | 'modelName'>>;
|
|
18
|
+
export declare const transformAttribute: (name: string, attribute: Attribute.Any, contentType: LoadedContentTypeModel) => Attribute.BigInteger | (Attribute.OfType<"boolean"> & Attribute.ConfigurableOption & Attribute.DefaultOption<boolean> & Attribute.PrivateOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Blocks | Attribute.DateTime | Attribute.Date | Attribute.Decimal | Attribute.Email | Attribute.Enumeration<string[]> | Attribute.Float | Attribute.Integer | Attribute.JSON | Attribute.Password | (Attribute.OfType<"relation"> & {
|
|
19
|
+
relation: "morphToOne";
|
|
20
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
21
|
+
relation: "morphToMany";
|
|
22
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
23
|
+
relation: "oneToOne";
|
|
24
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
25
|
+
} & import("@strapi/types/dist/types/utils").Without<{
|
|
26
|
+
inversedBy?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
mappedBy?: string | undefined;
|
|
29
|
+
}> & {
|
|
30
|
+
mappedBy?: string | undefined;
|
|
31
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
32
|
+
relation: "oneToOne";
|
|
33
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
34
|
+
} & import("@strapi/types/dist/types/utils").Without<{
|
|
35
|
+
mappedBy?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
inversedBy?: string | undefined;
|
|
38
|
+
}> & {
|
|
39
|
+
inversedBy?: string | undefined;
|
|
40
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
41
|
+
relation: "oneToMany";
|
|
42
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
43
|
+
} & import("@strapi/types/dist/types/utils").Without<{
|
|
44
|
+
inversedBy?: string | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
mappedBy?: string | undefined;
|
|
47
|
+
}> & {
|
|
48
|
+
mappedBy?: string | undefined;
|
|
49
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
50
|
+
relation: "oneToMany";
|
|
51
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
52
|
+
} & import("@strapi/types/dist/types/utils").Without<{
|
|
53
|
+
mappedBy?: string | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
inversedBy?: string | undefined;
|
|
56
|
+
}> & {
|
|
57
|
+
inversedBy?: string | undefined;
|
|
58
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
59
|
+
relation: "manyToOne";
|
|
60
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
61
|
+
} & import("@strapi/types/dist/types/utils").Without<{
|
|
62
|
+
inversedBy?: string | undefined;
|
|
63
|
+
}, {
|
|
64
|
+
mappedBy?: string | undefined;
|
|
65
|
+
}> & {
|
|
66
|
+
mappedBy?: string | undefined;
|
|
67
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
68
|
+
relation: "manyToOne";
|
|
69
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
70
|
+
} & import("@strapi/types/dist/types/utils").Without<{
|
|
71
|
+
mappedBy?: string | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
inversedBy?: string | undefined;
|
|
74
|
+
}> & {
|
|
75
|
+
inversedBy?: string | undefined;
|
|
76
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
77
|
+
relation: "manyToMany";
|
|
78
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
79
|
+
} & import("@strapi/types/dist/types/utils").Without<{
|
|
80
|
+
inversedBy?: string | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
mappedBy?: string | undefined;
|
|
83
|
+
}> & {
|
|
84
|
+
mappedBy?: string | undefined;
|
|
85
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
86
|
+
relation: "manyToMany";
|
|
87
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
88
|
+
} & import("@strapi/types/dist/types/utils").Without<{
|
|
89
|
+
mappedBy?: string | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
inversedBy?: string | undefined;
|
|
92
|
+
}> & {
|
|
93
|
+
inversedBy?: string | undefined;
|
|
94
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
95
|
+
relation: "oneWay";
|
|
96
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
97
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
98
|
+
relation: "manyWay";
|
|
99
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
100
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
101
|
+
relation: "morphOne";
|
|
102
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
103
|
+
morphBy?: string | undefined;
|
|
104
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | (Attribute.OfType<"relation"> & {
|
|
105
|
+
relation: "morphMany";
|
|
106
|
+
target: import("@strapi/types/dist/types/core/common/uid").ContentType;
|
|
107
|
+
morphBy?: string | undefined;
|
|
108
|
+
} & Attribute.ConfigurableOption & Attribute.PrivateOption & Attribute.WritableOption & Attribute.VisibleOption & Attribute.RequiredOption) | Attribute.RichText | (Attribute.OfType<"string"> & Attribute.StringProperties & Attribute.ConfigurableOption & Attribute.DefaultOption<string> & Attribute.MinMaxLengthOption & Attribute.PrivateOption & Attribute.UniqueOption & Attribute.RequiredOption & Attribute.WritableOption & Attribute.VisibleOption) | Attribute.Text | Attribute.Time | Attribute.Timestamp | Attribute.UID<string, Attribute.UIDOptions> | {
|
|
109
|
+
type: string;
|
|
110
|
+
relation: string;
|
|
111
|
+
target: string;
|
|
112
|
+
morphBy: string;
|
|
113
|
+
joinTable?: undefined;
|
|
114
|
+
} | {
|
|
115
|
+
type: string;
|
|
116
|
+
relation: string;
|
|
117
|
+
target: `${string}.${string}`;
|
|
118
|
+
joinTable: {
|
|
119
|
+
name: string;
|
|
120
|
+
joinColumn: {
|
|
121
|
+
name: string;
|
|
122
|
+
referencedColumn: string;
|
|
123
|
+
};
|
|
124
|
+
inverseJoinColumn: {
|
|
125
|
+
name: string;
|
|
126
|
+
referencedColumn: string;
|
|
127
|
+
};
|
|
128
|
+
on: {
|
|
129
|
+
field: string;
|
|
130
|
+
};
|
|
131
|
+
orderColumnName: string;
|
|
132
|
+
orderBy: {
|
|
133
|
+
order: string;
|
|
134
|
+
};
|
|
135
|
+
pivotColumns: string[];
|
|
136
|
+
morphColumn?: undefined;
|
|
137
|
+
};
|
|
138
|
+
morphBy?: undefined;
|
|
139
|
+
} | {
|
|
140
|
+
type: string;
|
|
141
|
+
relation: string;
|
|
142
|
+
joinTable: {
|
|
143
|
+
name: string;
|
|
144
|
+
joinColumn: {
|
|
145
|
+
name: string;
|
|
146
|
+
referencedColumn: string;
|
|
147
|
+
};
|
|
148
|
+
morphColumn: {
|
|
149
|
+
idColumn: {
|
|
150
|
+
name: string;
|
|
151
|
+
referencedColumn: string;
|
|
152
|
+
};
|
|
153
|
+
typeColumn: {
|
|
154
|
+
name: string;
|
|
155
|
+
};
|
|
156
|
+
typeField: string;
|
|
157
|
+
};
|
|
158
|
+
on: {
|
|
159
|
+
field: string;
|
|
160
|
+
};
|
|
161
|
+
orderBy: {
|
|
162
|
+
order: string;
|
|
163
|
+
};
|
|
164
|
+
pivotColumns: string[];
|
|
165
|
+
inverseJoinColumn?: undefined;
|
|
166
|
+
orderColumnName?: undefined;
|
|
167
|
+
};
|
|
168
|
+
target?: undefined;
|
|
169
|
+
morphBy?: undefined;
|
|
170
|
+
};
|
|
171
|
+
export declare const transformAttributes: (contentType: LoadedContentTypeModel) => {};
|
|
172
|
+
export declare const hasComponentsOrDz: (contentType: LoadedContentTypeModel) => contentType is Schema.ContentType & Required<Pick<Schema.ContentType, "uid" | "collectionName" | "modelName">> & {
|
|
173
|
+
type: 'dynamiczone' | 'component';
|
|
174
|
+
};
|
|
4
175
|
export declare const createDocumentId: typeof createId;
|
|
5
|
-
export declare const transformContentTypesToModels: (contentTypes:
|
|
176
|
+
export declare const transformContentTypesToModels: (contentTypes: LoadedContentTypeModel[]) => Model[];
|
|
6
177
|
//# sourceMappingURL=transform-content-types-to-models.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-content-types-to-models.d.ts","sourceRoot":"","sources":["../../src/utils/transform-content-types-to-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"transform-content-types-to-models.d.ts","sourceRoot":"","sources":["../../src/utils/transform-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use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const database = require("@strapi/database");
|
|
3
4
|
const cuid2 = require("@paralleldrive/cuid2");
|
|
4
5
|
const assert = require("node:assert");
|
|
6
|
+
const _ = require("lodash/fp");
|
|
5
7
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
6
8
|
const assert__default = /* @__PURE__ */ _interopDefault(assert);
|
|
9
|
+
const ___default = /* @__PURE__ */ _interopDefault(_);
|
|
10
|
+
const { identifiers } = database.utils;
|
|
11
|
+
const COMPONENT_JOIN_TABLE_SUFFIX = "components";
|
|
12
|
+
const DZ_JOIN_TABLE_SUFFIX = "components";
|
|
13
|
+
const COMPONENT_INVERSE_COLUMN_NAME = "component";
|
|
14
|
+
const COMPONENT_TYPE_COLUMN = "component_type";
|
|
15
|
+
const ENTITY = "entity";
|
|
16
|
+
const getComponentJoinTableName = (collectionName) => identifiers.getTableName(collectionName, { suffix: COMPONENT_JOIN_TABLE_SUFFIX });
|
|
17
|
+
const getDzJoinTableName = (collectionName) => identifiers.getTableName(collectionName, { suffix: DZ_JOIN_TABLE_SUFFIX });
|
|
18
|
+
const { ID_COLUMN: id, FIELD_COLUMN: field, ORDER_COLUMN: order } = identifiers;
|
|
7
19
|
const transformAttribute = (name, attribute, contentType) => {
|
|
8
20
|
switch (attribute.type) {
|
|
9
21
|
case "media": {
|
|
@@ -15,6 +27,11 @@ const transformAttribute = (name, attribute, contentType) => {
|
|
|
15
27
|
};
|
|
16
28
|
}
|
|
17
29
|
case "component": {
|
|
30
|
+
const joinTableName = getComponentJoinTableName(contentType.collectionName);
|
|
31
|
+
const joinColumnEntityName = identifiers.getJoinColumnAttributeIdName(ENTITY);
|
|
32
|
+
const joinColumnInverseName = identifiers.getJoinColumnAttributeIdName(
|
|
33
|
+
COMPONENT_INVERSE_COLUMN_NAME
|
|
34
|
+
);
|
|
18
35
|
return {
|
|
19
36
|
type: "relation",
|
|
20
37
|
relation: attribute.repeatable === true ? "oneToMany" : "oneToOne",
|
|
@@ -22,45 +39,50 @@ const transformAttribute = (name, attribute, contentType) => {
|
|
|
22
39
|
// We need the join table name to be deterministic,
|
|
23
40
|
// We need to allow passing the join table name as an option
|
|
24
41
|
joinTable: {
|
|
25
|
-
name:
|
|
42
|
+
name: joinTableName,
|
|
26
43
|
joinColumn: {
|
|
27
|
-
name:
|
|
28
|
-
referencedColumn:
|
|
44
|
+
name: joinColumnEntityName,
|
|
45
|
+
referencedColumn: id
|
|
29
46
|
},
|
|
30
47
|
inverseJoinColumn: {
|
|
31
|
-
name:
|
|
32
|
-
referencedColumn:
|
|
48
|
+
name: joinColumnInverseName,
|
|
49
|
+
referencedColumn: id
|
|
33
50
|
},
|
|
34
51
|
on: {
|
|
35
52
|
field: name
|
|
36
53
|
},
|
|
37
|
-
orderColumnName:
|
|
54
|
+
orderColumnName: order,
|
|
38
55
|
orderBy: {
|
|
39
56
|
order: "asc"
|
|
40
57
|
},
|
|
41
|
-
pivotColumns: [
|
|
58
|
+
pivotColumns: [joinColumnEntityName, joinColumnInverseName, field, COMPONENT_TYPE_COLUMN]
|
|
42
59
|
}
|
|
43
60
|
};
|
|
44
61
|
}
|
|
45
62
|
case "dynamiczone": {
|
|
63
|
+
const joinTableName = getDzJoinTableName(contentType.collectionName);
|
|
64
|
+
const joinColumnEntityName = identifiers.getJoinColumnAttributeIdName(ENTITY);
|
|
65
|
+
const joinColumnInverseName = identifiers.getJoinColumnAttributeIdName(
|
|
66
|
+
COMPONENT_INVERSE_COLUMN_NAME
|
|
67
|
+
);
|
|
46
68
|
return {
|
|
47
69
|
type: "relation",
|
|
48
70
|
relation: "morphToMany",
|
|
49
71
|
// TODO: handle restrictions at some point
|
|
50
72
|
// target: attribute.components,
|
|
51
73
|
joinTable: {
|
|
52
|
-
name:
|
|
74
|
+
name: joinTableName,
|
|
53
75
|
joinColumn: {
|
|
54
|
-
name:
|
|
55
|
-
referencedColumn:
|
|
76
|
+
name: joinColumnEntityName,
|
|
77
|
+
referencedColumn: id
|
|
56
78
|
},
|
|
57
79
|
morphColumn: {
|
|
58
80
|
idColumn: {
|
|
59
|
-
name:
|
|
60
|
-
referencedColumn:
|
|
81
|
+
name: joinColumnInverseName,
|
|
82
|
+
referencedColumn: id
|
|
61
83
|
},
|
|
62
84
|
typeColumn: {
|
|
63
|
-
name:
|
|
85
|
+
name: COMPONENT_TYPE_COLUMN
|
|
64
86
|
},
|
|
65
87
|
typeField: "__component"
|
|
66
88
|
},
|
|
@@ -70,7 +92,7 @@ const transformAttribute = (name, attribute, contentType) => {
|
|
|
70
92
|
orderBy: {
|
|
71
93
|
order: "asc"
|
|
72
94
|
},
|
|
73
|
-
pivotColumns: [
|
|
95
|
+
pivotColumns: [joinColumnEntityName, joinColumnInverseName, field, COMPONENT_TYPE_COLUMN]
|
|
74
96
|
}
|
|
75
97
|
};
|
|
76
98
|
}
|
|
@@ -88,41 +110,44 @@ const transformAttributes = (contentType) => {
|
|
|
88
110
|
}, {});
|
|
89
111
|
};
|
|
90
112
|
const hasComponentsOrDz = (contentType) => {
|
|
91
|
-
return Object.values(contentType.attributes).some(
|
|
113
|
+
return Object.values(contentType.attributes || {}).some(
|
|
92
114
|
({ type }) => type === "dynamiczone" || type === "component"
|
|
93
115
|
);
|
|
94
116
|
};
|
|
95
117
|
const createDocumentId = cuid2.createId;
|
|
96
118
|
const createCompoLinkModel = (contentType) => {
|
|
97
|
-
const name =
|
|
119
|
+
const name = getComponentJoinTableName(contentType.collectionName);
|
|
120
|
+
const entityId = identifiers.getJoinColumnAttributeIdName(ENTITY);
|
|
121
|
+
const componentId = identifiers.getJoinColumnAttributeIdName(COMPONENT_INVERSE_COLUMN_NAME);
|
|
122
|
+
const fkIndex = identifiers.getFkIndexName([contentType.collectionName, ENTITY]);
|
|
98
123
|
return {
|
|
99
124
|
// TODO: make sure there can't be any conflicts with a prefix
|
|
100
125
|
singularName: name,
|
|
101
126
|
uid: name,
|
|
102
127
|
tableName: name,
|
|
103
128
|
attributes: {
|
|
104
|
-
id: {
|
|
129
|
+
[id]: {
|
|
105
130
|
type: "increments"
|
|
106
131
|
},
|
|
107
|
-
|
|
132
|
+
[entityId]: {
|
|
108
133
|
type: "integer",
|
|
109
134
|
column: {
|
|
110
135
|
unsigned: true
|
|
111
136
|
}
|
|
112
137
|
},
|
|
113
|
-
|
|
138
|
+
[componentId]: {
|
|
114
139
|
type: "integer",
|
|
115
140
|
column: {
|
|
116
141
|
unsigned: true
|
|
117
142
|
}
|
|
118
143
|
},
|
|
119
|
-
|
|
144
|
+
[COMPONENT_TYPE_COLUMN]: {
|
|
120
145
|
type: "string"
|
|
121
146
|
},
|
|
122
|
-
field: {
|
|
147
|
+
[field]: {
|
|
123
148
|
type: "string"
|
|
124
149
|
},
|
|
125
|
-
order: {
|
|
150
|
+
[order]: {
|
|
126
151
|
type: "float",
|
|
127
152
|
column: {
|
|
128
153
|
unsigned: true,
|
|
@@ -132,29 +157,30 @@ const createCompoLinkModel = (contentType) => {
|
|
|
132
157
|
},
|
|
133
158
|
indexes: [
|
|
134
159
|
{
|
|
135
|
-
name:
|
|
136
|
-
columns: [
|
|
160
|
+
name: identifiers.getIndexName([contentType.collectionName, field]),
|
|
161
|
+
columns: [field]
|
|
137
162
|
},
|
|
138
163
|
{
|
|
139
|
-
name:
|
|
140
|
-
columns: [
|
|
164
|
+
name: identifiers.getIndexName([contentType.collectionName, COMPONENT_TYPE_COLUMN]),
|
|
165
|
+
columns: [COMPONENT_TYPE_COLUMN]
|
|
141
166
|
},
|
|
142
167
|
{
|
|
143
|
-
name:
|
|
144
|
-
columns: [
|
|
168
|
+
name: fkIndex,
|
|
169
|
+
columns: [entityId]
|
|
145
170
|
},
|
|
146
171
|
{
|
|
147
|
-
|
|
148
|
-
|
|
172
|
+
// NOTE: since we don't include attribute names, we need to be careful not to create another unique index
|
|
173
|
+
name: identifiers.getUniqueIndexName([contentType.collectionName]),
|
|
174
|
+
columns: [entityId, componentId, field, COMPONENT_TYPE_COLUMN],
|
|
149
175
|
type: "unique"
|
|
150
176
|
}
|
|
151
177
|
],
|
|
152
178
|
foreignKeys: [
|
|
153
179
|
{
|
|
154
|
-
name:
|
|
155
|
-
columns: [
|
|
156
|
-
referencedColumns: [
|
|
157
|
-
referencedTable: contentType.collectionName,
|
|
180
|
+
name: fkIndex,
|
|
181
|
+
columns: [entityId],
|
|
182
|
+
referencedColumns: [id],
|
|
183
|
+
referencedTable: identifiers.getTableName(contentType.collectionName),
|
|
158
184
|
onDelete: "CASCADE"
|
|
159
185
|
}
|
|
160
186
|
]
|
|
@@ -163,12 +189,16 @@ const createCompoLinkModel = (contentType) => {
|
|
|
163
189
|
const transformContentTypesToModels = (contentTypes) => {
|
|
164
190
|
const models = [];
|
|
165
191
|
contentTypes.forEach((contentType) => {
|
|
192
|
+
assert__default.default(contentType.collectionName, 'Content type "collectionName" is required');
|
|
193
|
+
assert__default.default(contentType.modelName, 'Content type "modelName" is required');
|
|
194
|
+
assert__default.default(contentType.uid, 'Content type "uid" is required');
|
|
166
195
|
const documentIdAttribute = contentType.modelType === "contentType" ? { documentId: { type: "string", default: createDocumentId } } : {};
|
|
167
|
-
const reservedAttributeNames = ["
|
|
168
|
-
|
|
169
|
-
|
|
196
|
+
const reservedAttributeNames = ["document_id", id];
|
|
197
|
+
Object.keys(contentType.attributes || {}).forEach((attributeName) => {
|
|
198
|
+
const snakeCasedAttributeName = ___default.default.snakeCase(attributeName);
|
|
199
|
+
if (reservedAttributeNames.includes(snakeCasedAttributeName)) {
|
|
170
200
|
throw new Error(
|
|
171
|
-
`The attribute "${
|
|
201
|
+
`The attribute "${attributeName}" is reserved and cannot be used in a model. Please rename "${contentType.modelName}" attribute "${attributeName}" to something else.`
|
|
172
202
|
);
|
|
173
203
|
}
|
|
174
204
|
});
|
|
@@ -176,13 +206,12 @@ const transformContentTypesToModels = (contentTypes) => {
|
|
|
176
206
|
const compoLinkModel = createCompoLinkModel(contentType);
|
|
177
207
|
models.push(compoLinkModel);
|
|
178
208
|
}
|
|
179
|
-
assert__default.default(contentType.collectionName, "Collection name is required");
|
|
180
209
|
const model = {
|
|
181
210
|
uid: contentType.uid,
|
|
182
211
|
singularName: contentType.modelName,
|
|
183
|
-
tableName: contentType.collectionName,
|
|
212
|
+
tableName: identifiers.getTableName(contentType.collectionName),
|
|
184
213
|
attributes: {
|
|
185
|
-
id: {
|
|
214
|
+
[id]: {
|
|
186
215
|
type: "increments"
|
|
187
216
|
},
|
|
188
217
|
...documentIdAttribute,
|
|
@@ -193,6 +222,16 @@ const transformContentTypesToModels = (contentTypes) => {
|
|
|
193
222
|
});
|
|
194
223
|
return models;
|
|
195
224
|
};
|
|
225
|
+
exports.COMPONENT_INVERSE_COLUMN_NAME = COMPONENT_INVERSE_COLUMN_NAME;
|
|
226
|
+
exports.COMPONENT_JOIN_TABLE_SUFFIX = COMPONENT_JOIN_TABLE_SUFFIX;
|
|
227
|
+
exports.COMPONENT_TYPE_COLUMN = COMPONENT_TYPE_COLUMN;
|
|
228
|
+
exports.DZ_JOIN_TABLE_SUFFIX = DZ_JOIN_TABLE_SUFFIX;
|
|
229
|
+
exports.ENTITY = ENTITY;
|
|
196
230
|
exports.createDocumentId = createDocumentId;
|
|
231
|
+
exports.getComponentJoinTableName = getComponentJoinTableName;
|
|
232
|
+
exports.getDzJoinTableName = getDzJoinTableName;
|
|
233
|
+
exports.hasComponentsOrDz = hasComponentsOrDz;
|
|
234
|
+
exports.transformAttribute = transformAttribute;
|
|
235
|
+
exports.transformAttributes = transformAttributes;
|
|
197
236
|
exports.transformContentTypesToModels = transformContentTypesToModels;
|
|
198
237
|
//# sourceMappingURL=transform-content-types-to-models.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-content-types-to-models.js","sources":["../../src/utils/transform-content-types-to-models.ts"],"sourcesContent":["import { Model } from '@strapi/database';\nimport { Schema, Attribute } from '@strapi/types';\nimport { createId } from '@paralleldrive/cuid2';\nimport assert from 'node:assert';\n\nconst transformAttribute = (\n name: string,\n attribute: Attribute.Any,\n contentType: Schema.ContentType\n) => {\n switch (attribute.type) {\n case 'media': {\n return {\n type: 'relation',\n relation: attribute.multiple === true ? 'morphMany' : 'morphOne',\n target: 'plugin::upload.file',\n morphBy: 'related',\n };\n }\n case 'component': {\n return {\n type: 'relation',\n relation: attribute.repeatable === true ? 'oneToMany' : 'oneToOne',\n target: attribute.component,\n\n // We need the join table name to be deterministic,\n // We need to allow passing the join table name as an option\n joinTable: {\n name: `${contentType.collectionName}_components`,\n joinColumn: {\n name: 'entity_id',\n referencedColumn: 'id',\n },\n inverseJoinColumn: {\n name: 'component_id',\n referencedColumn: 'id',\n },\n on: {\n field: name,\n },\n orderColumnName: 'order',\n orderBy: {\n order: 'asc',\n },\n pivotColumns: ['entity_id', 'component_id', 'field', 'component_type'],\n },\n };\n }\n case 'dynamiczone': {\n return {\n type: 'relation',\n relation: 'morphToMany',\n // TODO: handle restrictions at some point\n // target: attribute.components,\n joinTable: {\n name: `${contentType.collectionName}_components`,\n joinColumn: {\n name: 'entity_id',\n referencedColumn: 'id',\n },\n morphColumn: {\n idColumn: {\n name: 'component_id',\n referencedColumn: 'id',\n },\n typeColumn: {\n name: 'component_type',\n },\n typeField: '__component',\n },\n on: {\n field: name,\n },\n orderBy: {\n order: 'asc',\n },\n pivotColumns: ['entity_id', 'component_id', 'field', 'component_type'],\n },\n };\n }\n default: {\n return attribute;\n }\n }\n};\n\nconst transformAttributes = (contentType: Schema.ContentType) => {\n return Object.keys(contentType.attributes! || {}).reduce((attrs, attrName) => {\n return {\n ...attrs,\n [attrName]: transformAttribute(attrName, contentType.attributes[attrName]!, contentType),\n };\n }, {});\n};\n\nconst hasComponentsOrDz = (contentType: Schema.ContentType) => {\n return Object.values(contentType.attributes).some(\n ({ type }) => type === 'dynamiczone' || type === 'component'\n );\n};\n\nexport const createDocumentId = createId;\n\nconst createCompoLinkModel = (contentType: Schema.ContentType): Model => {\n const name = `${contentType.collectionName}_components`;\n\n return {\n // TODO: make sure there can't be any conflicts with a prefix\n singularName: name,\n uid: name,\n tableName: name,\n attributes: {\n id: {\n type: 'increments',\n },\n entity_id: {\n type: 'integer',\n column: {\n unsigned: true,\n },\n },\n component_id: {\n type: 'integer',\n column: {\n unsigned: true,\n },\n },\n component_type: {\n type: 'string',\n },\n field: {\n type: 'string',\n },\n order: {\n type: 'float',\n column: {\n unsigned: true,\n defaultTo: null,\n },\n },\n },\n indexes: [\n {\n name: `${contentType.collectionName}_field_index`,\n columns: ['field'],\n },\n {\n name: `${contentType.collectionName}_component_type_index`,\n columns: ['component_type'],\n },\n {\n name: `${contentType.collectionName}_entity_fk`,\n columns: ['entity_id'],\n },\n {\n name: `${contentType.collectionName}_unique`,\n columns: ['entity_id', 'component_id', 'field', 'component_type'],\n type: 'unique',\n },\n ],\n foreignKeys: [\n {\n name: `${contentType.collectionName}_entity_fk`,\n columns: ['entity_id'],\n referencedColumns: ['id'],\n referencedTable: contentType.collectionName!,\n onDelete: 'CASCADE',\n },\n ],\n };\n};\n\nexport const transformContentTypesToModels = (contentTypes: Schema.ContentType[]): Model[] => {\n const models: Model[] = [];\n\n contentTypes.forEach((contentType) => {\n // Add document id to content types\n // as it is not documented\n const documentIdAttribute: Record<string, Attribute.Any> =\n contentType.modelType === 'contentType'\n ? { documentId: { type: 'string', default: createDocumentId } }\n : {};\n\n // Prevent user from creating a documentId attribute\n const reservedAttributeNames = ['documentId', 'document_id', 'id'];\n reservedAttributeNames.forEach((reservedAttributeName) => {\n if (reservedAttributeName in contentType.attributes) {\n throw new Error(\n `The attribute \"${reservedAttributeName}\" is reserved and cannot be used in a model` +\n `Please rename \"${contentType.modelName}\" attribute \"${reservedAttributeName}\" to something else.`\n );\n }\n });\n\n if (hasComponentsOrDz(contentType)) {\n const compoLinkModel = createCompoLinkModel(contentType);\n models.push(compoLinkModel);\n }\n\n assert(contentType.collectionName, 'Collection name is required');\n\n const model: Model = {\n uid: contentType.uid,\n singularName: contentType.modelName,\n tableName: contentType.collectionName,\n attributes: {\n id: {\n type: 'increments',\n },\n ...documentIdAttribute,\n ...transformAttributes(contentType),\n },\n };\n\n models.push(model);\n });\n\n return models;\n};\n"],"names":["createId","assert"],"mappings":";;;;;;AAKA,MAAM,qBAAqB,CACzB,MACA,WACA,gBACG;AACH,UAAQ,UAAU,MAAM;AAAA,IACtB,KAAK,SAAS;AACL,aAAA;AAAA,QACL,MAAM;AAAA,QACN,UAAU,UAAU,aAAa,OAAO,cAAc;AAAA,QACtD,QAAQ;AAAA,QACR,SAAS;AAAA,MAAA;AAAA,IAEb;AAAA,IACA,KAAK,aAAa;AACT,aAAA;AAAA,QACL,MAAM;AAAA,QACN,UAAU,UAAU,eAAe,OAAO,cAAc;AAAA,QACxD,QAAQ,UAAU;AAAA;AAAA;AAAA,QAIlB,WAAW;AAAA,UACT,MAAM,GAAG,YAAY,cAAc;AAAA,UACnC,YAAY;AAAA,YACV,MAAM;AAAA,YACN,kBAAkB;AAAA,UACpB;AAAA,UACA,mBAAmB;AAAA,YACjB,MAAM;AAAA,YACN,kBAAkB;AAAA,UACpB;AAAA,UACA,IAAI;AAAA,YACF,OAAO;AAAA,UACT;AAAA,UACA,iBAAiB;AAAA,UACjB,SAAS;AAAA,YACP,OAAO;AAAA,UACT;AAAA,UACA,cAAc,CAAC,aAAa,gBAAgB,SAAS,gBAAgB;AAAA,QACvE;AAAA,MAAA;AAAA,IAEJ;AAAA,IACA,KAAK,eAAe;AACX,aAAA;AAAA,QACL,MAAM;AAAA,QACN,UAAU;AAAA;AAAA;AAAA,QAGV,WAAW;AAAA,UACT,MAAM,GAAG,YAAY,cAAc;AAAA,UACnC,YAAY;AAAA,YACV,MAAM;AAAA,YACN,kBAAkB;AAAA,UACpB;AAAA,UACA,aAAa;AAAA,YACX,UAAU;AAAA,cACR,MAAM;AAAA,cACN,kBAAkB;AAAA,YACpB;AAAA,YACA,YAAY;AAAA,cACV,MAAM;AAAA,YACR;AAAA,YACA,WAAW;AAAA,UACb;AAAA,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AAA,YAAY,gBAAgB,6BAA6B;AAEhE,UAAM,QAAe;AAAA,MACnB,KAAK,YAAY;AAAA,MACjB,cAAc,YAAY;AAAA,MAC1B,WAAW,YAAY;AAAA,MACvB,YAAY;AAAA,QACV,IAAI;AAAA,UACF,MAAM;AAAA,QACR;AAAA,QACA,GAAG;AAAA,QACH,GAAG,oBAAoB,WAAW;AAAA,MACpC;AAAA,IAAA;AAGF,WAAO,KAAK,KAAK;AAAA,EAAA,CAClB;AAEM,SAAA;AACT;;;"}
|
|
1
|
+
{"version":3,"file":"transform-content-types-to-models.js","sources":["../../src/utils/transform-content-types-to-models.ts"],"sourcesContent":["import { type Model, utils } from '@strapi/database';\nimport { Schema, Attribute } from '@strapi/types';\nimport { createId } from '@paralleldrive/cuid2';\nimport assert from 'node:assert';\nimport _ from 'lodash/fp';\n\nconst { identifiers } = utils;\n\n/**\n * Because strapi/database models don't know about things like components or dynamic zones, we use this file to convert them\n * to a relations format that it recognizes\n *\n * Therefore we have to keep an additional set of helpers/extensions to the database naming methods\n */\n\nexport const COMPONENT_JOIN_TABLE_SUFFIX = 'components';\nexport const DZ_JOIN_TABLE_SUFFIX = 'components';\nexport const COMPONENT_INVERSE_COLUMN_NAME = 'component';\nexport const COMPONENT_TYPE_COLUMN = 'component_type';\nexport const ENTITY = 'entity';\n\nexport const getComponentJoinTableName = (collectionName: string) =>\n identifiers.getTableName(collectionName, { suffix: COMPONENT_JOIN_TABLE_SUFFIX });\n\nexport const getDzJoinTableName = (collectionName: string) =>\n identifiers.getTableName(collectionName, { suffix: DZ_JOIN_TABLE_SUFFIX });\n\nconst { ID_COLUMN: id, FIELD_COLUMN: field, ORDER_COLUMN: order } = identifiers;\n\nexport type LoadedContentTypeModel = Schema.ContentType &\n Required<Pick<Schema.ContentType, 'collectionName' | 'uid' | 'modelName'>>;\n\n// Transforms an attribute (particularly for relation types) into the format that strapi/database accepts\nexport const transformAttribute = (\n name: string,\n attribute: Attribute.Any,\n contentType: LoadedContentTypeModel\n) => {\n switch (attribute.type) {\n case 'media': {\n return {\n type: 'relation',\n relation: attribute.multiple === true ? 'morphMany' : 'morphOne',\n target: 'plugin::upload.file',\n morphBy: 'related',\n };\n }\n case 'component': {\n const joinTableName = getComponentJoinTableName(contentType.collectionName);\n const joinColumnEntityName = identifiers.getJoinColumnAttributeIdName(ENTITY);\n const joinColumnInverseName = identifiers.getJoinColumnAttributeIdName(\n COMPONENT_INVERSE_COLUMN_NAME\n );\n\n return {\n type: 'relation',\n relation: attribute.repeatable === true ? 'oneToMany' : 'oneToOne',\n target: attribute.component,\n\n // We need the join table name to be deterministic,\n // We need to allow passing the join table name as an option\n joinTable: {\n name: joinTableName,\n joinColumn: {\n name: joinColumnEntityName,\n referencedColumn: id,\n },\n inverseJoinColumn: {\n name: joinColumnInverseName,\n referencedColumn: id,\n },\n on: {\n field: name,\n },\n orderColumnName: order,\n orderBy: {\n order: 'asc',\n },\n pivotColumns: [joinColumnEntityName, joinColumnInverseName, field, COMPONENT_TYPE_COLUMN],\n },\n };\n }\n case 'dynamiczone': {\n const joinTableName = getDzJoinTableName(contentType.collectionName);\n const joinColumnEntityName = identifiers.getJoinColumnAttributeIdName(ENTITY);\n const joinColumnInverseName = identifiers.getJoinColumnAttributeIdName(\n COMPONENT_INVERSE_COLUMN_NAME\n );\n\n return {\n type: 'relation',\n relation: 'morphToMany',\n // TODO: handle restrictions at some point\n // target: attribute.components,\n joinTable: {\n name: joinTableName,\n joinColumn: {\n name: joinColumnEntityName,\n referencedColumn: id,\n },\n morphColumn: {\n idColumn: {\n name: joinColumnInverseName,\n referencedColumn: id,\n },\n typeColumn: {\n name: COMPONENT_TYPE_COLUMN,\n },\n typeField: '__component',\n },\n on: {\n field: name,\n },\n orderBy: {\n order: 'asc',\n },\n pivotColumns: [joinColumnEntityName, joinColumnInverseName, field, COMPONENT_TYPE_COLUMN],\n },\n };\n }\n default: {\n return attribute;\n }\n }\n};\n\nexport const transformAttributes = (contentType: LoadedContentTypeModel) => {\n return Object.keys(contentType.attributes! || {}).reduce((attrs, attrName) => {\n return {\n ...attrs,\n [attrName]: transformAttribute(attrName, contentType.attributes[attrName]!, contentType),\n };\n }, {});\n};\n\nexport const hasComponentsOrDz = (\n contentType: LoadedContentTypeModel\n): contentType is LoadedContentTypeModel & { type: 'dynamiczone' | 'component' } => {\n return Object.values(contentType.attributes || {}).some(\n ({ type }) => type === 'dynamiczone' || type === 'component'\n );\n};\n\nexport const createDocumentId = createId;\n\n// Creates the\nconst createCompoLinkModel = (contentType: LoadedContentTypeModel): Model => {\n const name = getComponentJoinTableName(contentType.collectionName);\n\n const entityId = identifiers.getJoinColumnAttributeIdName(ENTITY);\n const componentId = identifiers.getJoinColumnAttributeIdName(COMPONENT_INVERSE_COLUMN_NAME);\n const fkIndex = identifiers.getFkIndexName([contentType.collectionName, ENTITY]);\n\n return {\n // TODO: make sure there can't be any conflicts with a prefix\n singularName: name,\n uid: name,\n tableName: name,\n attributes: {\n [id]: {\n type: 'increments',\n },\n [entityId]: {\n type: 'integer',\n column: {\n unsigned: true,\n },\n },\n [componentId]: {\n type: 'integer',\n column: {\n unsigned: true,\n },\n },\n [COMPONENT_TYPE_COLUMN]: {\n type: 'string',\n },\n [field]: {\n type: 'string',\n },\n [order]: {\n type: 'float',\n column: {\n unsigned: true,\n defaultTo: null,\n },\n },\n },\n indexes: [\n {\n name: identifiers.getIndexName([contentType.collectionName, field]),\n columns: [field],\n },\n {\n name: identifiers.getIndexName([contentType.collectionName, COMPONENT_TYPE_COLUMN]),\n columns: [COMPONENT_TYPE_COLUMN],\n },\n {\n name: fkIndex,\n columns: [entityId],\n },\n {\n // NOTE: since we don't include attribute names, we need to be careful not to create another unique index\n name: identifiers.getUniqueIndexName([contentType.collectionName]),\n columns: [entityId, componentId, field, COMPONENT_TYPE_COLUMN],\n type: 'unique',\n },\n ],\n foreignKeys: [\n {\n name: fkIndex,\n columns: [entityId],\n referencedColumns: [id],\n referencedTable: identifiers.getTableName(contentType.collectionName),\n onDelete: 'CASCADE',\n },\n ],\n };\n};\n\nexport const transformContentTypesToModels = (contentTypes: LoadedContentTypeModel[]): Model[] => {\n const models: Model[] = [];\n\n contentTypes.forEach((contentType) => {\n assert(contentType.collectionName, 'Content type \"collectionName\" is required');\n assert(contentType.modelName, 'Content type \"modelName\" is required');\n assert(contentType.uid, 'Content type \"uid\" is required');\n\n // Add document id to content types\n // as it is not documented\n const documentIdAttribute: Record<string, Attribute.Any> =\n contentType.modelType === 'contentType'\n ? { documentId: { type: 'string', default: createDocumentId } }\n : {};\n\n // TODO: this needs to be combined with getReservedNames, we should not be maintaining two lists\n // Prevent user from creating a documentId attribute\n const reservedAttributeNames = ['document_id', id];\n Object.keys(contentType.attributes || {}).forEach((attributeName) => {\n const snakeCasedAttributeName = _.snakeCase(attributeName);\n if (reservedAttributeNames.includes(snakeCasedAttributeName)) {\n throw new Error(\n `The attribute \"${attributeName}\" is reserved and cannot be used in a model. Please rename \"${contentType.modelName}\" attribute \"${attributeName}\" to something else.`\n );\n }\n });\n\n if (hasComponentsOrDz(contentType)) {\n const compoLinkModel = createCompoLinkModel(contentType);\n models.push(compoLinkModel);\n }\n\n const model: Model = {\n uid: contentType.uid,\n singularName: contentType.modelName,\n tableName: identifiers.getTableName(contentType.collectionName),\n attributes: {\n [id]: {\n type: 'increments',\n },\n ...documentIdAttribute,\n ...transformAttributes(contentType),\n },\n };\n\n models.push(model);\n });\n\n return models;\n};\n"],"names":["utils","createId","assert","_"],"mappings":";;;;;;;;;AAMA,MAAM,EAAE,YAAgB,IAAAA;AASjB,MAAM,8BAA8B;AACpC,MAAM,uBAAuB;AAC7B,MAAM,gCAAgC;AACtC,MAAM,wBAAwB;AAC9B,MAAM,SAAS;AAET,MAAA,4BAA4B,CAAC,mBACxC,YAAY,aAAa,gBAAgB,EAAE,QAAQ,6BAA6B;AAErE,MAAA,qBAAqB,CAAC,mBACjC,YAAY,aAAa,gBAAgB,EAAE,QAAQ,sBAAsB;AAE3E,MAAM,EAAE,WAAW,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