@webiny/api-headless-cms 5.17.4 → 5.18.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/contextSetup.js +1 -2
- package/content/graphQLHandlerFactory.d.ts +1 -2
- package/content/graphQLHandlerFactory.js +12 -4
- package/content/plugins/CmsGroupPlugin.d.ts +11 -0
- package/content/plugins/{ContentModelGroupPlugin.js → CmsGroupPlugin.js} +4 -5
- package/content/plugins/CmsModelPlugin.d.ts +11 -0
- package/content/plugins/{ContentModelPlugin.js → CmsModelPlugin.js} +4 -5
- package/content/plugins/buildSchemaPlugins.js +1 -2
- package/content/plugins/crud/contentEntry/beforeCreate.d.ts +7 -0
- package/content/plugins/crud/contentEntry/beforeCreate.js +28 -0
- package/content/plugins/crud/contentEntry/beforeUpdate.d.ts +7 -0
- package/content/plugins/crud/contentEntry/beforeUpdate.js +28 -0
- package/content/plugins/crud/contentEntry/entryDataValidation.d.ts +2 -2
- package/content/plugins/crud/contentEntry/entryDataValidation.js +1 -2
- package/content/plugins/crud/contentEntry/markLockedFields.d.ts +3 -3
- package/content/plugins/crud/contentEntry/markLockedFields.js +10 -7
- package/content/plugins/crud/contentEntry.crud.d.ts +12 -4
- package/content/plugins/crud/contentEntry.crud.js +807 -757
- package/content/plugins/crud/contentModel/afterCreate.d.ts +7 -0
- package/content/plugins/crud/contentModel/afterCreate.js +18 -0
- package/content/plugins/crud/contentModel/afterDelete.d.ts +7 -0
- package/content/plugins/crud/contentModel/afterDelete.js +18 -0
- package/content/plugins/crud/contentModel/afterUpdate.d.ts +7 -0
- package/content/plugins/crud/contentModel/afterUpdate.js +18 -0
- package/content/plugins/crud/contentModel/beforeCreate.d.ts +9 -0
- package/content/plugins/crud/contentModel/beforeCreate.js +146 -0
- package/content/plugins/crud/contentModel/beforeDelete.d.ts +9 -0
- package/content/plugins/crud/contentModel/beforeDelete.js +56 -0
- package/content/plugins/crud/contentModel/beforeUpdate.d.ts +9 -0
- package/content/plugins/crud/contentModel/beforeUpdate.js +128 -0
- package/content/plugins/crud/contentModel/contentModelManagerFactory.d.ts +2 -2
- package/content/plugins/crud/contentModel/contentModelManagerFactory.js +2 -3
- package/content/plugins/crud/contentModel/createFieldModels.d.ts +2 -2
- package/content/plugins/crud/contentModel/createFieldModels.js +2 -3
- package/content/plugins/crud/contentModel/idValidation.js +1 -2
- package/content/plugins/crud/contentModel/models.js +1 -2
- package/content/plugins/crud/contentModel/validateLayout.d.ts +2 -2
- package/content/plugins/crud/contentModel/validateLayout.js +1 -2
- package/content/plugins/crud/contentModel.crud.d.ts +12 -4
- package/content/plugins/crud/contentModel.crud.js +351 -279
- package/content/plugins/crud/contentModelGroup/beforeCreate.d.ts +9 -0
- package/content/plugins/crud/contentModelGroup/beforeCreate.js +66 -0
- package/content/plugins/crud/contentModelGroup/beforeDelete.d.ts +9 -0
- package/content/plugins/crud/contentModelGroup/beforeDelete.js +48 -0
- package/content/plugins/crud/contentModelGroup/beforeUpdate.d.ts +8 -0
- package/content/plugins/crud/contentModelGroup/beforeUpdate.js +28 -0
- package/content/plugins/crud/contentModelGroup.crud.d.ts +12 -4
- package/content/plugins/crud/contentModelGroup.crud.js +259 -219
- package/content/plugins/crud/index.d.ts +6 -0
- package/content/plugins/crud/index.js +96 -0
- package/content/plugins/graphqlFields/boolean.js +1 -2
- package/content/plugins/graphqlFields/datetime.js +1 -2
- package/content/plugins/graphqlFields/file.js +1 -2
- package/content/plugins/graphqlFields/index.js +1 -2
- package/content/plugins/graphqlFields/longText.js +1 -2
- package/content/plugins/graphqlFields/number.js +1 -2
- package/content/plugins/graphqlFields/object.js +1 -2
- package/content/plugins/graphqlFields/ref.js +22 -11
- package/content/plugins/graphqlFields/richText.js +1 -2
- package/content/plugins/graphqlFields/text.js +1 -2
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js +2 -3
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js +1 -2
- package/content/plugins/modelManager/DefaultCmsModelManager.d.ts +15 -0
- package/content/plugins/modelManager/DefaultCmsModelManager.js +62 -0
- package/content/plugins/modelManager/index.d.ts +2 -2
- package/content/plugins/modelManager/index.js +3 -4
- package/content/plugins/schema/baseSchema.js +1 -2
- package/content/plugins/schema/contentEntries.js +9 -10
- package/content/plugins/schema/contentModelGroups.js +13 -14
- package/content/plugins/schema/contentModels.js +9 -10
- package/content/plugins/schema/createFieldResolvers.d.ts +2 -2
- package/content/plugins/schema/createFieldResolvers.js +14 -20
- package/content/plugins/schema/createManageResolvers.d.ts +3 -3
- package/content/plugins/schema/createManageResolvers.js +6 -10
- package/content/plugins/schema/createManageSDL.d.ts +2 -2
- package/content/plugins/schema/createManageSDL.js +5 -6
- package/content/plugins/schema/createPreviewResolvers.d.ts +3 -3
- package/content/plugins/schema/createPreviewResolvers.js +5 -6
- package/content/plugins/schema/createReadResolvers.d.ts +3 -3
- package/content/plugins/schema/createReadResolvers.js +5 -6
- package/content/plugins/schema/createReadSDL.d.ts +2 -2
- package/content/plugins/schema/createReadSDL.js +3 -4
- package/content/plugins/schema/resolvers/commonFieldResolvers.d.ts +4 -4
- package/content/plugins/schema/resolvers/commonFieldResolvers.js +1 -2
- package/content/plugins/schema/resolvers/manage/resolveCreate.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveCreate.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveDelete.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveDelete.js +4 -5
- package/content/plugins/schema/resolvers/manage/resolveGet.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveGet.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveList.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveList.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolvePublish.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolvePublish.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveUnpublish.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveUnpublish.js +3 -4
- package/content/plugins/schema/resolvers/manage/resolveUpdate.d.ts +1 -1
- package/content/plugins/schema/resolvers/manage/resolveUpdate.js +3 -4
- package/content/plugins/schema/resolvers/preview/resolveGet.d.ts +1 -1
- package/content/plugins/schema/resolvers/preview/resolveGet.js +3 -4
- package/content/plugins/schema/resolvers/preview/resolveList.d.ts +1 -1
- package/content/plugins/schema/resolvers/preview/resolveList.js +3 -4
- package/content/plugins/schema/resolvers/read/resolveGet.d.ts +1 -1
- package/content/plugins/schema/resolvers/read/resolveGet.js +3 -4
- package/content/plugins/schema/resolvers/read/resolveList.d.ts +1 -1
- package/content/plugins/schema/resolvers/read/resolveList.js +3 -4
- package/content/plugins/schema/schemaPlugins.js +4 -3
- package/content/plugins/storage/StorageTransformPlugin.d.ts +30 -0
- package/content/plugins/storage/StorageTransformPlugin.js +36 -0
- package/content/plugins/storage/default.d.ts +2 -2
- package/content/plugins/storage/default.js +12 -12
- package/content/plugins/storage/object.d.ts +2 -2
- package/content/plugins/storage/object.js +28 -29
- package/content/plugins/utils/createTypeName.js +1 -2
- package/content/plugins/utils/entryStorage.d.ts +5 -5
- package/content/plugins/utils/entryStorage.js +21 -14
- package/content/plugins/utils/getEntryTitle.d.ts +2 -2
- package/content/plugins/utils/getEntryTitle.js +1 -2
- package/content/plugins/utils/getSchemaFromFieldPlugins.d.ts +2 -2
- package/content/plugins/utils/getSchemaFromFieldPlugins.js +1 -2
- package/content/plugins/utils/pluralizedTypeName.js +1 -2
- package/content/plugins/utils/renderFields.d.ts +2 -2
- package/content/plugins/utils/renderFields.js +1 -2
- package/content/plugins/utils/renderGetFilterFields.d.ts +2 -2
- package/content/plugins/utils/renderGetFilterFields.js +1 -2
- package/content/plugins/utils/renderInputFields.d.ts +2 -2
- package/content/plugins/utils/renderInputFields.js +1 -2
- package/content/plugins/utils/renderListFilterFields.d.ts +2 -2
- package/content/plugins/utils/renderListFilterFields.js +1 -2
- package/content/plugins/utils/renderSortEnum.d.ts +2 -2
- package/content/plugins/utils/renderSortEnum.js +1 -2
- package/content/plugins/validators/dateGte.js +1 -2
- package/content/plugins/validators/dateLte.js +1 -2
- package/content/plugins/validators/gte.js +1 -2
- package/content/plugins/validators/in.js +1 -2
- package/content/plugins/validators/index.js +1 -2
- package/content/plugins/validators/lte.js +1 -2
- package/content/plugins/validators/maxLength.js +1 -2
- package/content/plugins/validators/minLength.js +1 -2
- package/content/plugins/validators/pattern.js +1 -2
- package/content/plugins/validators/patternPlugins/email.js +1 -2
- package/content/plugins/validators/patternPlugins/index.js +1 -2
- package/content/plugins/validators/patternPlugins/lowerCase.js +1 -2
- package/content/plugins/validators/patternPlugins/upperCase.js +1 -2
- package/content/plugins/validators/patternPlugins/url.js +1 -2
- package/content/plugins/validators/required.js +1 -2
- package/content/plugins/validators/timeGte.js +1 -2
- package/content/plugins/validators/timeLte.js +1 -2
- package/index.d.ts +12 -0
- package/index.js +66 -0
- package/migrateCMSPermissions.d.ts +2 -2
- package/migrateCMSPermissions.js +1 -2
- package/package.json +23 -21
- package/plugins/context.js +1 -2
- package/plugins/crud/index.d.ts +6 -2
- package/plugins/crud/index.js +69 -6
- package/plugins/crud/settings.crud.d.ts +10 -4
- package/plugins/crud/settings.crud.js +64 -77
- package/plugins/crud/system.crud.d.ts +10 -4
- package/plugins/crud/system.crud.js +139 -126
- package/plugins/graphql/system.js +5 -6
- package/plugins/graphql.d.ts +1 -2
- package/plugins/graphql.js +49 -50
- package/plugins/upgrades/index.js +1 -2
- package/plugins/upgrades/v5.5.0/helpers.js +1 -2
- package/plugins/upgrades/v5.5.0/index.js +3 -4
- package/transformers.js +1 -2
- package/types.d.ts +742 -1232
- package/types.js +104 -254
- package/utils.d.ts +4 -11
- package/utils.js +2 -49
- package/content/contextSetup.js.map +0 -1
- package/content/graphQLHandlerFactory.js.map +0 -1
- package/content/index.d.ts +0 -5
- package/content/index.js +0 -37
- package/content/index.js.map +0 -1
- package/content/plugins/ContentModelGroupPlugin.d.ts +0 -7
- package/content/plugins/ContentModelGroupPlugin.js.map +0 -1
- package/content/plugins/ContentModelPlugin.d.ts +0 -7
- package/content/plugins/ContentModelPlugin.js.map +0 -1
- package/content/plugins/buildSchemaPlugins.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterCreate.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterCreate.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterCreate.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterCreateRevisionFrom.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterCreateRevisionFrom.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterCreateRevisionFrom.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterDelete.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterDelete.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterDelete.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterDeleteRevision.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterDeleteRevision.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterDeleteRevision.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterPublish.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterPublish.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterPublish.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterRequestChanges.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterRequestChanges.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterRequestChanges.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterRequestReview.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterRequestReview.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterRequestReview.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterUnpublish.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterUnpublish.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterUnpublish.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/afterUpdate.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/afterUpdate.hook.js +0 -15
- package/content/plugins/crud/contentEntry/afterUpdate.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforeCreate.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforeCreate.hook.js +0 -18
- package/content/plugins/crud/contentEntry/beforeCreate.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforeCreateRevisionFrom.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforeCreateRevisionFrom.hook.js +0 -15
- package/content/plugins/crud/contentEntry/beforeCreateRevisionFrom.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforeDelete.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforeDelete.hook.js +0 -15
- package/content/plugins/crud/contentEntry/beforeDelete.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforeDeleteRevision.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforeDeleteRevision.hook.js +0 -15
- package/content/plugins/crud/contentEntry/beforeDeleteRevision.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforePublish.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforePublish.hook.js +0 -15
- package/content/plugins/crud/contentEntry/beforePublish.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforeRequestChanges.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforeRequestChanges.hook.js +0 -15
- package/content/plugins/crud/contentEntry/beforeRequestChanges.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforeRequestReview.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforeRequestReview.hook.js +0 -15
- package/content/plugins/crud/contentEntry/beforeRequestReview.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforeUnpublish.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforeUnpublish.hook.js +0 -15
- package/content/plugins/crud/contentEntry/beforeUnpublish.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/beforeUpdate.hook.d.ts +0 -2
- package/content/plugins/crud/contentEntry/beforeUpdate.hook.js +0 -18
- package/content/plugins/crud/contentEntry/beforeUpdate.hook.js.map +0 -1
- package/content/plugins/crud/contentEntry/entryDataValidation.js.map +0 -1
- package/content/plugins/crud/contentEntry/hooks.d.ts +0 -18
- package/content/plugins/crud/contentEntry/hooks.js +0 -240
- package/content/plugins/crud/contentEntry/hooks.js.map +0 -1
- package/content/plugins/crud/contentEntry/markLockedFields.js.map +0 -1
- package/content/plugins/crud/contentEntry/runContentEntryLifecycleHooks.d.ts +0 -4
- package/content/plugins/crud/contentEntry/runContentEntryLifecycleHooks.js +0 -24
- package/content/plugins/crud/contentEntry/runContentEntryLifecycleHooks.js.map +0 -1
- package/content/plugins/crud/contentEntry.crud.js.map +0 -1
- package/content/plugins/crud/contentModel/afterCreate.hook.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterCreate.hook.js +0 -24
- package/content/plugins/crud/contentModel/afterCreate.hook.js.map +0 -1
- package/content/plugins/crud/contentModel/afterDelete.hook.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterDelete.hook.js +0 -24
- package/content/plugins/crud/contentModel/afterDelete.hook.js.map +0 -1
- package/content/plugins/crud/contentModel/afterUpdate.hook.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterUpdate.hook.js +0 -24
- package/content/plugins/crud/contentModel/afterUpdate.hook.js.map +0 -1
- package/content/plugins/crud/contentModel/beforeCreate.hook.d.ts +0 -7
- package/content/plugins/crud/contentModel/beforeCreate.hook.js +0 -137
- package/content/plugins/crud/contentModel/beforeCreate.hook.js.map +0 -1
- package/content/plugins/crud/contentModel/beforeDelete.hook.d.ts +0 -7
- package/content/plugins/crud/contentModel/beforeDelete.hook.js +0 -58
- package/content/plugins/crud/contentModel/beforeDelete.hook.js.map +0 -1
- package/content/plugins/crud/contentModel/beforeUpdate.hook.d.ts +0 -7
- package/content/plugins/crud/contentModel/beforeUpdate.hook.js +0 -141
- package/content/plugins/crud/contentModel/beforeUpdate.hook.js.map +0 -1
- package/content/plugins/crud/contentModel/contentModelManagerFactory.js.map +0 -1
- package/content/plugins/crud/contentModel/createFieldModels.js.map +0 -1
- package/content/plugins/crud/contentModel/hooks.d.ts +0 -6
- package/content/plugins/crud/contentModel/hooks.js +0 -84
- package/content/plugins/crud/contentModel/hooks.js.map +0 -1
- package/content/plugins/crud/contentModel/idValidation.js.map +0 -1
- package/content/plugins/crud/contentModel/models.js.map +0 -1
- package/content/plugins/crud/contentModel/runContentModelLifecycleHooks.d.ts +0 -2
- package/content/plugins/crud/contentModel/runContentModelLifecycleHooks.js +0 -24
- package/content/plugins/crud/contentModel/runContentModelLifecycleHooks.js.map +0 -1
- package/content/plugins/crud/contentModel/validateLayout.js.map +0 -1
- package/content/plugins/crud/contentModel.crud.js.map +0 -1
- package/content/plugins/crud/contentModelGroup/afterCreate.hook.d.ts +0 -7
- package/content/plugins/crud/contentModelGroup/afterCreate.hook.js +0 -24
- package/content/plugins/crud/contentModelGroup/afterCreate.hook.js.map +0 -1
- package/content/plugins/crud/contentModelGroup/afterDelete.hook.d.ts +0 -8
- package/content/plugins/crud/contentModelGroup/afterDelete.hook.js +0 -22
- package/content/plugins/crud/contentModelGroup/afterDelete.hook.js.map +0 -1
- package/content/plugins/crud/contentModelGroup/afterUpdate.hook.d.ts +0 -7
- package/content/plugins/crud/contentModelGroup/afterUpdate.hook.js +0 -26
- package/content/plugins/crud/contentModelGroup/afterUpdate.hook.js.map +0 -1
- package/content/plugins/crud/contentModelGroup/beforeCreate.hook.d.ts +0 -7
- package/content/plugins/crud/contentModelGroup/beforeCreate.hook.js +0 -87
- package/content/plugins/crud/contentModelGroup/beforeCreate.hook.js.map +0 -1
- package/content/plugins/crud/contentModelGroup/beforeDelete.hook.d.ts +0 -7
- package/content/plugins/crud/contentModelGroup/beforeDelete.hook.js +0 -46
- package/content/plugins/crud/contentModelGroup/beforeDelete.hook.js.map +0 -1
- package/content/plugins/crud/contentModelGroup/beforeUpdate.hook.d.ts +0 -7
- package/content/plugins/crud/contentModelGroup/beforeUpdate.hook.js +0 -35
- package/content/plugins/crud/contentModelGroup/beforeUpdate.hook.js.map +0 -1
- package/content/plugins/crud/contentModelGroup.crud.js.map +0 -1
- package/content/plugins/graphqlFields/boolean.js.map +0 -1
- package/content/plugins/graphqlFields/datetime.js.map +0 -1
- package/content/plugins/graphqlFields/file.js.map +0 -1
- package/content/plugins/graphqlFields/index.js.map +0 -1
- package/content/plugins/graphqlFields/longText.js.map +0 -1
- package/content/plugins/graphqlFields/number.js.map +0 -1
- package/content/plugins/graphqlFields/object.js.map +0 -1
- package/content/plugins/graphqlFields/ref.js.map +0 -1
- package/content/plugins/graphqlFields/richText.js.map +0 -1
- package/content/plugins/graphqlFields/text.js.map +0 -1
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js.map +0 -1
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js.map +0 -1
- package/content/plugins/modelManager/DefaultContentModelManager.d.ts +0 -15
- package/content/plugins/modelManager/DefaultContentModelManager.js +0 -63
- package/content/plugins/modelManager/DefaultContentModelManager.js.map +0 -1
- package/content/plugins/modelManager/index.js.map +0 -1
- package/content/plugins/schema/baseSchema.js.map +0 -1
- package/content/plugins/schema/contentEntries.js.map +0 -1
- package/content/plugins/schema/contentModelGroups.js.map +0 -1
- package/content/plugins/schema/contentModels.js.map +0 -1
- package/content/plugins/schema/createFieldResolvers.js.map +0 -1
- package/content/plugins/schema/createManageResolvers.js.map +0 -1
- package/content/plugins/schema/createManageSDL.js.map +0 -1
- package/content/plugins/schema/createPreviewResolvers.js.map +0 -1
- package/content/plugins/schema/createReadResolvers.js.map +0 -1
- package/content/plugins/schema/createReadSDL.js.map +0 -1
- package/content/plugins/schema/resolvers/commonFieldResolvers.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveCreate.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveDelete.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveGet.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveList.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolvePublish.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveRequestChanges.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveRequestReview.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveUnpublish.js.map +0 -1
- package/content/plugins/schema/resolvers/manage/resolveUpdate.js.map +0 -1
- package/content/plugins/schema/resolvers/preview/resolveGet.js.map +0 -1
- package/content/plugins/schema/resolvers/preview/resolveList.js.map +0 -1
- package/content/plugins/schema/resolvers/read/resolveGet.js.map +0 -1
- package/content/plugins/schema/resolvers/read/resolveList.js.map +0 -1
- package/content/plugins/schema/schemaPlugins.js.map +0 -1
- package/content/plugins/storage/default.js.map +0 -1
- package/content/plugins/storage/object.js.map +0 -1
- package/content/plugins/utils/createTypeName.js.map +0 -1
- package/content/plugins/utils/entryStorage.js.map +0 -1
- package/content/plugins/utils/getEntryTitle.js.map +0 -1
- package/content/plugins/utils/getSchemaFromFieldPlugins.js.map +0 -1
- package/content/plugins/utils/pluralizedTypeName.js.map +0 -1
- package/content/plugins/utils/renderFields.js.map +0 -1
- package/content/plugins/utils/renderGetFilterFields.js.map +0 -1
- package/content/plugins/utils/renderInputFields.js.map +0 -1
- package/content/plugins/utils/renderListFilterFields.js.map +0 -1
- package/content/plugins/utils/renderSortEnum.js.map +0 -1
- package/content/plugins/validators/dateGte.js.map +0 -1
- package/content/plugins/validators/dateLte.js.map +0 -1
- package/content/plugins/validators/gte.js.map +0 -1
- package/content/plugins/validators/in.js.map +0 -1
- package/content/plugins/validators/index.js.map +0 -1
- package/content/plugins/validators/lte.js.map +0 -1
- package/content/plugins/validators/maxLength.js.map +0 -1
- package/content/plugins/validators/minLength.js.map +0 -1
- package/content/plugins/validators/pattern.js.map +0 -1
- package/content/plugins/validators/patternPlugins/email.js.map +0 -1
- package/content/plugins/validators/patternPlugins/index.js.map +0 -1
- package/content/plugins/validators/patternPlugins/lowerCase.js.map +0 -1
- package/content/plugins/validators/patternPlugins/upperCase.js.map +0 -1
- package/content/plugins/validators/patternPlugins/url.js.map +0 -1
- package/content/plugins/validators/required.js.map +0 -1
- package/content/plugins/validators/timeGte.js.map +0 -1
- package/content/plugins/validators/timeLte.js.map +0 -1
- package/migrateCMSPermissions.js.map +0 -1
- package/plugins/InstallationPlugin.d.ts +0 -19
- package/plugins/InstallationPlugin.js +0 -39
- package/plugins/InstallationPlugin.js.map +0 -1
- package/plugins/context.js.map +0 -1
- package/plugins/crud/index.js.map +0 -1
- package/plugins/crud/settings.crud.js.map +0 -1
- package/plugins/crud/system.crud.js.map +0 -1
- package/plugins/graphql/system.js.map +0 -1
- package/plugins/graphql.js.map +0 -1
- package/plugins/index.d.ts +0 -2
- package/plugins/index.js +0 -25
- package/plugins/index.js.map +0 -1
- package/plugins/upgrades/index.js.map +0 -1
- package/plugins/upgrades/v5.5.0/helpers.js.map +0 -1
- package/plugins/upgrades/v5.5.0/index.js.map +0 -1
- package/transformers.js.map +0 -1
- package/types.js.map +0 -1
- package/utils.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AfterModelCreateTopicParams, CmsContext } from "../../../../types";
|
|
2
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
3
|
+
export interface Params {
|
|
4
|
+
onAfterCreate: Topic<AfterModelCreateTopicParams>;
|
|
5
|
+
context: CmsContext;
|
|
6
|
+
}
|
|
7
|
+
export declare const assignAfterModelCreate: (params: Params) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assignAfterModelCreate = void 0;
|
|
7
|
+
|
|
8
|
+
const assignAfterModelCreate = params => {
|
|
9
|
+
const {
|
|
10
|
+
onAfterCreate,
|
|
11
|
+
context
|
|
12
|
+
} = params;
|
|
13
|
+
onAfterCreate.subscribe(async () => {
|
|
14
|
+
await context.cms.updateModelLastChange();
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.assignAfterModelCreate = assignAfterModelCreate;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AfterModelDeleteTopicParams, CmsContext } from "../../../../types";
|
|
2
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
3
|
+
export interface Params {
|
|
4
|
+
onAfterDelete: Topic<AfterModelDeleteTopicParams>;
|
|
5
|
+
context: CmsContext;
|
|
6
|
+
}
|
|
7
|
+
export declare const assignAfterModelDelete: (params: Params) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assignAfterModelDelete = void 0;
|
|
7
|
+
|
|
8
|
+
const assignAfterModelDelete = params => {
|
|
9
|
+
const {
|
|
10
|
+
onAfterDelete,
|
|
11
|
+
context
|
|
12
|
+
} = params;
|
|
13
|
+
onAfterDelete.subscribe(async () => {
|
|
14
|
+
await context.cms.updateModelLastChange();
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.assignAfterModelDelete = assignAfterModelDelete;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AfterModelUpdateTopicParams, CmsContext } from "../../../../types";
|
|
2
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
3
|
+
export interface Params {
|
|
4
|
+
onAfterUpdate: Topic<AfterModelUpdateTopicParams>;
|
|
5
|
+
context: CmsContext;
|
|
6
|
+
}
|
|
7
|
+
export declare const assignAfterModelUpdate: (params: Params) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assignAfterModelUpdate = void 0;
|
|
7
|
+
|
|
8
|
+
const assignAfterModelUpdate = params => {
|
|
9
|
+
const {
|
|
10
|
+
onAfterUpdate,
|
|
11
|
+
context
|
|
12
|
+
} = params;
|
|
13
|
+
onAfterUpdate.subscribe(async () => {
|
|
14
|
+
await context.cms.updateModelLastChange();
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.assignAfterModelUpdate = assignAfterModelUpdate;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BeforeModelCreateTopicParams, HeadlessCmsStorageOperations } from "../../../../types";
|
|
2
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
3
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
export interface Params {
|
|
5
|
+
onBeforeCreate: Topic<BeforeModelCreateTopicParams>;
|
|
6
|
+
storageOperations: HeadlessCmsStorageOperations;
|
|
7
|
+
plugins: PluginsContainer;
|
|
8
|
+
}
|
|
9
|
+
export declare const assignBeforeModelCreate: (params: Params) => void;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.assignBeforeModelCreate = void 0;
|
|
9
|
+
|
|
10
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
|
|
12
|
+
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
|
|
13
|
+
|
|
14
|
+
var _pluralize = _interopRequireDefault(require("pluralize"));
|
|
15
|
+
|
|
16
|
+
var _CmsModelPlugin = require("../../CmsModelPlugin");
|
|
17
|
+
|
|
18
|
+
const disallowedModelIdList = ["contentModel", "contentModels", "contentModelGroup", "contentModelGroups"];
|
|
19
|
+
/**
|
|
20
|
+
* This list is to disallow creating models that might interfere with GraphQL schema creation.
|
|
21
|
+
* Add more if required.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const disallowedModelIdEndingList = ["Response", "List", "Meta", "Input", "Sorter"];
|
|
25
|
+
/**
|
|
26
|
+
* Checks for the uniqueness of provided modelId, against the provided list of models.
|
|
27
|
+
* It also takes plural / singular forms of the provided modelId into account.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const checkModelIdUniqueness = (modelIdList, modelId) => {
|
|
31
|
+
if (modelIdList.includes(modelId) === true) {
|
|
32
|
+
throw new _error.default(`Content model with modelId "${modelId}" already exists.`, "MODEL_ID_EXISTS", {
|
|
33
|
+
modelId
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Additionally, check if the plural form of the received modelId exists too. This prevents users
|
|
38
|
+
* from creating, for example, "event" and "events" models, which would break the GraphQL schema.
|
|
39
|
+
* 1. First check if user wants to create the "event" model, but the "events" model already exists.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const pluralizedModelIdCamelCase = (0, _pluralize.default)(modelId);
|
|
44
|
+
|
|
45
|
+
if (modelIdList.includes(pluralizedModelIdCamelCase) === true) {
|
|
46
|
+
throw new _error.default(`Content model with modelId "${modelId}" does not exist, but a model with modelId "${pluralizedModelIdCamelCase}" does.`, "MODEL_ID_PLURAL_ERROR", {
|
|
47
|
+
modelId,
|
|
48
|
+
plural: pluralizedModelIdCamelCase
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 2. Then check if user wants to create the "events" model, but the "event" model already exists.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
const singularizedModelIdCamelCase = _pluralize.default.singular(modelId);
|
|
57
|
+
|
|
58
|
+
if (modelIdList.includes(singularizedModelIdCamelCase) === true) {
|
|
59
|
+
throw new _error.default(`Content model with modelId "${modelId}" does not exist, but a model with modelId "${singularizedModelIdCamelCase}" does.`, "MODEL_ID_SINGULAR_ERROR", {
|
|
60
|
+
modelId,
|
|
61
|
+
singular: singularizedModelIdCamelCase
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const checkModelIdAllowed = modelId => {
|
|
67
|
+
if (disallowedModelIdList.includes(modelId) === false) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
throw new _error.default(`Provided model ID "${modelId}" is not allowed.`);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const checkModelIdEndingAllowed = modelId => {
|
|
75
|
+
for (const ending of disallowedModelIdEndingList) {
|
|
76
|
+
const re = new RegExp(`${ending}$`, "i");
|
|
77
|
+
const matched = modelId.match(re);
|
|
78
|
+
|
|
79
|
+
if (matched === null) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
throw new _error.default(`ModelId that ends with "${ending}" is not allowed.`, "MODEL_ID_NOT_ALLOWED", {
|
|
84
|
+
modelId
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const getModelId = model => {
|
|
90
|
+
const {
|
|
91
|
+
modelId,
|
|
92
|
+
name
|
|
93
|
+
} = model;
|
|
94
|
+
|
|
95
|
+
if (modelId) {
|
|
96
|
+
return (0, _camelCase.default)(modelId.trim());
|
|
97
|
+
} else if (name) {
|
|
98
|
+
return (0, _camelCase.default)(name.trim());
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
throw new _error.default(`There is no "modelId" or "name" passed into the create model method.`, "MISSING_MODEL_DATA", {
|
|
102
|
+
model
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const assignBeforeModelCreate = params => {
|
|
107
|
+
const {
|
|
108
|
+
onBeforeCreate,
|
|
109
|
+
storageOperations,
|
|
110
|
+
plugins
|
|
111
|
+
} = params;
|
|
112
|
+
onBeforeCreate.subscribe(async params => {
|
|
113
|
+
const {
|
|
114
|
+
model
|
|
115
|
+
} = params;
|
|
116
|
+
const modelId = getModelId(model);
|
|
117
|
+
const modelPlugin = plugins.byType(_CmsModelPlugin.CmsModelPlugin.type).find(item => item.contentModel.modelId === modelId);
|
|
118
|
+
|
|
119
|
+
if (modelPlugin) {
|
|
120
|
+
throw new _error.default(`Cannot create "${model.modelId}" content model because one is already registered via a plugin.`, "CONTENT_MODEL_CREATE_ERROR", {
|
|
121
|
+
modelId: model.modelId
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const models = await storageOperations.models.list({
|
|
126
|
+
where: {
|
|
127
|
+
tenant: model.tenant,
|
|
128
|
+
locale: model.locale
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const modelIdList = models.map(m => m.modelId);
|
|
132
|
+
/**
|
|
133
|
+
* We need to check for:
|
|
134
|
+
* - is that exact modelId allowed
|
|
135
|
+
* - is modelId unique
|
|
136
|
+
* - is model ending allowed
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
checkModelIdAllowed(modelId);
|
|
140
|
+
checkModelIdEndingAllowed(modelId);
|
|
141
|
+
checkModelIdUniqueness(modelIdList, modelId);
|
|
142
|
+
model.modelId = modelId;
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
exports.assignBeforeModelCreate = assignBeforeModelCreate;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
2
|
+
import { BeforeModelDeleteTopicParams, HeadlessCmsStorageOperations } from "../../../../types";
|
|
3
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
export interface Params {
|
|
5
|
+
onBeforeDelete: Topic<BeforeModelDeleteTopicParams>;
|
|
6
|
+
storageOperations: HeadlessCmsStorageOperations;
|
|
7
|
+
plugins: PluginsContainer;
|
|
8
|
+
}
|
|
9
|
+
export declare const assignBeforeModelDelete: (params: Params) => void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.assignBeforeModelDelete = void 0;
|
|
9
|
+
|
|
10
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
|
|
12
|
+
var _CmsModelPlugin = require("../../CmsModelPlugin");
|
|
13
|
+
|
|
14
|
+
const assignBeforeModelDelete = params => {
|
|
15
|
+
const {
|
|
16
|
+
onBeforeDelete,
|
|
17
|
+
storageOperations,
|
|
18
|
+
plugins
|
|
19
|
+
} = params;
|
|
20
|
+
onBeforeDelete.subscribe(async params => {
|
|
21
|
+
const {
|
|
22
|
+
model
|
|
23
|
+
} = params;
|
|
24
|
+
const modelPlugin = plugins.byType(_CmsModelPlugin.CmsModelPlugin.type).find(item => item.contentModel.modelId === model.modelId);
|
|
25
|
+
|
|
26
|
+
if (modelPlugin) {
|
|
27
|
+
throw new _error.default("Content models defined via plugins cannot be deleted.", "CONTENT_MODEL_DELETE_ERROR", {
|
|
28
|
+
modelId: model.modelId
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let entries = [];
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const result = await storageOperations.entries.list(model, {
|
|
36
|
+
where: {
|
|
37
|
+
tenant: model.tenant,
|
|
38
|
+
locale: model.locale
|
|
39
|
+
},
|
|
40
|
+
limit: 1
|
|
41
|
+
});
|
|
42
|
+
entries = result.items;
|
|
43
|
+
} catch (ex) {
|
|
44
|
+
throw new _error.default("Could not retrieve a list of content entries from the model.", "ENTRIES_ERROR", {
|
|
45
|
+
error: ex,
|
|
46
|
+
model
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (entries.length > 0) {
|
|
51
|
+
throw new _error.default(`Cannot delete content model "${model.modelId}" because there are existing entries.`, "CONTENT_MODEL_BEFORE_DELETE_HOOK_FAILED");
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.assignBeforeModelDelete = assignBeforeModelDelete;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
2
|
+
import { BeforeModelUpdateTopicParams, HeadlessCmsStorageOperations } from "../../../../types";
|
|
3
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
export interface Params {
|
|
5
|
+
onBeforeUpdate: Topic<BeforeModelUpdateTopicParams>;
|
|
6
|
+
storageOperations: HeadlessCmsStorageOperations;
|
|
7
|
+
plugins: PluginsContainer;
|
|
8
|
+
}
|
|
9
|
+
export declare const assignBeforeModelUpdate: (params: Params) => void;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.assignBeforeModelUpdate = void 0;
|
|
9
|
+
|
|
10
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
+
|
|
12
|
+
var _CmsModelPlugin = require("../../CmsModelPlugin");
|
|
13
|
+
|
|
14
|
+
const defaultTitleFieldId = "id";
|
|
15
|
+
const allowedTitleFieldTypes = ["text", "number"];
|
|
16
|
+
|
|
17
|
+
const getContentModelTitleFieldId = (fields, titleFieldId) => {
|
|
18
|
+
// if there is no title field defined either in input data or existing content model data
|
|
19
|
+
// we will take first text field that has no multiple values enabled
|
|
20
|
+
// or if initial titleFieldId is the default one also try to find first available text field
|
|
21
|
+
if (!titleFieldId || titleFieldId === defaultTitleFieldId) {
|
|
22
|
+
const titleField = fields.find(field => {
|
|
23
|
+
return field.type === "text" && !field.multipleValues;
|
|
24
|
+
});
|
|
25
|
+
return titleField ? titleField.fieldId : defaultTitleFieldId;
|
|
26
|
+
} // check existing titleFieldId for existence in the model
|
|
27
|
+
// for correct type
|
|
28
|
+
// and that it is not multiple values field
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const target = fields.find(f => f.fieldId === titleFieldId);
|
|
32
|
+
|
|
33
|
+
if (!target) {
|
|
34
|
+
throw new _error.default(`Field does not exist in the model.`, "VALIDATION_ERROR", {
|
|
35
|
+
fieldId: titleFieldId
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (allowedTitleFieldTypes.includes(target.type) === false) {
|
|
40
|
+
throw new _error.default(`Only ${allowedTitleFieldTypes.join(", ")} and id fields can be used as an entry title.`, "ENTRY_TITLE_FIELD_TYPE", {
|
|
41
|
+
fieldId: target.fieldId,
|
|
42
|
+
type: target.type
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (target.multipleValues) {
|
|
47
|
+
throw new _error.default(`Fields that accept multiple values cannot be used as the entry title.`, "ENTRY_TITLE_FIELD_TYPE", {
|
|
48
|
+
fieldId: target.fieldId,
|
|
49
|
+
type: target.type
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return target.fieldId;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const assignBeforeModelUpdate = params => {
|
|
57
|
+
const {
|
|
58
|
+
onBeforeUpdate,
|
|
59
|
+
plugins
|
|
60
|
+
} = params;
|
|
61
|
+
onBeforeUpdate.subscribe(async params => {
|
|
62
|
+
const {
|
|
63
|
+
model
|
|
64
|
+
} = params;
|
|
65
|
+
const modelPlugin = plugins.byType(_CmsModelPlugin.CmsModelPlugin.type).find(item => item.contentModel.modelId === model.modelId);
|
|
66
|
+
|
|
67
|
+
if (modelPlugin) {
|
|
68
|
+
throw new _error.default("Content models defined via plugins cannot be updated.", "CONTENT_MODEL_UPDATE_ERROR", {
|
|
69
|
+
modelId: model.modelId
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const {
|
|
74
|
+
titleFieldId
|
|
75
|
+
} = model; // There should be fields/locked fields in either model or data to be updated.
|
|
76
|
+
|
|
77
|
+
const {
|
|
78
|
+
fields = [],
|
|
79
|
+
lockedFields = []
|
|
80
|
+
} = model; // Let's inspect the fields of the received content model. We prevent saving of a content model if it
|
|
81
|
+
// contains a field for which a "cms-model-field-to-graphql" plugin does not exist on the backend.
|
|
82
|
+
|
|
83
|
+
const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql");
|
|
84
|
+
|
|
85
|
+
for (let i = 0; i < fields.length; i++) {
|
|
86
|
+
const field = fields[i];
|
|
87
|
+
|
|
88
|
+
if (!fieldTypePlugins.find(item => item.fieldType === field.type)) {
|
|
89
|
+
throw new Error(`Cannot update content model because of the unknown "${field.type}" field.`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);
|
|
94
|
+
const cmsLockedFieldPlugins = plugins.byType("cms-model-locked-field"); // We must not allow removal or changes in fields that are already in use in content entries.
|
|
95
|
+
|
|
96
|
+
for (const lockedField of lockedFields) {
|
|
97
|
+
const existingField = fields.find(item => item.fieldId === lockedField.fieldId);
|
|
98
|
+
|
|
99
|
+
if (!existingField) {
|
|
100
|
+
throw new _error.default(`Cannot remove the field "${lockedField.fieldId}" because it's already in use in created content.`, "ENTRY_FIELD_USED");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (lockedField.multipleValues !== existingField.multipleValues) {
|
|
104
|
+
throw new _error.default(`Cannot change "multipleValues" for the "${lockedField.fieldId}" field because it's already in use in created content.`, "ENTRY_FIELD_USED");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (lockedField.type !== existingField.type) {
|
|
108
|
+
throw new _error.default(`Cannot change field type for the "${lockedField.fieldId}" field because it's already in use in created content.`, "ENTRY_FIELD_USED");
|
|
109
|
+
} // Check `lockedField` invariant for specific field
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
const lockedFieldsByType = cmsLockedFieldPlugins.filter(pl => pl.fieldType === lockedField.type);
|
|
113
|
+
|
|
114
|
+
for (const plugin of lockedFieldsByType) {
|
|
115
|
+
if (typeof plugin.checkLockedField !== "function") {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
plugin.checkLockedField({
|
|
120
|
+
lockedField,
|
|
121
|
+
field: existingField
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
exports.assignBeforeModelUpdate = assignBeforeModelUpdate;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const contentModelManagerFactory: (context: CmsContext, model:
|
|
1
|
+
import { CmsModel, CmsContext } from "../../../../types";
|
|
2
|
+
export declare const contentModelManagerFactory: (context: CmsContext, model: CmsModel) => Promise<import("../../../../types").CmsModelManager>;
|
|
@@ -20,11 +20,10 @@ const contentModelManagerFactory = async (context, model) => {
|
|
|
20
20
|
const plugin = pluginsByType.find(plugin => plugin.name === defaultName);
|
|
21
21
|
|
|
22
22
|
if (!plugin) {
|
|
23
|
-
throw new Error("There is no default plugin to create
|
|
23
|
+
throw new Error("There is no default plugin to create CmsModelManager");
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
return await plugin.create(context, model);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
exports.contentModelManagerFactory = contentModelManagerFactory;
|
|
30
|
-
//# sourceMappingURL=contentModelManagerFactory.js.map
|
|
29
|
+
exports.contentModelManagerFactory = contentModelManagerFactory;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const createFieldModels: (
|
|
1
|
+
import { CmsModelField, CmsModel, CmsModelUpdateInput } from "../../../../types";
|
|
2
|
+
export declare const createFieldModels: (_: CmsModel, data: CmsModelUpdateInput) => Promise<CmsModelField[]>;
|
|
@@ -7,7 +7,7 @@ exports.createFieldModels = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _models = require("./models");
|
|
9
9
|
|
|
10
|
-
const createFieldModels = async (
|
|
10
|
+
const createFieldModels = async (_, data) => {
|
|
11
11
|
const fields = [];
|
|
12
12
|
|
|
13
13
|
for (const field of data.fields) {
|
|
@@ -19,5 +19,4 @@ const createFieldModels = async (model, data) => {
|
|
|
19
19
|
return fields;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
exports.createFieldModels = createFieldModels;
|
|
23
|
-
//# sourceMappingURL=createFieldModels.js.map
|
|
22
|
+
exports.createFieldModels = createFieldModels;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const validateLayout: ({ layout }:
|
|
1
|
+
import { CmsModelField, CmsModel } from "../../../../types";
|
|
2
|
+
export declare const validateLayout: ({ layout }: CmsModel, fields: CmsModelField[]) => void;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { CmsContext, CmsModelContext, HeadlessCmsStorageOperations } from "../../../types";
|
|
2
|
+
import { Tenant } from "@webiny/api-tenancy/types";
|
|
3
|
+
import { I18NLocale } from "@webiny/api-i18n/types";
|
|
4
|
+
import { SecurityIdentity } from "@webiny/api-security/types";
|
|
5
|
+
export interface Params {
|
|
6
|
+
getTenant: () => Tenant;
|
|
7
|
+
getLocale: () => I18NLocale;
|
|
8
|
+
storageOperations: HeadlessCmsStorageOperations;
|
|
9
|
+
context: CmsContext;
|
|
10
|
+
getIdentity: () => SecurityIdentity;
|
|
11
|
+
}
|
|
12
|
+
export declare const createModelsCrud: (params: Params) => CmsModelContext;
|