@webiny/api-headless-cms 0.0.0-mt-2 → 0.0.0-unstable.1e66d121db
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/context.d.ts +3 -0
- package/context.js +60 -0
- package/context.js.map +1 -0
- package/crud/contentEntry/afterDelete.d.ts +8 -0
- package/{content/plugins/crud → crud}/contentEntry/afterDelete.js +2 -2
- package/crud/contentEntry/afterDelete.js.map +1 -0
- package/crud/contentEntry/beforeCreate.d.ts +8 -0
- package/{content/plugins/crud → crud}/contentEntry/beforeCreate.js +2 -2
- package/crud/contentEntry/beforeCreate.js.map +1 -0
- package/crud/contentEntry/beforeUpdate.d.ts +8 -0
- package/{content/plugins/crud → crud}/contentEntry/beforeUpdate.js +2 -2
- package/crud/contentEntry/beforeUpdate.js.map +1 -0
- package/crud/contentEntry/entryDataValidation.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentEntry/entryDataValidation.js +23 -11
- package/crud/contentEntry/entryDataValidation.js.map +1 -0
- package/{content/plugins/crud → crud}/contentEntry/markLockedFields.d.ts +3 -2
- package/{content/plugins/crud → crud}/contentEntry/markLockedFields.js +10 -14
- package/crud/contentEntry/markLockedFields.js.map +1 -0
- package/crud/contentEntry/referenceFieldsMapping.d.ts +13 -0
- package/crud/contentEntry/referenceFieldsMapping.js +288 -0
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -0
- package/{content/plugins/crud → crud}/contentEntry.crud.d.ts +5 -9
- package/crud/contentEntry.crud.js +1255 -0
- package/crud/contentEntry.crud.js.map +1 -0
- package/crud/contentModel/afterCreate.d.ts +8 -0
- package/crud/contentModel/afterCreate.js +18 -0
- package/crud/contentModel/afterCreate.js.map +1 -0
- package/crud/contentModel/afterCreateFrom.d.ts +8 -0
- package/crud/contentModel/afterCreateFrom.js +18 -0
- package/crud/contentModel/afterCreateFrom.js.map +1 -0
- package/crud/contentModel/afterDelete.d.ts +8 -0
- package/crud/contentModel/afterDelete.js +18 -0
- package/crud/contentModel/afterDelete.js.map +1 -0
- package/crud/contentModel/afterUpdate.d.ts +8 -0
- package/crud/contentModel/afterUpdate.js +18 -0
- package/crud/contentModel/afterUpdate.js.map +1 -0
- package/crud/contentModel/beforeCreate.d.ts +15 -0
- package/{content/plugins/crud → crud}/contentModel/beforeCreate.js +61 -13
- package/crud/contentModel/beforeCreate.js.map +1 -0
- package/crud/contentModel/beforeDelete.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentModel/beforeDelete.js +14 -10
- package/crud/contentModel/beforeDelete.js.map +1 -0
- package/crud/contentModel/beforeUpdate.d.ts +10 -0
- package/crud/contentModel/beforeUpdate.js +37 -0
- package/crud/contentModel/beforeUpdate.js.map +1 -0
- package/crud/contentModel/contentModelManagerFactory.d.ts +2 -0
- package/{content/plugins/crud → crud}/contentModel/contentModelManagerFactory.js +0 -0
- package/crud/contentModel/contentModelManagerFactory.js.map +1 -0
- package/crud/contentModel/createFieldModels.d.ts +2 -0
- package/{content/plugins/crud → crud}/contentModel/createFieldModels.js +6 -2
- package/crud/contentModel/createFieldModels.js.map +1 -0
- package/crud/contentModel/createFieldStorageId.d.ts +2 -0
- package/crud/contentModel/createFieldStorageId.js +16 -0
- package/crud/contentModel/createFieldStorageId.js.map +1 -0
- package/crud/contentModel/fieldIdValidation.d.ts +1 -0
- package/crud/contentModel/fieldIdValidation.js +25 -0
- package/crud/contentModel/fieldIdValidation.js.map +1 -0
- package/crud/contentModel/idValidation.d.ts +1 -0
- package/{content/plugins/crud → crud}/contentModel/idValidation.js +3 -3
- package/crud/contentModel/idValidation.js.map +1 -0
- package/{content/plugins/crud → crud}/contentModel/models.d.ts +2 -1
- package/{content/plugins/crud → crud}/contentModel/models.js +64 -25
- package/crud/contentModel/models.js.map +1 -0
- package/crud/contentModel/systemFields.d.ts +1 -0
- package/crud/contentModel/systemFields.js +8 -0
- package/crud/contentModel/systemFields.js.map +1 -0
- package/crud/contentModel/validateLayout.d.ts +2 -0
- package/{content/plugins/crud → crud}/contentModel/validateLayout.js +1 -3
- package/crud/contentModel/validateLayout.js.map +1 -0
- package/crud/contentModel/validateModel.d.ts +9 -0
- package/crud/contentModel/validateModel.js +32 -0
- package/crud/contentModel/validateModel.js.map +1 -0
- package/crud/contentModel/validateModelFields.d.ts +9 -0
- package/crud/contentModel/validateModelFields.js +359 -0
- package/crud/contentModel/validateModelFields.js.map +1 -0
- package/{content/plugins/crud → crud}/contentModel.crud.d.ts +3 -3
- package/crud/contentModel.crud.js +590 -0
- package/crud/contentModel.crud.js.map +1 -0
- package/crud/contentModelGroup/beforeCreate.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentModelGroup/beforeCreate.js +9 -9
- package/crud/contentModelGroup/beforeCreate.js.map +1 -0
- package/crud/contentModelGroup/beforeDelete.d.ts +10 -0
- package/{content/plugins/crud → crud}/contentModelGroup/beforeDelete.js +4 -4
- package/crud/contentModelGroup/beforeDelete.js.map +1 -0
- package/crud/contentModelGroup/beforeUpdate.d.ts +9 -0
- package/{content/plugins/crud → crud}/contentModelGroup/beforeUpdate.js +3 -3
- package/crud/contentModelGroup/beforeUpdate.js.map +1 -0
- package/{content/plugins/crud → crud}/contentModelGroup.crud.d.ts +3 -3
- package/{content/plugins/crud → crud}/contentModelGroup.crud.js +108 -93
- package/crud/contentModelGroup.crud.js.map +1 -0
- package/crud/index.d.ts +6 -0
- package/crud/index.js +85 -0
- package/crud/index.js.map +1 -0
- package/{plugins/crud → crud}/settings.crud.d.ts +3 -3
- package/crud/settings.crud.js +83 -0
- package/crud/settings.crud.js.map +1 -0
- package/{plugins/crud → crud}/system.crud.d.ts +6 -3
- package/crud/system.crud.js +221 -0
- package/crud/system.crud.js.map +1 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.d.ts +7 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js +66 -0
- package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.d.ts +11 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +304 -0
- package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -0
- package/fieldConverters/index.d.ts +3 -0
- package/fieldConverters/index.js +16 -0
- package/fieldConverters/index.js.map +1 -0
- package/{content/plugins → graphql}/buildSchemaPlugins.d.ts +2 -3
- package/graphql/buildSchemaPlugins.js +27 -0
- package/graphql/buildSchemaPlugins.js.map +1 -0
- package/graphql/graphQLHandlerFactory.d.ts +5 -0
- package/graphql/graphQLHandlerFactory.js +158 -0
- package/graphql/graphQLHandlerFactory.js.map +1 -0
- package/graphql/index.d.ts +5 -0
- package/graphql/index.js +57 -0
- package/graphql/index.js.map +1 -0
- package/graphql/schema/baseContentSchema.d.ts +3 -0
- package/graphql/schema/baseContentSchema.js +76 -0
- package/graphql/schema/baseContentSchema.js.map +1 -0
- package/graphql/schema/contentEntries.d.ts +3 -0
- package/graphql/schema/contentEntries.js +351 -0
- package/graphql/schema/contentEntries.js.map +1 -0
- package/graphql/schema/contentModelGroups.d.ts +3 -0
- package/{content/plugins → graphql}/schema/contentModelGroups.js +34 -15
- package/graphql/schema/contentModelGroups.js.map +1 -0
- package/graphql/schema/contentModels.d.ts +3 -0
- package/{content/plugins → graphql}/schema/contentModels.js +47 -10
- package/graphql/schema/contentModels.js.map +1 -0
- package/graphql/schema/createFieldResolvers.d.ts +20 -0
- package/{content/plugins → graphql}/schema/createFieldResolvers.js +48 -23
- package/graphql/schema/createFieldResolvers.js.map +1 -0
- package/graphql/schema/createManageResolvers.d.ts +12 -0
- package/{content/plugins → graphql}/schema/createManageResolvers.js +36 -34
- package/graphql/schema/createManageResolvers.js.map +1 -0
- package/graphql/schema/createManageSDL.d.ts +10 -0
- package/{content/plugins → graphql}/schema/createManageSDL.js +23 -16
- package/graphql/schema/createManageSDL.js.map +1 -0
- package/graphql/schema/createPreviewResolvers.d.ts +12 -0
- package/graphql/schema/createPreviewResolvers.js +58 -0
- package/graphql/schema/createPreviewResolvers.js.map +1 -0
- package/graphql/schema/createReadResolvers.d.ts +12 -0
- package/graphql/schema/createReadResolvers.js +58 -0
- package/graphql/schema/createReadResolvers.js.map +1 -0
- package/graphql/schema/createReadSDL.d.ts +10 -0
- package/{content/plugins → graphql}/schema/createReadSDL.js +14 -8
- package/graphql/schema/createReadSDL.js.map +1 -0
- package/graphql/schema/resolvers/commonFieldResolvers.d.ts +6 -0
- package/{content/plugins → graphql}/schema/resolvers/commonFieldResolvers.js +0 -0
- package/graphql/schema/resolvers/commonFieldResolvers.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveCreate.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreate.js +2 -4
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +8 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreateFrom.js +2 -4
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveDelete.js +10 -8
- package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGet.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveGet.js +79 -0
- package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGetByIds.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetByIds.js +2 -4
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGetRevisions.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetRevisions.js +2 -4
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveList.d.ts +4 -0
- package/{content/plugins/schema/resolvers/read → graphql/schema/resolvers/manage}/resolveList.js +2 -4
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolvePublish.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolvePublish.js +0 -0
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveRepublish.d.ts +7 -0
- package/{content/plugins/schema/resolvers/manage/resolveGet.js → graphql/schema/resolvers/manage/resolveRepublish.js} +4 -4
- package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestChanges.d.ts +4 -3
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestChanges.js +2 -4
- package/graphql/schema/resolvers/manage/resolveRequestChanges.js.map +1 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestReview.d.ts +4 -3
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestReview.js +2 -4
- package/graphql/schema/resolvers/manage/resolveRequestReview.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveUnpublish.d.ts +7 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveUnpublish.js +0 -0
- package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +8 -0
- package/{content/plugins → graphql}/schema/resolvers/manage/resolveUpdate.js +2 -4
- package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -0
- package/graphql/schema/resolvers/preview/resolveGet.d.ts +4 -0
- package/graphql/schema/resolvers/preview/resolveGet.js +34 -0
- package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/preview/resolveList.d.ts +4 -0
- package/{content/plugins → graphql}/schema/resolvers/preview/resolveList.js +2 -4
- package/graphql/schema/resolvers/preview/resolveList.js.map +1 -0
- package/graphql/schema/resolvers/read/resolveGet.d.ts +4 -0
- package/graphql/schema/resolvers/read/resolveGet.js +34 -0
- package/graphql/schema/resolvers/read/resolveGet.js.map +1 -0
- package/graphql/schema/resolvers/read/resolveList.d.ts +4 -0
- package/{content/plugins/schema/resolvers/manage → graphql/schema/resolvers/read}/resolveList.js +2 -4
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -0
- package/{content/plugins → graphql}/schema/schemaPlugins.d.ts +1 -1
- package/{content/plugins → graphql}/schema/schemaPlugins.js +25 -6
- package/graphql/schema/schemaPlugins.js.map +1 -0
- package/graphql/system.d.ts +6 -0
- package/graphql/system.js +119 -0
- package/graphql/system.js.map +1 -0
- package/graphqlFields/boolean.d.ts +2 -0
- package/graphqlFields/boolean.js +69 -0
- package/graphqlFields/boolean.js.map +1 -0
- package/graphqlFields/datetime.d.ts +2 -0
- package/graphqlFields/datetime.js +95 -0
- package/graphqlFields/datetime.js.map +1 -0
- package/graphqlFields/file.d.ts +2 -0
- package/graphqlFields/file.js +50 -0
- package/graphqlFields/file.js.map +1 -0
- package/graphqlFields/helpers.d.ts +6 -0
- package/graphqlFields/helpers.js +49 -0
- package/graphqlFields/helpers.js.map +1 -0
- package/graphqlFields/index.d.ts +2 -0
- package/graphqlFields/index.js +28 -0
- package/graphqlFields/index.js.map +1 -0
- package/graphqlFields/longText.d.ts +2 -0
- package/graphqlFields/longText.js +63 -0
- package/graphqlFields/longText.js.map +1 -0
- package/graphqlFields/number.d.ts +2 -0
- package/graphqlFields/number.js +75 -0
- package/graphqlFields/number.js.map +1 -0
- package/graphqlFields/object.d.ts +2 -0
- package/graphqlFields/object.js +225 -0
- package/graphqlFields/object.js.map +1 -0
- package/graphqlFields/ref.d.ts +2 -0
- package/graphqlFields/ref.js +275 -0
- package/graphqlFields/ref.js.map +1 -0
- package/graphqlFields/richText.d.ts +2 -0
- package/graphqlFields/richText.js +56 -0
- package/graphqlFields/richText.js.map +1 -0
- package/graphqlFields/text.d.ts +2 -0
- package/graphqlFields/text.js +73 -0
- package/graphqlFields/text.js.map +1 -0
- package/index.d.ts +10 -12
- package/index.js +80 -37
- package/index.js.map +1 -0
- package/modelManager/DefaultCmsModelManager.d.ts +14 -0
- package/{content/plugins/modelManager → modelManager}/DefaultCmsModelManager.js +12 -10
- package/modelManager/DefaultCmsModelManager.js.map +1 -0
- package/modelManager/index.d.ts +2 -0
- package/{content/plugins/modelManager → modelManager}/index.js +3 -3
- package/modelManager/index.js.map +1 -0
- package/package.json +37 -36
- package/parameters/context.d.ts +2 -0
- package/parameters/context.js +22 -0
- package/parameters/context.js.map +1 -0
- package/parameters/header.d.ts +2 -0
- package/parameters/header.js +55 -0
- package/parameters/header.js.map +1 -0
- package/parameters/index.d.ts +4 -0
- package/parameters/index.js +57 -0
- package/parameters/index.js.map +1 -0
- package/parameters/manual.d.ts +6 -0
- package/parameters/manual.js +44 -0
- package/parameters/manual.js.map +1 -0
- package/parameters/path.d.ts +2 -0
- package/parameters/path.js +51 -0
- package/parameters/path.js.map +1 -0
- package/plugins/CmsGroupPlugin.d.ts +13 -0
- package/{content/plugins → plugins}/CmsGroupPlugin.js +9 -3
- package/plugins/CmsGroupPlugin.js.map +1 -0
- package/plugins/CmsModelFieldConverterPlugin.d.ts +14 -0
- package/plugins/CmsModelFieldConverterPlugin.js +17 -0
- package/plugins/CmsModelFieldConverterPlugin.js.map +1 -0
- package/plugins/CmsModelPlugin.d.ts +45 -0
- package/plugins/CmsModelPlugin.js +194 -0
- package/plugins/CmsModelPlugin.js.map +1 -0
- package/plugins/CmsParametersPlugin.d.ts +20 -0
- package/plugins/CmsParametersPlugin.js +28 -0
- package/plugins/CmsParametersPlugin.js.map +1 -0
- package/{content/plugins/storage → plugins}/StorageTransformPlugin.d.ts +4 -3
- package/{content/plugins/storage → plugins}/StorageTransformPlugin.js +2 -1
- package/plugins/StorageTransformPlugin.js.map +1 -0
- package/plugins/index.d.ts +5 -0
- package/plugins/index.js +70 -0
- package/plugins/index.js.map +1 -0
- package/storage/default.d.ts +2 -0
- package/storage/default.js +27 -0
- package/storage/default.js.map +1 -0
- package/storage/object.d.ts +2 -0
- package/storage/object.js +124 -0
- package/storage/object.js.map +1 -0
- package/types.d.ts +645 -348
- package/types.js +52 -2
- package/types.js.map +1 -0
- package/upgrades/5.33.0/index.d.ts +3 -0
- package/upgrades/5.33.0/index.js +182 -0
- package/upgrades/5.33.0/index.js.map +1 -0
- package/upgrades/index.d.ts +1 -0
- package/upgrades/index.js +12 -0
- package/upgrades/index.js.map +1 -0
- package/utils/access.d.ts +8 -0
- package/utils/access.js +90 -0
- package/utils/access.js.map +1 -0
- package/utils/converters/Converter.d.ts +27 -0
- package/utils/converters/Converter.js +71 -0
- package/utils/converters/Converter.js.map +1 -0
- package/utils/converters/ConverterCollection.d.ts +24 -0
- package/utils/converters/ConverterCollection.js +113 -0
- package/utils/converters/ConverterCollection.js.map +1 -0
- package/utils/converters/valueKeyStorageConverter.d.ts +18 -0
- package/utils/converters/valueKeyStorageConverter.js +148 -0
- package/utils/converters/valueKeyStorageConverter.js.map +1 -0
- package/{content/plugins/utils → utils}/createTypeName.d.ts +3 -3
- package/{content/plugins/utils → utils}/createTypeName.js +1 -1
- package/utils/createTypeName.js.map +1 -0
- package/{content/plugins/utils → utils}/entryStorage.d.ts +3 -3
- package/{content/plugins/utils → utils}/entryStorage.js +4 -12
- package/utils/entryStorage.js.map +1 -0
- package/utils/filterAsync.d.ts +1 -0
- package/utils/filterAsync.js +23 -0
- package/utils/filterAsync.js.map +1 -0
- package/utils/filterModelFields.d.ts +16 -0
- package/utils/filterModelFields.js +77 -0
- package/utils/filterModelFields.js.map +1 -0
- package/utils/getEntryTitle.d.ts +2 -0
- package/{content/plugins/utils → utils}/getEntryTitle.js +7 -6
- package/utils/getEntryTitle.js.map +1 -0
- package/utils/getSchemaFromFieldPlugins.d.ts +12 -0
- package/utils/getSchemaFromFieldPlugins.js +35 -0
- package/utils/getSchemaFromFieldPlugins.js.map +1 -0
- package/utils/ownership.d.ts +8 -0
- package/utils/ownership.js +41 -0
- package/utils/ownership.js.map +1 -0
- package/utils/permissions.d.ts +7 -0
- package/utils/permissions.js +106 -0
- package/utils/permissions.js.map +1 -0
- package/utils/pluralizedTypeName.d.ts +1 -0
- package/{content/plugins/utils → utils}/pluralizedTypeName.js +1 -1
- package/utils/pluralizedTypeName.js.map +1 -0
- package/utils/renderFields.d.ts +15 -0
- package/{content/plugins/utils → utils}/renderFields.js +4 -2
- package/utils/renderFields.js.map +1 -0
- package/utils/renderGetFilterFields.d.ts +10 -0
- package/{content/plugins/utils → utils}/renderGetFilterFields.js +28 -13
- package/utils/renderGetFilterFields.js.map +1 -0
- package/utils/renderInputFields.d.ts +14 -0
- package/{content/plugins/utils → utils}/renderInputFields.js +1 -1
- package/utils/renderInputFields.js.map +1 -0
- package/utils/renderListFilterFields.d.ts +11 -0
- package/{content/plugins/utils → utils}/renderListFilterFields.js +37 -17
- package/utils/renderListFilterFields.js.map +1 -0
- package/{content/plugins/utils → utils}/renderSortEnum.d.ts +1 -1
- package/utils/renderSortEnum.js +32 -0
- package/utils/renderSortEnum.js.map +1 -0
- package/utils/toSlug.d.ts +1 -0
- package/utils/toSlug.js +20 -0
- package/utils/toSlug.js.map +1 -0
- package/validators/dateGte.d.ts +2 -0
- package/{content/plugins/validators → validators}/dateGte.js +4 -4
- package/validators/dateGte.js.map +1 -0
- package/validators/dateLte.d.ts +2 -0
- package/{content/plugins/validators → validators}/dateLte.js +4 -4
- package/validators/dateLte.js.map +1 -0
- package/validators/gte.d.ts +2 -0
- package/validators/gte.js +36 -0
- package/validators/gte.js.map +1 -0
- package/validators/in.d.ts +2 -0
- package/validators/in.js +36 -0
- package/validators/in.js.map +1 -0
- package/validators/index.d.ts +1 -0
- package/validators/index.js +36 -0
- package/validators/index.js.map +1 -0
- package/validators/lte.d.ts +2 -0
- package/validators/lte.js +36 -0
- package/validators/lte.js.map +1 -0
- package/validators/maxLength.d.ts +2 -0
- package/validators/maxLength.js +36 -0
- package/validators/maxLength.js.map +1 -0
- package/validators/minLength.d.ts +2 -0
- package/validators/minLength.js +36 -0
- package/validators/minLength.js.map +1 -0
- package/validators/pattern.d.ts +2 -0
- package/validators/pattern.js +50 -0
- package/validators/pattern.js.map +1 -0
- package/validators/patternPlugins/email.d.ts +2 -0
- package/validators/patternPlugins/email.js +20 -0
- package/validators/patternPlugins/email.js.map +1 -0
- package/validators/patternPlugins/index.d.ts +2 -0
- package/validators/patternPlugins/index.js +24 -0
- package/validators/patternPlugins/index.js.map +1 -0
- package/validators/patternPlugins/lowerCase.d.ts +2 -0
- package/validators/patternPlugins/lowerCase.js +20 -0
- package/validators/patternPlugins/lowerCase.js.map +1 -0
- package/validators/patternPlugins/lowerCaseSpace.d.ts +2 -0
- package/validators/patternPlugins/lowerCaseSpace.js +20 -0
- package/validators/patternPlugins/lowerCaseSpace.js.map +1 -0
- package/validators/patternPlugins/upperCase.d.ts +2 -0
- package/validators/patternPlugins/upperCase.js +20 -0
- package/validators/patternPlugins/upperCase.js.map +1 -0
- package/validators/patternPlugins/upperCaseSpace.d.ts +2 -0
- package/validators/patternPlugins/upperCaseSpace.js +20 -0
- package/validators/patternPlugins/upperCaseSpace.js.map +1 -0
- package/validators/patternPlugins/url.d.ts +2 -0
- package/validators/patternPlugins/url.js +20 -0
- package/validators/patternPlugins/url.js.map +1 -0
- package/validators/required.d.ts +2 -0
- package/validators/required.js +27 -0
- package/validators/required.js.map +1 -0
- package/validators/timeGte.d.ts +2 -0
- package/{content/plugins/validators → validators}/timeGte.js +6 -4
- package/validators/timeGte.js.map +1 -0
- package/validators/timeLte.d.ts +2 -0
- package/{content/plugins/validators → validators}/timeLte.js +6 -4
- package/validators/timeLte.js.map +1 -0
- package/validators/unique.d.ts +6 -0
- package/validators/unique.js +63 -0
- package/validators/unique.js.map +1 -0
- package/content/contextSetup.d.ts +0 -4
- package/content/contextSetup.js +0 -65
- package/content/graphQLHandlerFactory.d.ts +0 -5
- package/content/graphQLHandlerFactory.js +0 -173
- package/content/plugins/CmsGroupPlugin.d.ts +0 -11
- package/content/plugins/CmsModelPlugin.d.ts +0 -11
- package/content/plugins/CmsModelPlugin.js +0 -24
- package/content/plugins/buildSchemaPlugins.js +0 -29
- package/content/plugins/crud/contentEntry/afterDelete.d.ts +0 -7
- package/content/plugins/crud/contentEntry/beforeCreate.d.ts +0 -7
- package/content/plugins/crud/contentEntry/beforeUpdate.d.ts +0 -7
- package/content/plugins/crud/contentEntry/entryDataValidation.d.ts +0 -4
- package/content/plugins/crud/contentEntry.crud.js +0 -931
- package/content/plugins/crud/contentModel/afterCreate.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterCreate.js +0 -18
- package/content/plugins/crud/contentModel/afterDelete.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterDelete.js +0 -18
- package/content/plugins/crud/contentModel/afterUpdate.d.ts +0 -7
- package/content/plugins/crud/contentModel/afterUpdate.js +0 -18
- package/content/plugins/crud/contentModel/beforeCreate.d.ts +0 -9
- package/content/plugins/crud/contentModel/beforeDelete.d.ts +0 -9
- package/content/plugins/crud/contentModel/beforeUpdate.d.ts +0 -9
- package/content/plugins/crud/contentModel/beforeUpdate.js +0 -128
- package/content/plugins/crud/contentModel/contentModelManagerFactory.d.ts +0 -2
- package/content/plugins/crud/contentModel/createFieldModels.d.ts +0 -2
- package/content/plugins/crud/contentModel/idValidation.d.ts +0 -2
- package/content/plugins/crud/contentModel/validateLayout.d.ts +0 -2
- package/content/plugins/crud/contentModel.crud.js +0 -425
- package/content/plugins/crud/contentModelGroup/beforeCreate.d.ts +0 -9
- package/content/plugins/crud/contentModelGroup/beforeDelete.d.ts +0 -9
- package/content/plugins/crud/contentModelGroup/beforeUpdate.d.ts +0 -8
- package/content/plugins/crud/index.d.ts +0 -6
- package/content/plugins/crud/index.js +0 -100
- package/content/plugins/graphqlFields/boolean.d.ts +0 -3
- package/content/plugins/graphqlFields/boolean.js +0 -69
- package/content/plugins/graphqlFields/datetime.d.ts +0 -3
- package/content/plugins/graphqlFields/datetime.js +0 -83
- package/content/plugins/graphqlFields/file.d.ts +0 -3
- package/content/plugins/graphqlFields/file.js +0 -49
- package/content/plugins/graphqlFields/index.d.ts +0 -2
- package/content/plugins/graphqlFields/index.js +0 -30
- package/content/plugins/graphqlFields/longText.d.ts +0 -3
- package/content/plugins/graphqlFields/longText.js +0 -62
- package/content/plugins/graphqlFields/number.d.ts +0 -3
- package/content/plugins/graphqlFields/number.js +0 -75
- package/content/plugins/graphqlFields/object.d.ts +0 -3
- package/content/plugins/graphqlFields/object.js +0 -180
- package/content/plugins/graphqlFields/ref.d.ts +0 -3
- package/content/plugins/graphqlFields/ref.js +0 -205
- package/content/plugins/graphqlFields/richText.d.ts +0 -3
- package/content/plugins/graphqlFields/richText.js +0 -55
- package/content/plugins/graphqlFields/text.d.ts +0 -3
- package/content/plugins/graphqlFields/text.js +0 -72
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.d.ts +0 -8
- package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js +0 -54
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.d.ts +0 -7
- package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js +0 -35
- package/content/plugins/modelManager/DefaultCmsModelManager.d.ts +0 -15
- package/content/plugins/modelManager/index.d.ts +0 -3
- package/content/plugins/schema/baseSchema.d.ts +0 -4
- package/content/plugins/schema/baseSchema.js +0 -98
- package/content/plugins/schema/contentEntries.d.ts +0 -4
- package/content/plugins/schema/contentEntries.js +0 -166
- package/content/plugins/schema/contentModelGroups.d.ts +0 -4
- package/content/plugins/schema/contentModels.d.ts +0 -4
- package/content/plugins/schema/createFieldResolvers.d.ts +0 -19
- package/content/plugins/schema/createManageResolvers.d.ts +0 -11
- package/content/plugins/schema/createManageSDL.d.ts +0 -9
- package/content/plugins/schema/createPreviewResolvers.d.ts +0 -10
- package/content/plugins/schema/createPreviewResolvers.js +0 -55
- package/content/plugins/schema/createReadResolvers.d.ts +0 -10
- package/content/plugins/schema/createReadResolvers.js +0 -55
- package/content/plugins/schema/createReadSDL.d.ts +0 -9
- package/content/plugins/schema/resolvers/commonFieldResolvers.d.ts +0 -6
- package/content/plugins/schema/resolvers/manage/resolveCreate.d.ts +0 -6
- package/content/plugins/schema/resolvers/manage/resolveCreateFrom.d.ts +0 -7
- package/content/plugins/schema/resolvers/manage/resolveDelete.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveGet.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveGetByIds.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveGetRevisions.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveList.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolvePublish.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveUnpublish.d.ts +0 -2
- package/content/plugins/schema/resolvers/manage/resolveUpdate.d.ts +0 -7
- package/content/plugins/schema/resolvers/preview/resolveGet.d.ts +0 -2
- package/content/plugins/schema/resolvers/preview/resolveGet.js +0 -38
- package/content/plugins/schema/resolvers/preview/resolveList.d.ts +0 -2
- package/content/plugins/schema/resolvers/read/resolveGet.d.ts +0 -2
- package/content/plugins/schema/resolvers/read/resolveGet.js +0 -38
- package/content/plugins/schema/resolvers/read/resolveList.d.ts +0 -2
- package/content/plugins/storage/default.d.ts +0 -3
- package/content/plugins/storage/default.js +0 -28
- package/content/plugins/storage/object.d.ts +0 -3
- package/content/plugins/storage/object.js +0 -119
- package/content/plugins/utils/getEntryTitle.d.ts +0 -2
- package/content/plugins/utils/getSchemaFromFieldPlugins.d.ts +0 -11
- package/content/plugins/utils/getSchemaFromFieldPlugins.js +0 -30
- package/content/plugins/utils/pluralizedTypeName.d.ts +0 -1
- package/content/plugins/utils/renderFields.d.ts +0 -16
- package/content/plugins/utils/renderGetFilterFields.d.ts +0 -9
- package/content/plugins/utils/renderInputFields.d.ts +0 -14
- package/content/plugins/utils/renderListFilterFields.d.ts +0 -10
- package/content/plugins/utils/renderSortEnum.js +0 -32
- package/content/plugins/validators/dateGte.d.ts +0 -3
- package/content/plugins/validators/dateLte.d.ts +0 -3
- package/content/plugins/validators/gte.d.ts +0 -3
- package/content/plugins/validators/gte.js +0 -32
- package/content/plugins/validators/in.d.ts +0 -3
- package/content/plugins/validators/in.js +0 -32
- package/content/plugins/validators/index.d.ts +0 -2
- package/content/plugins/validators/index.js +0 -36
- package/content/plugins/validators/lte.d.ts +0 -3
- package/content/plugins/validators/lte.js +0 -32
- package/content/plugins/validators/maxLength.d.ts +0 -3
- package/content/plugins/validators/maxLength.js +0 -32
- package/content/plugins/validators/minLength.d.ts +0 -3
- package/content/plugins/validators/minLength.js +0 -32
- package/content/plugins/validators/pattern.d.ts +0 -3
- package/content/plugins/validators/pattern.js +0 -47
- package/content/plugins/validators/patternPlugins/email.d.ts +0 -3
- package/content/plugins/validators/patternPlugins/email.js +0 -17
- package/content/plugins/validators/patternPlugins/index.d.ts +0 -2
- package/content/plugins/validators/patternPlugins/index.js +0 -19
- package/content/plugins/validators/patternPlugins/lowerCase.d.ts +0 -3
- package/content/plugins/validators/patternPlugins/lowerCase.js +0 -17
- package/content/plugins/validators/patternPlugins/upperCase.d.ts +0 -3
- package/content/plugins/validators/patternPlugins/upperCase.js +0 -17
- package/content/plugins/validators/patternPlugins/url.d.ts +0 -3
- package/content/plugins/validators/patternPlugins/url.js +0 -17
- package/content/plugins/validators/required.d.ts +0 -3
- package/content/plugins/validators/required.js +0 -25
- package/content/plugins/validators/timeGte.d.ts +0 -3
- package/content/plugins/validators/timeLte.d.ts +0 -3
- package/migrateCMSPermissions.d.ts +0 -17
- package/migrateCMSPermissions.js +0 -193
- package/plugins/context.d.ts +0 -4
- package/plugins/context.js +0 -34
- package/plugins/crud/index.d.ts +0 -6
- package/plugins/crud/index.js +0 -100
- package/plugins/crud/settings.crud.js +0 -93
- package/plugins/crud/system.crud.js +0 -182
- package/plugins/graphql/system.d.ts +0 -17
- package/plugins/graphql/system.js +0 -72
- package/plugins/graphql.d.ts +0 -2
- package/plugins/graphql.js +0 -79
- package/plugins/upgrades/index.d.ts +0 -2
- package/plugins/upgrades/index.js +0 -14
- package/plugins/upgrades/v5.5.0/helpers.d.ts +0 -6
- package/plugins/upgrades/v5.5.0/helpers.js +0 -10
- package/plugins/upgrades/v5.5.0/index.d.ts +0 -4
- package/plugins/upgrades/v5.5.0/index.js +0 -129
- package/transformers.d.ts +0 -2
- package/transformers.js +0 -25
- package/utils.d.ts +0 -25
- package/utils.js +0 -251
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,128 +0,0 @@
|
|
|
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,425 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createModelsCrud = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var utils = _interopRequireWildcard(require("../../../utils"));
|
|
13
|
-
|
|
14
|
-
var _dataloader = _interopRequireDefault(require("dataloader"));
|
|
15
|
-
|
|
16
|
-
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
17
|
-
|
|
18
|
-
var _contentModelManagerFactory = require("./contentModel/contentModelManagerFactory");
|
|
19
|
-
|
|
20
|
-
var _models = require("./contentModel/models");
|
|
21
|
-
|
|
22
|
-
var _createFieldModels = require("./contentModel/createFieldModels");
|
|
23
|
-
|
|
24
|
-
var _validateLayout = require("./contentModel/validateLayout");
|
|
25
|
-
|
|
26
|
-
var _apiSecurity = require("@webiny/api-security");
|
|
27
|
-
|
|
28
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
29
|
-
|
|
30
|
-
var _CmsModelPlugin = require("../CmsModelPlugin");
|
|
31
|
-
|
|
32
|
-
var _pubsub = require("@webiny/pubsub");
|
|
33
|
-
|
|
34
|
-
var _beforeCreate = require("./contentModel/beforeCreate");
|
|
35
|
-
|
|
36
|
-
var _beforeUpdate = require("./contentModel/beforeUpdate");
|
|
37
|
-
|
|
38
|
-
var _beforeDelete = require("./contentModel/beforeDelete");
|
|
39
|
-
|
|
40
|
-
var _afterCreate = require("./contentModel/afterCreate");
|
|
41
|
-
|
|
42
|
-
var _afterUpdate = require("./contentModel/afterUpdate");
|
|
43
|
-
|
|
44
|
-
var _afterDelete = require("./contentModel/afterDelete");
|
|
45
|
-
|
|
46
|
-
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); }
|
|
47
|
-
|
|
48
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
|
-
|
|
50
|
-
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; }
|
|
51
|
-
|
|
52
|
-
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; }
|
|
53
|
-
|
|
54
|
-
const createModelsCrud = params => {
|
|
55
|
-
const {
|
|
56
|
-
getTenant,
|
|
57
|
-
getIdentity,
|
|
58
|
-
getLocale,
|
|
59
|
-
storageOperations,
|
|
60
|
-
context
|
|
61
|
-
} = params;
|
|
62
|
-
const loaders = {
|
|
63
|
-
listModels: new _dataloader.default(async () => {
|
|
64
|
-
const models = await storageOperations.models.list({
|
|
65
|
-
where: {
|
|
66
|
-
tenant: getTenant().id,
|
|
67
|
-
locale: getLocale().code
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return [models.map(model => {
|
|
71
|
-
return _objectSpread(_objectSpread({}, model), {}, {
|
|
72
|
-
tenant: model.tenant || getTenant().id,
|
|
73
|
-
locale: model.locale || getLocale().code
|
|
74
|
-
});
|
|
75
|
-
})];
|
|
76
|
-
})
|
|
77
|
-
};
|
|
78
|
-
const managers = new Map();
|
|
79
|
-
|
|
80
|
-
const updateManager = async (context, model) => {
|
|
81
|
-
const manager = await (0, _contentModelManagerFactory.contentModelManagerFactory)(context, model);
|
|
82
|
-
managers.set(model.modelId, manager);
|
|
83
|
-
return manager;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const checkModelPermissions = check => {
|
|
87
|
-
return utils.checkPermissions(context, "cms.contentModel", {
|
|
88
|
-
rwd: check
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const getModelsAsPlugins = () => {
|
|
93
|
-
const tenant = getTenant().id;
|
|
94
|
-
const locale = getLocale().code;
|
|
95
|
-
return context.plugins.byType(_CmsModelPlugin.CmsModelPlugin.type)
|
|
96
|
-
/**
|
|
97
|
-
* We need to filter out models that are not for this tenant or locale.
|
|
98
|
-
* If it does not have tenant or locale define, it is for every locale and tenant
|
|
99
|
-
*/
|
|
100
|
-
.filter(plugin => {
|
|
101
|
-
const {
|
|
102
|
-
tenant: t,
|
|
103
|
-
locale: l
|
|
104
|
-
} = plugin.contentModel;
|
|
105
|
-
|
|
106
|
-
if (t && t !== tenant) {
|
|
107
|
-
return false;
|
|
108
|
-
} else if (l && l !== locale) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return true;
|
|
113
|
-
}).map(plugin => {
|
|
114
|
-
return _objectSpread(_objectSpread({}, plugin.contentModel), {}, {
|
|
115
|
-
tenant,
|
|
116
|
-
locale,
|
|
117
|
-
webinyVersion: context.WEBINY_VERSION
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const modelsGet = async modelId => {
|
|
123
|
-
const pluginModel = getModelsAsPlugins().find(model => model.modelId === modelId);
|
|
124
|
-
|
|
125
|
-
if (pluginModel) {
|
|
126
|
-
return pluginModel;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const model = await storageOperations.models.get({
|
|
130
|
-
tenant: getTenant().id,
|
|
131
|
-
locale: getLocale().code,
|
|
132
|
-
modelId
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
if (!model) {
|
|
136
|
-
throw new _handlerGraphql.NotFoundError(`Content model "${modelId}" was not found!`);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return _objectSpread(_objectSpread({}, model), {}, {
|
|
140
|
-
tenant: model.tenant || getTenant().id,
|
|
141
|
-
locale: model.locale || getLocale().code
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const modelsList = async () => {
|
|
146
|
-
const databaseModels = await loaders.listModels.load("listModels");
|
|
147
|
-
const pluginsModels = getModelsAsPlugins();
|
|
148
|
-
return databaseModels.concat(pluginsModels);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const listOperations = async () => {
|
|
152
|
-
const permission = await checkModelPermissions("r");
|
|
153
|
-
const models = await modelsList();
|
|
154
|
-
return utils.filterAsync(models, async model => {
|
|
155
|
-
if (!utils.validateOwnership(context, permission, model)) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return utils.validateModelAccess(context, model);
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const get = async modelId => {
|
|
164
|
-
const permission = await checkModelPermissions("r");
|
|
165
|
-
const model = await modelsGet(modelId);
|
|
166
|
-
utils.checkOwnership(context, permission, model);
|
|
167
|
-
await utils.checkModelAccess(context, model);
|
|
168
|
-
return model;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const getManager = async modelId => {
|
|
172
|
-
if (managers.has(modelId)) {
|
|
173
|
-
return managers.get(modelId);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const models = await modelsList();
|
|
177
|
-
const model = models.find(m => m.modelId === modelId);
|
|
178
|
-
|
|
179
|
-
if (!model) {
|
|
180
|
-
throw new _handlerGraphql.NotFoundError(`There is no content model "${modelId}".`);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return await updateManager(context, model);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const onBeforeCreate = (0, _pubsub.createTopic)();
|
|
187
|
-
const onAfterCreate = (0, _pubsub.createTopic)();
|
|
188
|
-
const onBeforeUpdate = (0, _pubsub.createTopic)();
|
|
189
|
-
const onAfterUpdate = (0, _pubsub.createTopic)();
|
|
190
|
-
const onBeforeDelete = (0, _pubsub.createTopic)();
|
|
191
|
-
const onAfterDelete = (0, _pubsub.createTopic)();
|
|
192
|
-
/**
|
|
193
|
-
* We need to assign some default behaviors.
|
|
194
|
-
*/
|
|
195
|
-
|
|
196
|
-
(0, _beforeCreate.assignBeforeModelCreate)({
|
|
197
|
-
onBeforeCreate,
|
|
198
|
-
plugins: context.plugins,
|
|
199
|
-
storageOperations
|
|
200
|
-
});
|
|
201
|
-
(0, _afterCreate.assignAfterModelCreate)({
|
|
202
|
-
context,
|
|
203
|
-
onAfterCreate
|
|
204
|
-
});
|
|
205
|
-
(0, _beforeUpdate.assignBeforeModelUpdate)({
|
|
206
|
-
onBeforeUpdate,
|
|
207
|
-
plugins: context.plugins,
|
|
208
|
-
storageOperations
|
|
209
|
-
});
|
|
210
|
-
(0, _afterUpdate.assignAfterModelUpdate)({
|
|
211
|
-
context,
|
|
212
|
-
onAfterUpdate
|
|
213
|
-
});
|
|
214
|
-
(0, _beforeDelete.assignBeforeModelDelete)({
|
|
215
|
-
onBeforeDelete,
|
|
216
|
-
plugins: context.plugins,
|
|
217
|
-
storageOperations
|
|
218
|
-
});
|
|
219
|
-
(0, _afterDelete.assignAfterModelDelete)({
|
|
220
|
-
context,
|
|
221
|
-
onAfterDelete
|
|
222
|
-
});
|
|
223
|
-
return {
|
|
224
|
-
onBeforeModelCreate: onBeforeCreate,
|
|
225
|
-
onAfterModelCreate: onAfterCreate,
|
|
226
|
-
onBeforeModelUpdate: onBeforeUpdate,
|
|
227
|
-
onAfterModelUpdate: onAfterUpdate,
|
|
228
|
-
onBeforeModelDelete: onBeforeDelete,
|
|
229
|
-
onAfterModelDelete: onAfterDelete,
|
|
230
|
-
silentAuthModel: () => {
|
|
231
|
-
return {
|
|
232
|
-
list: async () => {
|
|
233
|
-
try {
|
|
234
|
-
return await listOperations();
|
|
235
|
-
} catch (ex) {
|
|
236
|
-
if (ex instanceof _apiSecurity.NotAuthorizedError) {
|
|
237
|
-
return [];
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
throw ex;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
},
|
|
245
|
-
getModel: get,
|
|
246
|
-
listModels: listOperations,
|
|
247
|
-
|
|
248
|
-
async createModel(inputData) {
|
|
249
|
-
await checkModelPermissions("w");
|
|
250
|
-
const createdData = new _models.CreateContentModelModel().populate(inputData);
|
|
251
|
-
await createdData.validate();
|
|
252
|
-
const input = await createdData.toJSON();
|
|
253
|
-
context.security.disableAuthorization();
|
|
254
|
-
const group = await context.cms.getGroup(input.group);
|
|
255
|
-
context.security.enableAuthorization();
|
|
256
|
-
|
|
257
|
-
if (!group) {
|
|
258
|
-
throw new _handlerGraphql.NotFoundError(`There is no group "${input.group}".`);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
const identity = getIdentity();
|
|
262
|
-
|
|
263
|
-
const model = _objectSpread(_objectSpread({}, input), {}, {
|
|
264
|
-
titleFieldId: "id",
|
|
265
|
-
locale: getLocale().code,
|
|
266
|
-
tenant: getTenant().id,
|
|
267
|
-
group: {
|
|
268
|
-
id: group.id,
|
|
269
|
-
name: group.name
|
|
270
|
-
},
|
|
271
|
-
createdBy: {
|
|
272
|
-
id: identity.id,
|
|
273
|
-
displayName: identity.displayName,
|
|
274
|
-
type: identity.type
|
|
275
|
-
},
|
|
276
|
-
createdOn: new Date().toISOString(),
|
|
277
|
-
savedOn: new Date().toISOString(),
|
|
278
|
-
fields: [],
|
|
279
|
-
lockedFields: [],
|
|
280
|
-
layout: [],
|
|
281
|
-
webinyVersion: context.WEBINY_VERSION
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
await onBeforeCreate.publish({
|
|
285
|
-
model,
|
|
286
|
-
input
|
|
287
|
-
});
|
|
288
|
-
const createdModel = await storageOperations.models.create({
|
|
289
|
-
input,
|
|
290
|
-
model
|
|
291
|
-
});
|
|
292
|
-
loaders.listModels.clearAll();
|
|
293
|
-
await updateManager(context, model);
|
|
294
|
-
await onAfterCreate.publish({
|
|
295
|
-
input,
|
|
296
|
-
model: createdModel
|
|
297
|
-
});
|
|
298
|
-
return createdModel;
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Method does not check for permissions or ownership.
|
|
303
|
-
* @internal
|
|
304
|
-
*/
|
|
305
|
-
async updateModelDirect(params) {
|
|
306
|
-
const {
|
|
307
|
-
model: initialModel,
|
|
308
|
-
original
|
|
309
|
-
} = params;
|
|
310
|
-
|
|
311
|
-
const model = _objectSpread(_objectSpread({}, initialModel), {}, {
|
|
312
|
-
tenant: initialModel.tenant || getTenant().id,
|
|
313
|
-
locale: initialModel.locale || getLocale().code,
|
|
314
|
-
webinyVersion: context.WEBINY_VERSION
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
await onBeforeUpdate.publish({
|
|
318
|
-
input: {},
|
|
319
|
-
original,
|
|
320
|
-
model
|
|
321
|
-
});
|
|
322
|
-
const resultModel = await storageOperations.models.update({
|
|
323
|
-
original,
|
|
324
|
-
model,
|
|
325
|
-
input: {}
|
|
326
|
-
});
|
|
327
|
-
await updateManager(context, resultModel);
|
|
328
|
-
loaders.listModels.clearAll();
|
|
329
|
-
await onAfterUpdate.publish({
|
|
330
|
-
input: {},
|
|
331
|
-
original,
|
|
332
|
-
model: resultModel
|
|
333
|
-
});
|
|
334
|
-
return resultModel;
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
async updateModel(modelId, inputData) {
|
|
338
|
-
await checkModelPermissions("w"); // Get a model record; this will also perform ownership validation.
|
|
339
|
-
|
|
340
|
-
const original = await get(modelId);
|
|
341
|
-
const updatedData = new _models.UpdateContentModelModel().populate(inputData);
|
|
342
|
-
await updatedData.validate();
|
|
343
|
-
const input = await updatedData.toJSON({
|
|
344
|
-
onlyDirty: true
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
if (Object.keys(input).length === 0) {
|
|
348
|
-
return {};
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (input.group) {
|
|
352
|
-
context.security.disableAuthorization();
|
|
353
|
-
const group = await context.cms.getGroup(input.group);
|
|
354
|
-
context.security.enableAuthorization();
|
|
355
|
-
|
|
356
|
-
if (!group) {
|
|
357
|
-
throw new _handlerGraphql.NotFoundError(`There is no group "${input.group}".`);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
input.group = {
|
|
361
|
-
id: group.id,
|
|
362
|
-
name: group.name
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
const modelFields = await (0, _createFieldModels.createFieldModels)(original, inputData);
|
|
367
|
-
(0, _validateLayout.validateLayout)(input, modelFields);
|
|
368
|
-
|
|
369
|
-
const model = _objectSpread(_objectSpread(_objectSpread({}, original), input), {}, {
|
|
370
|
-
tenant: original.tenant || getTenant().id,
|
|
371
|
-
locale: original.locale || getLocale().code,
|
|
372
|
-
webinyVersion: context.WEBINY_VERSION,
|
|
373
|
-
fields: modelFields,
|
|
374
|
-
savedOn: new Date().toISOString()
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
await onBeforeUpdate.publish({
|
|
378
|
-
input,
|
|
379
|
-
original,
|
|
380
|
-
model
|
|
381
|
-
});
|
|
382
|
-
const resultModel = await storageOperations.models.update({
|
|
383
|
-
original,
|
|
384
|
-
model,
|
|
385
|
-
input
|
|
386
|
-
});
|
|
387
|
-
await updateManager(context, resultModel);
|
|
388
|
-
await onAfterUpdate.publish({
|
|
389
|
-
original,
|
|
390
|
-
model: resultModel,
|
|
391
|
-
input
|
|
392
|
-
});
|
|
393
|
-
return resultModel;
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
async deleteModel(modelId) {
|
|
397
|
-
await checkModelPermissions("d");
|
|
398
|
-
const model = await get(modelId);
|
|
399
|
-
await onBeforeDelete.publish({
|
|
400
|
-
model
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
try {
|
|
404
|
-
await storageOperations.models.delete({
|
|
405
|
-
model
|
|
406
|
-
});
|
|
407
|
-
} catch (ex) {
|
|
408
|
-
throw new _error.default(ex.message || "Could not delete the content model", ex.code || "CONTENT_MODEL_DELETE_ERROR", {
|
|
409
|
-
error: ex,
|
|
410
|
-
modelId: model.modelId
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
await onAfterDelete.publish({
|
|
415
|
-
model
|
|
416
|
-
});
|
|
417
|
-
managers.delete(model.modelId);
|
|
418
|
-
},
|
|
419
|
-
|
|
420
|
-
getModelManager: getManager,
|
|
421
|
-
getManagers: () => managers
|
|
422
|
-
};
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
exports.createModelsCrud = createModelsCrud;
|