@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
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.createModelGroupsCrud = void 0;
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
@@ -17,23 +17,19 @@ var _mdbid = _interopRequireDefault(require("mdbid"));
|
|
|
17
17
|
|
|
18
18
|
var utils = _interopRequireWildcard(require("../../../utils"));
|
|
19
19
|
|
|
20
|
-
var _beforeDelete = require("./contentModelGroup/beforeDelete.hook");
|
|
21
|
-
|
|
22
|
-
var _beforeCreate = require("./contentModelGroup/beforeCreate.hook");
|
|
23
|
-
|
|
24
|
-
var _afterDelete = require("./contentModelGroup/afterDelete.hook");
|
|
25
|
-
|
|
26
20
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
27
21
|
|
|
28
22
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
29
23
|
|
|
30
|
-
var
|
|
24
|
+
var _CmsGroupPlugin = require("../CmsGroupPlugin");
|
|
25
|
+
|
|
26
|
+
var _pubsub = require("@webiny/pubsub");
|
|
31
27
|
|
|
32
|
-
var _beforeUpdate = require("./contentModelGroup/beforeUpdate
|
|
28
|
+
var _beforeUpdate = require("./contentModelGroup/beforeUpdate");
|
|
33
29
|
|
|
34
|
-
var
|
|
30
|
+
var _beforeCreate = require("./contentModelGroup/beforeCreate");
|
|
35
31
|
|
|
36
|
-
var
|
|
32
|
+
var _beforeDelete = require("./contentModelGroup/beforeDelete");
|
|
37
33
|
|
|
38
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
35
|
|
|
@@ -69,243 +65,287 @@ const UpdateContentModelGroupModel = (0, _fields.withFields)({
|
|
|
69
65
|
})
|
|
70
66
|
})();
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
const createModelGroupsCrud = params => {
|
|
69
|
+
const {
|
|
70
|
+
getTenant,
|
|
71
|
+
getIdentity,
|
|
72
|
+
getLocale,
|
|
73
|
+
storageOperations,
|
|
74
|
+
context
|
|
75
|
+
} = params;
|
|
76
|
+
|
|
77
|
+
const getGroupsAsPlugins = () => {
|
|
78
|
+
const tenant = getTenant().id;
|
|
79
|
+
const locale = getLocale().code;
|
|
80
|
+
return context.plugins.byType(_CmsGroupPlugin.CmsGroupPlugin.type)
|
|
76
81
|
/**
|
|
77
|
-
*
|
|
82
|
+
* We need to filter out groups that are not for this tenant or locale.
|
|
83
|
+
* If it does not have tenant or locale define, it is for every locale and tenant
|
|
78
84
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
.filter(plugin => {
|
|
86
|
+
const {
|
|
87
|
+
tenant: t,
|
|
88
|
+
locale: l
|
|
89
|
+
} = plugin.contentModelGroup;
|
|
90
|
+
|
|
91
|
+
if (t && t !== tenant) {
|
|
92
|
+
return false;
|
|
93
|
+
} else if (l && l !== locale) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
82
96
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
return true;
|
|
98
|
+
}).map(plugin => {
|
|
99
|
+
return _objectSpread(_objectSpread({}, plugin.contentModelGroup), {}, {
|
|
100
|
+
tenant,
|
|
101
|
+
locale,
|
|
102
|
+
webinyVersion: context.WEBINY_VERSION
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
89
106
|
|
|
90
|
-
|
|
107
|
+
const checkPermissions = check => {
|
|
108
|
+
return utils.checkPermissions(context, "cms.contentModelGroup", {
|
|
109
|
+
rwd: check
|
|
110
|
+
});
|
|
111
|
+
};
|
|
91
112
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
113
|
+
const groupsGet = async id => {
|
|
114
|
+
const groupPlugin = getGroupsAsPlugins().find(group => group.id === id);
|
|
115
|
+
|
|
116
|
+
if (groupPlugin) {
|
|
117
|
+
return groupPlugin;
|
|
96
118
|
}
|
|
97
119
|
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
120
|
+
const tenant = getTenant().id;
|
|
121
|
+
const locale = getLocale().code;
|
|
122
|
+
let group = null;
|
|
101
123
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
124
|
+
try {
|
|
125
|
+
group = await storageOperations.groups.get({
|
|
126
|
+
tenant,
|
|
127
|
+
locale,
|
|
128
|
+
id
|
|
105
129
|
});
|
|
106
|
-
}
|
|
130
|
+
} catch (ex) {
|
|
131
|
+
throw new _error.default(ex.message, ex.code || "GET_ERROR", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
132
|
+
id
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
107
135
|
|
|
108
|
-
|
|
109
|
-
|
|
136
|
+
if (!group) {
|
|
137
|
+
throw new _handlerGraphql.NotFoundError(`Cms Group "${id}" was not found!`);
|
|
138
|
+
}
|
|
110
139
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
140
|
+
return _objectSpread(_objectSpread({}, group), {}, {
|
|
141
|
+
tenant: group.tenant || tenant,
|
|
142
|
+
locale: group.locale || locale
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const groupsList = async params => {
|
|
147
|
+
const {
|
|
148
|
+
where
|
|
149
|
+
} = params || {};
|
|
150
|
+
const tenant = getTenant().id;
|
|
151
|
+
const locale = getLocale().code;
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
const pluginsGroups = getGroupsAsPlugins();
|
|
155
|
+
const databaseGroups = await storageOperations.groups.list({
|
|
156
|
+
where: _objectSpread(_objectSpread({}, where || {}), {}, {
|
|
157
|
+
tenant: where ? where.tenant : tenant,
|
|
158
|
+
locale: where ? where.locale : locale
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
return pluginsGroups.concat(databaseGroups.map(group => {
|
|
162
|
+
return _objectSpread(_objectSpread({}, group), {}, {
|
|
163
|
+
tenant: group.tenant || tenant,
|
|
164
|
+
locale: group.locale || locale
|
|
165
|
+
});
|
|
166
|
+
}));
|
|
167
|
+
} catch (ex) {
|
|
168
|
+
throw new _error.default(ex.message, ex.code || "LIST_ERROR", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
169
|
+
where
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const onBeforeCreate = (0, _pubsub.createTopic)();
|
|
175
|
+
const onAfterCreate = (0, _pubsub.createTopic)();
|
|
176
|
+
const onBeforeUpdate = (0, _pubsub.createTopic)();
|
|
177
|
+
const onAfterUpdate = (0, _pubsub.createTopic)();
|
|
178
|
+
const onBeforeDelete = (0, _pubsub.createTopic)();
|
|
179
|
+
const onAfterDelete = (0, _pubsub.createTopic)();
|
|
180
|
+
/**
|
|
181
|
+
* We need to assign some default behaviors.
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
(0, _beforeCreate.assignBeforeGroupCreate)({
|
|
185
|
+
onBeforeCreate,
|
|
186
|
+
plugins: context.plugins,
|
|
187
|
+
storageOperations
|
|
188
|
+
});
|
|
189
|
+
(0, _beforeUpdate.assignBeforeGroupUpdate)({
|
|
190
|
+
onBeforeUpdate,
|
|
191
|
+
plugins: context.plugins
|
|
192
|
+
});
|
|
193
|
+
(0, _beforeDelete.assignBeforeGroupDelete)({
|
|
194
|
+
onBeforeDelete,
|
|
195
|
+
plugins: context.plugins,
|
|
196
|
+
storageOperations
|
|
197
|
+
});
|
|
198
|
+
return {
|
|
199
|
+
onBeforeGroupCreate: onBeforeCreate,
|
|
200
|
+
onAfterGroupCreate: onAfterCreate,
|
|
201
|
+
onBeforeGroupUpdate: onBeforeUpdate,
|
|
202
|
+
onAfterGroupUpdate: onAfterUpdate,
|
|
203
|
+
onBeforeGroupDelete: onBeforeDelete,
|
|
204
|
+
onAfterGroupDelete: onAfterDelete,
|
|
205
|
+
getGroup: async id => {
|
|
206
|
+
const permission = await checkPermissions("r");
|
|
207
|
+
const group = await groupsGet(id);
|
|
208
|
+
utils.checkOwnership(context, permission, group);
|
|
209
|
+
utils.validateGroupAccess(context, permission, group);
|
|
210
|
+
return group;
|
|
211
|
+
},
|
|
212
|
+
listGroups: async params => {
|
|
213
|
+
const {
|
|
214
|
+
where
|
|
215
|
+
} = params || {};
|
|
216
|
+
const {
|
|
217
|
+
tenant,
|
|
218
|
+
locale
|
|
219
|
+
} = where || {};
|
|
220
|
+
const permission = await checkPermissions("r");
|
|
221
|
+
const response = await groupsList(_objectSpread(_objectSpread({}, params || {}), {}, {
|
|
222
|
+
where: _objectSpread(_objectSpread({}, where || {}), {}, {
|
|
223
|
+
tenant: tenant || getTenant().id,
|
|
224
|
+
locale: locale || getLocale().code
|
|
225
|
+
})
|
|
226
|
+
}));
|
|
227
|
+
return response.filter(group => {
|
|
228
|
+
if (!utils.validateOwnership(context, permission, group)) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
114
231
|
|
|
115
|
-
|
|
232
|
+
return utils.validateGroupAccess(context, permission, group);
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
createGroup: async inputData => {
|
|
236
|
+
await checkPermissions("w");
|
|
237
|
+
const createdData = new CreateContentModelGroupModel().populate(_objectSpread(_objectSpread({}, inputData), {}, {
|
|
238
|
+
slug: inputData.slug ? utils.toSlug(inputData.slug) : ""
|
|
239
|
+
}));
|
|
240
|
+
await createdData.validate();
|
|
241
|
+
const input = await createdData.toJSON();
|
|
242
|
+
const identity = getIdentity();
|
|
243
|
+
const id = (0, _mdbid.default)();
|
|
244
|
+
|
|
245
|
+
const group = _objectSpread(_objectSpread({}, input), {}, {
|
|
246
|
+
id,
|
|
247
|
+
tenant: getTenant().id,
|
|
248
|
+
locale: getLocale().code,
|
|
249
|
+
createdOn: new Date().toISOString(),
|
|
250
|
+
savedOn: new Date().toISOString(),
|
|
251
|
+
createdBy: {
|
|
252
|
+
id: identity.id,
|
|
253
|
+
displayName: identity.displayName,
|
|
254
|
+
type: identity.type
|
|
255
|
+
},
|
|
256
|
+
webinyVersion: context.WEBINY_VERSION
|
|
257
|
+
});
|
|
116
258
|
|
|
117
259
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
260
|
+
await onBeforeCreate.publish({
|
|
261
|
+
group
|
|
262
|
+
});
|
|
263
|
+
const result = await storageOperations.groups.create({
|
|
264
|
+
input,
|
|
265
|
+
group
|
|
120
266
|
});
|
|
267
|
+
await onAfterCreate.publish({
|
|
268
|
+
group: result
|
|
269
|
+
});
|
|
270
|
+
return group;
|
|
121
271
|
} catch (ex) {
|
|
122
|
-
throw new _error.default(ex.message, ex.code || "
|
|
123
|
-
|
|
272
|
+
throw new _error.default(ex.message || "Could not save data model group.", ex.code || "ERROR_ON_CREATE", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
273
|
+
group,
|
|
274
|
+
input
|
|
124
275
|
}));
|
|
125
276
|
}
|
|
277
|
+
},
|
|
278
|
+
updateGroup: async (id, inputData) => {
|
|
279
|
+
const permission = await checkPermissions("w");
|
|
280
|
+
const original = await groupsGet(id);
|
|
281
|
+
utils.checkOwnership(context, permission, original);
|
|
282
|
+
const input = new UpdateContentModelGroupModel().populate(inputData);
|
|
283
|
+
await input.validate();
|
|
284
|
+
const updatedDataJson = await input.toJSON({
|
|
285
|
+
onlyDirty: true
|
|
286
|
+
});
|
|
287
|
+
/**
|
|
288
|
+
* No need to continue if no values were changed
|
|
289
|
+
*/
|
|
126
290
|
|
|
127
|
-
if (
|
|
128
|
-
|
|
291
|
+
if (Object.keys(updatedDataJson).length === 0) {
|
|
292
|
+
return original;
|
|
129
293
|
}
|
|
130
294
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
where,
|
|
137
|
-
limit
|
|
138
|
-
} = args || {};
|
|
295
|
+
const group = _objectSpread(_objectSpread(_objectSpread({}, original), updatedDataJson), {}, {
|
|
296
|
+
locale: getLocale().code,
|
|
297
|
+
tenant: getTenant().id,
|
|
298
|
+
savedOn: new Date().toISOString()
|
|
299
|
+
});
|
|
139
300
|
|
|
140
301
|
try {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
limit
|
|
302
|
+
await onBeforeUpdate.publish({
|
|
303
|
+
original,
|
|
304
|
+
group
|
|
145
305
|
});
|
|
146
|
-
|
|
306
|
+
const updatedGroup = await storageOperations.groups.update({
|
|
307
|
+
original,
|
|
308
|
+
group,
|
|
309
|
+
input
|
|
310
|
+
});
|
|
311
|
+
await onAfterUpdate.publish({
|
|
312
|
+
original,
|
|
313
|
+
group: updatedGroup
|
|
314
|
+
});
|
|
315
|
+
return updatedGroup;
|
|
147
316
|
} catch (ex) {
|
|
148
|
-
throw new _error.default(ex.message, ex.code || "
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
317
|
+
throw new _error.default(ex.message, ex.code || "UPDATE_ERROR", {
|
|
318
|
+
error: ex,
|
|
319
|
+
original,
|
|
320
|
+
group,
|
|
321
|
+
input
|
|
322
|
+
});
|
|
152
323
|
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
get: async id => {
|
|
164
|
-
const permission = await checkPermissions("r");
|
|
165
|
-
const group = await groupsGet(id);
|
|
166
|
-
utils.checkOwnership(context, permission, group);
|
|
167
|
-
utils.validateGroupAccess(context, permission, group);
|
|
168
|
-
return group;
|
|
169
|
-
},
|
|
170
|
-
list: async args => {
|
|
171
|
-
const permission = await checkPermissions("r");
|
|
172
|
-
const response = await groupsList(args);
|
|
173
|
-
return response.filter(group => {
|
|
174
|
-
if (!utils.validateOwnership(context, permission, group)) {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return utils.validateGroupAccess(context, permission, group);
|
|
324
|
+
},
|
|
325
|
+
deleteGroup: async id => {
|
|
326
|
+
const permission = await checkPermissions("d");
|
|
327
|
+
const group = await groupsGet(id);
|
|
328
|
+
utils.checkOwnership(context, permission, group);
|
|
329
|
+
|
|
330
|
+
try {
|
|
331
|
+
await onBeforeDelete.publish({
|
|
332
|
+
group
|
|
179
333
|
});
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
await checkPermissions("w");
|
|
183
|
-
const createdData = new CreateContentModelGroupModel().populate(_objectSpread(_objectSpread({}, inputData), {}, {
|
|
184
|
-
slug: inputData.slug ? utils.toSlug(inputData.slug) : ""
|
|
185
|
-
}));
|
|
186
|
-
await createdData.validate();
|
|
187
|
-
const input = await createdData.toJSON();
|
|
188
|
-
const identity = context.security.getIdentity();
|
|
189
|
-
const id = (0, _mdbid.default)();
|
|
190
|
-
|
|
191
|
-
const data = _objectSpread(_objectSpread({}, input), {}, {
|
|
192
|
-
id,
|
|
193
|
-
locale: context.cms.getLocale().code,
|
|
194
|
-
createdOn: new Date().toISOString(),
|
|
195
|
-
savedOn: new Date().toISOString(),
|
|
196
|
-
createdBy: {
|
|
197
|
-
id: identity.id,
|
|
198
|
-
displayName: identity.displayName,
|
|
199
|
-
type: identity.type
|
|
200
|
-
}
|
|
334
|
+
await storageOperations.groups.delete({
|
|
335
|
+
group
|
|
201
336
|
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
await (0, _beforeCreate.beforeCreateHook)({
|
|
205
|
-
context,
|
|
206
|
-
storageOperations,
|
|
207
|
-
input,
|
|
208
|
-
data
|
|
209
|
-
});
|
|
210
|
-
const group = await storageOperations.create({
|
|
211
|
-
input,
|
|
212
|
-
data
|
|
213
|
-
});
|
|
214
|
-
await (0, _afterCreate.afterCreateHook)({
|
|
215
|
-
context,
|
|
216
|
-
storageOperations,
|
|
217
|
-
input,
|
|
218
|
-
group
|
|
219
|
-
});
|
|
220
|
-
return group;
|
|
221
|
-
} catch (ex) {
|
|
222
|
-
throw new _error.default(ex.message || "Could not save data model group.", ex.code || "ERROR_ON_CREATE", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
223
|
-
data,
|
|
224
|
-
input
|
|
225
|
-
}));
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
update: async (id, inputData) => {
|
|
229
|
-
const permission = await checkPermissions("w");
|
|
230
|
-
const group = await groupsGet(id);
|
|
231
|
-
utils.checkOwnership(context, permission, group);
|
|
232
|
-
const input = new UpdateContentModelGroupModel().populate(inputData);
|
|
233
|
-
await input.validate();
|
|
234
|
-
const updatedDataJson = await input.toJSON({
|
|
235
|
-
onlyDirty: true
|
|
236
|
-
}); // no need to continue if no values were changed
|
|
237
|
-
|
|
238
|
-
if (Object.keys(updatedDataJson).length === 0) {
|
|
239
|
-
return group;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const data = Object.assign(updatedDataJson, {
|
|
243
|
-
savedOn: new Date().toISOString()
|
|
337
|
+
await onAfterDelete.publish({
|
|
338
|
+
group
|
|
244
339
|
});
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
storageOperations,
|
|
250
|
-
group,
|
|
251
|
-
input,
|
|
252
|
-
data
|
|
253
|
-
});
|
|
254
|
-
const updatedGroup = await storageOperations.update({
|
|
255
|
-
group,
|
|
256
|
-
data,
|
|
257
|
-
input
|
|
258
|
-
});
|
|
259
|
-
await (0, _afterUpdate.afterUpdateHook)({
|
|
260
|
-
context,
|
|
261
|
-
storageOperations,
|
|
262
|
-
group: updatedGroup,
|
|
263
|
-
data,
|
|
264
|
-
input
|
|
265
|
-
});
|
|
266
|
-
return updatedGroup;
|
|
267
|
-
} catch (ex) {
|
|
268
|
-
throw new _error.default(ex.message, ex.code || "UPDATE_ERROR", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
269
|
-
group,
|
|
270
|
-
data,
|
|
271
|
-
input
|
|
272
|
-
}));
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
delete: async id => {
|
|
276
|
-
const permission = await checkPermissions("d");
|
|
277
|
-
const group = await groupsGet(id);
|
|
278
|
-
utils.checkOwnership(context, permission, group);
|
|
279
|
-
|
|
280
|
-
try {
|
|
281
|
-
await (0, _beforeDelete.beforeDeleteHook)({
|
|
282
|
-
context,
|
|
283
|
-
storageOperations,
|
|
284
|
-
group
|
|
285
|
-
});
|
|
286
|
-
await storageOperations.delete({
|
|
287
|
-
group
|
|
288
|
-
});
|
|
289
|
-
await (0, _afterDelete.afterDeleteHook)({
|
|
290
|
-
context,
|
|
291
|
-
storageOperations,
|
|
292
|
-
group
|
|
293
|
-
});
|
|
294
|
-
} catch (ex) {
|
|
295
|
-
throw new _error.default(ex.message, ex.code || "DELETE_ERROR", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
296
|
-
id
|
|
297
|
-
}));
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return true;
|
|
340
|
+
} catch (ex) {
|
|
341
|
+
throw new _error.default(ex.message, ex.code || "DELETE_ERROR", _objectSpread(_objectSpread({}, ex.data || {}), {}, {
|
|
342
|
+
id
|
|
343
|
+
}));
|
|
301
344
|
}
|
|
302
|
-
};
|
|
303
|
-
context.cms = _objectSpread(_objectSpread({}, context.cms || {}), {}, {
|
|
304
|
-
groups
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
345
|
|
|
308
|
-
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
};
|
|
309
350
|
|
|
310
|
-
exports.
|
|
311
|
-
//# sourceMappingURL=contentModelGroup.crud.js.map
|
|
351
|
+
exports.createModelGroupsCrud = createModelGroupsCrud;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContextPlugin } from "@webiny/handler/plugins/ContextPlugin";
|
|
2
|
+
import { CmsContext, HeadlessCmsStorageOperations } from "../../../types";
|
|
3
|
+
export interface Params {
|
|
4
|
+
storageOperations: HeadlessCmsStorageOperations;
|
|
5
|
+
}
|
|
6
|
+
export declare const createContentCruds: (params: Params) => ContextPlugin<CmsContext>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createContentCruds = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _ContextPlugin = require("@webiny/handler/plugins/ContextPlugin");
|
|
13
|
+
|
|
14
|
+
var _contentModelGroup = require("./contentModelGroup.crud");
|
|
15
|
+
|
|
16
|
+
var _contentModel = require("./contentModel.crud");
|
|
17
|
+
|
|
18
|
+
var _contentEntry = require("./contentEntry.crud");
|
|
19
|
+
|
|
20
|
+
var _system = require("../../../plugins/crud/system.crud");
|
|
21
|
+
|
|
22
|
+
var _settings = require("../../../plugins/crud/settings.crud");
|
|
23
|
+
|
|
24
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
+
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
|
+
|
|
28
|
+
const createContentCruds = params => {
|
|
29
|
+
const {
|
|
30
|
+
storageOperations
|
|
31
|
+
} = params;
|
|
32
|
+
return new _ContextPlugin.ContextPlugin(async context => {
|
|
33
|
+
/**
|
|
34
|
+
* This should never happen in the actual project.
|
|
35
|
+
* It is to make sure that we load setup context before the CRUD init in our internal code.
|
|
36
|
+
*/
|
|
37
|
+
if (!context.cms) {
|
|
38
|
+
console.log(`Missing initial "cms" on the context. Make sure that you set it up before creating Content CRUDs.`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const getLocale = () => {
|
|
43
|
+
return context.i18n.getCurrentLocale();
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const getIdentity = () => {
|
|
47
|
+
return context.security.getIdentity();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const getTenant = () => {
|
|
51
|
+
return context.tenancy.getCurrentTenant();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (storageOperations.plugins && storageOperations.plugins.length > 0) {
|
|
55
|
+
context.plugins.register(storageOperations.plugins);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
context.cms = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, context.cms), (0, _system.createSystemCrud)({
|
|
59
|
+
context,
|
|
60
|
+
getTenant,
|
|
61
|
+
getIdentity,
|
|
62
|
+
storageOperations
|
|
63
|
+
})), (0, _settings.createSettingsCrud)({
|
|
64
|
+
context,
|
|
65
|
+
getTenant,
|
|
66
|
+
getLocale,
|
|
67
|
+
storageOperations
|
|
68
|
+
})), (0, _contentModelGroup.createModelGroupsCrud)({
|
|
69
|
+
context,
|
|
70
|
+
getTenant,
|
|
71
|
+
getLocale,
|
|
72
|
+
getIdentity,
|
|
73
|
+
storageOperations
|
|
74
|
+
})), (0, _contentModel.createModelsCrud)({
|
|
75
|
+
context,
|
|
76
|
+
getLocale,
|
|
77
|
+
getTenant,
|
|
78
|
+
getIdentity,
|
|
79
|
+
storageOperations
|
|
80
|
+
})), (0, _contentEntry.createContentEntryCrud)({
|
|
81
|
+
context,
|
|
82
|
+
getLocale,
|
|
83
|
+
getTenant,
|
|
84
|
+
getIdentity,
|
|
85
|
+
storageOperations
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
if (!storageOperations.init) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
await storageOperations.init(context.cms);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
exports.createContentCruds = createContentCruds;
|
|
@@ -27,5 +27,4 @@ var _object = _interopRequireDefault(require("./object"));
|
|
|
27
27
|
|
|
28
28
|
var _default = () => [_text.default, _ref.default, _number.default, _datetime.default, _boolean.default, _longText.default, _richText.default, _file.default, _object.default];
|
|
29
29
|
|
|
30
|
-
exports.default = _default;
|
|
31
|
-
//# sourceMappingURL=index.js.map
|
|
30
|
+
exports.default = _default;
|