@webiny/api-headless-cms 0.0.0-ee-vpcs.549378cf03
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/LICENSE +21 -0
- package/README.md +73 -0
- 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/crud/contentEntry/afterDelete.js +41 -0
- package/crud/contentEntry/afterDelete.js.map +1 -0
- package/crud/contentEntry/beforeCreate.d.ts +8 -0
- package/crud/contentEntry/beforeCreate.js +28 -0
- package/crud/contentEntry/beforeCreate.js.map +1 -0
- package/crud/contentEntry/beforeUpdate.d.ts +8 -0
- package/crud/contentEntry/beforeUpdate.js +28 -0
- package/crud/contentEntry/beforeUpdate.js.map +1 -0
- package/crud/contentEntry/entryDataValidation.d.ts +10 -0
- package/crud/contentEntry/entryDataValidation.js +200 -0
- package/crud/contentEntry/entryDataValidation.js.map +1 -0
- package/crud/contentEntry/markLockedFields.d.ts +13 -0
- package/crud/contentEntry/markLockedFields.js +116 -0
- package/crud/contentEntry/markLockedFields.js.map +1 -0
- package/crud/contentEntry/referenceFieldsMapping.d.ts +13 -0
- package/crud/contentEntry/referenceFieldsMapping.js +292 -0
- package/crud/contentEntry/referenceFieldsMapping.js.map +1 -0
- package/crud/contentEntry/searchableFields.d.ts +9 -0
- package/crud/contentEntry/searchableFields.js +83 -0
- package/crud/contentEntry/searchableFields.js.map +1 -0
- package/crud/contentEntry.crud.d.ts +13 -0
- package/crud/contentEntry.crud.js +1277 -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/crud/contentModel/beforeCreate.js +194 -0
- package/crud/contentModel/beforeCreate.js.map +1 -0
- package/crud/contentModel/beforeDelete.d.ts +10 -0
- package/crud/contentModel/beforeDelete.js +60 -0
- 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/crud/contentModel/contentModelManagerFactory.js +29 -0
- package/crud/contentModel/contentModelManagerFactory.js.map +1 -0
- package/crud/contentModel/createFieldModels.d.ts +2 -0
- package/crud/contentModel/createFieldModels.js +26 -0
- package/crud/contentModel/createFieldModels.js.map +1 -0
- package/crud/contentModel/createFieldStorageId.d.ts +2 -0
- package/crud/contentModel/createFieldStorageId.js +20 -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/crud/contentModel/idValidation.js +22 -0
- package/crud/contentModel/idValidation.js.map +1 -0
- package/crud/contentModel/models.d.ts +4 -0
- package/crud/contentModel/models.js +192 -0
- 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/crud/contentModel/validateLayout.js +36 -0
- 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 +371 -0
- package/crud/contentModel/validateModelFields.js.map +1 -0
- package/crud/contentModel.crud.d.ts +12 -0
- package/crud/contentModel.crud.js +650 -0
- package/crud/contentModel.crud.js.map +1 -0
- package/crud/contentModelGroup/beforeCreate.d.ts +10 -0
- package/crud/contentModelGroup/beforeCreate.js +66 -0
- package/crud/contentModelGroup/beforeCreate.js.map +1 -0
- package/crud/contentModelGroup/beforeDelete.d.ts +10 -0
- package/crud/contentModelGroup/beforeDelete.js +48 -0
- package/crud/contentModelGroup/beforeDelete.js.map +1 -0
- package/crud/contentModelGroup/beforeUpdate.d.ts +9 -0
- package/crud/contentModelGroup/beforeUpdate.js +28 -0
- package/crud/contentModelGroup/beforeUpdate.js.map +1 -0
- package/crud/contentModelGroup.crud.d.ts +12 -0
- package/crud/contentModelGroup.crud.js +396 -0
- 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/crud/settings.crud.d.ts +10 -0
- package/crud/settings.crud.js +83 -0
- package/crud/settings.crud.js.map +1 -0
- package/crud/system.crud.d.ts +13 -0
- 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/CmsModelDynamicZoneFieldConverterPlugin.d.ts +11 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +239 -0
- package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.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 +4 -0
- package/fieldConverters/index.js +18 -0
- package/fieldConverters/index.js.map +1 -0
- package/graphql/buildSchemaPlugins.d.ts +6 -0
- package/graphql/buildSchemaPlugins.js +27 -0
- package/graphql/buildSchemaPlugins.js.map +1 -0
- package/graphql/graphQLHandlerFactory.d.ts +5 -0
- package/graphql/graphQLHandlerFactory.js +202 -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/graphql/schema/contentModelGroups.js +172 -0
- package/graphql/schema/contentModelGroups.js.map +1 -0
- package/graphql/schema/contentModels.d.ts +3 -0
- package/graphql/schema/contentModels.js +300 -0
- package/graphql/schema/contentModels.js.map +1 -0
- package/graphql/schema/createFieldResolvers.d.ts +20 -0
- package/graphql/schema/createFieldResolvers.js +121 -0
- package/graphql/schema/createFieldResolvers.js.map +1 -0
- package/graphql/schema/createManageResolvers.d.ts +12 -0
- package/graphql/schema/createManageResolvers.js +137 -0
- package/graphql/schema/createManageResolvers.js.map +1 -0
- package/graphql/schema/createManageSDL.d.ts +10 -0
- package/graphql/schema/createManageSDL.js +161 -0
- 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/graphql/schema/createReadSDL.js +104 -0
- package/graphql/schema/createReadSDL.js.map +1 -0
- package/graphql/schema/resolvers/commonFieldResolvers.d.ts +6 -0
- package/graphql/schema/resolvers/commonFieldResolvers.js +14 -0
- package/graphql/schema/resolvers/commonFieldResolvers.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveCreate.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveCreate.js +21 -0
- package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +8 -0
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js +21 -0
- package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveDelete.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveDelete.js +32 -0
- 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/graphql/schema/resolvers/manage/resolveGetByIds.js +21 -0
- package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveGetRevisions.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js +21 -0
- package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveList.d.ts +4 -0
- package/graphql/schema/resolvers/manage/resolveList.js +21 -0
- package/graphql/schema/resolvers/manage/resolveList.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolvePublish.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolvePublish.js +21 -0
- package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveRepublish.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveRepublish.js +21 -0
- package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveUnpublish.d.ts +7 -0
- package/graphql/schema/resolvers/manage/resolveUnpublish.js +21 -0
- package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -0
- package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +8 -0
- package/graphql/schema/resolvers/manage/resolveUpdate.js +21 -0
- 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/graphql/schema/resolvers/preview/resolveList.js +21 -0
- 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/graphql/schema/resolvers/read/resolveList.js +21 -0
- package/graphql/schema/resolvers/read/resolveList.js.map +1 -0
- package/graphql/schema/schemaPlugins.d.ts +3 -0
- package/graphql/schema/schemaPlugins.js +111 -0
- 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/dynamicZone/dynamicZoneField.d.ts +2 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js +234 -0
- package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +3 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js +79 -0
- package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -0
- package/graphqlFields/dynamicZone/index.d.ts +2 -0
- package/graphqlFields/dynamicZone/index.js +21 -0
- package/graphqlFields/dynamicZone/index.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 +30 -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 +79 -0
- package/graphqlFields/number.js.map +1 -0
- package/graphqlFields/object.d.ts +2 -0
- package/graphqlFields/object.js +275 -0
- package/graphqlFields/object.js.map +1 -0
- package/graphqlFields/ref.d.ts +2 -0
- package/graphqlFields/ref.js +257 -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 -0
- package/index.js +111 -0
- package/index.js.map +1 -0
- package/modelManager/DefaultCmsModelManager.d.ts +14 -0
- package/modelManager/DefaultCmsModelManager.js +64 -0
- package/modelManager/DefaultCmsModelManager.js.map +1 -0
- package/modelManager/index.d.ts +2 -0
- package/modelManager/index.js +20 -0
- package/modelManager/index.js.map +1 -0
- package/package.json +81 -0
- 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/plugins/CmsGroupPlugin.js +30 -0
- 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/plugins/StorageTransformPlugin.d.ts +31 -0
- package/plugins/StorageTransformPlugin.js +37 -0
- 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 +127 -0
- package/storage/object.js.map +1 -0
- package/types.d.ts +2600 -0
- package/types.js +459 -0
- 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 +31 -0
- package/utils/converters/ConverterCollection.js +143 -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/utils/createTypeFromFields.d.ts +15 -0
- package/utils/createTypeFromFields.js +75 -0
- package/utils/createTypeFromFields.js.map +1 -0
- package/utils/createTypeName.d.ts +3 -0
- package/utils/createTypeName.js +30 -0
- package/utils/createTypeName.js.map +1 -0
- package/utils/entryStorage.d.ts +17 -0
- package/utils/entryStorage.js +120 -0
- 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/getBaseFieldType.d.ts +4 -0
- package/utils/getBaseFieldType.js +12 -0
- package/utils/getBaseFieldType.js.map +1 -0
- package/utils/getEntryTitle.d.ts +2 -0
- package/utils/getEntryTitle.js +43 -0
- 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/utils/pluralizedTypeName.js +26 -0
- package/utils/pluralizedTypeName.js.map +1 -0
- package/utils/renderFields.d.ts +15 -0
- package/utils/renderFields.js +55 -0
- package/utils/renderFields.js.map +1 -0
- package/utils/renderGetFilterFields.d.ts +10 -0
- package/utils/renderGetFilterFields.js +61 -0
- package/utils/renderGetFilterFields.js.map +1 -0
- package/utils/renderInputFields.d.ts +14 -0
- package/utils/renderInputFields.js +55 -0
- package/utils/renderInputFields.js.map +1 -0
- package/utils/renderListFilterFields.d.ts +11 -0
- package/utils/renderListFilterFields.js +62 -0
- package/utils/renderListFilterFields.js.map +1 -0
- package/utils/renderSortEnum.d.ts +9 -0
- package/utils/renderSortEnum.js +34 -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/validators/dateGte.js +37 -0
- package/validators/dateGte.js.map +1 -0
- package/validators/dateLte.d.ts +2 -0
- package/validators/dateLte.js +37 -0
- package/validators/dateLte.js.map +1 -0
- package/validators/dynamicZone.d.ts +2 -0
- package/validators/dynamicZone.js +24 -0
- package/validators/dynamicZone.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 +38 -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/validators/timeGte.js +34 -0
- package/validators/timeGte.js.map +1 -0
- package/validators/timeLte.d.ts +2 -0
- package/validators/timeLte.js +34 -0
- 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/types.d.ts
ADDED
|
@@ -0,0 +1,2600 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins/types";
|
|
2
|
+
import { I18NContext, I18NLocale } from "@webiny/api-i18n/types";
|
|
3
|
+
import { Context } from "@webiny/api/types";
|
|
4
|
+
import { GraphQLFieldResolver, GraphQLSchemaDefinition, Resolvers } from "@webiny/handler-graphql/types";
|
|
5
|
+
import { SecurityPermission } from "@webiny/api-security/types";
|
|
6
|
+
import { DbContext } from "@webiny/handler-db/types";
|
|
7
|
+
import { FileManagerContext } from "@webiny/api-file-manager/types";
|
|
8
|
+
import { UpgradePlugin } from "@webiny/api-upgrade/types";
|
|
9
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
10
|
+
import { CmsModelConverterCallable } from "./utils/converters/ConverterCollection";
|
|
11
|
+
export declare type ApiEndpoint = "manage" | "preview" | "read";
|
|
12
|
+
export interface HeadlessCms extends CmsSettingsContext, CmsSystemContext, CmsGroupContext, CmsModelContext, CmsEntryContext {
|
|
13
|
+
/**
|
|
14
|
+
* API type
|
|
15
|
+
*/
|
|
16
|
+
type: ApiEndpoint | null;
|
|
17
|
+
/**
|
|
18
|
+
* Requested locale
|
|
19
|
+
*/
|
|
20
|
+
locale: string;
|
|
21
|
+
/**
|
|
22
|
+
* returns an instance of current locale
|
|
23
|
+
*/
|
|
24
|
+
getLocale: () => I18NLocale;
|
|
25
|
+
/**
|
|
26
|
+
* Means this request is a READ API
|
|
27
|
+
*/
|
|
28
|
+
READ: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Means this request is a MANAGE API
|
|
31
|
+
*/
|
|
32
|
+
MANAGE: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Means this request is a PREVIEW API
|
|
35
|
+
*/
|
|
36
|
+
PREVIEW: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The storage operations loaded for current context.
|
|
39
|
+
*/
|
|
40
|
+
storageOperations: HeadlessCmsStorageOperations;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @description This combines all contexts used in the CMS into a single one.
|
|
44
|
+
*
|
|
45
|
+
* @category Context
|
|
46
|
+
*/
|
|
47
|
+
export interface CmsContext extends Context, DbContext, I18NContext, FileManagerContext {
|
|
48
|
+
cms: HeadlessCms;
|
|
49
|
+
}
|
|
50
|
+
interface CmsModelFieldPredefinedValuesValue {
|
|
51
|
+
value: string;
|
|
52
|
+
label: string;
|
|
53
|
+
/**
|
|
54
|
+
* Default selected predefined value.
|
|
55
|
+
*/
|
|
56
|
+
selected?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Object containing content model field predefined options and values.
|
|
60
|
+
*
|
|
61
|
+
* @category CmsModelField
|
|
62
|
+
*/
|
|
63
|
+
export interface CmsModelFieldPredefinedValues {
|
|
64
|
+
/**
|
|
65
|
+
* Are predefined field values enabled?
|
|
66
|
+
*/
|
|
67
|
+
enabled: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Predefined values array.
|
|
70
|
+
*/
|
|
71
|
+
values: CmsModelFieldPredefinedValuesValue[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Object containing content model field renderer options.
|
|
75
|
+
*
|
|
76
|
+
* @category CmsModelField
|
|
77
|
+
*/
|
|
78
|
+
interface CmsModelFieldRenderer {
|
|
79
|
+
/**
|
|
80
|
+
* Name of the field renderer. Must have one in field renderer plugins.
|
|
81
|
+
* Can be blank to let automatically determine the renderer.
|
|
82
|
+
*/
|
|
83
|
+
name: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A definition for content model field settings.
|
|
87
|
+
*
|
|
88
|
+
* @category ModelField
|
|
89
|
+
* @category Database model
|
|
90
|
+
*/
|
|
91
|
+
export interface CmsModelFieldSettings {
|
|
92
|
+
/**
|
|
93
|
+
* Predefined values (text, number)
|
|
94
|
+
* The default value for the field in case it is not predefined values field.
|
|
95
|
+
*/
|
|
96
|
+
defaultValue?: string | number | null | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Object field has child fields.
|
|
99
|
+
*/
|
|
100
|
+
fields?: CmsModelField[];
|
|
101
|
+
/**
|
|
102
|
+
* Object field has child fields - so it needs to have a layout.
|
|
103
|
+
*/
|
|
104
|
+
layout?: string[][];
|
|
105
|
+
/**
|
|
106
|
+
* Ref field.
|
|
107
|
+
*/
|
|
108
|
+
models?: Pick<CmsModel, "modelId">[];
|
|
109
|
+
/**
|
|
110
|
+
* Date field.
|
|
111
|
+
*/
|
|
112
|
+
type?: string;
|
|
113
|
+
/**
|
|
114
|
+
* There are a lot of other settings that are possible to add, so we keep the type opened.
|
|
115
|
+
*/
|
|
116
|
+
[key: string]: any;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A definition for content model field. This type exists on the app side as well.
|
|
120
|
+
*
|
|
121
|
+
* @category ModelField
|
|
122
|
+
* @category Database model
|
|
123
|
+
*/
|
|
124
|
+
export interface CmsModelField {
|
|
125
|
+
/**
|
|
126
|
+
* A generated unique ID for the model field.
|
|
127
|
+
* MUST be absolute unique throughout the models.
|
|
128
|
+
* Must be in form of a-zA-Z0-9.
|
|
129
|
+
*
|
|
130
|
+
* We generate a unique id value when you're building a model via UI,
|
|
131
|
+
* but when user is creating a model via a plugin it is up to them to be careful about this.
|
|
132
|
+
*/
|
|
133
|
+
id: string;
|
|
134
|
+
/**
|
|
135
|
+
* A type of the field.
|
|
136
|
+
* We are defining our built-in fields, so people know which are available by the default.
|
|
137
|
+
*/
|
|
138
|
+
type: "boolean" | "datetime" | "file" | "long-text" | "number" | "object" | "ref" | "rich-text" | "text" | "dynamicZone" | string;
|
|
139
|
+
/**
|
|
140
|
+
* A unique storage ID for storing actual values.
|
|
141
|
+
* Must in form of a-zA-Z0-9@a-zA-Z0-9@a-zA-Z0-9.
|
|
142
|
+
*
|
|
143
|
+
* This is an auto-generated value: uses `id` and `type`
|
|
144
|
+
*
|
|
145
|
+
* This is used as path for the entry value.
|
|
146
|
+
*
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
storageId: string;
|
|
150
|
+
/**
|
|
151
|
+
* Field identifier for the model field that will be available to the outside world.
|
|
152
|
+
* `storageId` is used as path (or column) to store the data.
|
|
153
|
+
*
|
|
154
|
+
* Must in form of a-zA-Z0-9.
|
|
155
|
+
*
|
|
156
|
+
* This value MUST be unique in the CmsModel.
|
|
157
|
+
*/
|
|
158
|
+
fieldId: string;
|
|
159
|
+
/**
|
|
160
|
+
* A label for the field
|
|
161
|
+
*/
|
|
162
|
+
label: string;
|
|
163
|
+
/**
|
|
164
|
+
* Text below the field to clarify what is it meant to be in the field value
|
|
165
|
+
*/
|
|
166
|
+
helpText?: string | null;
|
|
167
|
+
/**
|
|
168
|
+
* Text to be displayed in the field
|
|
169
|
+
*/
|
|
170
|
+
placeholderText?: string | null;
|
|
171
|
+
/**
|
|
172
|
+
* Are predefined values enabled? And list of them
|
|
173
|
+
*/
|
|
174
|
+
predefinedValues?: CmsModelFieldPredefinedValues;
|
|
175
|
+
/**
|
|
176
|
+
* Field renderer. Blank if determined automatically.
|
|
177
|
+
*/
|
|
178
|
+
renderer?: CmsModelFieldRenderer;
|
|
179
|
+
/**
|
|
180
|
+
* List of validations for the field
|
|
181
|
+
*
|
|
182
|
+
* @default []
|
|
183
|
+
*/
|
|
184
|
+
validation?: CmsModelFieldValidation[];
|
|
185
|
+
/**
|
|
186
|
+
* List of validations for the list of values, when a field is set to accept a list of values.
|
|
187
|
+
* These validations will be applied to the entire list, and `validation` (see above) will be applied
|
|
188
|
+
* to each individual value in the list.
|
|
189
|
+
*
|
|
190
|
+
* @default []
|
|
191
|
+
*/
|
|
192
|
+
listValidation?: CmsModelFieldValidation[];
|
|
193
|
+
/**
|
|
194
|
+
* Is this a multiple values field?
|
|
195
|
+
*
|
|
196
|
+
*/
|
|
197
|
+
multipleValues?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Fields can be tagged to give them contextual meaning.
|
|
200
|
+
*/
|
|
201
|
+
tags?: string[];
|
|
202
|
+
/**
|
|
203
|
+
* Any user defined settings.
|
|
204
|
+
*
|
|
205
|
+
* @default {}
|
|
206
|
+
*/
|
|
207
|
+
settings?: CmsModelFieldSettings;
|
|
208
|
+
}
|
|
209
|
+
export interface CmsDynamicZoneTemplate {
|
|
210
|
+
id: string;
|
|
211
|
+
name: string;
|
|
212
|
+
gqlTypeName: string;
|
|
213
|
+
description: string;
|
|
214
|
+
icon: string;
|
|
215
|
+
fields: CmsModelField[];
|
|
216
|
+
layout: string[][];
|
|
217
|
+
validation: CmsModelFieldValidation[];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* A definition for dynamic-zone field to show possible type of the field in settings.
|
|
221
|
+
*/
|
|
222
|
+
export interface CmsModelDynamicZoneField extends CmsModelField {
|
|
223
|
+
/**
|
|
224
|
+
* Settings object for the field. Contains `templates` property.
|
|
225
|
+
*/
|
|
226
|
+
settings: {
|
|
227
|
+
templates: CmsDynamicZoneTemplate[];
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Used for our internal functionality.
|
|
232
|
+
*/
|
|
233
|
+
export interface CmsModelFieldWithParent extends CmsModelField {
|
|
234
|
+
parent?: CmsModelFieldWithParent | null;
|
|
235
|
+
}
|
|
236
|
+
export interface CmsModelDynamicZoneFieldWithParent extends CmsModelDynamicZoneField {
|
|
237
|
+
parent?: CmsModelDynamicZoneFieldWithParent | null;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* A definition for dateTime field to show possible type of the field in settings.
|
|
241
|
+
*/
|
|
242
|
+
export interface CmsModelDateTimeField extends CmsModelField {
|
|
243
|
+
/**
|
|
244
|
+
* Settings object for the field. Contains `type` property.
|
|
245
|
+
*/
|
|
246
|
+
settings: {
|
|
247
|
+
type: "time" | "date" | "dateTimeWithoutTimezone" | "dateTimeWithTimezone";
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Arguments for the field validator validate method.
|
|
252
|
+
*
|
|
253
|
+
* @category ModelField
|
|
254
|
+
* @category FieldValidation
|
|
255
|
+
*/
|
|
256
|
+
export interface CmsModelFieldValidatorValidateParams<T = any> {
|
|
257
|
+
/**
|
|
258
|
+
* A value to be validated.
|
|
259
|
+
*/
|
|
260
|
+
value: T;
|
|
261
|
+
/**
|
|
262
|
+
* Options from the CmsModelField validations.
|
|
263
|
+
*
|
|
264
|
+
* @see CmsModelField.validation
|
|
265
|
+
* @see CmsModelField.listValidation
|
|
266
|
+
*/
|
|
267
|
+
validator: CmsModelFieldValidation;
|
|
268
|
+
/**
|
|
269
|
+
* An instance of the current context.
|
|
270
|
+
*/
|
|
271
|
+
context: CmsContext;
|
|
272
|
+
/**
|
|
273
|
+
* Field being validated.
|
|
274
|
+
*/
|
|
275
|
+
field: CmsModelField;
|
|
276
|
+
/**
|
|
277
|
+
* An instance of the content model being validated.
|
|
278
|
+
*/
|
|
279
|
+
model: CmsModel;
|
|
280
|
+
/**
|
|
281
|
+
* If entry is sent it means it is an update operation.
|
|
282
|
+
* First usage is for the unique field value.
|
|
283
|
+
*/
|
|
284
|
+
entry?: CmsEntry;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Definition for the field validator.
|
|
288
|
+
*
|
|
289
|
+
* @category Plugin
|
|
290
|
+
* @category ModelField
|
|
291
|
+
* @category FieldValidation
|
|
292
|
+
*/
|
|
293
|
+
export interface CmsModelFieldValidatorPlugin extends Plugin {
|
|
294
|
+
/**
|
|
295
|
+
* A plugin type.
|
|
296
|
+
*/
|
|
297
|
+
type: "cms-model-field-validator";
|
|
298
|
+
/**
|
|
299
|
+
* Actual validator definition.
|
|
300
|
+
*/
|
|
301
|
+
validator: {
|
|
302
|
+
/**
|
|
303
|
+
* Name of the validator.
|
|
304
|
+
*/
|
|
305
|
+
name: string;
|
|
306
|
+
/**
|
|
307
|
+
* Validation method.
|
|
308
|
+
*/
|
|
309
|
+
validate(params: CmsModelFieldValidatorValidateParams): Promise<boolean>;
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* A pattern validator for the content entry field value.
|
|
314
|
+
*
|
|
315
|
+
* @category Plugin
|
|
316
|
+
* @category ModelField
|
|
317
|
+
* @category FieldValidation
|
|
318
|
+
*/
|
|
319
|
+
export interface CmsModelFieldPatternValidatorPlugin extends Plugin {
|
|
320
|
+
/**
|
|
321
|
+
* A plugin type
|
|
322
|
+
*/
|
|
323
|
+
type: "cms-model-field-validator-pattern";
|
|
324
|
+
/**
|
|
325
|
+
* A pattern object for the validator.
|
|
326
|
+
*/
|
|
327
|
+
pattern: {
|
|
328
|
+
/**
|
|
329
|
+
* name of the pattern.
|
|
330
|
+
*/
|
|
331
|
+
name: string;
|
|
332
|
+
/**
|
|
333
|
+
* RegExp of the validator.
|
|
334
|
+
*/
|
|
335
|
+
regex: string;
|
|
336
|
+
/**
|
|
337
|
+
* RegExp flags
|
|
338
|
+
*/
|
|
339
|
+
flags: string;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Locked field in the content model
|
|
344
|
+
*
|
|
345
|
+
* @see CmsModel.lockedFields
|
|
346
|
+
*
|
|
347
|
+
* @category ModelField
|
|
348
|
+
*/
|
|
349
|
+
export interface LockedField {
|
|
350
|
+
/**
|
|
351
|
+
* Locked field storage ID - one used to store values.
|
|
352
|
+
* We cannot change this due to old systems.
|
|
353
|
+
*/
|
|
354
|
+
fieldId: string;
|
|
355
|
+
/**
|
|
356
|
+
* Is the field multiple values field?
|
|
357
|
+
*/
|
|
358
|
+
multipleValues: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Field type.
|
|
361
|
+
*/
|
|
362
|
+
type: string;
|
|
363
|
+
[key: string]: any;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Cms Model defining an entry.
|
|
367
|
+
*
|
|
368
|
+
* @category Database model
|
|
369
|
+
* @category CmsModel
|
|
370
|
+
*/
|
|
371
|
+
export interface CmsModel {
|
|
372
|
+
/**
|
|
373
|
+
* Name of the content model.
|
|
374
|
+
*/
|
|
375
|
+
name: string;
|
|
376
|
+
/**
|
|
377
|
+
* Unique ID for the content model. Created from name if not defined by user.
|
|
378
|
+
*/
|
|
379
|
+
modelId: string;
|
|
380
|
+
/**
|
|
381
|
+
* Model tenant.
|
|
382
|
+
*/
|
|
383
|
+
tenant: string;
|
|
384
|
+
/**
|
|
385
|
+
* Locale this model belongs to.
|
|
386
|
+
*/
|
|
387
|
+
locale: string;
|
|
388
|
+
/**
|
|
389
|
+
* Cms Group reference object.
|
|
390
|
+
*/
|
|
391
|
+
group: {
|
|
392
|
+
/**
|
|
393
|
+
* Generated ID of the group
|
|
394
|
+
*/
|
|
395
|
+
id: string;
|
|
396
|
+
/**
|
|
397
|
+
* Name of the group
|
|
398
|
+
*/
|
|
399
|
+
name: string;
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* Description for the content model.
|
|
403
|
+
*/
|
|
404
|
+
description: string;
|
|
405
|
+
/**
|
|
406
|
+
* Date created
|
|
407
|
+
*/
|
|
408
|
+
createdOn?: string;
|
|
409
|
+
/**
|
|
410
|
+
* Date saved. Changes on both save and create.
|
|
411
|
+
*/
|
|
412
|
+
savedOn?: string;
|
|
413
|
+
/**
|
|
414
|
+
* CreatedBy object wrapper. Contains id, name and type of the user.
|
|
415
|
+
*/
|
|
416
|
+
createdBy?: CreatedBy;
|
|
417
|
+
/**
|
|
418
|
+
* List of fields defining entry values.
|
|
419
|
+
*/
|
|
420
|
+
fields: CmsModelField[];
|
|
421
|
+
/**
|
|
422
|
+
* Admin UI field layout
|
|
423
|
+
*
|
|
424
|
+
* ```ts
|
|
425
|
+
* layout: [
|
|
426
|
+
* [field1id, field2id],
|
|
427
|
+
* [field3id]
|
|
428
|
+
* ]
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
layout: string[][];
|
|
432
|
+
/**
|
|
433
|
+
* Models can be tagged to give them contextual meaning.
|
|
434
|
+
*/
|
|
435
|
+
tags?: string[];
|
|
436
|
+
/**
|
|
437
|
+
* List of locked fields. Updated when entry is saved and a field has been used.
|
|
438
|
+
*/
|
|
439
|
+
lockedFields?: LockedField[];
|
|
440
|
+
/**
|
|
441
|
+
* The field that is being displayed as entry title.
|
|
442
|
+
* It is picked as first available text field. Or user can select own field.
|
|
443
|
+
*/
|
|
444
|
+
titleFieldId: string;
|
|
445
|
+
/**
|
|
446
|
+
* The version of Webiny which this record was stored with.
|
|
447
|
+
*/
|
|
448
|
+
webinyVersion: string;
|
|
449
|
+
/**
|
|
450
|
+
* Is model private?
|
|
451
|
+
* This is meant to be used for some internal models - will not be visible in the schema.
|
|
452
|
+
* Only available for the plugin constructed models.
|
|
453
|
+
*/
|
|
454
|
+
isPrivate?: boolean;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* When sending model to the storage operations, it must contain createValueKeyToStorageConverter and createValueKeyFromStorageConverter
|
|
458
|
+
*
|
|
459
|
+
* @category CmsModel
|
|
460
|
+
*/
|
|
461
|
+
export interface StorageOperationsCmsModel extends CmsModel {
|
|
462
|
+
convertValueKeyToStorage: CmsModelConverterCallable;
|
|
463
|
+
convertValueKeyFromStorage: CmsModelConverterCallable;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* @category ModelField
|
|
467
|
+
*/
|
|
468
|
+
export interface CmsModelFieldDefinition {
|
|
469
|
+
fields: string;
|
|
470
|
+
typeDefs?: string;
|
|
471
|
+
}
|
|
472
|
+
interface CmsModelFieldToGraphQLCreateResolverParams<TField> {
|
|
473
|
+
models: CmsModel[];
|
|
474
|
+
model: CmsModel;
|
|
475
|
+
graphQLType: string;
|
|
476
|
+
field: TField;
|
|
477
|
+
createFieldResolvers: any;
|
|
478
|
+
}
|
|
479
|
+
export interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {
|
|
480
|
+
(params: CmsModelFieldToGraphQLCreateResolverParams<TField>): GraphQLFieldResolver | {
|
|
481
|
+
resolver: GraphQLFieldResolver | null;
|
|
482
|
+
typeResolvers: Resolvers<CmsContext>;
|
|
483
|
+
} | false;
|
|
484
|
+
}
|
|
485
|
+
export interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<TField extends CmsModelField = CmsModelField> {
|
|
486
|
+
fields: TField[];
|
|
487
|
+
originalFields: TField[];
|
|
488
|
+
}
|
|
489
|
+
export interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {
|
|
490
|
+
(params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;
|
|
491
|
+
}
|
|
492
|
+
export interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField extends CmsModelField = CmsModelField> {
|
|
493
|
+
field: TField;
|
|
494
|
+
originalField?: TField;
|
|
495
|
+
validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;
|
|
496
|
+
}
|
|
497
|
+
export interface CmsModelFieldToGraphQLPluginValidateChildFields<TField extends CmsModelField = CmsModelField> {
|
|
498
|
+
(params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* @category Plugin
|
|
502
|
+
* @category ModelField
|
|
503
|
+
* @category GraphQL
|
|
504
|
+
*/
|
|
505
|
+
export interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = CmsModelField> extends Plugin {
|
|
506
|
+
/**
|
|
507
|
+
* A plugin type
|
|
508
|
+
*/
|
|
509
|
+
type: "cms-model-field-to-graphql";
|
|
510
|
+
/**
|
|
511
|
+
* Field type name which must be exact as the one in `CmsEditorFieldTypePlugin` plugin.
|
|
512
|
+
*
|
|
513
|
+
* ```ts
|
|
514
|
+
* fieldType: "myField"
|
|
515
|
+
* ```
|
|
516
|
+
*/
|
|
517
|
+
fieldType: string;
|
|
518
|
+
/**
|
|
519
|
+
* Is the field searchable via the GraphQL?
|
|
520
|
+
*
|
|
521
|
+
* ```ts
|
|
522
|
+
* isSearchable: false
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
isSearchable: boolean;
|
|
526
|
+
/**
|
|
527
|
+
* Is the field searchable via full text search?
|
|
528
|
+
*
|
|
529
|
+
* Field is not full text searchable by default.
|
|
530
|
+
* ```ts
|
|
531
|
+
* fullTextSearch: false
|
|
532
|
+
* ```
|
|
533
|
+
*/
|
|
534
|
+
fullTextSearch?: boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Is the field sortable via the GraphQL?
|
|
537
|
+
*
|
|
538
|
+
* ```ts
|
|
539
|
+
* isSortable: true
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
isSortable: boolean;
|
|
543
|
+
/**
|
|
544
|
+
* Optional method which creates the storageId.
|
|
545
|
+
* Primary use is for the datetime field, but if users has some specific fields, they can customize the storageId to their needs.
|
|
546
|
+
*
|
|
547
|
+
* ```ts
|
|
548
|
+
* createStorageId: ({field}) => {
|
|
549
|
+
* if (field.settings.type === "time) {
|
|
550
|
+
* return `${field.type}_time@${field.id}`
|
|
551
|
+
* }
|
|
552
|
+
* // use default method
|
|
553
|
+
* return undefined;
|
|
554
|
+
* }
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
557
|
+
createStorageId?: (params: {
|
|
558
|
+
model: CmsModel;
|
|
559
|
+
field: TField;
|
|
560
|
+
}) => string | null | undefined;
|
|
561
|
+
/**
|
|
562
|
+
* Read API methods.
|
|
563
|
+
*/
|
|
564
|
+
read: {
|
|
565
|
+
/**
|
|
566
|
+
* Definition for get filtering for GraphQL.
|
|
567
|
+
*
|
|
568
|
+
* ```ts
|
|
569
|
+
* read: {
|
|
570
|
+
* createGetFilters({ field }) {
|
|
571
|
+
* return `${field.fieldId}: MyField`;
|
|
572
|
+
* }
|
|
573
|
+
* }
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
576
|
+
createGetFilters?(params: {
|
|
577
|
+
model: CmsModel;
|
|
578
|
+
field: TField;
|
|
579
|
+
}): string;
|
|
580
|
+
/**
|
|
581
|
+
* Definition for list filtering for GraphQL.
|
|
582
|
+
*
|
|
583
|
+
* ```ts
|
|
584
|
+
* read: {
|
|
585
|
+
* createListFilters({ field }) {
|
|
586
|
+
* return `
|
|
587
|
+
* ${field.fieldId}: MyType
|
|
588
|
+
* ${field.fieldId}_not: MyType
|
|
589
|
+
* ${field.fieldId}_in: [MyType]
|
|
590
|
+
* ${field.fieldId}_not_in: [MyType]
|
|
591
|
+
* `;
|
|
592
|
+
* }
|
|
593
|
+
* }
|
|
594
|
+
* ```
|
|
595
|
+
*/
|
|
596
|
+
createListFilters?(params: {
|
|
597
|
+
model: CmsModel;
|
|
598
|
+
field: TField;
|
|
599
|
+
plugins: CmsFieldTypePlugins;
|
|
600
|
+
}): string;
|
|
601
|
+
/**
|
|
602
|
+
* Definition of the field type for GraphQL - be aware if multiple values is selected.
|
|
603
|
+
*
|
|
604
|
+
* ```ts
|
|
605
|
+
* read: {
|
|
606
|
+
* createTypeField({ field }) {
|
|
607
|
+
* if (field.multipleValues) {
|
|
608
|
+
* return `${field.fieldId}: [MyFieldType]`;
|
|
609
|
+
* }
|
|
610
|
+
*
|
|
611
|
+
* return `${field.fieldId}: MyField`;
|
|
612
|
+
* }
|
|
613
|
+
* }
|
|
614
|
+
* ```
|
|
615
|
+
*/
|
|
616
|
+
createTypeField(params: {
|
|
617
|
+
model: CmsModel;
|
|
618
|
+
field: TField;
|
|
619
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
620
|
+
}): CmsModelFieldDefinition | string | null;
|
|
621
|
+
/**
|
|
622
|
+
* Definition for field resolver.
|
|
623
|
+
* By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
624
|
+
*
|
|
625
|
+
* ```ts
|
|
626
|
+
* read: {
|
|
627
|
+
* createResolver({ field }) {
|
|
628
|
+
* return instance => {
|
|
629
|
+
* return instance.values[field.storageId];
|
|
630
|
+
* };
|
|
631
|
+
* }
|
|
632
|
+
* }
|
|
633
|
+
* ```
|
|
634
|
+
*/
|
|
635
|
+
createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;
|
|
636
|
+
/**
|
|
637
|
+
* Read API schema definitions for the field and resolvers for them.
|
|
638
|
+
*
|
|
639
|
+
* ```ts
|
|
640
|
+
* read: {
|
|
641
|
+
* createSchema() {
|
|
642
|
+
* return {
|
|
643
|
+
* typeDefs: `
|
|
644
|
+
* myField {
|
|
645
|
+
* id
|
|
646
|
+
* date
|
|
647
|
+
* }
|
|
648
|
+
* `,
|
|
649
|
+
* resolvers: {}
|
|
650
|
+
* }
|
|
651
|
+
* }
|
|
652
|
+
* }
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
createSchema?: (params: {
|
|
656
|
+
models: CmsModel[];
|
|
657
|
+
}) => GraphQLSchemaDefinition<CmsContext>;
|
|
658
|
+
};
|
|
659
|
+
manage: {
|
|
660
|
+
/**
|
|
661
|
+
* Definition for list filtering for GraphQL.
|
|
662
|
+
*
|
|
663
|
+
* ```ts
|
|
664
|
+
* manage: {
|
|
665
|
+
* createListFilters({ field }) {
|
|
666
|
+
* return `
|
|
667
|
+
* ${field.fieldId}: MyType
|
|
668
|
+
* ${field.fieldId}_not: MyType
|
|
669
|
+
* ${field.fieldId}_in: [MyType]
|
|
670
|
+
* ${field.fieldId}_not_in: [MyType]
|
|
671
|
+
* `;
|
|
672
|
+
* }
|
|
673
|
+
* }
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
createListFilters?: (params: {
|
|
677
|
+
model: CmsModel;
|
|
678
|
+
field: TField;
|
|
679
|
+
plugins: CmsFieldTypePlugins;
|
|
680
|
+
}) => string;
|
|
681
|
+
/**
|
|
682
|
+
* Manage API schema definitions for the field and resolvers for them. Probably similar to `read.createSchema`.
|
|
683
|
+
*
|
|
684
|
+
* ```ts
|
|
685
|
+
* createSchema() {
|
|
686
|
+
* return {
|
|
687
|
+
* typeDefs: `
|
|
688
|
+
* myField {
|
|
689
|
+
* id
|
|
690
|
+
* date
|
|
691
|
+
* }
|
|
692
|
+
* `,
|
|
693
|
+
* resolvers: {}
|
|
694
|
+
* }
|
|
695
|
+
* }
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
createSchema?: (params: {
|
|
699
|
+
models: CmsModel[];
|
|
700
|
+
}) => GraphQLSchemaDefinition<CmsContext>;
|
|
701
|
+
/**
|
|
702
|
+
* Definition of the field type for GraphQL - be aware if multiple values is selected. Probably same as `read.createTypeField`.
|
|
703
|
+
*
|
|
704
|
+
* ```ts
|
|
705
|
+
* manage: {
|
|
706
|
+
* createTypeField({ field }) {
|
|
707
|
+
* if (field.multipleValues) {
|
|
708
|
+
* return field.fieldId + ": [MyType]";
|
|
709
|
+
* }
|
|
710
|
+
*
|
|
711
|
+
* return field.fieldId + ": MyType";
|
|
712
|
+
* }
|
|
713
|
+
* }
|
|
714
|
+
* ```
|
|
715
|
+
*/
|
|
716
|
+
createTypeField: (params: {
|
|
717
|
+
model: CmsModel;
|
|
718
|
+
field: TField;
|
|
719
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
720
|
+
}) => CmsModelFieldDefinition | string | null;
|
|
721
|
+
/**
|
|
722
|
+
* Definition for input GraphQL field type.
|
|
723
|
+
*
|
|
724
|
+
* ```ts
|
|
725
|
+
* manage: {
|
|
726
|
+
* createInputField({ field }) {
|
|
727
|
+
* if (field.multipleValues) {
|
|
728
|
+
* return field.fieldId + ": [MyField]";
|
|
729
|
+
* }
|
|
730
|
+
*
|
|
731
|
+
* return field.fieldId + ": MyField";
|
|
732
|
+
* }
|
|
733
|
+
* }
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
createInputField: (params: {
|
|
737
|
+
model: CmsModel;
|
|
738
|
+
field: TField;
|
|
739
|
+
fieldTypePlugins: CmsFieldTypePlugins;
|
|
740
|
+
}) => CmsModelFieldDefinition | string | null;
|
|
741
|
+
/**
|
|
742
|
+
* Definition for field resolver.
|
|
743
|
+
* By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.
|
|
744
|
+
*
|
|
745
|
+
* ```ts
|
|
746
|
+
* manage: {
|
|
747
|
+
* createResolver({ field }) {
|
|
748
|
+
* return instance => {
|
|
749
|
+
* return instance.values[field.storageId];
|
|
750
|
+
* };
|
|
751
|
+
* }
|
|
752
|
+
* }
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
*
|
|
759
|
+
* @param field
|
|
760
|
+
*/
|
|
761
|
+
validateChildFields?: CmsModelFieldToGraphQLPluginValidateChildFields<TField>;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Check for content model locked field.
|
|
765
|
+
* A custom plugin definable by the user.
|
|
766
|
+
*
|
|
767
|
+
* @category CmsModel
|
|
768
|
+
* @category Plugin
|
|
769
|
+
*/
|
|
770
|
+
export interface CmsModelLockedFieldPlugin extends Plugin {
|
|
771
|
+
/**
|
|
772
|
+
* A plugin type
|
|
773
|
+
*/
|
|
774
|
+
type: "cms-model-locked-field";
|
|
775
|
+
/**
|
|
776
|
+
* A unique identifier of the field type (text, number, json, myField, ...).
|
|
777
|
+
*/
|
|
778
|
+
fieldType: string;
|
|
779
|
+
/**
|
|
780
|
+
* A method to check if field really is locked.
|
|
781
|
+
*/
|
|
782
|
+
checkLockedField?: (params: {
|
|
783
|
+
lockedField: LockedField;
|
|
784
|
+
field: CmsModelField;
|
|
785
|
+
}) => void;
|
|
786
|
+
/**
|
|
787
|
+
* A method to get the locked field data.
|
|
788
|
+
*/
|
|
789
|
+
getLockedFieldData?: (params: {
|
|
790
|
+
field: CmsModelField;
|
|
791
|
+
}) => Record<string, any>;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* @category ModelField
|
|
795
|
+
*/
|
|
796
|
+
export interface CmsFieldTypePlugins {
|
|
797
|
+
[key: string]: CmsModelFieldToGraphQLPlugin;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* An interface describing the reference to a user that created some data in the database.
|
|
801
|
+
*
|
|
802
|
+
* @category General
|
|
803
|
+
*/
|
|
804
|
+
export interface CreatedBy {
|
|
805
|
+
/**
|
|
806
|
+
* ID if the user.
|
|
807
|
+
*/
|
|
808
|
+
id: string;
|
|
809
|
+
/**
|
|
810
|
+
* Full name of the user.
|
|
811
|
+
*/
|
|
812
|
+
displayName: string | null;
|
|
813
|
+
/**
|
|
814
|
+
* Type of the user (admin, user)
|
|
815
|
+
*/
|
|
816
|
+
type: string;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Representation of settings database model.
|
|
820
|
+
*
|
|
821
|
+
* @category Database model
|
|
822
|
+
*/
|
|
823
|
+
export interface CmsSettings {
|
|
824
|
+
/**
|
|
825
|
+
* Last content model change. Used to cache GraphQL schema.
|
|
826
|
+
*/
|
|
827
|
+
contentModelLastChange: Date;
|
|
828
|
+
/**
|
|
829
|
+
* Settings tenant.
|
|
830
|
+
*/
|
|
831
|
+
tenant: string;
|
|
832
|
+
/**
|
|
833
|
+
* Settings locale.
|
|
834
|
+
*/
|
|
835
|
+
locale: string;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Settings CRUD in context.
|
|
839
|
+
*
|
|
840
|
+
* @category Context
|
|
841
|
+
*/
|
|
842
|
+
export interface CmsSettingsContext {
|
|
843
|
+
/**
|
|
844
|
+
* Gets settings model from the database.
|
|
845
|
+
*/
|
|
846
|
+
getSettings: () => Promise<CmsSettings | null>;
|
|
847
|
+
/**
|
|
848
|
+
* Updates settings model with a new date.
|
|
849
|
+
*/
|
|
850
|
+
updateModelLastChange: () => Promise<void>;
|
|
851
|
+
/**
|
|
852
|
+
* Get the datetime when content model last changed.
|
|
853
|
+
*/
|
|
854
|
+
getModelLastChange: () => Promise<Date>;
|
|
855
|
+
}
|
|
856
|
+
export interface OnSystemBeforeInstallTopicParams {
|
|
857
|
+
tenant: string;
|
|
858
|
+
locale: string;
|
|
859
|
+
}
|
|
860
|
+
export interface OnSystemAfterInstallTopicParams {
|
|
861
|
+
tenant: string;
|
|
862
|
+
locale: string;
|
|
863
|
+
}
|
|
864
|
+
export interface OnSystemInstallErrorTopicParams {
|
|
865
|
+
error: Error;
|
|
866
|
+
tenant: string;
|
|
867
|
+
locale: string;
|
|
868
|
+
}
|
|
869
|
+
export declare type CmsSystemContext = {
|
|
870
|
+
getSystemVersion: () => Promise<string | null>;
|
|
871
|
+
setSystemVersion: (version: string) => Promise<void>;
|
|
872
|
+
getReadAPIKey(): Promise<string | null>;
|
|
873
|
+
installSystem: () => Promise<void>;
|
|
874
|
+
upgradeSystem: (version: string) => Promise<boolean>;
|
|
875
|
+
/**
|
|
876
|
+
* Lifecycle events - deprecated
|
|
877
|
+
*/
|
|
878
|
+
/**
|
|
879
|
+
* @deprecated
|
|
880
|
+
*/
|
|
881
|
+
onBeforeSystemInstall: Topic<OnSystemBeforeInstallTopicParams>;
|
|
882
|
+
/**
|
|
883
|
+
* @deprecated
|
|
884
|
+
*/
|
|
885
|
+
onAfterSystemInstall: Topic<OnSystemAfterInstallTopicParams>;
|
|
886
|
+
/**
|
|
887
|
+
* Released in 5.34.0
|
|
888
|
+
*/
|
|
889
|
+
onSystemBeforeInstall: Topic<OnSystemBeforeInstallTopicParams>;
|
|
890
|
+
onSystemAfterInstall: Topic<OnSystemAfterInstallTopicParams>;
|
|
891
|
+
onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;
|
|
892
|
+
};
|
|
893
|
+
/**
|
|
894
|
+
* A GraphQL `params.data` parameter received when creating content model group.
|
|
895
|
+
*
|
|
896
|
+
* @category CmsGroup
|
|
897
|
+
* @category GraphQL params
|
|
898
|
+
*/
|
|
899
|
+
export interface CmsGroupCreateInput {
|
|
900
|
+
name: string;
|
|
901
|
+
slug?: string;
|
|
902
|
+
description?: string;
|
|
903
|
+
icon: string;
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* A GraphQL `params.data` parameter received when updating content model group.
|
|
907
|
+
*
|
|
908
|
+
* @category CmsGroup
|
|
909
|
+
* @category GraphQL params
|
|
910
|
+
*/
|
|
911
|
+
export interface CmsGroupUpdateInput {
|
|
912
|
+
name?: string;
|
|
913
|
+
slug?: string;
|
|
914
|
+
description?: string;
|
|
915
|
+
icon?: string;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* A representation of content model group in the database.
|
|
919
|
+
*
|
|
920
|
+
* @category CmsGroup
|
|
921
|
+
* @category Database model
|
|
922
|
+
*/
|
|
923
|
+
export interface CmsGroup {
|
|
924
|
+
/**
|
|
925
|
+
* Generated ID.
|
|
926
|
+
*/
|
|
927
|
+
id: string;
|
|
928
|
+
/**
|
|
929
|
+
* Name of the group.
|
|
930
|
+
*/
|
|
931
|
+
name: string;
|
|
932
|
+
/**
|
|
933
|
+
* Slug for the group. Must be unique.
|
|
934
|
+
*/
|
|
935
|
+
slug: string;
|
|
936
|
+
/**
|
|
937
|
+
* Group tenant.
|
|
938
|
+
*/
|
|
939
|
+
tenant: string;
|
|
940
|
+
/**
|
|
941
|
+
* Locale this group belongs to.
|
|
942
|
+
*/
|
|
943
|
+
locale: string;
|
|
944
|
+
/**
|
|
945
|
+
* Description for the group.
|
|
946
|
+
*/
|
|
947
|
+
description: string;
|
|
948
|
+
/**
|
|
949
|
+
* Icon for the group. In a form of "ico/ico".
|
|
950
|
+
*/
|
|
951
|
+
icon: string;
|
|
952
|
+
/**
|
|
953
|
+
* CreatedBy reference object.
|
|
954
|
+
*/
|
|
955
|
+
createdBy?: CreatedBy;
|
|
956
|
+
/**
|
|
957
|
+
* Date group was created on.
|
|
958
|
+
*/
|
|
959
|
+
createdOn?: string;
|
|
960
|
+
/**
|
|
961
|
+
* Date group was created or changed on.
|
|
962
|
+
*/
|
|
963
|
+
savedOn?: string;
|
|
964
|
+
/**
|
|
965
|
+
* Which Webiny version was this record stored with.
|
|
966
|
+
*/
|
|
967
|
+
webinyVersion: string;
|
|
968
|
+
/**
|
|
969
|
+
* Is group private?
|
|
970
|
+
* This is meant to be used for some internal groups - will not be visible in the schema.
|
|
971
|
+
* Only available for the plugin constructed groups.
|
|
972
|
+
*/
|
|
973
|
+
isPrivate?: boolean;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* A `data.where` parameter received when listing content model groups.
|
|
977
|
+
*
|
|
978
|
+
* @category CmsGroup
|
|
979
|
+
* @category GraphQL params
|
|
980
|
+
*/
|
|
981
|
+
export interface CmsGroupListParams {
|
|
982
|
+
where: {
|
|
983
|
+
tenant: string;
|
|
984
|
+
locale: string;
|
|
985
|
+
[key: string]: any;
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* @category CmsGroup
|
|
990
|
+
* @category Topic
|
|
991
|
+
*/
|
|
992
|
+
export interface OnGroupBeforeCreateTopicParams {
|
|
993
|
+
group: CmsGroup;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* @category CmsGroup
|
|
997
|
+
* @category Topic
|
|
998
|
+
*/
|
|
999
|
+
export interface OnGroupAfterCreateTopicParams {
|
|
1000
|
+
group: CmsGroup;
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* @category CmsGroup
|
|
1004
|
+
* @category Topic
|
|
1005
|
+
*/
|
|
1006
|
+
export interface OnGroupCreateErrorTopicParams {
|
|
1007
|
+
input: CmsGroupCreateInput;
|
|
1008
|
+
group: CmsGroup;
|
|
1009
|
+
error: Error;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* @category CmsGroup
|
|
1013
|
+
* @category Topic
|
|
1014
|
+
*/
|
|
1015
|
+
export interface OnGroupBeforeUpdateTopicParams {
|
|
1016
|
+
original: CmsGroup;
|
|
1017
|
+
group: CmsGroup;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* @category CmsGroup
|
|
1021
|
+
* @category Topic
|
|
1022
|
+
*/
|
|
1023
|
+
export interface OnGroupAfterUpdateTopicParams {
|
|
1024
|
+
original: CmsGroup;
|
|
1025
|
+
group: CmsGroup;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* @category CmsGroup
|
|
1029
|
+
* @category Topic
|
|
1030
|
+
*/
|
|
1031
|
+
export interface OnGroupUpdateErrorTopicParams {
|
|
1032
|
+
input: CmsGroupUpdateInput;
|
|
1033
|
+
original: CmsGroup;
|
|
1034
|
+
group: CmsGroup;
|
|
1035
|
+
error: Error;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* @category CmsGroup
|
|
1039
|
+
* @category Topic
|
|
1040
|
+
*/
|
|
1041
|
+
export interface OnGroupBeforeDeleteTopicParams {
|
|
1042
|
+
group: CmsGroup;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* @category CmsGroup
|
|
1046
|
+
* @category Topic
|
|
1047
|
+
*/
|
|
1048
|
+
export interface OnGroupAfterDeleteTopicParams {
|
|
1049
|
+
group: CmsGroup;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* @category CmsGroup
|
|
1053
|
+
* @category Topic
|
|
1054
|
+
*/
|
|
1055
|
+
export interface OnGroupDeleteErrorTopicParams {
|
|
1056
|
+
group: CmsGroup;
|
|
1057
|
+
error: Error;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Cms Group in context.
|
|
1061
|
+
*
|
|
1062
|
+
* @category Context
|
|
1063
|
+
* @category CmsGroup
|
|
1064
|
+
*/
|
|
1065
|
+
export interface CmsGroupContext {
|
|
1066
|
+
/**
|
|
1067
|
+
* Gets content model group by given id.
|
|
1068
|
+
*/
|
|
1069
|
+
getGroup: (id: string) => Promise<CmsGroup | null>;
|
|
1070
|
+
/**
|
|
1071
|
+
* List all content model groups. Filterable via params.
|
|
1072
|
+
*/
|
|
1073
|
+
listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Create a new content model group.
|
|
1076
|
+
*/
|
|
1077
|
+
createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Update existing content model group.
|
|
1080
|
+
*/
|
|
1081
|
+
updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Delete content model group by given id.
|
|
1084
|
+
*/
|
|
1085
|
+
deleteGroup: (id: string) => Promise<boolean>;
|
|
1086
|
+
/**
|
|
1087
|
+
* Clear the cached groups.
|
|
1088
|
+
*/
|
|
1089
|
+
clearGroupsCache: () => void;
|
|
1090
|
+
/**
|
|
1091
|
+
* Lifecycle events - deprecated
|
|
1092
|
+
*/
|
|
1093
|
+
/**
|
|
1094
|
+
* @deprecated
|
|
1095
|
+
*/
|
|
1096
|
+
onBeforeGroupCreate: Topic<OnGroupBeforeCreateTopicParams>;
|
|
1097
|
+
/**
|
|
1098
|
+
* @deprecated
|
|
1099
|
+
*/
|
|
1100
|
+
onAfterGroupCreate: Topic<OnGroupAfterCreateTopicParams>;
|
|
1101
|
+
/**
|
|
1102
|
+
* @deprecated
|
|
1103
|
+
*/
|
|
1104
|
+
onBeforeGroupUpdate: Topic<OnGroupBeforeUpdateTopicParams>;
|
|
1105
|
+
/**
|
|
1106
|
+
* @deprecated
|
|
1107
|
+
*/
|
|
1108
|
+
onAfterGroupUpdate: Topic<OnGroupAfterUpdateTopicParams>;
|
|
1109
|
+
/**
|
|
1110
|
+
* @deprecated
|
|
1111
|
+
*/
|
|
1112
|
+
onBeforeGroupDelete: Topic<OnGroupBeforeDeleteTopicParams>;
|
|
1113
|
+
/**
|
|
1114
|
+
* @deprecated
|
|
1115
|
+
*/
|
|
1116
|
+
onAfterGroupDelete: Topic<OnGroupAfterDeleteTopicParams>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Lifecycle events released in 5.33.0
|
|
1119
|
+
*/
|
|
1120
|
+
onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;
|
|
1121
|
+
onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;
|
|
1122
|
+
onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;
|
|
1123
|
+
onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;
|
|
1124
|
+
onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;
|
|
1125
|
+
onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;
|
|
1126
|
+
onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;
|
|
1127
|
+
onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;
|
|
1128
|
+
onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Definition for content model field validator.
|
|
1132
|
+
*
|
|
1133
|
+
* @category ModelField
|
|
1134
|
+
* @category FieldValidation
|
|
1135
|
+
*/
|
|
1136
|
+
export interface CmsModelFieldValidation {
|
|
1137
|
+
name: string;
|
|
1138
|
+
message: string;
|
|
1139
|
+
settings?: {
|
|
1140
|
+
value?: string | number;
|
|
1141
|
+
values?: string[];
|
|
1142
|
+
preset?: string;
|
|
1143
|
+
[key: string]: any;
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* A GraphQL `params.data` parameter received when creating content model.
|
|
1148
|
+
*
|
|
1149
|
+
* @category GraphQL params
|
|
1150
|
+
* @category CmsModel
|
|
1151
|
+
*/
|
|
1152
|
+
export interface CmsModelCreateInput {
|
|
1153
|
+
/**
|
|
1154
|
+
* Name of the content model.
|
|
1155
|
+
*/
|
|
1156
|
+
name: string;
|
|
1157
|
+
/**
|
|
1158
|
+
* Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.
|
|
1159
|
+
*/
|
|
1160
|
+
modelId?: string;
|
|
1161
|
+
/**
|
|
1162
|
+
* Description of the content model.
|
|
1163
|
+
*/
|
|
1164
|
+
description?: string;
|
|
1165
|
+
/**
|
|
1166
|
+
* Group where to put the content model in.
|
|
1167
|
+
*/
|
|
1168
|
+
group: string;
|
|
1169
|
+
/**
|
|
1170
|
+
* A list of content model fields to define the entry values.
|
|
1171
|
+
*/
|
|
1172
|
+
fields?: CmsModelFieldInput[];
|
|
1173
|
+
/**
|
|
1174
|
+
* Admin UI field layout
|
|
1175
|
+
*
|
|
1176
|
+
* ```ts
|
|
1177
|
+
* layout: [
|
|
1178
|
+
* [field1id, field2id],
|
|
1179
|
+
* [field3id]
|
|
1180
|
+
* ]
|
|
1181
|
+
* ```
|
|
1182
|
+
*/
|
|
1183
|
+
layout?: string[][];
|
|
1184
|
+
/**
|
|
1185
|
+
* Models can be tagged to give them contextual meaning.
|
|
1186
|
+
*/
|
|
1187
|
+
tags?: string[];
|
|
1188
|
+
/**
|
|
1189
|
+
* The field that is being displayed as entry title.
|
|
1190
|
+
* It is picked as first available text field. Or user can select own field.
|
|
1191
|
+
*/
|
|
1192
|
+
titleFieldId?: string;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* A GraphQL `params.data` parameter received when creating content model from existing model.
|
|
1196
|
+
*
|
|
1197
|
+
* @category GraphQL params
|
|
1198
|
+
* @category CmsModel
|
|
1199
|
+
*/
|
|
1200
|
+
export interface CmsModelCreateFromInput extends CmsModelCreateInput {
|
|
1201
|
+
/**
|
|
1202
|
+
* Locale into which we want to clone the model into.
|
|
1203
|
+
*/
|
|
1204
|
+
locale?: string;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* A definition for content model field received from the user.
|
|
1208
|
+
*
|
|
1209
|
+
* Input type for `CmsModelField`.
|
|
1210
|
+
* @see CmsModelField
|
|
1211
|
+
*
|
|
1212
|
+
* @category GraphQL params
|
|
1213
|
+
* @category ModelField
|
|
1214
|
+
*/
|
|
1215
|
+
export interface CmsModelFieldInput {
|
|
1216
|
+
/**
|
|
1217
|
+
* Generated ID.
|
|
1218
|
+
*/
|
|
1219
|
+
id: string;
|
|
1220
|
+
/**
|
|
1221
|
+
* Type of the field. A plugin for the field must be defined.
|
|
1222
|
+
* @see CmsModelFieldToGraphQLPlugin
|
|
1223
|
+
*/
|
|
1224
|
+
type: string;
|
|
1225
|
+
/**
|
|
1226
|
+
* Field outside world identifier for the field. Must be unique in the model.
|
|
1227
|
+
*/
|
|
1228
|
+
fieldId: string;
|
|
1229
|
+
/**
|
|
1230
|
+
* Label for the field.
|
|
1231
|
+
*/
|
|
1232
|
+
label: string;
|
|
1233
|
+
/**
|
|
1234
|
+
* Text to display below the field to help user what to write in the field.
|
|
1235
|
+
*/
|
|
1236
|
+
helpText?: string;
|
|
1237
|
+
/**
|
|
1238
|
+
* Text to display in the field.
|
|
1239
|
+
*/
|
|
1240
|
+
placeholderText?: string;
|
|
1241
|
+
/**
|
|
1242
|
+
* Fields can be tagged to give them contextual meaning.
|
|
1243
|
+
*/
|
|
1244
|
+
tags?: string[];
|
|
1245
|
+
/**
|
|
1246
|
+
* Are multiple values allowed?
|
|
1247
|
+
*/
|
|
1248
|
+
multipleValues?: boolean;
|
|
1249
|
+
/**
|
|
1250
|
+
* Predefined values options for the field. Check the reference for more information.
|
|
1251
|
+
*/
|
|
1252
|
+
predefinedValues?: CmsModelFieldPredefinedValues;
|
|
1253
|
+
/**
|
|
1254
|
+
* Renderer options for the field. Check the reference for more information.
|
|
1255
|
+
*/
|
|
1256
|
+
renderer?: CmsModelFieldRenderer;
|
|
1257
|
+
/**
|
|
1258
|
+
* List of validations for the field.
|
|
1259
|
+
*/
|
|
1260
|
+
validation?: CmsModelFieldValidation[];
|
|
1261
|
+
/**
|
|
1262
|
+
* @see CmsModelField.listValidation
|
|
1263
|
+
*/
|
|
1264
|
+
listValidation: CmsModelFieldValidation[];
|
|
1265
|
+
/**
|
|
1266
|
+
* User defined settings.
|
|
1267
|
+
*/
|
|
1268
|
+
settings?: Record<string, any>;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* A GraphQL `params.data` parameter received when updating content model.
|
|
1272
|
+
*
|
|
1273
|
+
* @category GraphQL params
|
|
1274
|
+
* @category CmsModel
|
|
1275
|
+
*/
|
|
1276
|
+
export interface CmsModelUpdateInput {
|
|
1277
|
+
/**
|
|
1278
|
+
* A new content model name.
|
|
1279
|
+
*/
|
|
1280
|
+
name?: string;
|
|
1281
|
+
/**
|
|
1282
|
+
* A group we want to move the model to.
|
|
1283
|
+
*/
|
|
1284
|
+
group?: string;
|
|
1285
|
+
/**
|
|
1286
|
+
* A new description of the content model.
|
|
1287
|
+
*/
|
|
1288
|
+
description?: string;
|
|
1289
|
+
/**
|
|
1290
|
+
* A list of content model fields to define the entry values.
|
|
1291
|
+
*/
|
|
1292
|
+
fields: CmsModelFieldInput[];
|
|
1293
|
+
/**
|
|
1294
|
+
* Admin UI field layout
|
|
1295
|
+
*
|
|
1296
|
+
* ```ts
|
|
1297
|
+
* layout: [
|
|
1298
|
+
* [field1id, field2id],
|
|
1299
|
+
* [field3id]
|
|
1300
|
+
* ]
|
|
1301
|
+
* ```
|
|
1302
|
+
*/
|
|
1303
|
+
layout: string[][];
|
|
1304
|
+
/**
|
|
1305
|
+
* The field that is being displayed as entry title.
|
|
1306
|
+
* It is picked as first available text field. Or user can select own field.
|
|
1307
|
+
*/
|
|
1308
|
+
titleFieldId?: string;
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* A plugin to load a CmsModelManager.
|
|
1312
|
+
*
|
|
1313
|
+
* @see CmsModelManager
|
|
1314
|
+
*
|
|
1315
|
+
* @category Plugin
|
|
1316
|
+
* @category CmsModel
|
|
1317
|
+
* @category CmsEntry
|
|
1318
|
+
*/
|
|
1319
|
+
export interface ModelManagerPlugin extends Plugin {
|
|
1320
|
+
/**
|
|
1321
|
+
* A plugin type.
|
|
1322
|
+
*/
|
|
1323
|
+
type: "cms-content-model-manager";
|
|
1324
|
+
/**
|
|
1325
|
+
* Specific model CmsModelManager loader. Can target exact modelId(s).
|
|
1326
|
+
* Be aware that if you define multiple plugins without `modelId`, last one will run.
|
|
1327
|
+
*/
|
|
1328
|
+
modelId?: string[] | string;
|
|
1329
|
+
/**
|
|
1330
|
+
* Create a CmsModelManager for specific type - or new default one.
|
|
1331
|
+
* For reference in how is this plugin run check [contentModelManagerFactory](https://github.com/webiny/webiny-js/blob/f15676/packages/api-headless-cms/src/content/plugins/CRUD/contentModel/contentModelManagerFactory.ts)
|
|
1332
|
+
*/
|
|
1333
|
+
create: (context: CmsContext, model: CmsModel) => Promise<CmsModelManager>;
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* A content entry values definition for and from the database.
|
|
1337
|
+
*
|
|
1338
|
+
* @category Database model
|
|
1339
|
+
* @category CmsEntry
|
|
1340
|
+
*/
|
|
1341
|
+
export interface CmsEntryValues {
|
|
1342
|
+
[key: string]: any;
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* A content entry definition for and from the database.
|
|
1346
|
+
*
|
|
1347
|
+
* @category Database model
|
|
1348
|
+
* @category CmsEntry
|
|
1349
|
+
*/
|
|
1350
|
+
export interface CmsEntry<T = CmsEntryValues> {
|
|
1351
|
+
/**
|
|
1352
|
+
* A version of the webiny this entry was created with.
|
|
1353
|
+
* This can be used when upgrading the system, so we know which entries to update.
|
|
1354
|
+
*/
|
|
1355
|
+
webinyVersion: string;
|
|
1356
|
+
/**
|
|
1357
|
+
* Tenant id which is this entry for. Can be used in case of shared storage.
|
|
1358
|
+
*/
|
|
1359
|
+
tenant: string;
|
|
1360
|
+
/**
|
|
1361
|
+
* Generated ID of the entry. It is shared across all the records in the database that represent a single entry.
|
|
1362
|
+
* So version 1, 2, ..., 2371 will have the same value in this field to link them together.
|
|
1363
|
+
*/
|
|
1364
|
+
entryId: string;
|
|
1365
|
+
/**
|
|
1366
|
+
* Generated ID + version of the entry.
|
|
1367
|
+
*/
|
|
1368
|
+
id: string;
|
|
1369
|
+
/**
|
|
1370
|
+
* CreatedBy object reference.
|
|
1371
|
+
*/
|
|
1372
|
+
createdBy: CreatedBy;
|
|
1373
|
+
/**
|
|
1374
|
+
* OwnedBy object reference. Can be different from CreatedBy.
|
|
1375
|
+
*/
|
|
1376
|
+
ownedBy: CreatedBy;
|
|
1377
|
+
/**
|
|
1378
|
+
* A string of Date.toISOString() type.
|
|
1379
|
+
* Populated on creation.
|
|
1380
|
+
*/
|
|
1381
|
+
createdOn: string;
|
|
1382
|
+
/**
|
|
1383
|
+
* A string of Date.toISOString() type.
|
|
1384
|
+
* Populated every time entry is saved.
|
|
1385
|
+
*/
|
|
1386
|
+
savedOn: string;
|
|
1387
|
+
/**
|
|
1388
|
+
* Model ID of the definition for the entry.
|
|
1389
|
+
* @see CmsModel
|
|
1390
|
+
*/
|
|
1391
|
+
modelId: string;
|
|
1392
|
+
/**
|
|
1393
|
+
* A locale of the entry.
|
|
1394
|
+
* @see I18NLocale.code
|
|
1395
|
+
*/
|
|
1396
|
+
locale: string;
|
|
1397
|
+
/**
|
|
1398
|
+
* A string of Date.toISOString() type - if published.
|
|
1399
|
+
* Populated when entry is published.
|
|
1400
|
+
*/
|
|
1401
|
+
publishedOn?: string;
|
|
1402
|
+
/**
|
|
1403
|
+
* A revision version of the entry.
|
|
1404
|
+
*/
|
|
1405
|
+
version: number;
|
|
1406
|
+
/**
|
|
1407
|
+
* Is the entry locked?
|
|
1408
|
+
*/
|
|
1409
|
+
locked: boolean;
|
|
1410
|
+
/**
|
|
1411
|
+
* Status type of the entry.
|
|
1412
|
+
*/
|
|
1413
|
+
status: CmsEntryStatus;
|
|
1414
|
+
/**
|
|
1415
|
+
* A mapped storageId -> value object.
|
|
1416
|
+
*
|
|
1417
|
+
* @see CmsModelField
|
|
1418
|
+
*/
|
|
1419
|
+
values: T;
|
|
1420
|
+
/**
|
|
1421
|
+
* Settings for the given entry.
|
|
1422
|
+
*
|
|
1423
|
+
* Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.
|
|
1424
|
+
* Be aware that when accessing properties in it on old systems, it will break if not checked first.
|
|
1425
|
+
*
|
|
1426
|
+
* Available only on the Manage API in entry GraphQL type `meta.data` property.
|
|
1427
|
+
*/
|
|
1428
|
+
meta?: {
|
|
1429
|
+
[key: string]: any;
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
export interface CmsStorageEntry extends CmsEntry {
|
|
1433
|
+
[key: string]: any;
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* A definition for content model manager to be used in the code.
|
|
1437
|
+
* The default one uses `CmsEntryContext` methods internally, but devs can change to what every they want.
|
|
1438
|
+
*
|
|
1439
|
+
* @see CmsEntryContext
|
|
1440
|
+
*
|
|
1441
|
+
* @category Context
|
|
1442
|
+
* @category CmsEntry
|
|
1443
|
+
* @category CmsModel
|
|
1444
|
+
*/
|
|
1445
|
+
export interface CmsModelManager {
|
|
1446
|
+
/**
|
|
1447
|
+
* List only published entries in the content model.
|
|
1448
|
+
*/
|
|
1449
|
+
listPublished: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
1450
|
+
/**
|
|
1451
|
+
* List latest entries in the content model. Used for administration.
|
|
1452
|
+
*/
|
|
1453
|
+
listLatest: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
1454
|
+
/**
|
|
1455
|
+
* Get a list of published entries by the ID list.
|
|
1456
|
+
*/
|
|
1457
|
+
getPublishedByIds: (ids: string[]) => Promise<CmsEntry[]>;
|
|
1458
|
+
/**
|
|
1459
|
+
* Get a list of the latest entries by the ID list.
|
|
1460
|
+
*/
|
|
1461
|
+
getLatestByIds: (ids: string[]) => Promise<CmsEntry[]>;
|
|
1462
|
+
/**
|
|
1463
|
+
* Get an entry filtered by given params. Will always get one.
|
|
1464
|
+
*/
|
|
1465
|
+
get: (id: string) => Promise<CmsEntry>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Create an entry.
|
|
1468
|
+
*/
|
|
1469
|
+
create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;
|
|
1470
|
+
/**
|
|
1471
|
+
* Update an entry.
|
|
1472
|
+
*/
|
|
1473
|
+
update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;
|
|
1474
|
+
/**
|
|
1475
|
+
* Delete an entry.
|
|
1476
|
+
*/
|
|
1477
|
+
delete: (id: string) => Promise<void>;
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Create
|
|
1481
|
+
*/
|
|
1482
|
+
export interface OnModelBeforeCreateTopicParams {
|
|
1483
|
+
input: CmsModelCreateInput;
|
|
1484
|
+
model: CmsModel;
|
|
1485
|
+
}
|
|
1486
|
+
export interface OnModelAfterCreateTopicParams {
|
|
1487
|
+
input: CmsModelCreateInput;
|
|
1488
|
+
model: CmsModel;
|
|
1489
|
+
}
|
|
1490
|
+
export interface OnModelCreateErrorTopicParams {
|
|
1491
|
+
input: CmsModelCreateInput;
|
|
1492
|
+
model: CmsModel;
|
|
1493
|
+
error: Error;
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Create From / Clone
|
|
1497
|
+
*/
|
|
1498
|
+
export interface OnModelBeforeCreateFromTopicParams {
|
|
1499
|
+
input: CmsModelCreateInput;
|
|
1500
|
+
original: CmsModel;
|
|
1501
|
+
model: CmsModel;
|
|
1502
|
+
}
|
|
1503
|
+
export interface OnModelAfterCreateFromTopicParams {
|
|
1504
|
+
input: CmsModelCreateInput;
|
|
1505
|
+
original: CmsModel;
|
|
1506
|
+
model: CmsModel;
|
|
1507
|
+
}
|
|
1508
|
+
export interface OnModelCreateFromErrorParams {
|
|
1509
|
+
input: CmsModelCreateInput;
|
|
1510
|
+
original: CmsModel;
|
|
1511
|
+
model: CmsModel;
|
|
1512
|
+
error: Error;
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Update
|
|
1516
|
+
*/
|
|
1517
|
+
export interface OnModelBeforeUpdateTopicParams {
|
|
1518
|
+
input: CmsModelUpdateInput;
|
|
1519
|
+
original: CmsModel;
|
|
1520
|
+
model: CmsModel;
|
|
1521
|
+
}
|
|
1522
|
+
export interface OnModelAfterUpdateTopicParams {
|
|
1523
|
+
input: CmsModelUpdateInput;
|
|
1524
|
+
original: CmsModel;
|
|
1525
|
+
model: CmsModel;
|
|
1526
|
+
}
|
|
1527
|
+
export interface OnModelUpdateErrorTopicParams {
|
|
1528
|
+
input: CmsModelUpdateInput;
|
|
1529
|
+
original: CmsModel;
|
|
1530
|
+
model: CmsModel;
|
|
1531
|
+
error: Error;
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Delete
|
|
1535
|
+
*/
|
|
1536
|
+
export interface OnModelBeforeDeleteTopicParams {
|
|
1537
|
+
model: CmsModel;
|
|
1538
|
+
}
|
|
1539
|
+
export interface OnModelAfterDeleteTopicParams {
|
|
1540
|
+
model: CmsModel;
|
|
1541
|
+
}
|
|
1542
|
+
export interface OnModelDeleteErrorTopicParams {
|
|
1543
|
+
model: CmsModel;
|
|
1544
|
+
error: Error;
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Initialize
|
|
1548
|
+
*/
|
|
1549
|
+
export interface OnModelInitializeParams {
|
|
1550
|
+
model: CmsModel;
|
|
1551
|
+
data: Record<string, any>;
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
*
|
|
1555
|
+
*/
|
|
1556
|
+
export interface CmsModelUpdateDirectParams {
|
|
1557
|
+
model: CmsModel;
|
|
1558
|
+
original: CmsModel;
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Cms Model in the context.
|
|
1562
|
+
*
|
|
1563
|
+
* @category Context
|
|
1564
|
+
* @category CmsModel
|
|
1565
|
+
*/
|
|
1566
|
+
export interface CmsModelContext {
|
|
1567
|
+
/**
|
|
1568
|
+
* Get a single content model.
|
|
1569
|
+
*/
|
|
1570
|
+
getModel: (modelId: string) => Promise<CmsModel | null>;
|
|
1571
|
+
/**
|
|
1572
|
+
* Get all content models.
|
|
1573
|
+
*/
|
|
1574
|
+
listModels: () => Promise<CmsModel[]>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Create a content model.
|
|
1577
|
+
*/
|
|
1578
|
+
createModel: (data: CmsModelCreateInput) => Promise<CmsModel>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Create a content model from the given model - clone.
|
|
1581
|
+
*/
|
|
1582
|
+
createModelFrom: (modelId: string, data: CmsModelCreateFromInput) => Promise<CmsModel>;
|
|
1583
|
+
/**
|
|
1584
|
+
* Update content model without data validation. Used internally.
|
|
1585
|
+
* @hidden
|
|
1586
|
+
*/
|
|
1587
|
+
updateModelDirect: (params: CmsModelUpdateDirectParams) => Promise<CmsModel>;
|
|
1588
|
+
/**
|
|
1589
|
+
* Update content model.
|
|
1590
|
+
*/
|
|
1591
|
+
updateModel: (modelId: string, data: CmsModelUpdateInput) => Promise<CmsModel>;
|
|
1592
|
+
/**
|
|
1593
|
+
* Delete content model. Should not allow deletion if there are entries connected to it.
|
|
1594
|
+
*/
|
|
1595
|
+
deleteModel: (modelId: string) => Promise<void>;
|
|
1596
|
+
/**
|
|
1597
|
+
* Possibility for users to trigger the model initialization.
|
|
1598
|
+
* They can hook into it and do what ever they want to.
|
|
1599
|
+
*
|
|
1600
|
+
* Primary idea behind this is creating the index, for the code models, in the ES.
|
|
1601
|
+
*/
|
|
1602
|
+
initializeModel: (modelId: string, data: Record<string, any>) => Promise<boolean>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Get an instance of CmsModelManager for given content modelId.
|
|
1605
|
+
*
|
|
1606
|
+
* @see CmsModelManager
|
|
1607
|
+
*
|
|
1608
|
+
* @deprecated use the getEntryManager() method instead
|
|
1609
|
+
*/
|
|
1610
|
+
getModelManager: (model: CmsModel | string) => Promise<CmsModelManager>;
|
|
1611
|
+
getEntryManager: (model: CmsModel | string) => Promise<CmsModelManager>;
|
|
1612
|
+
/**
|
|
1613
|
+
* Get all content model managers mapped by modelId.
|
|
1614
|
+
* @see CmsModelManager
|
|
1615
|
+
* @deprecated use getEntryManagers instead
|
|
1616
|
+
*/
|
|
1617
|
+
getManagers: () => Map<string, CmsModelManager>;
|
|
1618
|
+
getEntryManagers: () => Map<string, CmsModelManager>;
|
|
1619
|
+
/**
|
|
1620
|
+
* Clear all the model caches.
|
|
1621
|
+
*/
|
|
1622
|
+
clearModelsCache: () => void;
|
|
1623
|
+
/**
|
|
1624
|
+
* Lifecycle events - deprecated.
|
|
1625
|
+
*/
|
|
1626
|
+
/**
|
|
1627
|
+
* @deprecated
|
|
1628
|
+
*/
|
|
1629
|
+
onBeforeModelCreate: Topic<OnModelBeforeCreateTopicParams>;
|
|
1630
|
+
/**
|
|
1631
|
+
* @deprecated
|
|
1632
|
+
*/
|
|
1633
|
+
onAfterModelCreate: Topic<OnModelAfterCreateTopicParams>;
|
|
1634
|
+
/**
|
|
1635
|
+
* @deprecated
|
|
1636
|
+
*/
|
|
1637
|
+
onBeforeModelCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;
|
|
1638
|
+
/**
|
|
1639
|
+
* @deprecated
|
|
1640
|
+
*/
|
|
1641
|
+
onAfterModelCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;
|
|
1642
|
+
/**
|
|
1643
|
+
* @deprecated
|
|
1644
|
+
*/
|
|
1645
|
+
onBeforeModelUpdate: Topic<OnModelBeforeUpdateTopicParams>;
|
|
1646
|
+
/**
|
|
1647
|
+
* @deprecated
|
|
1648
|
+
*/
|
|
1649
|
+
onAfterModelUpdate: Topic<OnModelAfterUpdateTopicParams>;
|
|
1650
|
+
/**
|
|
1651
|
+
* @deprecated
|
|
1652
|
+
*/
|
|
1653
|
+
onBeforeModelDelete: Topic<OnModelBeforeDeleteTopicParams>;
|
|
1654
|
+
/**
|
|
1655
|
+
* @deprecated
|
|
1656
|
+
*/
|
|
1657
|
+
onAfterModelDelete: Topic<OnModelAfterDeleteTopicParams>;
|
|
1658
|
+
/**
|
|
1659
|
+
* Lifecycle events - released in 5.33.0
|
|
1660
|
+
*/
|
|
1661
|
+
onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;
|
|
1662
|
+
onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;
|
|
1663
|
+
onModelCreateError: Topic<OnModelCreateErrorTopicParams>;
|
|
1664
|
+
onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;
|
|
1665
|
+
onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;
|
|
1666
|
+
onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;
|
|
1667
|
+
onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;
|
|
1668
|
+
onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;
|
|
1669
|
+
onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;
|
|
1670
|
+
onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;
|
|
1671
|
+
onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;
|
|
1672
|
+
onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;
|
|
1673
|
+
onModelInitialize: Topic<OnModelInitializeParams>;
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Available statuses for content entry.
|
|
1677
|
+
*
|
|
1678
|
+
* @category CmsEntry
|
|
1679
|
+
*/
|
|
1680
|
+
export declare type CmsEntryStatus = "published" | "unpublished" | "draft";
|
|
1681
|
+
export interface CmsEntryListWhereRef {
|
|
1682
|
+
id?: string;
|
|
1683
|
+
id_in?: string[];
|
|
1684
|
+
id_not?: string;
|
|
1685
|
+
id_not_in?: string[];
|
|
1686
|
+
entryId?: string;
|
|
1687
|
+
entryId_not?: string;
|
|
1688
|
+
entryId_in?: string[];
|
|
1689
|
+
entryId_not_in?: string[];
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Entry listing where params.
|
|
1693
|
+
*
|
|
1694
|
+
* @category CmsEntry
|
|
1695
|
+
* @category GraphQL params
|
|
1696
|
+
*/
|
|
1697
|
+
export interface CmsEntryListWhere {
|
|
1698
|
+
/**
|
|
1699
|
+
* Fields.
|
|
1700
|
+
*/
|
|
1701
|
+
id?: string;
|
|
1702
|
+
id_in?: string[];
|
|
1703
|
+
id_not?: string;
|
|
1704
|
+
id_not_in?: string[];
|
|
1705
|
+
/**
|
|
1706
|
+
* Generated ID without the version.
|
|
1707
|
+
*/
|
|
1708
|
+
entryId?: string;
|
|
1709
|
+
entryId_not?: string;
|
|
1710
|
+
entryId_in?: string[];
|
|
1711
|
+
entryId_not_in?: string[];
|
|
1712
|
+
/**
|
|
1713
|
+
* Contains the owner of the entry. An "owner" is the identity who originally created the entry.
|
|
1714
|
+
* Subsequent revisions can be created by other identities, and those will be stored in `createdBy`,
|
|
1715
|
+
* but the `owner` is always the original author of the entry.
|
|
1716
|
+
*
|
|
1717
|
+
* Can be sent via the API or set internal if user can see only their own entries.
|
|
1718
|
+
*/
|
|
1719
|
+
ownedBy?: string;
|
|
1720
|
+
ownedBy_not?: string;
|
|
1721
|
+
ownedBy_in?: string[];
|
|
1722
|
+
ownedBy_not_in?: string[];
|
|
1723
|
+
/**
|
|
1724
|
+
* Who created the entry?
|
|
1725
|
+
*/
|
|
1726
|
+
createdBy?: string;
|
|
1727
|
+
createdBy_not?: string;
|
|
1728
|
+
createdBy_in?: string[];
|
|
1729
|
+
createdBy_not_in?: string[];
|
|
1730
|
+
/**
|
|
1731
|
+
* Version of the entry.
|
|
1732
|
+
*
|
|
1733
|
+
* It is not meant to be used via the API.
|
|
1734
|
+
* @internal
|
|
1735
|
+
*/
|
|
1736
|
+
version?: number;
|
|
1737
|
+
version_lt?: number;
|
|
1738
|
+
version_gt?: number;
|
|
1739
|
+
/**
|
|
1740
|
+
* Each storage operations implementation MUST determine how to use this field.
|
|
1741
|
+
* In SQL, it can be a `published` field, and in DynamoDB it can be an SK.
|
|
1742
|
+
*
|
|
1743
|
+
* It is not meant to be used via the API.
|
|
1744
|
+
* @internal
|
|
1745
|
+
*/
|
|
1746
|
+
published?: boolean;
|
|
1747
|
+
/**
|
|
1748
|
+
* Each storage operations implementation MUST determine how to use this field.
|
|
1749
|
+
* In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.
|
|
1750
|
+
*
|
|
1751
|
+
* It is not meant to be used via the API.
|
|
1752
|
+
* @internal
|
|
1753
|
+
*/
|
|
1754
|
+
latest?: boolean;
|
|
1755
|
+
/**
|
|
1756
|
+
* This is to allow querying by any content model field defined by the user.
|
|
1757
|
+
*/
|
|
1758
|
+
[key: string]: string | number | boolean | undefined | string[] | number[] | null | CmsEntryListWhere[] | CmsEntryListWhere | CmsEntryListWhereRef;
|
|
1759
|
+
/**
|
|
1760
|
+
* To allow querying via nested queries, we added the AND / OR properties.
|
|
1761
|
+
*/
|
|
1762
|
+
AND?: CmsEntryListWhere[];
|
|
1763
|
+
OR?: CmsEntryListWhere[];
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Entry listing sort.
|
|
1767
|
+
*
|
|
1768
|
+
* @category CmsEntry
|
|
1769
|
+
* @category GraphQL params
|
|
1770
|
+
*/
|
|
1771
|
+
export declare type CmsEntryListSort = string[];
|
|
1772
|
+
/**
|
|
1773
|
+
* Get entry GraphQL resolver params.
|
|
1774
|
+
*
|
|
1775
|
+
* @category CmsEntry
|
|
1776
|
+
* @category GraphQL params
|
|
1777
|
+
*/
|
|
1778
|
+
export interface CmsEntryGetParams {
|
|
1779
|
+
where: CmsEntryListWhere;
|
|
1780
|
+
sort?: CmsEntryListSort;
|
|
1781
|
+
}
|
|
1782
|
+
/**
|
|
1783
|
+
* List entries GraphQL resolver params.
|
|
1784
|
+
*
|
|
1785
|
+
* @category CmsEntry
|
|
1786
|
+
* @category GraphQL params
|
|
1787
|
+
*/
|
|
1788
|
+
export interface CmsEntryListParams {
|
|
1789
|
+
where?: CmsEntryListWhere;
|
|
1790
|
+
sort?: CmsEntryListSort;
|
|
1791
|
+
search?: string;
|
|
1792
|
+
fields?: string[];
|
|
1793
|
+
limit?: number;
|
|
1794
|
+
after?: string | null;
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Meta information for GraphQL output.
|
|
1798
|
+
*
|
|
1799
|
+
* @category CmsEntry
|
|
1800
|
+
* @category GraphQL output
|
|
1801
|
+
*/
|
|
1802
|
+
export interface CmsEntryMeta {
|
|
1803
|
+
/**
|
|
1804
|
+
* A cursor for pagination.
|
|
1805
|
+
*/
|
|
1806
|
+
cursor: string | null;
|
|
1807
|
+
/**
|
|
1808
|
+
* Is there more items to load?
|
|
1809
|
+
*/
|
|
1810
|
+
hasMoreItems: boolean;
|
|
1811
|
+
/**
|
|
1812
|
+
* Total count of the items in the storage.
|
|
1813
|
+
*/
|
|
1814
|
+
totalCount: number;
|
|
1815
|
+
}
|
|
1816
|
+
export interface OnEntryBeforeCreateTopicParams {
|
|
1817
|
+
input: CreateCmsEntryInput;
|
|
1818
|
+
entry: CmsEntry;
|
|
1819
|
+
model: StorageOperationsCmsModel;
|
|
1820
|
+
}
|
|
1821
|
+
export interface OnEntryAfterCreateTopicParams {
|
|
1822
|
+
input: CreateCmsEntryInput;
|
|
1823
|
+
entry: CmsEntry;
|
|
1824
|
+
model: StorageOperationsCmsModel;
|
|
1825
|
+
storageEntry: CmsEntry;
|
|
1826
|
+
}
|
|
1827
|
+
export interface OnEntryCreateErrorTopicParams {
|
|
1828
|
+
error: Error;
|
|
1829
|
+
input: CreateCmsEntryInput;
|
|
1830
|
+
entry: CmsEntry;
|
|
1831
|
+
model: CmsModel;
|
|
1832
|
+
}
|
|
1833
|
+
export interface OnEntryRevisionBeforeCreateTopicParams {
|
|
1834
|
+
input: CreateFromCmsEntryInput;
|
|
1835
|
+
entry: CmsEntry;
|
|
1836
|
+
original: CmsEntry;
|
|
1837
|
+
model: StorageOperationsCmsModel;
|
|
1838
|
+
}
|
|
1839
|
+
export interface OnEntryRevisionAfterCreateTopicParams {
|
|
1840
|
+
input: CreateFromCmsEntryInput;
|
|
1841
|
+
entry: CmsEntry;
|
|
1842
|
+
original: CmsEntry;
|
|
1843
|
+
model: StorageOperationsCmsModel;
|
|
1844
|
+
storageEntry: CmsEntry;
|
|
1845
|
+
}
|
|
1846
|
+
export interface OnEntryCreateRevisionErrorTopicParams {
|
|
1847
|
+
error: Error;
|
|
1848
|
+
input: CreateFromCmsEntryInput;
|
|
1849
|
+
original: CmsEntry;
|
|
1850
|
+
entry: CmsEntry;
|
|
1851
|
+
model: CmsModel;
|
|
1852
|
+
}
|
|
1853
|
+
export interface OnEntryBeforeUpdateTopicParams {
|
|
1854
|
+
input: UpdateCmsEntryInput;
|
|
1855
|
+
original: CmsEntry;
|
|
1856
|
+
entry: CmsEntry;
|
|
1857
|
+
model: StorageOperationsCmsModel;
|
|
1858
|
+
}
|
|
1859
|
+
export interface OnEntryAfterUpdateTopicParams {
|
|
1860
|
+
input: UpdateCmsEntryInput;
|
|
1861
|
+
original: CmsEntry;
|
|
1862
|
+
entry: CmsEntry;
|
|
1863
|
+
model: StorageOperationsCmsModel;
|
|
1864
|
+
storageEntry: CmsEntry;
|
|
1865
|
+
}
|
|
1866
|
+
export interface OnEntryUpdateErrorTopicParams {
|
|
1867
|
+
error: Error;
|
|
1868
|
+
input: CreateFromCmsEntryInput;
|
|
1869
|
+
entry: CmsEntry;
|
|
1870
|
+
model: CmsModel;
|
|
1871
|
+
}
|
|
1872
|
+
export interface OnEntryBeforePublishTopicParams {
|
|
1873
|
+
entry: CmsEntry;
|
|
1874
|
+
model: StorageOperationsCmsModel;
|
|
1875
|
+
}
|
|
1876
|
+
export interface OnEntryAfterPublishTopicParams {
|
|
1877
|
+
entry: CmsEntry;
|
|
1878
|
+
model: StorageOperationsCmsModel;
|
|
1879
|
+
storageEntry: CmsEntry;
|
|
1880
|
+
}
|
|
1881
|
+
export interface OnEntryPublishErrorTopicParams {
|
|
1882
|
+
error: Error;
|
|
1883
|
+
entry: CmsEntry;
|
|
1884
|
+
model: StorageOperationsCmsModel;
|
|
1885
|
+
}
|
|
1886
|
+
export interface OnEntryBeforeUnpublishTopicParams {
|
|
1887
|
+
entry: CmsEntry;
|
|
1888
|
+
model: StorageOperationsCmsModel;
|
|
1889
|
+
}
|
|
1890
|
+
export interface OnEntryAfterUnpublishTopicParams {
|
|
1891
|
+
entry: CmsEntry;
|
|
1892
|
+
model: StorageOperationsCmsModel;
|
|
1893
|
+
storageEntry: CmsEntry;
|
|
1894
|
+
}
|
|
1895
|
+
export interface OnEntryUnpublishErrorTopicParams {
|
|
1896
|
+
error: Error;
|
|
1897
|
+
entry: CmsEntry;
|
|
1898
|
+
model: CmsModel;
|
|
1899
|
+
}
|
|
1900
|
+
export interface OnEntryBeforeDeleteTopicParams {
|
|
1901
|
+
entry: CmsEntry;
|
|
1902
|
+
model: StorageOperationsCmsModel;
|
|
1903
|
+
}
|
|
1904
|
+
export interface OnEntryAfterDeleteTopicParams {
|
|
1905
|
+
entry: CmsEntry;
|
|
1906
|
+
model: StorageOperationsCmsModel;
|
|
1907
|
+
}
|
|
1908
|
+
export interface OnEntryDeleteErrorTopicParams {
|
|
1909
|
+
error: Error;
|
|
1910
|
+
entry: CmsEntry;
|
|
1911
|
+
model: StorageOperationsCmsModel;
|
|
1912
|
+
}
|
|
1913
|
+
export interface OnEntryRevisionBeforeDeleteTopicParams {
|
|
1914
|
+
entry: CmsEntry;
|
|
1915
|
+
model: StorageOperationsCmsModel;
|
|
1916
|
+
}
|
|
1917
|
+
export interface OnEntryRevisionAfterDeleteTopicParams {
|
|
1918
|
+
entry: CmsEntry;
|
|
1919
|
+
model: StorageOperationsCmsModel;
|
|
1920
|
+
}
|
|
1921
|
+
export interface OnEntryRevisionDeleteErrorTopicParams {
|
|
1922
|
+
error: Error;
|
|
1923
|
+
entry: CmsEntry;
|
|
1924
|
+
model: StorageOperationsCmsModel;
|
|
1925
|
+
}
|
|
1926
|
+
export interface OnEntryBeforeGetTopicParams {
|
|
1927
|
+
model: StorageOperationsCmsModel;
|
|
1928
|
+
where: CmsEntryListWhere;
|
|
1929
|
+
}
|
|
1930
|
+
export interface EntryBeforeListTopicParams {
|
|
1931
|
+
where: CmsEntryListWhere;
|
|
1932
|
+
model: StorageOperationsCmsModel;
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* @category Context
|
|
1936
|
+
* @category CmsEntry
|
|
1937
|
+
*/
|
|
1938
|
+
export interface CreateCmsEntryInput {
|
|
1939
|
+
[key: string]: any;
|
|
1940
|
+
}
|
|
1941
|
+
/**
|
|
1942
|
+
* @category Context
|
|
1943
|
+
* @category CmsEntry
|
|
1944
|
+
*/
|
|
1945
|
+
export interface CreateFromCmsEntryInput {
|
|
1946
|
+
[key: string]: any;
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* @category Context
|
|
1950
|
+
* @category CmsEntry
|
|
1951
|
+
*/
|
|
1952
|
+
export interface UpdateCmsEntryInput {
|
|
1953
|
+
[key: string]: any;
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Cms Entry CRUD methods in the context.
|
|
1957
|
+
*
|
|
1958
|
+
* @category Context
|
|
1959
|
+
* @category CmsEntry
|
|
1960
|
+
*/
|
|
1961
|
+
export interface CmsEntryContext {
|
|
1962
|
+
/**
|
|
1963
|
+
* Get a single content entry for a model.
|
|
1964
|
+
*/
|
|
1965
|
+
getEntry: (model: CmsModel, params: CmsEntryGetParams) => Promise<CmsEntry | null>;
|
|
1966
|
+
/**
|
|
1967
|
+
* Get a list of entries for a model by a given ID (revision).
|
|
1968
|
+
*/
|
|
1969
|
+
getEntriesByIds: (model: CmsModel, revisions: string[]) => Promise<CmsEntry[]>;
|
|
1970
|
+
/**
|
|
1971
|
+
* Get the entry for a model by a given ID.
|
|
1972
|
+
*/
|
|
1973
|
+
getEntryById: (model: CmsModel, revision: string) => Promise<CmsEntry>;
|
|
1974
|
+
/**
|
|
1975
|
+
* List entries for a model. Internal method used by get, listLatest and listPublished.
|
|
1976
|
+
*/
|
|
1977
|
+
listEntries: (model: CmsModel, params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
1978
|
+
/**
|
|
1979
|
+
* Lists the latest entries. Used for manage API.
|
|
1980
|
+
*/
|
|
1981
|
+
listLatestEntries: (model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
1982
|
+
/**
|
|
1983
|
+
* List published entries. Used for read API.
|
|
1984
|
+
*/
|
|
1985
|
+
listPublishedEntries: (model: CmsModel, params?: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;
|
|
1986
|
+
/**
|
|
1987
|
+
* List published entries by IDs.
|
|
1988
|
+
*/
|
|
1989
|
+
getPublishedEntriesByIds: (model: CmsModel, ids: string[]) => Promise<CmsEntry[]>;
|
|
1990
|
+
/**
|
|
1991
|
+
* List latest entries by IDs.
|
|
1992
|
+
*/
|
|
1993
|
+
getLatestEntriesByIds: (model: CmsModel, ids: string[]) => Promise<CmsEntry[]>;
|
|
1994
|
+
/**
|
|
1995
|
+
* Create a new content entry.
|
|
1996
|
+
*/
|
|
1997
|
+
createEntry: (model: CmsModel, input: CreateCmsEntryInput) => Promise<CmsEntry>;
|
|
1998
|
+
/**
|
|
1999
|
+
* Create a new entry from already existing entry.
|
|
2000
|
+
*/
|
|
2001
|
+
createEntryRevisionFrom: (model: CmsModel, id: string, input: CreateFromCmsEntryInput) => Promise<CmsEntry>;
|
|
2002
|
+
/**
|
|
2003
|
+
* Update existing entry.
|
|
2004
|
+
*/
|
|
2005
|
+
updateEntry: (model: CmsModel, id: string, input: UpdateCmsEntryInput, meta?: Record<string, any>) => Promise<CmsEntry>;
|
|
2006
|
+
/**
|
|
2007
|
+
* Method that republishes entry with given identifier.
|
|
2008
|
+
* @internal
|
|
2009
|
+
*/
|
|
2010
|
+
republishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;
|
|
2011
|
+
/**
|
|
2012
|
+
* Delete only a certain revision of the entry.
|
|
2013
|
+
*/
|
|
2014
|
+
deleteEntryRevision: (model: CmsModel, id: string) => Promise<void>;
|
|
2015
|
+
/**
|
|
2016
|
+
* Delete entry with all its revisions.
|
|
2017
|
+
*/
|
|
2018
|
+
deleteEntry: (model: CmsModel, id: string) => Promise<void>;
|
|
2019
|
+
/**
|
|
2020
|
+
* Publish entry.
|
|
2021
|
+
*/
|
|
2022
|
+
publishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;
|
|
2023
|
+
/**
|
|
2024
|
+
* Unpublish entry.
|
|
2025
|
+
*/
|
|
2026
|
+
unpublishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;
|
|
2027
|
+
/**
|
|
2028
|
+
* Get all entry revisions.
|
|
2029
|
+
*/
|
|
2030
|
+
getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;
|
|
2031
|
+
/**
|
|
2032
|
+
* Lifecyle events - deprecated.
|
|
2033
|
+
*/
|
|
2034
|
+
/**
|
|
2035
|
+
* @deprecated
|
|
2036
|
+
*/
|
|
2037
|
+
onBeforeEntryCreate: Topic<OnEntryBeforeCreateTopicParams>;
|
|
2038
|
+
/**
|
|
2039
|
+
* @deprecated
|
|
2040
|
+
*/
|
|
2041
|
+
onAfterEntryCreate: Topic<OnEntryAfterCreateTopicParams>;
|
|
2042
|
+
/**
|
|
2043
|
+
* @deprecated
|
|
2044
|
+
*/
|
|
2045
|
+
onBeforeEntryCreateRevision: Topic<OnEntryRevisionBeforeCreateTopicParams>;
|
|
2046
|
+
/**
|
|
2047
|
+
* @deprecated
|
|
2048
|
+
*/
|
|
2049
|
+
onAfterEntryCreateRevision: Topic<OnEntryRevisionAfterCreateTopicParams>;
|
|
2050
|
+
/**
|
|
2051
|
+
* @deprecated
|
|
2052
|
+
*/
|
|
2053
|
+
onBeforeEntryUpdate: Topic<OnEntryBeforeUpdateTopicParams>;
|
|
2054
|
+
/**
|
|
2055
|
+
* @deprecated
|
|
2056
|
+
*/
|
|
2057
|
+
onAfterEntryUpdate: Topic<OnEntryAfterUpdateTopicParams>;
|
|
2058
|
+
/**
|
|
2059
|
+
* @deprecated
|
|
2060
|
+
*/
|
|
2061
|
+
onBeforeEntryDelete: Topic<OnEntryBeforeDeleteTopicParams>;
|
|
2062
|
+
/**
|
|
2063
|
+
* @deprecated
|
|
2064
|
+
*/
|
|
2065
|
+
onAfterEntryDelete: Topic<OnEntryAfterDeleteTopicParams>;
|
|
2066
|
+
/**
|
|
2067
|
+
* @deprecated
|
|
2068
|
+
*/
|
|
2069
|
+
onBeforeEntryDeleteRevision: Topic<OnEntryRevisionBeforeDeleteTopicParams>;
|
|
2070
|
+
/**
|
|
2071
|
+
* @deprecated
|
|
2072
|
+
*/
|
|
2073
|
+
onAfterEntryDeleteRevision: Topic<OnEntryRevisionAfterDeleteTopicParams>;
|
|
2074
|
+
/**
|
|
2075
|
+
* @deprecated
|
|
2076
|
+
*/
|
|
2077
|
+
onBeforeEntryPublish: Topic<OnEntryBeforePublishTopicParams>;
|
|
2078
|
+
/**
|
|
2079
|
+
* @deprecated
|
|
2080
|
+
*/
|
|
2081
|
+
onAfterEntryPublish: Topic<OnEntryAfterPublishTopicParams>;
|
|
2082
|
+
/**
|
|
2083
|
+
* @deprecated
|
|
2084
|
+
*/
|
|
2085
|
+
onBeforeEntryUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;
|
|
2086
|
+
/**
|
|
2087
|
+
* @deprecated
|
|
2088
|
+
*/
|
|
2089
|
+
onAfterEntryUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;
|
|
2090
|
+
/**
|
|
2091
|
+
* @deprecated
|
|
2092
|
+
*/
|
|
2093
|
+
onBeforeEntryGet: Topic<OnEntryBeforeGetTopicParams>;
|
|
2094
|
+
/**
|
|
2095
|
+
* @deprecated
|
|
2096
|
+
*/
|
|
2097
|
+
onBeforeEntryList: Topic<EntryBeforeListTopicParams>;
|
|
2098
|
+
/**
|
|
2099
|
+
* Lifecycle events released in 5.33.0
|
|
2100
|
+
*/
|
|
2101
|
+
onEntryBeforeCreate: Topic<OnEntryBeforeCreateTopicParams>;
|
|
2102
|
+
onEntryAfterCreate: Topic<OnEntryAfterCreateTopicParams>;
|
|
2103
|
+
onEntryCreateError: Topic<OnEntryCreateErrorTopicParams>;
|
|
2104
|
+
onEntryRevisionBeforeCreate: Topic<OnEntryRevisionBeforeCreateTopicParams>;
|
|
2105
|
+
onEntryRevisionAfterCreate: Topic<OnEntryRevisionAfterCreateTopicParams>;
|
|
2106
|
+
onEntryRevisionCreateError: Topic<OnEntryCreateRevisionErrorTopicParams>;
|
|
2107
|
+
onEntryBeforeUpdate: Topic<OnEntryBeforeUpdateTopicParams>;
|
|
2108
|
+
onEntryAfterUpdate: Topic<OnEntryAfterUpdateTopicParams>;
|
|
2109
|
+
onEntryUpdateError: Topic<OnEntryUpdateErrorTopicParams>;
|
|
2110
|
+
onEntryBeforeDelete: Topic<OnEntryBeforeDeleteTopicParams>;
|
|
2111
|
+
onEntryAfterDelete: Topic<OnEntryAfterDeleteTopicParams>;
|
|
2112
|
+
onEntryDeleteError: Topic<OnEntryDeleteErrorTopicParams>;
|
|
2113
|
+
onEntryRevisionBeforeDelete: Topic<OnEntryRevisionBeforeDeleteTopicParams>;
|
|
2114
|
+
onEntryRevisionAfterDelete: Topic<OnEntryRevisionAfterDeleteTopicParams>;
|
|
2115
|
+
onEntryRevisionDeleteError: Topic<OnEntryRevisionDeleteErrorTopicParams>;
|
|
2116
|
+
onEntryBeforePublish: Topic<OnEntryBeforePublishTopicParams>;
|
|
2117
|
+
onEntryAfterPublish: Topic<OnEntryAfterPublishTopicParams>;
|
|
2118
|
+
onEntryPublishError: Topic<OnEntryPublishErrorTopicParams>;
|
|
2119
|
+
onEntryBeforeUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;
|
|
2120
|
+
onEntryAfterUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;
|
|
2121
|
+
onEntryUnpublishError: Topic<OnEntryUnpublishErrorTopicParams>;
|
|
2122
|
+
onEntryBeforeGet: Topic<OnEntryBeforeGetTopicParams>;
|
|
2123
|
+
onEntryBeforeList: Topic<EntryBeforeListTopicParams>;
|
|
2124
|
+
}
|
|
2125
|
+
/**
|
|
2126
|
+
* Parameters for CmsEntryResolverFactory.
|
|
2127
|
+
*
|
|
2128
|
+
* @category GraphQL resolver
|
|
2129
|
+
* @category CmsEntry
|
|
2130
|
+
*/
|
|
2131
|
+
interface CmsEntryResolverFactoryParams {
|
|
2132
|
+
model: CmsModel;
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.
|
|
2136
|
+
*
|
|
2137
|
+
* @category GraphQL resolver
|
|
2138
|
+
* @category CmsEntry
|
|
2139
|
+
*/
|
|
2140
|
+
export declare type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {
|
|
2141
|
+
(params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;
|
|
2142
|
+
};
|
|
2143
|
+
/**
|
|
2144
|
+
* Settings security permission.
|
|
2145
|
+
*
|
|
2146
|
+
* @category SecurityPermission
|
|
2147
|
+
*/
|
|
2148
|
+
export interface CmsSettingsPermission extends SecurityPermission {
|
|
2149
|
+
}
|
|
2150
|
+
/**
|
|
2151
|
+
* A base security permission for CMS.
|
|
2152
|
+
*
|
|
2153
|
+
* @category SecurityPermission
|
|
2154
|
+
*/
|
|
2155
|
+
export interface BaseCmsSecurityPermission extends SecurityPermission {
|
|
2156
|
+
own?: boolean;
|
|
2157
|
+
rwd: string | number;
|
|
2158
|
+
}
|
|
2159
|
+
/**
|
|
2160
|
+
* A security permission for content model.
|
|
2161
|
+
*
|
|
2162
|
+
* @category SecurityPermission
|
|
2163
|
+
* @category CmsModel
|
|
2164
|
+
*/
|
|
2165
|
+
export interface CmsModelPermission extends BaseCmsSecurityPermission {
|
|
2166
|
+
/**
|
|
2167
|
+
* An object representing `key: model.modelId` values where key is locale code.
|
|
2168
|
+
*/
|
|
2169
|
+
models?: {
|
|
2170
|
+
[key: string]: string[];
|
|
2171
|
+
};
|
|
2172
|
+
/**
|
|
2173
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2174
|
+
*/
|
|
2175
|
+
groups?: {
|
|
2176
|
+
[key: string]: string[];
|
|
2177
|
+
};
|
|
2178
|
+
}
|
|
2179
|
+
/**
|
|
2180
|
+
* The security permission for content model groups.
|
|
2181
|
+
*
|
|
2182
|
+
* @category SecurityPermission
|
|
2183
|
+
* @category CmsGroup
|
|
2184
|
+
*/
|
|
2185
|
+
export interface CmsGroupPermission extends BaseCmsSecurityPermission {
|
|
2186
|
+
/**
|
|
2187
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2188
|
+
*/
|
|
2189
|
+
groups?: {
|
|
2190
|
+
[key: string]: string[];
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2193
|
+
/**
|
|
2194
|
+
* The security permission for content entry.
|
|
2195
|
+
*
|
|
2196
|
+
* @category SecurityPermission
|
|
2197
|
+
* @category CmsEntry
|
|
2198
|
+
*/
|
|
2199
|
+
export interface CmsEntryPermission extends BaseCmsSecurityPermission {
|
|
2200
|
+
pw?: string;
|
|
2201
|
+
/**
|
|
2202
|
+
* An object representing `key: model.modelId` values where key is locale code.
|
|
2203
|
+
*/
|
|
2204
|
+
models?: {
|
|
2205
|
+
[key: string]: string[];
|
|
2206
|
+
};
|
|
2207
|
+
/**
|
|
2208
|
+
* {locale: groupId[]} map, where key is a locale code.
|
|
2209
|
+
*/
|
|
2210
|
+
groups?: {
|
|
2211
|
+
[key: string]: string[];
|
|
2212
|
+
};
|
|
2213
|
+
}
|
|
2214
|
+
export interface CmsGroupStorageOperationsGetParams {
|
|
2215
|
+
id: string;
|
|
2216
|
+
tenant: string;
|
|
2217
|
+
locale: string;
|
|
2218
|
+
}
|
|
2219
|
+
export interface CmsGroupStorageOperationsListWhereParams {
|
|
2220
|
+
tenant: string;
|
|
2221
|
+
locale: string;
|
|
2222
|
+
[key: string]: any;
|
|
2223
|
+
}
|
|
2224
|
+
export interface CmsGroupStorageOperationsListParams {
|
|
2225
|
+
where: CmsGroupStorageOperationsListWhereParams;
|
|
2226
|
+
sort?: string[];
|
|
2227
|
+
}
|
|
2228
|
+
export interface CmsGroupStorageOperationsCreateParams {
|
|
2229
|
+
group: CmsGroup;
|
|
2230
|
+
}
|
|
2231
|
+
export interface CmsGroupStorageOperationsUpdateParams {
|
|
2232
|
+
group: CmsGroup;
|
|
2233
|
+
}
|
|
2234
|
+
export interface CmsGroupStorageOperationsDeleteParams {
|
|
2235
|
+
group: CmsGroup;
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Description of the CmsGroup CRUD operations.
|
|
2239
|
+
* If user wants to add another database to the application, this is how it is done.
|
|
2240
|
+
* This is just plain read, update, write, delete and list - no authentication or permission checks.
|
|
2241
|
+
*/
|
|
2242
|
+
export interface CmsGroupStorageOperations {
|
|
2243
|
+
/**
|
|
2244
|
+
* Gets content model group by given id.
|
|
2245
|
+
*/
|
|
2246
|
+
get: (params: CmsGroupStorageOperationsGetParams) => Promise<CmsGroup | null>;
|
|
2247
|
+
/**
|
|
2248
|
+
* List all content model groups. Filterable via params.
|
|
2249
|
+
*/
|
|
2250
|
+
list: (params: CmsGroupStorageOperationsListParams) => Promise<CmsGroup[]>;
|
|
2251
|
+
/**
|
|
2252
|
+
* Create a new content model group.
|
|
2253
|
+
*/
|
|
2254
|
+
create: (params: CmsGroupStorageOperationsCreateParams) => Promise<CmsGroup>;
|
|
2255
|
+
/**
|
|
2256
|
+
* Update existing content model group.
|
|
2257
|
+
*/
|
|
2258
|
+
update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<CmsGroup>;
|
|
2259
|
+
/**
|
|
2260
|
+
* Delete the content model group.
|
|
2261
|
+
*/
|
|
2262
|
+
delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<CmsGroup>;
|
|
2263
|
+
}
|
|
2264
|
+
export interface CmsModelStorageOperationsGetParams {
|
|
2265
|
+
tenant: string;
|
|
2266
|
+
locale: string;
|
|
2267
|
+
modelId: string;
|
|
2268
|
+
}
|
|
2269
|
+
export interface CmsModelStorageOperationsListWhereParams {
|
|
2270
|
+
tenant: string;
|
|
2271
|
+
locale: string;
|
|
2272
|
+
[key: string]: string;
|
|
2273
|
+
}
|
|
2274
|
+
export interface CmsModelStorageOperationsListParams {
|
|
2275
|
+
where: CmsModelStorageOperationsListWhereParams;
|
|
2276
|
+
}
|
|
2277
|
+
export interface CmsModelStorageOperationsCreateParams {
|
|
2278
|
+
model: CmsModel;
|
|
2279
|
+
}
|
|
2280
|
+
export interface CmsModelStorageOperationsUpdateParams {
|
|
2281
|
+
model: CmsModel;
|
|
2282
|
+
}
|
|
2283
|
+
export interface CmsModelStorageOperationsDeleteParams {
|
|
2284
|
+
model: CmsModel;
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Description of the CmsModel storage operations.
|
|
2288
|
+
* If user wants to add another database to the application, this is how it is done.
|
|
2289
|
+
* This is just plain read, update, write, delete and list - no authentication or permission checks.
|
|
2290
|
+
*/
|
|
2291
|
+
export interface CmsModelStorageOperations {
|
|
2292
|
+
/**
|
|
2293
|
+
* Gets content model by given id.
|
|
2294
|
+
*/
|
|
2295
|
+
get: (params: CmsModelStorageOperationsGetParams) => Promise<CmsModel | null>;
|
|
2296
|
+
/**
|
|
2297
|
+
* List all content models. Filterable via params.
|
|
2298
|
+
*/
|
|
2299
|
+
list: (params: CmsModelStorageOperationsListParams) => Promise<CmsModel[]>;
|
|
2300
|
+
/**
|
|
2301
|
+
* Create a new content model.
|
|
2302
|
+
*/
|
|
2303
|
+
create: (params: CmsModelStorageOperationsCreateParams) => Promise<CmsModel>;
|
|
2304
|
+
/**
|
|
2305
|
+
* Update existing content model.
|
|
2306
|
+
*/
|
|
2307
|
+
update: (params: CmsModelStorageOperationsUpdateParams) => Promise<CmsModel>;
|
|
2308
|
+
/**
|
|
2309
|
+
* Delete the content model.
|
|
2310
|
+
*/
|
|
2311
|
+
delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<CmsModel>;
|
|
2312
|
+
}
|
|
2313
|
+
export interface CmsEntryStorageOperationsGetParams {
|
|
2314
|
+
where: CmsEntryListWhere;
|
|
2315
|
+
sort?: CmsEntryListSort;
|
|
2316
|
+
limit?: number;
|
|
2317
|
+
}
|
|
2318
|
+
export interface CmsEntryStorageOperationsListParams {
|
|
2319
|
+
where: CmsEntryListWhere;
|
|
2320
|
+
sort?: CmsEntryListSort;
|
|
2321
|
+
search?: string;
|
|
2322
|
+
fields?: string[];
|
|
2323
|
+
limit?: number;
|
|
2324
|
+
after?: string | null;
|
|
2325
|
+
}
|
|
2326
|
+
export interface CmsEntryStorageOperationsCreateParams<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2327
|
+
/**
|
|
2328
|
+
* Real entry, with no transformations on it.
|
|
2329
|
+
*/
|
|
2330
|
+
entry: CmsEntry;
|
|
2331
|
+
/**
|
|
2332
|
+
* Entry prepared for the storage.
|
|
2333
|
+
*/
|
|
2334
|
+
storageEntry: T;
|
|
2335
|
+
}
|
|
2336
|
+
export interface CmsEntryStorageOperationsCreateRevisionFromParams<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2337
|
+
/**
|
|
2338
|
+
* Real entry, with no transformations on it.
|
|
2339
|
+
*/
|
|
2340
|
+
entry: CmsEntry;
|
|
2341
|
+
/**
|
|
2342
|
+
* Entry prepared for the storage.
|
|
2343
|
+
*/
|
|
2344
|
+
storageEntry: T;
|
|
2345
|
+
}
|
|
2346
|
+
export interface CmsEntryStorageOperationsUpdateParams<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2347
|
+
/**
|
|
2348
|
+
* Real entry, with no transformations on it.
|
|
2349
|
+
*/
|
|
2350
|
+
entry: CmsEntry;
|
|
2351
|
+
/**
|
|
2352
|
+
* Entry prepared for the storage.
|
|
2353
|
+
*/
|
|
2354
|
+
storageEntry: T;
|
|
2355
|
+
}
|
|
2356
|
+
export interface CmsEntryStorageOperationsDeleteRevisionParams<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2357
|
+
/**
|
|
2358
|
+
* Entry that was deleted.
|
|
2359
|
+
*/
|
|
2360
|
+
entry: CmsEntry;
|
|
2361
|
+
/**
|
|
2362
|
+
* Entry that was deleted, directly from storage, with transformations.
|
|
2363
|
+
*/
|
|
2364
|
+
storageEntry: T;
|
|
2365
|
+
/**
|
|
2366
|
+
* Entry that was set as latest.
|
|
2367
|
+
*/
|
|
2368
|
+
latestEntry: CmsEntry | null;
|
|
2369
|
+
/**
|
|
2370
|
+
* Entry that was set as latest, directly from storage, with transformations.
|
|
2371
|
+
*/
|
|
2372
|
+
latestStorageEntry: T | null;
|
|
2373
|
+
}
|
|
2374
|
+
export interface CmsEntryStorageOperationsDeleteParams {
|
|
2375
|
+
/**
|
|
2376
|
+
* Entry that is going to be deleted.
|
|
2377
|
+
*/
|
|
2378
|
+
entry: CmsEntry;
|
|
2379
|
+
}
|
|
2380
|
+
export interface CmsEntryStorageOperationsPublishParams<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2381
|
+
/**
|
|
2382
|
+
* The modified entry that is going to be saved as published.
|
|
2383
|
+
* Entry is in its original form.
|
|
2384
|
+
*/
|
|
2385
|
+
entry: CmsEntry;
|
|
2386
|
+
/**
|
|
2387
|
+
* The modified entry and prepared for the storage.
|
|
2388
|
+
*/
|
|
2389
|
+
storageEntry: T;
|
|
2390
|
+
}
|
|
2391
|
+
export interface CmsEntryStorageOperationsUnpublishParams<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2392
|
+
/**
|
|
2393
|
+
* The modified entry that is going to be saved as unpublished.
|
|
2394
|
+
*/
|
|
2395
|
+
entry: CmsEntry;
|
|
2396
|
+
/**
|
|
2397
|
+
* The modified entry that is going to be saved as unpublished, with transformations on it.
|
|
2398
|
+
*/
|
|
2399
|
+
storageEntry: T;
|
|
2400
|
+
}
|
|
2401
|
+
export interface CmsEntryStorageOperationsGetByIdsParams {
|
|
2402
|
+
ids: readonly string[];
|
|
2403
|
+
}
|
|
2404
|
+
export interface CmsEntryStorageOperationsGetLatestByIdsParams {
|
|
2405
|
+
ids: readonly string[];
|
|
2406
|
+
}
|
|
2407
|
+
export interface CmsEntryStorageOperationsGetPublishedByIdsParams {
|
|
2408
|
+
ids: readonly string[];
|
|
2409
|
+
}
|
|
2410
|
+
export interface CmsEntryStorageOperationsGetRevisionsParams {
|
|
2411
|
+
id: string;
|
|
2412
|
+
}
|
|
2413
|
+
export interface CmsEntryStorageOperationsGetRevisionParams {
|
|
2414
|
+
id: string;
|
|
2415
|
+
}
|
|
2416
|
+
export interface CmsEntryStorageOperationsGetPublishedRevisionParams {
|
|
2417
|
+
id: string;
|
|
2418
|
+
}
|
|
2419
|
+
export interface CmsEntryStorageOperationsGetLatestRevisionParams {
|
|
2420
|
+
id: string;
|
|
2421
|
+
}
|
|
2422
|
+
export interface CmsEntryStorageOperationsGetPreviousRevisionParams {
|
|
2423
|
+
entryId: string;
|
|
2424
|
+
version: number;
|
|
2425
|
+
}
|
|
2426
|
+
export interface CmsEntryStorageOperationsListResponse<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2427
|
+
/**
|
|
2428
|
+
* Has more items to load with the current filtering?
|
|
2429
|
+
*/
|
|
2430
|
+
hasMoreItems: boolean;
|
|
2431
|
+
/**
|
|
2432
|
+
* Items loaded with current filtering.
|
|
2433
|
+
*/
|
|
2434
|
+
items: T[];
|
|
2435
|
+
/**
|
|
2436
|
+
* Pointer for where to start the new item set.
|
|
2437
|
+
*/
|
|
2438
|
+
cursor: string | null;
|
|
2439
|
+
/**
|
|
2440
|
+
* Total amount of items with the current filter.
|
|
2441
|
+
*/
|
|
2442
|
+
totalCount: number;
|
|
2443
|
+
}
|
|
2444
|
+
/**
|
|
2445
|
+
* Description of the CmsModel storage operations.
|
|
2446
|
+
* If user wants to add another database to the application, this is how it is done.
|
|
2447
|
+
* This is just plain read, update, write, delete and list - no authentication or permission checks.
|
|
2448
|
+
*
|
|
2449
|
+
*
|
|
2450
|
+
* @category StorageOperations
|
|
2451
|
+
* @category CmsEntry
|
|
2452
|
+
*/
|
|
2453
|
+
export interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorageEntry> {
|
|
2454
|
+
/**
|
|
2455
|
+
* Get all the entries of the ids.
|
|
2456
|
+
*/
|
|
2457
|
+
getByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;
|
|
2458
|
+
/**
|
|
2459
|
+
* Get all the published entries of the ids.
|
|
2460
|
+
*/
|
|
2461
|
+
getPublishedByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams) => Promise<T[]>;
|
|
2462
|
+
/**
|
|
2463
|
+
* Get all the latest entries of the ids.
|
|
2464
|
+
*/
|
|
2465
|
+
getLatestByIds: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams) => Promise<T[]>;
|
|
2466
|
+
/**
|
|
2467
|
+
* Get all revisions of the given entry id.
|
|
2468
|
+
*/
|
|
2469
|
+
getRevisions: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetRevisionsParams) => Promise<T[]>;
|
|
2470
|
+
/**
|
|
2471
|
+
* Get the entry by the given revision id.
|
|
2472
|
+
*/
|
|
2473
|
+
getRevisionById: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetRevisionParams) => Promise<T | null>;
|
|
2474
|
+
/**
|
|
2475
|
+
* Get the published entry by given entryId.
|
|
2476
|
+
*/
|
|
2477
|
+
getPublishedRevisionByEntryId: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams) => Promise<T | null>;
|
|
2478
|
+
/**
|
|
2479
|
+
* Get the latest entry by given entryId.
|
|
2480
|
+
*/
|
|
2481
|
+
getLatestRevisionByEntryId: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams) => Promise<T | null>;
|
|
2482
|
+
/**
|
|
2483
|
+
* Get the revision of the entry before given one.
|
|
2484
|
+
*/
|
|
2485
|
+
getPreviousRevision: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams) => Promise<T | null>;
|
|
2486
|
+
/**
|
|
2487
|
+
* Gets entry by given params.
|
|
2488
|
+
*/
|
|
2489
|
+
get: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;
|
|
2490
|
+
/**
|
|
2491
|
+
* List all entries. Filterable via params.
|
|
2492
|
+
*/
|
|
2493
|
+
list: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsListParams) => Promise<CmsEntryStorageOperationsListResponse<T>>;
|
|
2494
|
+
/**
|
|
2495
|
+
* Create a new entry.
|
|
2496
|
+
*/
|
|
2497
|
+
create: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;
|
|
2498
|
+
/**
|
|
2499
|
+
* Create a new entry from existing one.
|
|
2500
|
+
*/
|
|
2501
|
+
createRevisionFrom: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>) => Promise<T>;
|
|
2502
|
+
/**
|
|
2503
|
+
* Update existing entry.
|
|
2504
|
+
*/
|
|
2505
|
+
update: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;
|
|
2506
|
+
/**
|
|
2507
|
+
* Delete the entry revision.
|
|
2508
|
+
*/
|
|
2509
|
+
deleteRevision: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>) => Promise<void>;
|
|
2510
|
+
/**
|
|
2511
|
+
* Delete the entry.
|
|
2512
|
+
*/
|
|
2513
|
+
delete: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;
|
|
2514
|
+
/**
|
|
2515
|
+
* Publish the entry.
|
|
2516
|
+
*/
|
|
2517
|
+
publish: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;
|
|
2518
|
+
/**
|
|
2519
|
+
* Unpublish the entry.
|
|
2520
|
+
*/
|
|
2521
|
+
unpublish: (model: StorageOperationsCmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;
|
|
2522
|
+
}
|
|
2523
|
+
export declare enum CONTENT_ENTRY_STATUS {
|
|
2524
|
+
DRAFT = "draft",
|
|
2525
|
+
PUBLISHED = "published",
|
|
2526
|
+
UNPUBLISHED = "unpublished"
|
|
2527
|
+
}
|
|
2528
|
+
export interface CmsSettingsStorageOperationsGetParams {
|
|
2529
|
+
locale: string;
|
|
2530
|
+
tenant: string;
|
|
2531
|
+
}
|
|
2532
|
+
export interface CmsSettingsStorageOperationsCreateParams {
|
|
2533
|
+
settings: CmsSettings;
|
|
2534
|
+
}
|
|
2535
|
+
export interface CmsSettingsStorageOperationsUpdateParams {
|
|
2536
|
+
settings: CmsSettings;
|
|
2537
|
+
}
|
|
2538
|
+
export interface CmsSettingsStorageOperations {
|
|
2539
|
+
/**
|
|
2540
|
+
* Get the settings from the storage.
|
|
2541
|
+
*/
|
|
2542
|
+
get: (params: CmsSettingsStorageOperationsGetParams) => Promise<CmsSettings | null>;
|
|
2543
|
+
/**
|
|
2544
|
+
* Create settings in the storage.
|
|
2545
|
+
*/
|
|
2546
|
+
create: (params: CmsSettingsStorageOperationsCreateParams) => Promise<CmsSettings>;
|
|
2547
|
+
/**
|
|
2548
|
+
* Update the settings in the storage.
|
|
2549
|
+
*/
|
|
2550
|
+
update: (params: CmsSettingsStorageOperationsUpdateParams) => Promise<CmsSettings>;
|
|
2551
|
+
}
|
|
2552
|
+
export interface CmsSystem {
|
|
2553
|
+
version?: string;
|
|
2554
|
+
readAPIKey?: string;
|
|
2555
|
+
/**
|
|
2556
|
+
* System tenant.
|
|
2557
|
+
*/
|
|
2558
|
+
tenant: string;
|
|
2559
|
+
}
|
|
2560
|
+
export interface CmsSystemStorageOperationsGetParams {
|
|
2561
|
+
tenant: string;
|
|
2562
|
+
}
|
|
2563
|
+
export interface CmsSystemStorageOperationsCreateParams {
|
|
2564
|
+
system: CmsSystem;
|
|
2565
|
+
}
|
|
2566
|
+
export interface CmsSystemStorageOperationsUpdateParams {
|
|
2567
|
+
system: CmsSystem;
|
|
2568
|
+
}
|
|
2569
|
+
export interface CmsSystemStorageOperations {
|
|
2570
|
+
/**
|
|
2571
|
+
* Get the system data.
|
|
2572
|
+
*/
|
|
2573
|
+
get: (params: CmsSystemStorageOperationsGetParams) => Promise<CmsSystem | null>;
|
|
2574
|
+
/**
|
|
2575
|
+
* Create the system info in the storage.
|
|
2576
|
+
*/
|
|
2577
|
+
create: (params: CmsSystemStorageOperationsCreateParams) => Promise<CmsSystem>;
|
|
2578
|
+
/**
|
|
2579
|
+
* Update the system info in the storage.
|
|
2580
|
+
*/
|
|
2581
|
+
update: (params: CmsSystemStorageOperationsUpdateParams) => Promise<CmsSystem>;
|
|
2582
|
+
}
|
|
2583
|
+
export interface HeadlessCmsStorageOperations<C = CmsContext> {
|
|
2584
|
+
name: string;
|
|
2585
|
+
system: CmsSystemStorageOperations;
|
|
2586
|
+
settings: CmsSettingsStorageOperations;
|
|
2587
|
+
groups: CmsGroupStorageOperations;
|
|
2588
|
+
models: CmsModelStorageOperations;
|
|
2589
|
+
entries: CmsEntryStorageOperations;
|
|
2590
|
+
/**
|
|
2591
|
+
* Either attach something from the storage operations or run something in it.
|
|
2592
|
+
*/
|
|
2593
|
+
beforeInit?: (context: C) => Promise<void>;
|
|
2594
|
+
init?: (context: C) => Promise<void>;
|
|
2595
|
+
/**
|
|
2596
|
+
* An upgrade to run if necessary.
|
|
2597
|
+
*/
|
|
2598
|
+
upgrade?: UpgradePlugin | null;
|
|
2599
|
+
}
|
|
2600
|
+
export {};
|