@webiny/api-headless-cms 5.38.0-beta.0 → 5.38.0-beta.2

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.
@@ -841,6 +841,7 @@ const createContentEntryCrud = params => {
841
841
  return result.length > 0 ? result : [];
842
842
  };
843
843
  const moveEntry = async (model, id, folderId) => {
844
+ var _entry$location;
844
845
  await entriesPermissions.ensure({
845
846
  rwd: "w"
846
847
  });
@@ -857,6 +858,12 @@ const createContentEntryCrud = params => {
857
858
  throw new _handlerGraphql.NotFoundError(`Entry "${id}" of model "${model.modelId}" was not found.`);
858
859
  }
859
860
  const entry = await (0, _entryStorage.entryFromStorageTransform)(context, model, originalStorageEntry);
861
+ /**
862
+ * No need to continue if the entry is already in the requested folder.
863
+ */
864
+ if (((_entry$location = entry.location) === null || _entry$location === void 0 ? void 0 : _entry$location.folderId) === folderId) {
865
+ return entry;
866
+ }
860
867
  try {
861
868
  await onEntryBeforeMove.publish({
862
869
  entry,
@@ -1 +1 @@
1
- {"version":3,"names":["_merge","_interopRequireDefault","require","_utils","_error","_handlerGraphql","_types","_entryDataValidation","_pubsub","_beforeCreate","_beforeUpdate","_afterDelete","_referenceFieldsMapping","_entryStorage","_searchableFields","_filterAsync","_apiSecurity","_constants","STATUS_DRAFT","CONTENT_ENTRY_STATUS","DRAFT","exports","STATUS_PUBLISHED","PUBLISHED","STATUS_UNPUBLISHED","UNPUBLISHED","convertDefaultValue","field","value","type","Boolean","Number","getDefaultValue","settings","multipleValues","defaultValue","undefined","predefinedValues","enabled","Array","isArray","values","selectedValue","find","selected","filter","map","mapAndCleanCreateInputData","model","input","fields","reduce","acc","fieldId","WebinyError","mapAndCleanUpdatedInputData","createEntryMeta","original","meta","lodashMerge","removeUndefinedValues","removeNullValues","createEntryId","entryId","mdbid","id","match","version","createIdentifier","increaseEntryIdVersion","parseIdentifier","allowedEntryStatus","transformEntryStatus","status","includes","createSort","sort","s","length","createContentEntryCrud","params","storageOperations","entriesPermissions","modelsPermissions","context","getIdentity","getTenant","getLocale","getCreatedBy","identity","displayName","onEntryBeforeCreate","createTopic","onEntryAfterCreate","onEntryCreateError","onEntryBeforeCreateRevision","onEntryRevisionAfterCreate","onEntryCreateRevisionError","onEntryBeforeUpdate","onEntryAfterUpdate","onEntryUpdateError","onEntryBeforeMove","onEntryAfterMove","onEntryMoveError","onEntryBeforePublish","onEntryAfterPublish","onEntryPublishError","onEntryBeforeRepublish","onEntryAfterRepublish","onEntryRepublishError","onEntryBeforeUnpublish","onEntryAfterUnpublish","onEntryUnpublishError","onEntryBeforeDelete","onEntryAfterDelete","onEntryDeleteError","onEntryRevisionBeforeDelete","onEntryRevisionAfterDelete","onEntryRevisionDeleteError","onEntryBeforeDeleteMultiple","onEntryAfterDeleteMultiple","onEntryDeleteMultipleError","onEntryBeforeGet","onEntryBeforeList","assignBeforeEntryCreate","assignBeforeEntryUpdate","assignAfterEntryDelete","deleteEntryHelper","entry","publish","entries","delete","ex","error","message","code","getEntriesByIds","ids","benchmark","measure","ensure","rwd","ensureCanAccessModel","getByIds","filterAsync","owns","createdBy","throw","getEntryById","where","NotFoundError","getPublishedEntriesByIds","getPublishedByIds","getLatestEntriesByIds","getLatestByIds","getEntry","items","listEntries","limit","item","shift","getEntryRevisions","getRevisions","NotAuthorizedError","data","reason","initialWhere","initialLimit","_objectSpread2","default","canAccessOnlyOwnRecords","ownedBy","latest","published","getSearchableFields","plugins","hasMoreItems","totalCount","cursor","list","createEntry","inputData","options","_inputData$wbyAco_loc","initialInput","validateModelEntryDataOrThrow","skipValidators","referenceFieldsMapping","validateEntries","locale","owner","webinyVersion","WEBINY_VERSION","tenant","modelId","createdOn","Date","toISOString","savedOn","modifiedBy","locked","location","folderId","wbyAco_location","ROOT_FOLDER","storageEntry","entryToStorageTransform","result","create","createEntryRevisionFrom","sourceId","uniqueId","originalStorageEntry","getRevisionById","latestStorageEntry","getLatestRevisionByEntryId","originalEntry","entryFromStorageTransform","initialValues","latestId","nextVersion","publishedOn","createRevisionFrom","updateEntry","metaInput","_inputData$wbyAco_loc2","update","validateEntry","validateModelEntryData","moveEntry","move","from","republishEntry","deleteEntryRevision","revisionId","storageEntryToDelete","previousStorageEntry","getPreviousRevision","latestEntryRevisionId","entryToDelete","entryToSetAsLatest","storageEntryToSetAsLatest","deleteRevision","latestEntry","deleteMultipleEntries","maxDeletableEntries","entryIdList","Set","add","entryId_in","deleteEntry","force","publishEntry","pw","currentDate","unpublishEntry","getPublishedRevisionByEntryId","unpublish","getUniqueFieldValues","onEntryRevisionBeforeCreate","onEntryRevisionCreateError","listLatestEntries","listPublishedEntries"],"sources":["contentEntry.crud.ts"],"sourcesContent":["import lodashMerge from \"lodash/merge\";\nimport {\n createIdentifier,\n mdbid,\n parseIdentifier,\n removeNullValues,\n removeUndefinedValues\n} from \"@webiny/utils\";\nimport WebinyError from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport {\n CmsContext,\n CmsEntry,\n CmsEntryContext,\n CmsEntryListParams,\n CmsEntryListSort,\n CmsEntryListWhere,\n CmsEntryMeta,\n CmsEntryStatus,\n CmsEntryValues,\n CmsModel,\n CmsModelField,\n CmsStorageEntry,\n CONTENT_ENTRY_STATUS,\n CreateCmsEntryInput,\n EntryBeforeListTopicParams,\n HeadlessCms,\n HeadlessCmsStorageOperations,\n OnEntryAfterCreateTopicParams,\n OnEntryAfterDeleteMultipleTopicParams,\n OnEntryAfterDeleteTopicParams,\n OnEntryAfterMoveTopicParams,\n OnEntryAfterPublishTopicParams,\n OnEntryAfterRepublishTopicParams,\n OnEntryAfterUnpublishTopicParams,\n OnEntryAfterUpdateTopicParams,\n OnEntryBeforeCreateTopicParams,\n OnEntryBeforeDeleteMultipleTopicParams,\n OnEntryBeforeDeleteTopicParams,\n OnEntryBeforeGetTopicParams,\n OnEntryBeforeMoveTopicParams,\n OnEntryBeforePublishTopicParams,\n OnEntryBeforeRepublishTopicParams,\n OnEntryBeforeUnpublishTopicParams,\n OnEntryBeforeUpdateTopicParams,\n OnEntryCreateErrorTopicParams,\n OnEntryCreateRevisionErrorTopicParams,\n OnEntryDeleteErrorTopicParams,\n OnEntryDeleteMultipleErrorTopicParams,\n OnEntryMoveErrorTopicParams,\n OnEntryPublishErrorTopicParams,\n OnEntryRepublishErrorTopicParams,\n OnEntryRevisionAfterCreateTopicParams,\n OnEntryRevisionAfterDeleteTopicParams,\n OnEntryRevisionBeforeCreateTopicParams,\n OnEntryRevisionBeforeDeleteTopicParams,\n OnEntryRevisionDeleteErrorTopicParams,\n OnEntryUnpublishErrorTopicParams,\n OnEntryUpdateErrorTopicParams,\n UpdateCmsEntryInput\n} from \"~/types\";\nimport {\n validateModelEntryData,\n validateModelEntryDataOrThrow\n} from \"./contentEntry/entryDataValidation\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { assignBeforeEntryCreate } from \"./contentEntry/beforeCreate\";\nimport { assignBeforeEntryUpdate } from \"./contentEntry/beforeUpdate\";\nimport { assignAfterEntryDelete } from \"./contentEntry/afterDelete\";\nimport { referenceFieldsMapping } from \"./contentEntry/referenceFieldsMapping\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { entryFromStorageTransform, entryToStorageTransform } from \"~/utils/entryStorage\";\nimport { getSearchableFields } from \"./contentEntry/searchableFields\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { filterAsync } from \"~/utils/filterAsync\";\nimport { EntriesPermissions } from \"~/utils/permissions/EntriesPermissions\";\nimport { ModelsPermissions } from \"~/utils/permissions/ModelsPermissions\";\nimport { NotAuthorizedError } from \"@webiny/api-security/\";\nimport { ROOT_FOLDER } from \"~/constants\";\n\nexport const STATUS_DRAFT = CONTENT_ENTRY_STATUS.DRAFT;\nexport const STATUS_PUBLISHED = CONTENT_ENTRY_STATUS.PUBLISHED;\nexport const STATUS_UNPUBLISHED = CONTENT_ENTRY_STATUS.UNPUBLISHED;\n\ntype DefaultValue = boolean | number | string | null;\n/**\n * Used for some fields to convert their values.\n */\nconst convertDefaultValue = (field: CmsModelField, value: DefaultValue): DefaultValue => {\n switch (field.type) {\n case \"boolean\":\n return Boolean(value);\n case \"number\":\n return Number(value);\n default:\n return value;\n }\n};\nconst getDefaultValue = (field: CmsModelField): (DefaultValue | DefaultValue[]) | undefined => {\n const { settings, multipleValues } = field;\n if (settings && settings.defaultValue !== undefined) {\n return convertDefaultValue(field, settings.defaultValue);\n }\n const { predefinedValues } = field;\n if (\n !predefinedValues ||\n !predefinedValues.enabled ||\n Array.isArray(predefinedValues.values) === false\n ) {\n return undefined;\n }\n if (!multipleValues) {\n const selectedValue = predefinedValues.values.find(value => {\n return !!value.selected;\n });\n if (selectedValue) {\n return convertDefaultValue(field, selectedValue.value);\n }\n return undefined;\n }\n return predefinedValues.values\n .filter(({ selected }) => !!selected)\n .map(({ value }) => {\n return convertDefaultValue(field, value);\n });\n};\n/**\n * Cleans and adds default values to create input data.\n */\nconst mapAndCleanCreateInputData = (model: CmsModel, input: CreateCmsEntryInput) => {\n return model.fields.reduce<CreateCmsEntryInput>((acc, field) => {\n /**\n * This should never happen, but let's make it sure.\n * The fix would be for the user to add the fieldId on the field definition.\n */\n if (!field.fieldId) {\n throw new WebinyError(\"Field does not have an fieldId.\", \"MISSING_FIELD_ID\", {\n field\n });\n }\n const value = input[field.fieldId];\n /**\n * We set the default value on create input if value is not defined.\n */\n acc[field.fieldId] = value === undefined ? getDefaultValue(field) : value;\n return acc;\n }, {});\n};\n/**\n * Cleans the update input entry data.\n */\nconst mapAndCleanUpdatedInputData = (model: CmsModel, input: UpdateCmsEntryInput) => {\n return model.fields.reduce<UpdateCmsEntryInput>((acc, field) => {\n /**\n * This should never happen, but let's make it sure.\n * The fix would be for the user to add the fieldId on the field definition.\n */\n if (!field.fieldId) {\n throw new WebinyError(\"Field does not have an fieldId.\", \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * We cannot set default value here because user might want to update only certain field values.\n */\n const value = input[field.fieldId];\n if (value === undefined) {\n return acc;\n }\n acc[field.fieldId] = value;\n return acc;\n }, {});\n};\n/**\n * This method takes original entry meta and new input.\n * When new meta is merged onto the existing one, everything that has undefined or null value is removed.\n */\nconst createEntryMeta = (input?: Record<string, any>, original?: Record<string, any>) => {\n const meta = lodashMerge(original || {}, input || {});\n return removeUndefinedValues(removeNullValues(meta));\n};\n\ninterface DeleteEntryParams {\n model: CmsModel;\n entry: CmsEntry;\n}\n\nconst createEntryId = (input: CreateCmsEntryInput) => {\n let entryId = mdbid();\n if (input.id) {\n if (input.id.match(/^([a-zA-Z0-9])([a-zA-Z0-9\\-]+)([a-zA-Z0-9])$/) === null) {\n throw new WebinyError(\n \"The provided ID is not valid. It must be a string which can be A-Z, a-z, 0-9, - and it cannot start or end with a -.\",\n \"INVALID_ID\",\n {\n id: input.id\n }\n );\n }\n entryId = input.id;\n }\n const version = 1;\n return {\n entryId,\n version,\n id: createIdentifier({\n id: entryId,\n version\n })\n };\n};\n\nconst increaseEntryIdVersion = (id: string) => {\n const { id: entryId, version } = parseIdentifier(id);\n if (!version) {\n throw new WebinyError(\n \"Cannot increase version on the ID without the version part.\",\n \"WRONG_ID\",\n {\n id\n }\n );\n }\n return {\n entryId,\n version: version + 1,\n id: createIdentifier({\n id: entryId,\n version: version + 1\n })\n };\n};\n\nconst allowedEntryStatus: string[] = [\"draft\", \"published\", \"unpublished\"];\n\nconst transformEntryStatus = (status: CmsEntryStatus | string): CmsEntryStatus => {\n return allowedEntryStatus.includes(status) ? (status as CmsEntryStatus) : \"draft\";\n};\n\nconst createSort = (sort?: CmsEntryListSort): CmsEntryListSort => {\n if (!Array.isArray(sort)) {\n return [\"createdOn_DESC\"];\n } else if (sort.filter(s => !!s).length === 0) {\n return [\"createdOn_DESC\"];\n }\n return sort;\n};\n\ninterface CreateContentEntryCrudParams {\n storageOperations: HeadlessCmsStorageOperations;\n entriesPermissions: EntriesPermissions;\n modelsPermissions: ModelsPermissions;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n}\n\nexport const createContentEntryCrud = (params: CreateContentEntryCrudParams): CmsEntryContext => {\n const {\n storageOperations,\n entriesPermissions,\n modelsPermissions,\n context,\n getIdentity,\n getTenant,\n getLocale\n } = params;\n\n const getCreatedBy = () => {\n const identity = getIdentity();\n return {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n };\n };\n\n /**\n * Create\n */\n const onEntryBeforeCreate =\n createTopic<OnEntryBeforeCreateTopicParams>(\"cms.onEntryBeforeCreate\");\n const onEntryAfterCreate = createTopic<OnEntryAfterCreateTopicParams>(\"cms.onEntryAfterCreate\");\n const onEntryCreateError = createTopic<OnEntryCreateErrorTopicParams>(\"cms.onEntryCreateError\");\n\n /**\n * Create new revision\n */\n const onEntryBeforeCreateRevision = createTopic<OnEntryRevisionBeforeCreateTopicParams>(\n \"cms.onEntryBeforeCreateRevision\"\n );\n const onEntryRevisionAfterCreate = createTopic<OnEntryRevisionAfterCreateTopicParams>(\n \"cms.onEntryRevisionAfterCreate\"\n );\n const onEntryCreateRevisionError = createTopic<OnEntryCreateRevisionErrorTopicParams>(\n \"cms.onEntryCreateRevisionError\"\n );\n\n /**\n * Update\n */\n const onEntryBeforeUpdate =\n createTopic<OnEntryBeforeUpdateTopicParams>(\"cms.onEntryBeforeUpdate\");\n const onEntryAfterUpdate = createTopic<OnEntryAfterUpdateTopicParams>(\"cms.onEntryAfterUpdate\");\n const onEntryUpdateError = createTopic<OnEntryUpdateErrorTopicParams>(\"cms.onEntryUpdateError\");\n\n /**\n * Move\n */\n const onEntryBeforeMove = createTopic<OnEntryBeforeMoveTopicParams>(\"cms.onEntryBeforeMove\");\n const onEntryAfterMove = createTopic<OnEntryAfterMoveTopicParams>(\"cms.onEntryAfterMove\");\n const onEntryMoveError = createTopic<OnEntryMoveErrorTopicParams>(\"cms.onEntryMoveError\");\n\n /**\n * Publish\n */\n const onEntryBeforePublish = createTopic<OnEntryBeforePublishTopicParams>(\n \"cms.onEntryBeforePublish\"\n );\n const onEntryAfterPublish =\n createTopic<OnEntryAfterPublishTopicParams>(\"cms.onEntryAfterPublish\");\n\n const onEntryPublishError =\n createTopic<OnEntryPublishErrorTopicParams>(\"cms.onEntryPublishError\");\n\n /**\n * Republish\n */\n const onEntryBeforeRepublish = createTopic<OnEntryBeforeRepublishTopicParams>(\n \"cms.onEntryBeforeRepublish\"\n );\n const onEntryAfterRepublish = createTopic<OnEntryAfterRepublishTopicParams>(\n \"cms.onEntryAfterRepublish\"\n );\n\n const onEntryRepublishError = createTopic<OnEntryRepublishErrorTopicParams>(\n \"cms.onEntryRepublishError\"\n );\n\n /**\n * Unpublish\n */\n const onEntryBeforeUnpublish = createTopic<OnEntryBeforeUnpublishTopicParams>(\n \"cms.onEntryBeforeUnpublish\"\n );\n const onEntryAfterUnpublish = createTopic<OnEntryAfterUnpublishTopicParams>(\n \"cms.onEntryAfterUnpublish\"\n );\n const onEntryUnpublishError = createTopic<OnEntryUnpublishErrorTopicParams>(\n \"cms.onEntryUnpublishError\"\n );\n\n /**\n * Delete\n */\n const onEntryBeforeDelete =\n createTopic<OnEntryBeforeDeleteTopicParams>(\"cms.onEntryBeforeDelete\");\n const onEntryAfterDelete = createTopic<OnEntryAfterDeleteTopicParams>(\"cms.onEntryAfterDelete\");\n const onEntryDeleteError = createTopic<OnEntryDeleteErrorTopicParams>(\"cms.onEntryDeleteError\");\n\n /**\n * Delete revision\n */\n const onEntryRevisionBeforeDelete = createTopic<OnEntryRevisionBeforeDeleteTopicParams>(\n \"cms.onEntryRevisionBeforeDelete\"\n );\n const onEntryRevisionAfterDelete = createTopic<OnEntryRevisionAfterDeleteTopicParams>(\n \"cms.onEntryRevisionAfterDelete\"\n );\n const onEntryRevisionDeleteError = createTopic<OnEntryRevisionDeleteErrorTopicParams>(\n \"cms.onEntryRevisionDeleteError\"\n );\n /**\n * Delete multiple entries\n */\n const onEntryBeforeDeleteMultiple = createTopic<OnEntryBeforeDeleteMultipleTopicParams>(\n \"cms.onEntryBeforeDeleteMultiple\"\n );\n const onEntryAfterDeleteMultiple = createTopic<OnEntryAfterDeleteMultipleTopicParams>(\n \"cms.onEntryAfterDeleteMultiple\"\n );\n const onEntryDeleteMultipleError = createTopic<OnEntryDeleteMultipleErrorTopicParams>(\n \"cms.onEntryDeleteMultipleError\"\n );\n\n /**\n * Get entry\n */\n const onEntryBeforeGet = createTopic<OnEntryBeforeGetTopicParams>(\"cms.onEntryBeforeGet\");\n\n /**\n * List entries\n */\n const onEntryBeforeList = createTopic<EntryBeforeListTopicParams>(\"cms.onEntryBeforeList\");\n\n /**\n * We need to assign some default behaviors.\n */\n assignBeforeEntryCreate({\n context,\n onEntryBeforeCreate\n });\n assignBeforeEntryUpdate({\n context,\n onEntryBeforeUpdate\n });\n assignAfterEntryDelete({\n context,\n onEntryAfterDelete\n });\n\n /**\n * A helper to delete the entire entry.\n */\n const deleteEntryHelper = async (params: DeleteEntryParams): Promise<void> => {\n const { model, entry } = params;\n try {\n await onEntryBeforeDelete.publish({\n entry,\n model\n });\n\n await storageOperations.entries.delete(model, {\n entry\n });\n\n await onEntryAfterDelete.publish({\n entry,\n model\n });\n } catch (ex) {\n await onEntryDeleteError.publish({\n entry,\n model,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not delete entry.\",\n ex.code || \"DELETE_ERROR\",\n {\n entry\n }\n );\n }\n };\n /**\n * A helper to get entries by revision IDs\n */\n const getEntriesByIds: CmsEntryContext[\"getEntriesByIds\"] = async (model, ids) => {\n return context.benchmark.measure(\"headlessCms.crud.entries.getEntriesByIds\", async () => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const entries = await storageOperations.entries.getByIds(model, {\n ids\n });\n\n return filterAsync(entries, async entry => {\n return entriesPermissions.ensure(\n {\n owns: entry.createdBy\n },\n {\n throw: false\n }\n );\n });\n });\n };\n const getEntryById: CmsEntryContext[\"getEntryById\"] = async (model, id) => {\n const where: CmsEntryListWhere = {\n id\n };\n await onEntryBeforeGet.publish({\n where,\n model\n });\n const [entry] = await getEntriesByIds(model, [id]);\n if (!entry) {\n throw new NotFoundError(`Entry by ID \"${id}\" not found.`);\n }\n return entry;\n };\n const getPublishedEntriesByIds: CmsEntryContext[\"getPublishedEntriesByIds\"] = async (\n model,\n ids\n ) => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const entries = await storageOperations.entries.getPublishedByIds(model, {\n ids\n });\n\n return filterAsync(entries, async entry => {\n return entriesPermissions.ensure({ owns: entry.createdBy }, { throw: false });\n });\n };\n const getLatestEntriesByIds: CmsEntryContext[\"getLatestEntriesByIds\"] = async (model, ids) => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const entries = await storageOperations.entries.getLatestByIds(model, {\n ids\n });\n\n return filterAsync(entries, async entry => {\n return entriesPermissions.ensure({ owns: entry.createdBy }, { throw: false });\n });\n };\n const getEntry: CmsEntryContext[\"getEntry\"] = async (model, params) => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n\n const { where, sort } = params;\n\n await onEntryBeforeGet.publish({\n where,\n model\n });\n\n const [items] = await listEntries(model, {\n where,\n sort,\n limit: 1\n });\n\n const item = items.shift();\n\n if (!item) {\n throw new NotFoundError(`Entry not found!`);\n }\n return item;\n };\n const getEntryRevisions: CmsEntryContext[\"getEntryRevisions\"] = async (model, entryId) => {\n return storageOperations.entries.getRevisions(model, {\n id: entryId\n });\n };\n\n const listEntries = async <T = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> => {\n try {\n await entriesPermissions.ensure({ rwd: \"r\" });\n } catch {\n throw new NotAuthorizedError({\n data: {\n reason: 'Not allowed to perform \"read\" on \"cms.contentEntry\".'\n }\n });\n }\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { where: initialWhere, limit: initialLimit } = params;\n const limit = initialLimit && initialLimit > 0 ? initialLimit : 50;\n\n const where = {\n ...initialWhere\n };\n /**\n * Possibly only get records which are owned by current user.\n * Or if searching for the owner set that value - in the case that user can see other entries than their own.\n */\n if (await entriesPermissions.canAccessOnlyOwnRecords()) {\n where.ownedBy = getIdentity().id;\n }\n\n /**\n * Where must contain either latest or published keys.\n * We cannot list entries without one of those\n */\n if (where.latest && where.published) {\n throw new WebinyError(\n \"Cannot list entries that are both published and latest.\",\n \"LIST_ENTRIES_ERROR\",\n {\n where\n }\n );\n } else if (!where.latest && !where.published) {\n throw new WebinyError(\n \"Cannot list entries if we do not have latest or published defined.\",\n \"LIST_ENTRIES_ERROR\",\n {\n where\n }\n );\n }\n\n const fields = getSearchableFields({\n fields: model.fields,\n plugins: context.plugins,\n input: params.fields || []\n });\n\n try {\n await onEntryBeforeList.publish({\n where,\n model\n });\n\n const { hasMoreItems, totalCount, cursor, items } =\n await storageOperations.entries.list(model, {\n ...params,\n sort: createSort(params.sort),\n limit,\n where,\n fields\n });\n\n const meta = {\n hasMoreItems,\n totalCount,\n /**\n * Cursor should be null if there are no more items to load.\n * Just make sure of that, disregarding what is returned from the storageOperations.entries.list method.\n */\n cursor: hasMoreItems ? cursor : null\n };\n\n return [items as CmsEntry<T>[], meta];\n } catch (ex) {\n throw new WebinyError(\n \"Error while fetching entries from storage.\",\n \"LIST_ENTRIES_ERROR\",\n {\n params,\n error: {\n message: ex.message,\n code: ex.code,\n data: ex.data\n },\n model,\n fields\n }\n );\n }\n };\n const createEntry: CmsEntryContext[\"createEntry\"] = async (model, inputData, options) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n /**\n * Make sure we only work with fields that are defined in the model.\n */\n const initialInput = mapAndCleanCreateInputData(model, inputData);\n\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: initialInput,\n skipValidators: options?.skipValidators\n });\n\n const input = await referenceFieldsMapping({\n context,\n model,\n input: initialInput,\n validateEntries: true\n });\n\n const locale = getLocale();\n\n const owner = getCreatedBy();\n\n const { id, entryId, version } = createEntryId(inputData);\n /**\n * There is a possibility that user sends an ID in the input, so we will use that one.\n * There is no check if the ID is unique or not, that is up to the user.\n */\n const entry: CmsEntry = {\n webinyVersion: context.WEBINY_VERSION,\n tenant: getTenant().id,\n entryId,\n id,\n modelId: model.modelId,\n locale: locale.code,\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n createdBy: owner,\n ownedBy: owner,\n modifiedBy: null,\n version,\n locked: false,\n status: STATUS_DRAFT,\n values: input,\n location: {\n folderId: inputData.wbyAco_location?.folderId || ROOT_FOLDER\n }\n };\n\n let storageEntry: CmsStorageEntry | null = null;\n try {\n await onEntryBeforeCreate.publish({\n entry,\n input,\n model\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n\n const result = await storageOperations.entries.create(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterCreate.publish({\n entry,\n storageEntry: result,\n model,\n input\n });\n\n return entry;\n } catch (ex) {\n await onEntryCreateError.publish({\n error: ex,\n entry,\n model,\n input\n });\n throw new WebinyError(\n ex.message || \"Could not create content entry.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n ex.data || {\n error: ex,\n input,\n entry,\n storageEntry\n }\n );\n }\n };\n const createEntryRevisionFrom: CmsEntryContext[\"createEntryRevisionFrom\"] = async (\n model,\n sourceId,\n inputData,\n options\n ) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n /**\n * Make sure we only work with fields that are defined in the model.\n */\n const input = mapAndCleanUpdatedInputData(model, inputData);\n\n /**\n * Entries are identified by a common parent ID + Revision number.\n */\n const { id: uniqueId } = parseIdentifier(sourceId);\n\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id: sourceId\n });\n const latestStorageEntry = await storageOperations.entries.getLatestRevisionByEntryId(\n model,\n {\n id: uniqueId\n }\n );\n\n if (!originalStorageEntry) {\n throw new NotFoundError(\n `Entry \"${sourceId}\" of model \"${model.modelId}\" was not found.`\n );\n }\n\n /**\n * We need to convert data from DB to its original form before using it further.\n */\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n const initialValues = {\n ...originalEntry.values,\n ...input\n };\n\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: initialValues,\n entry: originalEntry,\n skipValidators: options?.skipValidators\n });\n\n const values = await referenceFieldsMapping({\n context,\n model,\n input: initialValues,\n validateEntries: false\n });\n\n await entriesPermissions.ensure({ owns: originalEntry.createdBy });\n\n const identity = getIdentity();\n\n const latestId = latestStorageEntry ? latestStorageEntry.id : sourceId;\n const { id, version: nextVersion } = increaseEntryIdVersion(latestId);\n\n const entry: CmsEntry = {\n ...originalEntry,\n id,\n version: nextVersion,\n savedOn: new Date().toISOString(),\n createdOn: new Date().toISOString(),\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n modifiedBy: null,\n locked: false,\n publishedOn: undefined,\n status: STATUS_DRAFT,\n values\n };\n\n let storageEntry: CmsStorageEntry | null = null;\n\n try {\n await onEntryBeforeCreateRevision.publish({\n input,\n entry,\n original: originalEntry,\n model\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n\n const result = await storageOperations.entries.createRevisionFrom(model, {\n entry,\n storageEntry\n });\n\n await onEntryRevisionAfterCreate.publish({\n input,\n entry,\n model,\n original: originalEntry,\n storageEntry: result\n });\n return entry;\n } catch (ex) {\n await onEntryCreateRevisionError.publish({\n entry,\n original: originalEntry,\n model,\n input,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not create entry from existing one.\",\n ex.code || \"CREATE_FROM_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry,\n originalEntry,\n originalStorageEntry\n }\n );\n }\n };\n const updateEntry: CmsEntryContext[\"updateEntry\"] = async (\n model,\n id,\n inputData,\n metaInput,\n options\n ) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n /**\n * Make sure we only work with fields that are defined in the model.\n */\n const input = mapAndCleanUpdatedInputData(model, inputData);\n\n /**\n * The entry we are going to update.\n */\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" of model \"${model.modelId}\" was not found.`);\n }\n\n if (originalStorageEntry.locked) {\n throw new WebinyError(\n `Cannot update entry because it's locked.`,\n \"CONTENT_ENTRY_UPDATE_ERROR\"\n );\n }\n\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: input,\n entry: originalEntry,\n skipValidators: options?.skipValidators\n });\n\n await entriesPermissions.ensure({ owns: originalEntry.createdBy });\n\n const initialValues = {\n /**\n * Existing values from the database, transformed back to original, of course.\n */\n ...originalEntry.values,\n /**\n * Add new values.\n */\n ...input\n };\n\n const values = await referenceFieldsMapping({\n context,\n model,\n input: initialValues,\n validateEntries: false\n });\n /**\n * If users wants to remove a key from meta values, they need to send meta key with the null value.\n */\n const meta = createEntryMeta(metaInput, originalEntry.meta);\n /**\n * We always send the full entry to the hooks and storage operations update.\n */\n const entry: CmsEntry = {\n ...originalEntry,\n savedOn: new Date().toISOString(),\n modifiedBy: getCreatedBy(),\n values,\n meta,\n status: transformEntryStatus(originalEntry.status)\n };\n const folderId = inputData.wbyAco_location?.folderId;\n if (folderId) {\n entry.location = {\n folderId\n };\n }\n\n let storageEntry: CmsStorageEntry | null = null;\n\n try {\n await onEntryBeforeUpdate.publish({\n entry,\n model,\n input,\n original: originalEntry\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n\n const result = await storageOperations.entries.update(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterUpdate.publish({\n entry,\n storageEntry: result,\n model,\n input,\n original: originalEntry\n });\n return entry;\n } catch (ex) {\n await onEntryUpdateError.publish({\n entry,\n model,\n input,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not update existing entry.\",\n ex.code || \"UPDATE_ERROR\",\n {\n error: ex,\n entry,\n storageEntry,\n originalEntry,\n input\n }\n );\n }\n };\n\n const validateEntry: CmsEntryContext[\"validateEntry\"] = async (model, id, inputData) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const input = mapAndCleanUpdatedInputData(model, inputData || {});\n let originalEntry: CmsEntry | undefined;\n if (id) {\n /**\n * The entry we are going to update.\n */\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" of model \"${model.modelId}\" was not found.`);\n }\n originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n }\n const result = await validateModelEntryData({\n context,\n model,\n data: input,\n entry: originalEntry\n });\n return result.length > 0 ? result : [];\n };\n\n const moveEntry: CmsEntryContext[\"moveEntry\"] = async (model, id, folderId) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n /**\n * The entry we are going to move to another folder.\n */\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" of model \"${model.modelId}\" was not found.`);\n }\n\n const entry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n try {\n await onEntryBeforeMove.publish({\n entry,\n model,\n folderId\n });\n await storageOperations.entries.move(model, id, folderId);\n await onEntryAfterMove.publish({\n entry,\n model,\n folderId\n });\n return entry;\n } catch (ex) {\n await onEntryMoveError.publish({\n entry,\n model,\n folderId,\n error: ex\n });\n throw WebinyError.from(ex, {\n message: `Could not move entry \"${id}\" of model \"${model.modelId}\".`,\n code: \"MOVE_ENTRY_ERROR\"\n });\n }\n };\n\n const republishEntry: CmsEntryContext[\"republishEntry\"] = async (model, id) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n /**\n * Fetch the entry from the storage.\n */\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" was not found!`);\n }\n\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n const values = await referenceFieldsMapping({\n context,\n model,\n input: originalEntry.values,\n validateEntries: false\n });\n\n const entry: CmsEntry = {\n ...originalEntry,\n status: STATUS_PUBLISHED,\n publishedOn: originalEntry.publishedOn || new Date().toISOString(),\n savedOn: new Date().toISOString(),\n webinyVersion: context.WEBINY_VERSION,\n values\n };\n\n const storageEntry = await entryToStorageTransform(context, model, entry);\n /**\n * First we need to update existing entry.\n */\n try {\n await storageOperations.entries.update(model, {\n entry,\n storageEntry\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not update existing entry with new data while re-publishing.\",\n \"REPUBLISH_UPDATE_ERROR\",\n {\n entry\n }\n );\n }\n /**\n * Then we move onto publishing it again.\n */\n try {\n await onEntryBeforeRepublish.publish({\n entry,\n model\n });\n\n const result = await storageOperations.entries.publish(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterRepublish.publish({\n entry,\n model,\n storageEntry: result\n });\n return entry;\n } catch (ex) {\n await onEntryRepublishError.publish({\n entry,\n model,\n error: ex\n });\n throw new WebinyError(\n \"Could not publish existing entry while re-publishing.\",\n \"REPUBLISH_PUBLISH_ERROR\",\n {\n entry\n }\n );\n }\n };\n const deleteEntryRevision: CmsEntryContext[\"deleteEntryRevision\"] = async (\n model,\n revisionId\n ) => {\n await entriesPermissions.ensure({ rwd: \"d\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { id: entryId, version } = parseIdentifier(revisionId);\n\n const storageEntryToDelete = await storageOperations.entries.getRevisionById(model, {\n id: revisionId\n });\n const latestStorageEntry = await storageOperations.entries.getLatestRevisionByEntryId(\n model,\n {\n id: entryId\n }\n );\n const previousStorageEntry = await storageOperations.entries.getPreviousRevision(model, {\n entryId,\n version: version as number\n });\n\n if (!storageEntryToDelete) {\n throw new NotFoundError(`Entry \"${revisionId}\" was not found!`);\n }\n\n await entriesPermissions.ensure({ owns: storageEntryToDelete.createdBy });\n\n const latestEntryRevisionId = latestStorageEntry ? latestStorageEntry.id : null;\n\n const entryToDelete = await entryFromStorageTransform(context, model, storageEntryToDelete);\n /**\n * If targeted record is the latest entry record and there is no previous one, we need to run full delete with hooks.\n * At this point deleteRevision hooks are not fired.\n */\n if (entryToDelete.id === latestEntryRevisionId && !previousStorageEntry) {\n return await deleteEntryHelper({\n model,\n entry: entryToDelete\n });\n }\n /**\n * If targeted record is latest entry revision, set the previous one as the new latest\n */\n let entryToSetAsLatest: CmsEntry | null = null;\n let storageEntryToSetAsLatest: CmsStorageEntry | null = null;\n if (entryToDelete.id === latestEntryRevisionId && previousStorageEntry) {\n entryToSetAsLatest = await entryFromStorageTransform(\n context,\n model,\n previousStorageEntry\n );\n storageEntryToSetAsLatest = previousStorageEntry;\n }\n\n try {\n await onEntryRevisionBeforeDelete.publish({\n entry: entryToDelete,\n model\n });\n\n await storageOperations.entries.deleteRevision(model, {\n entry: entryToDelete,\n storageEntry: storageEntryToDelete,\n latestEntry: entryToSetAsLatest,\n latestStorageEntry: storageEntryToSetAsLatest\n });\n\n await onEntryRevisionAfterDelete.publish({\n entry: entryToDelete,\n model\n });\n } catch (ex) {\n await onEntryRevisionDeleteError.publish({\n entry: entryToDelete,\n model,\n error: ex\n });\n throw new WebinyError(ex.message, ex.code || \"DELETE_REVISION_ERROR\", {\n error: ex,\n entry: entryToDelete,\n storageEntry: storageEntryToDelete,\n latestEntry: entryToSetAsLatest,\n latestStorageEntry: storageEntryToSetAsLatest\n });\n }\n };\n const deleteMultipleEntries: CmsEntryContext[\"deleteMultipleEntries\"] = async (\n model,\n params\n ) => {\n const { entries: input } = params;\n const maxDeletableEntries = 50;\n\n const entryIdList = new Set<string>();\n for (const id of input) {\n const { id: entryId } = parseIdentifier(id);\n entryIdList.add(entryId);\n }\n const ids = Array.from(entryIdList);\n\n if (ids.length > maxDeletableEntries) {\n throw new WebinyError(\n \"Cannot delete more than 50 entries at once.\",\n \"DELETE_ENTRIES_MAX\",\n {\n entries: ids\n }\n );\n }\n\n await entriesPermissions.ensure({ rwd: \"d\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { items: entries } = await storageOperations.entries.list(model, {\n where: {\n latest: true,\n entryId_in: ids\n },\n limit: maxDeletableEntries + 1\n });\n /**\n * We do not want to allow deleting entries that user does not own or cannot access.\n */\n const items = (\n await filterAsync(entries, async entry => {\n return entriesPermissions.ensure({ owns: entry.createdBy }, { throw: false });\n })\n ).map(entry => entry.id);\n\n try {\n await onEntryBeforeDeleteMultiple.publish({\n entries,\n ids,\n model\n });\n await storageOperations.entries.deleteMultipleEntries(model, {\n entries: items\n });\n await onEntryAfterDeleteMultiple.publish({\n entries,\n ids,\n model\n });\n return items.map(id => {\n return {\n id\n };\n });\n } catch (ex) {\n await onEntryDeleteMultipleError.publish({\n entries,\n ids,\n model,\n error: ex\n });\n throw new WebinyError(ex.message, ex.code || \"DELETE_ENTRIES_MULTIPLE_ERROR\", {\n error: ex,\n entries\n });\n }\n };\n\n const deleteEntry: CmsEntryContext[\"deleteEntry\"] = async (model, id, options) => {\n await entriesPermissions.ensure({ rwd: \"d\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { force } = options || {};\n\n const storageEntry = (await storageOperations.entries.getLatestRevisionByEntryId(model, {\n id\n })) as CmsEntry;\n /**\n * If there is no entry, and we do not force the deletion, just throw an error.\n */\n if (!storageEntry && !force) {\n throw new NotFoundError(`Entry \"${id}\" was not found!`);\n }\n /**\n * In the case we are forcing the deletion, we do not need the storageEntry to exist as it might be an error when loading single database record.\n *\n * This happens, sometimes, in the Elasticsearch system as the entry might get deleted from the DynamoDB but not from the Elasticsearch.\n * This is due to high load on the Elasticsearch at the time of the deletion.\n */\n //\n else if (!storageEntry && force) {\n const { id: entryId } = parseIdentifier(id);\n return await deleteEntryHelper({\n model,\n entry: {\n id,\n entryId\n } as CmsEntry\n });\n }\n\n await entriesPermissions.ensure({ owns: storageEntry.createdBy });\n\n const entry = await entryFromStorageTransform(context, model, storageEntry);\n\n return await deleteEntryHelper({\n model,\n entry\n });\n };\n const publishEntry: CmsEntryContext[\"publishEntry\"] = async (model, id) => {\n await entriesPermissions.ensure({ pw: \"p\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" in the model \"${model.modelId}\" was not found.`);\n }\n\n await entriesPermissions.ensure({ owns: originalStorageEntry.createdBy });\n\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: originalEntry.values,\n entry: originalEntry\n });\n\n const currentDate = new Date().toISOString();\n const entry: CmsEntry = {\n ...originalEntry,\n status: STATUS_PUBLISHED,\n locked: true,\n savedOn: currentDate,\n publishedOn: currentDate\n };\n\n let storageEntry: CmsStorageEntry | null = null;\n\n try {\n await onEntryBeforePublish.publish({\n entry,\n model\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n const result = await storageOperations.entries.publish(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterPublish.publish({\n entry,\n storageEntry: result,\n model\n });\n return entry;\n } catch (ex) {\n await onEntryPublishError.publish({\n entry,\n model,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not publish entry.\",\n ex.code || \"PUBLISH_ERROR\",\n {\n error: ex,\n entry,\n storageEntry,\n originalEntry,\n originalStorageEntry\n }\n );\n }\n };\n const unpublishEntry: CmsEntryContext[\"unpublishEntry\"] = async (model, id) => {\n await entriesPermissions.ensure({ pw: \"u\" });\n\n const { id: entryId } = parseIdentifier(id);\n\n const originalStorageEntry = await storageOperations.entries.getPublishedRevisionByEntryId(\n model,\n {\n id: entryId\n }\n );\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" of model \"${model.modelId}\" was not found.`);\n }\n\n if (originalStorageEntry.id !== id) {\n throw new WebinyError(`Entry is not published.`, \"UNPUBLISH_ERROR\", {\n entry: originalStorageEntry\n });\n }\n\n await entriesPermissions.ensure({ owns: originalStorageEntry.createdBy });\n\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n const entry: CmsEntry = {\n ...originalEntry,\n status: STATUS_UNPUBLISHED\n };\n\n let storageEntry: CmsStorageEntry | null = null;\n\n try {\n await onEntryBeforeUnpublish.publish({\n entry,\n model\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n\n const result = await storageOperations.entries.unpublish(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterUnpublish.publish({\n entry,\n storageEntry: result,\n model\n });\n\n return entry;\n } catch (ex) {\n await onEntryUnpublishError.publish({\n entry,\n model,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not unpublish entry.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n originalEntry,\n originalStorageEntry,\n entry,\n storageEntry\n }\n );\n }\n };\n\n const getUniqueFieldValues: CmsEntryContext[\"getUniqueFieldValues\"] = async (model, params) => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { where: initialWhere, fieldId } = params;\n\n const where = {\n ...initialWhere\n };\n /**\n * Possibly only get records which are owned by current user.\n * Or if searching for the owner set that value - in the case that user can see other entries than their own.\n */\n if (await entriesPermissions.canAccessOnlyOwnRecords()) {\n where.ownedBy = getIdentity().id;\n }\n\n /**\n * Where must contain either latest or published keys.\n * We cannot list entries without one of those\n */\n if (where.latest && where.published) {\n throw new WebinyError(\n \"Cannot list entries that are both published and latest.\",\n \"LIST_ENTRIES_ERROR\",\n {\n where\n }\n );\n } else if (!where.latest && !where.published) {\n throw new WebinyError(\n \"Cannot list entries if we do not have latest or published defined.\",\n \"LIST_ENTRIES_ERROR\",\n {\n where\n }\n );\n }\n /**\n * We need to verify that the field in question is searchable.\n */\n const fields = getSearchableFields({\n fields: model.fields,\n plugins: context.plugins,\n input: []\n });\n\n if (!fields.includes(fieldId)) {\n throw new WebinyError(\n \"Cannot list unique entry field values if the field is not searchable.\",\n \"LIST_UNIQUE_ENTRY_VALUES_ERROR\",\n {\n fieldId\n }\n );\n }\n\n try {\n return await storageOperations.entries.getUniqueFieldValues(model, {\n where,\n fieldId\n });\n } catch (ex) {\n throw new WebinyError(\n \"Error while fetching unique entry values from storage.\",\n \"LIST_UNIQUE_ENTRY_VALUES_ERROR\",\n {\n error: {\n message: ex.message,\n code: ex.code,\n data: ex.data\n },\n model,\n where,\n fieldId\n }\n );\n }\n };\n\n return {\n onEntryBeforeCreate,\n onEntryAfterCreate,\n onEntryCreateError,\n\n onEntryRevisionBeforeCreate: onEntryBeforeCreateRevision,\n onEntryRevisionAfterCreate,\n onEntryRevisionCreateError: onEntryCreateRevisionError,\n\n onEntryBeforeUpdate,\n onEntryAfterUpdate,\n onEntryUpdateError,\n\n onEntryBeforeMove,\n onEntryAfterMove,\n onEntryMoveError,\n\n onEntryBeforeDelete,\n onEntryAfterDelete,\n onEntryDeleteError,\n\n onEntryRevisionBeforeDelete,\n onEntryRevisionAfterDelete,\n onEntryRevisionDeleteError,\n\n onEntryBeforePublish,\n onEntryAfterPublish,\n onEntryPublishError,\n\n onEntryBeforeRepublish,\n onEntryAfterRepublish,\n onEntryRepublishError,\n\n onEntryBeforeUnpublish,\n onEntryAfterUnpublish,\n onEntryUnpublishError,\n\n onEntryBeforeGet,\n onEntryBeforeList,\n /**\n * Get entries by exact revision IDs from the database.\n */\n getEntriesByIds,\n /**\n * Get a single entry by revision ID from the database.\n */\n async getEntryById(model, id) {\n return context.benchmark.measure(\"headlessCms.crud.entries.getEntryById\", async () => {\n return getEntryById(model, id);\n });\n },\n /**\n * Get published revisions by entry IDs.\n */\n async getPublishedEntriesByIds(model: CmsModel, ids: string[]) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.getPublishedEntriesByIds\",\n async () => {\n return getPublishedEntriesByIds(model, ids);\n }\n );\n },\n /**\n * Get the latest revisions by entry IDs.\n */\n async getLatestEntriesByIds(model: CmsModel, ids: string[]) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.getLatestEntriesByIds\",\n async () => {\n return getLatestEntriesByIds(model, ids);\n }\n );\n },\n async getEntryRevisions(model, entryId) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.getEntryRevisions\",\n async () => {\n return getEntryRevisions(model, entryId);\n }\n );\n },\n /**\n * TODO determine if this method is required at all.\n *\n * @internal\n */\n async getEntry(model, params) {\n return context.benchmark.measure(\"headlessCms.crud.entries.getEntry\", async () => {\n return getEntry(model, params);\n });\n },\n /**\n * @description Should not be used directly. Internal use only!\n *\n * @internal\n */\n async listEntries<T = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> {\n return context.benchmark.measure(\"headlessCms.crud.entries.listEntries\", async () => {\n return listEntries(model, params);\n });\n },\n async listLatestEntries<T = CmsEntryValues>(\n this: HeadlessCms,\n model: CmsModel,\n params?: CmsEntryListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> {\n const where = params?.where || ({} as CmsEntryListWhere);\n\n return this.listEntries(model, {\n sort: [\"createdOn_DESC\"],\n ...(params || {}),\n where: {\n ...where,\n latest: true\n }\n });\n },\n async listPublishedEntries<T = CmsEntryValues>(\n model: CmsModel,\n params?: CmsEntryListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> {\n const where = params?.where || ({} as CmsEntryListWhere);\n\n return this.listEntries(model, {\n sort: [\"createdOn_DESC\"],\n ...(params || {}),\n where: {\n ...where,\n published: true\n }\n });\n },\n async createEntry(model, input, options) {\n return context.benchmark.measure(\"headlessCms.crud.entries.createEntry\", async () => {\n return createEntry(model, input, options);\n });\n },\n async createEntryRevisionFrom(model, sourceId, input, options) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.createEntryRevisionFrom\",\n async () => {\n return createEntryRevisionFrom(model, sourceId, input, options);\n }\n );\n },\n async updateEntry(model, id, input, meta, options) {\n return context.benchmark.measure(\"headlessCms.crud.entries.updateEntry\", async () => {\n return updateEntry(model, id, input, meta, options);\n });\n },\n async validateEntry(model, id, input) {\n return context.benchmark.measure(\"headlessCms.crud.entries.validateEntry\", async () => {\n return validateEntry(model, id, input);\n });\n },\n async moveEntry(model, id, folderId) {\n return context.benchmark.measure(\"headlessCms.crud.entries.moveEntry\", async () => {\n return moveEntry(model, id, folderId);\n });\n },\n /**\n * Method used internally. Not documented and should not be used in users systems.\n * @internal\n */\n async republishEntry(model, id) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.republishEntry\",\n async () => {\n return republishEntry(model, id);\n }\n );\n },\n async deleteEntryRevision(model, id) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.deleteEntryRevision\",\n async () => {\n return deleteEntryRevision(model, id);\n }\n );\n },\n async deleteEntry(model, entryId, options) {\n return context.benchmark.measure(\"headlessCms.crud.entries.deleteEntry\", async () => {\n return deleteEntry(model, entryId, options);\n });\n },\n async deleteMultipleEntries(model, ids) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.deleteMultipleEntries\",\n async () => {\n return deleteMultipleEntries(model, ids);\n }\n );\n },\n async publishEntry(model, id) {\n return context.benchmark.measure(\"headlessCms.crud.entries.publishEntry\", async () => {\n return publishEntry(model, id);\n });\n },\n async unpublishEntry(model, id) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.unpublishEntry\",\n async () => {\n return unpublishEntry(model, id);\n }\n );\n },\n async getUniqueFieldValues(model, params) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.getUniqueFieldValues\",\n async () => {\n return getUniqueFieldValues(model, params);\n }\n );\n }\n };\n};\n"],"mappings":";;;;;;;;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K,EAAEiB,EAAE,CAAC;MACpC,CACJ,CAAC;IACL,CAAC;IACD,MAAMiM,oBAAoBA,CAAClN,KAAK,EAAEgC,MAAM,EAAE;MACtC,OAAOI,OAAO,CAACsD,SAAS,CAACC,OAAO,CAC5B,+CAA+C,EAC/C,YAAY;QACR,OAAOuH,oBAAoB,CAAClN,KAAK,EAAEgC,MAAM,CAAC;MAC9C,CACJ,CAAC;IACL;EACJ,CAAC;AACL,CAAC;AAAC3D,OAAA,CAAA0D,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_merge","_interopRequireDefault","require","_utils","_error","_handlerGraphql","_types","_entryDataValidation","_pubsub","_beforeCreate","_beforeUpdate","_afterDelete","_referenceFieldsMapping","_entryStorage","_searchableFields","_filterAsync","_apiSecurity","_constants","STATUS_DRAFT","CONTENT_ENTRY_STATUS","DRAFT","exports","STATUS_PUBLISHED","PUBLISHED","STATUS_UNPUBLISHED","UNPUBLISHED","convertDefaultValue","field","value","type","Boolean","Number","getDefaultValue","settings","multipleValues","defaultValue","undefined","predefinedValues","enabled","Array","isArray","values","selectedValue","find","selected","filter","map","mapAndCleanCreateInputData","model","input","fields","reduce","acc","fieldId","WebinyError","mapAndCleanUpdatedInputData","createEntryMeta","original","meta","lodashMerge","removeUndefinedValues","removeNullValues","createEntryId","entryId","mdbid","id","match","version","createIdentifier","increaseEntryIdVersion","parseIdentifier","allowedEntryStatus","transformEntryStatus","status","includes","createSort","sort","s","length","createContentEntryCrud","params","storageOperations","entriesPermissions","modelsPermissions","context","getIdentity","getTenant","getLocale","getCreatedBy","identity","displayName","onEntryBeforeCreate","createTopic","onEntryAfterCreate","onEntryCreateError","onEntryBeforeCreateRevision","onEntryRevisionAfterCreate","onEntryCreateRevisionError","onEntryBeforeUpdate","onEntryAfterUpdate","onEntryUpdateError","onEntryBeforeMove","onEntryAfterMove","onEntryMoveError","onEntryBeforePublish","onEntryAfterPublish","onEntryPublishError","onEntryBeforeRepublish","onEntryAfterRepublish","onEntryRepublishError","onEntryBeforeUnpublish","onEntryAfterUnpublish","onEntryUnpublishError","onEntryBeforeDelete","onEntryAfterDelete","onEntryDeleteError","onEntryRevisionBeforeDelete","onEntryRevisionAfterDelete","onEntryRevisionDeleteError","onEntryBeforeDeleteMultiple","onEntryAfterDeleteMultiple","onEntryDeleteMultipleError","onEntryBeforeGet","onEntryBeforeList","assignBeforeEntryCreate","assignBeforeEntryUpdate","assignAfterEntryDelete","deleteEntryHelper","entry","publish","entries","delete","ex","error","message","code","getEntriesByIds","ids","benchmark","measure","ensure","rwd","ensureCanAccessModel","getByIds","filterAsync","owns","createdBy","throw","getEntryById","where","NotFoundError","getPublishedEntriesByIds","getPublishedByIds","getLatestEntriesByIds","getLatestByIds","getEntry","items","listEntries","limit","item","shift","getEntryRevisions","getRevisions","NotAuthorizedError","data","reason","initialWhere","initialLimit","_objectSpread2","default","canAccessOnlyOwnRecords","ownedBy","latest","published","getSearchableFields","plugins","hasMoreItems","totalCount","cursor","list","createEntry","inputData","options","_inputData$wbyAco_loc","initialInput","validateModelEntryDataOrThrow","skipValidators","referenceFieldsMapping","validateEntries","locale","owner","webinyVersion","WEBINY_VERSION","tenant","modelId","createdOn","Date","toISOString","savedOn","modifiedBy","locked","location","folderId","wbyAco_location","ROOT_FOLDER","storageEntry","entryToStorageTransform","result","create","createEntryRevisionFrom","sourceId","uniqueId","originalStorageEntry","getRevisionById","latestStorageEntry","getLatestRevisionByEntryId","originalEntry","entryFromStorageTransform","initialValues","latestId","nextVersion","publishedOn","createRevisionFrom","updateEntry","metaInput","_inputData$wbyAco_loc2","update","validateEntry","validateModelEntryData","moveEntry","_entry$location","move","from","republishEntry","deleteEntryRevision","revisionId","storageEntryToDelete","previousStorageEntry","getPreviousRevision","latestEntryRevisionId","entryToDelete","entryToSetAsLatest","storageEntryToSetAsLatest","deleteRevision","latestEntry","deleteMultipleEntries","maxDeletableEntries","entryIdList","Set","add","entryId_in","deleteEntry","force","publishEntry","pw","currentDate","unpublishEntry","getPublishedRevisionByEntryId","unpublish","getUniqueFieldValues","onEntryRevisionBeforeCreate","onEntryRevisionCreateError","listLatestEntries","listPublishedEntries"],"sources":["contentEntry.crud.ts"],"sourcesContent":["import lodashMerge from \"lodash/merge\";\nimport {\n createIdentifier,\n mdbid,\n parseIdentifier,\n removeNullValues,\n removeUndefinedValues\n} from \"@webiny/utils\";\nimport WebinyError from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport {\n CmsContext,\n CmsEntry,\n CmsEntryContext,\n CmsEntryListParams,\n CmsEntryListSort,\n CmsEntryListWhere,\n CmsEntryMeta,\n CmsEntryStatus,\n CmsEntryValues,\n CmsModel,\n CmsModelField,\n CmsStorageEntry,\n CONTENT_ENTRY_STATUS,\n CreateCmsEntryInput,\n EntryBeforeListTopicParams,\n HeadlessCms,\n HeadlessCmsStorageOperations,\n OnEntryAfterCreateTopicParams,\n OnEntryAfterDeleteMultipleTopicParams,\n OnEntryAfterDeleteTopicParams,\n OnEntryAfterMoveTopicParams,\n OnEntryAfterPublishTopicParams,\n OnEntryAfterRepublishTopicParams,\n OnEntryAfterUnpublishTopicParams,\n OnEntryAfterUpdateTopicParams,\n OnEntryBeforeCreateTopicParams,\n OnEntryBeforeDeleteMultipleTopicParams,\n OnEntryBeforeDeleteTopicParams,\n OnEntryBeforeGetTopicParams,\n OnEntryBeforeMoveTopicParams,\n OnEntryBeforePublishTopicParams,\n OnEntryBeforeRepublishTopicParams,\n OnEntryBeforeUnpublishTopicParams,\n OnEntryBeforeUpdateTopicParams,\n OnEntryCreateErrorTopicParams,\n OnEntryCreateRevisionErrorTopicParams,\n OnEntryDeleteErrorTopicParams,\n OnEntryDeleteMultipleErrorTopicParams,\n OnEntryMoveErrorTopicParams,\n OnEntryPublishErrorTopicParams,\n OnEntryRepublishErrorTopicParams,\n OnEntryRevisionAfterCreateTopicParams,\n OnEntryRevisionAfterDeleteTopicParams,\n OnEntryRevisionBeforeCreateTopicParams,\n OnEntryRevisionBeforeDeleteTopicParams,\n OnEntryRevisionDeleteErrorTopicParams,\n OnEntryUnpublishErrorTopicParams,\n OnEntryUpdateErrorTopicParams,\n UpdateCmsEntryInput\n} from \"~/types\";\nimport {\n validateModelEntryData,\n validateModelEntryDataOrThrow\n} from \"./contentEntry/entryDataValidation\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { assignBeforeEntryCreate } from \"./contentEntry/beforeCreate\";\nimport { assignBeforeEntryUpdate } from \"./contentEntry/beforeUpdate\";\nimport { assignAfterEntryDelete } from \"./contentEntry/afterDelete\";\nimport { referenceFieldsMapping } from \"./contentEntry/referenceFieldsMapping\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { entryFromStorageTransform, entryToStorageTransform } from \"~/utils/entryStorage\";\nimport { getSearchableFields } from \"./contentEntry/searchableFields\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { filterAsync } from \"~/utils/filterAsync\";\nimport { EntriesPermissions } from \"~/utils/permissions/EntriesPermissions\";\nimport { ModelsPermissions } from \"~/utils/permissions/ModelsPermissions\";\nimport { NotAuthorizedError } from \"@webiny/api-security/\";\nimport { ROOT_FOLDER } from \"~/constants\";\n\nexport const STATUS_DRAFT = CONTENT_ENTRY_STATUS.DRAFT;\nexport const STATUS_PUBLISHED = CONTENT_ENTRY_STATUS.PUBLISHED;\nexport const STATUS_UNPUBLISHED = CONTENT_ENTRY_STATUS.UNPUBLISHED;\n\ntype DefaultValue = boolean | number | string | null;\n/**\n * Used for some fields to convert their values.\n */\nconst convertDefaultValue = (field: CmsModelField, value: DefaultValue): DefaultValue => {\n switch (field.type) {\n case \"boolean\":\n return Boolean(value);\n case \"number\":\n return Number(value);\n default:\n return value;\n }\n};\nconst getDefaultValue = (field: CmsModelField): (DefaultValue | DefaultValue[]) | undefined => {\n const { settings, multipleValues } = field;\n if (settings && settings.defaultValue !== undefined) {\n return convertDefaultValue(field, settings.defaultValue);\n }\n const { predefinedValues } = field;\n if (\n !predefinedValues ||\n !predefinedValues.enabled ||\n Array.isArray(predefinedValues.values) === false\n ) {\n return undefined;\n }\n if (!multipleValues) {\n const selectedValue = predefinedValues.values.find(value => {\n return !!value.selected;\n });\n if (selectedValue) {\n return convertDefaultValue(field, selectedValue.value);\n }\n return undefined;\n }\n return predefinedValues.values\n .filter(({ selected }) => !!selected)\n .map(({ value }) => {\n return convertDefaultValue(field, value);\n });\n};\n/**\n * Cleans and adds default values to create input data.\n */\nconst mapAndCleanCreateInputData = (model: CmsModel, input: CreateCmsEntryInput) => {\n return model.fields.reduce<CreateCmsEntryInput>((acc, field) => {\n /**\n * This should never happen, but let's make it sure.\n * The fix would be for the user to add the fieldId on the field definition.\n */\n if (!field.fieldId) {\n throw new WebinyError(\"Field does not have an fieldId.\", \"MISSING_FIELD_ID\", {\n field\n });\n }\n const value = input[field.fieldId];\n /**\n * We set the default value on create input if value is not defined.\n */\n acc[field.fieldId] = value === undefined ? getDefaultValue(field) : value;\n return acc;\n }, {});\n};\n/**\n * Cleans the update input entry data.\n */\nconst mapAndCleanUpdatedInputData = (model: CmsModel, input: UpdateCmsEntryInput) => {\n return model.fields.reduce<UpdateCmsEntryInput>((acc, field) => {\n /**\n * This should never happen, but let's make it sure.\n * The fix would be for the user to add the fieldId on the field definition.\n */\n if (!field.fieldId) {\n throw new WebinyError(\"Field does not have an fieldId.\", \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * We cannot set default value here because user might want to update only certain field values.\n */\n const value = input[field.fieldId];\n if (value === undefined) {\n return acc;\n }\n acc[field.fieldId] = value;\n return acc;\n }, {});\n};\n/**\n * This method takes original entry meta and new input.\n * When new meta is merged onto the existing one, everything that has undefined or null value is removed.\n */\nconst createEntryMeta = (input?: Record<string, any>, original?: Record<string, any>) => {\n const meta = lodashMerge(original || {}, input || {});\n return removeUndefinedValues(removeNullValues(meta));\n};\n\ninterface DeleteEntryParams {\n model: CmsModel;\n entry: CmsEntry;\n}\n\nconst createEntryId = (input: CreateCmsEntryInput) => {\n let entryId = mdbid();\n if (input.id) {\n if (input.id.match(/^([a-zA-Z0-9])([a-zA-Z0-9\\-]+)([a-zA-Z0-9])$/) === null) {\n throw new WebinyError(\n \"The provided ID is not valid. It must be a string which can be A-Z, a-z, 0-9, - and it cannot start or end with a -.\",\n \"INVALID_ID\",\n {\n id: input.id\n }\n );\n }\n entryId = input.id;\n }\n const version = 1;\n return {\n entryId,\n version,\n id: createIdentifier({\n id: entryId,\n version\n })\n };\n};\n\nconst increaseEntryIdVersion = (id: string) => {\n const { id: entryId, version } = parseIdentifier(id);\n if (!version) {\n throw new WebinyError(\n \"Cannot increase version on the ID without the version part.\",\n \"WRONG_ID\",\n {\n id\n }\n );\n }\n return {\n entryId,\n version: version + 1,\n id: createIdentifier({\n id: entryId,\n version: version + 1\n })\n };\n};\n\nconst allowedEntryStatus: string[] = [\"draft\", \"published\", \"unpublished\"];\n\nconst transformEntryStatus = (status: CmsEntryStatus | string): CmsEntryStatus => {\n return allowedEntryStatus.includes(status) ? (status as CmsEntryStatus) : \"draft\";\n};\n\nconst createSort = (sort?: CmsEntryListSort): CmsEntryListSort => {\n if (!Array.isArray(sort)) {\n return [\"createdOn_DESC\"];\n } else if (sort.filter(s => !!s).length === 0) {\n return [\"createdOn_DESC\"];\n }\n return sort;\n};\n\ninterface CreateContentEntryCrudParams {\n storageOperations: HeadlessCmsStorageOperations;\n entriesPermissions: EntriesPermissions;\n modelsPermissions: ModelsPermissions;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n}\n\nexport const createContentEntryCrud = (params: CreateContentEntryCrudParams): CmsEntryContext => {\n const {\n storageOperations,\n entriesPermissions,\n modelsPermissions,\n context,\n getIdentity,\n getTenant,\n getLocale\n } = params;\n\n const getCreatedBy = () => {\n const identity = getIdentity();\n return {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n };\n };\n\n /**\n * Create\n */\n const onEntryBeforeCreate =\n createTopic<OnEntryBeforeCreateTopicParams>(\"cms.onEntryBeforeCreate\");\n const onEntryAfterCreate = createTopic<OnEntryAfterCreateTopicParams>(\"cms.onEntryAfterCreate\");\n const onEntryCreateError = createTopic<OnEntryCreateErrorTopicParams>(\"cms.onEntryCreateError\");\n\n /**\n * Create new revision\n */\n const onEntryBeforeCreateRevision = createTopic<OnEntryRevisionBeforeCreateTopicParams>(\n \"cms.onEntryBeforeCreateRevision\"\n );\n const onEntryRevisionAfterCreate = createTopic<OnEntryRevisionAfterCreateTopicParams>(\n \"cms.onEntryRevisionAfterCreate\"\n );\n const onEntryCreateRevisionError = createTopic<OnEntryCreateRevisionErrorTopicParams>(\n \"cms.onEntryCreateRevisionError\"\n );\n\n /**\n * Update\n */\n const onEntryBeforeUpdate =\n createTopic<OnEntryBeforeUpdateTopicParams>(\"cms.onEntryBeforeUpdate\");\n const onEntryAfterUpdate = createTopic<OnEntryAfterUpdateTopicParams>(\"cms.onEntryAfterUpdate\");\n const onEntryUpdateError = createTopic<OnEntryUpdateErrorTopicParams>(\"cms.onEntryUpdateError\");\n\n /**\n * Move\n */\n const onEntryBeforeMove = createTopic<OnEntryBeforeMoveTopicParams>(\"cms.onEntryBeforeMove\");\n const onEntryAfterMove = createTopic<OnEntryAfterMoveTopicParams>(\"cms.onEntryAfterMove\");\n const onEntryMoveError = createTopic<OnEntryMoveErrorTopicParams>(\"cms.onEntryMoveError\");\n\n /**\n * Publish\n */\n const onEntryBeforePublish = createTopic<OnEntryBeforePublishTopicParams>(\n \"cms.onEntryBeforePublish\"\n );\n const onEntryAfterPublish =\n createTopic<OnEntryAfterPublishTopicParams>(\"cms.onEntryAfterPublish\");\n\n const onEntryPublishError =\n createTopic<OnEntryPublishErrorTopicParams>(\"cms.onEntryPublishError\");\n\n /**\n * Republish\n */\n const onEntryBeforeRepublish = createTopic<OnEntryBeforeRepublishTopicParams>(\n \"cms.onEntryBeforeRepublish\"\n );\n const onEntryAfterRepublish = createTopic<OnEntryAfterRepublishTopicParams>(\n \"cms.onEntryAfterRepublish\"\n );\n\n const onEntryRepublishError = createTopic<OnEntryRepublishErrorTopicParams>(\n \"cms.onEntryRepublishError\"\n );\n\n /**\n * Unpublish\n */\n const onEntryBeforeUnpublish = createTopic<OnEntryBeforeUnpublishTopicParams>(\n \"cms.onEntryBeforeUnpublish\"\n );\n const onEntryAfterUnpublish = createTopic<OnEntryAfterUnpublishTopicParams>(\n \"cms.onEntryAfterUnpublish\"\n );\n const onEntryUnpublishError = createTopic<OnEntryUnpublishErrorTopicParams>(\n \"cms.onEntryUnpublishError\"\n );\n\n /**\n * Delete\n */\n const onEntryBeforeDelete =\n createTopic<OnEntryBeforeDeleteTopicParams>(\"cms.onEntryBeforeDelete\");\n const onEntryAfterDelete = createTopic<OnEntryAfterDeleteTopicParams>(\"cms.onEntryAfterDelete\");\n const onEntryDeleteError = createTopic<OnEntryDeleteErrorTopicParams>(\"cms.onEntryDeleteError\");\n\n /**\n * Delete revision\n */\n const onEntryRevisionBeforeDelete = createTopic<OnEntryRevisionBeforeDeleteTopicParams>(\n \"cms.onEntryRevisionBeforeDelete\"\n );\n const onEntryRevisionAfterDelete = createTopic<OnEntryRevisionAfterDeleteTopicParams>(\n \"cms.onEntryRevisionAfterDelete\"\n );\n const onEntryRevisionDeleteError = createTopic<OnEntryRevisionDeleteErrorTopicParams>(\n \"cms.onEntryRevisionDeleteError\"\n );\n /**\n * Delete multiple entries\n */\n const onEntryBeforeDeleteMultiple = createTopic<OnEntryBeforeDeleteMultipleTopicParams>(\n \"cms.onEntryBeforeDeleteMultiple\"\n );\n const onEntryAfterDeleteMultiple = createTopic<OnEntryAfterDeleteMultipleTopicParams>(\n \"cms.onEntryAfterDeleteMultiple\"\n );\n const onEntryDeleteMultipleError = createTopic<OnEntryDeleteMultipleErrorTopicParams>(\n \"cms.onEntryDeleteMultipleError\"\n );\n\n /**\n * Get entry\n */\n const onEntryBeforeGet = createTopic<OnEntryBeforeGetTopicParams>(\"cms.onEntryBeforeGet\");\n\n /**\n * List entries\n */\n const onEntryBeforeList = createTopic<EntryBeforeListTopicParams>(\"cms.onEntryBeforeList\");\n\n /**\n * We need to assign some default behaviors.\n */\n assignBeforeEntryCreate({\n context,\n onEntryBeforeCreate\n });\n assignBeforeEntryUpdate({\n context,\n onEntryBeforeUpdate\n });\n assignAfterEntryDelete({\n context,\n onEntryAfterDelete\n });\n\n /**\n * A helper to delete the entire entry.\n */\n const deleteEntryHelper = async (params: DeleteEntryParams): Promise<void> => {\n const { model, entry } = params;\n try {\n await onEntryBeforeDelete.publish({\n entry,\n model\n });\n\n await storageOperations.entries.delete(model, {\n entry\n });\n\n await onEntryAfterDelete.publish({\n entry,\n model\n });\n } catch (ex) {\n await onEntryDeleteError.publish({\n entry,\n model,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not delete entry.\",\n ex.code || \"DELETE_ERROR\",\n {\n entry\n }\n );\n }\n };\n /**\n * A helper to get entries by revision IDs\n */\n const getEntriesByIds: CmsEntryContext[\"getEntriesByIds\"] = async (model, ids) => {\n return context.benchmark.measure(\"headlessCms.crud.entries.getEntriesByIds\", async () => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const entries = await storageOperations.entries.getByIds(model, {\n ids\n });\n\n return filterAsync(entries, async entry => {\n return entriesPermissions.ensure(\n {\n owns: entry.createdBy\n },\n {\n throw: false\n }\n );\n });\n });\n };\n const getEntryById: CmsEntryContext[\"getEntryById\"] = async (model, id) => {\n const where: CmsEntryListWhere = {\n id\n };\n await onEntryBeforeGet.publish({\n where,\n model\n });\n const [entry] = await getEntriesByIds(model, [id]);\n if (!entry) {\n throw new NotFoundError(`Entry by ID \"${id}\" not found.`);\n }\n return entry;\n };\n const getPublishedEntriesByIds: CmsEntryContext[\"getPublishedEntriesByIds\"] = async (\n model,\n ids\n ) => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const entries = await storageOperations.entries.getPublishedByIds(model, {\n ids\n });\n\n return filterAsync(entries, async entry => {\n return entriesPermissions.ensure({ owns: entry.createdBy }, { throw: false });\n });\n };\n const getLatestEntriesByIds: CmsEntryContext[\"getLatestEntriesByIds\"] = async (model, ids) => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const entries = await storageOperations.entries.getLatestByIds(model, {\n ids\n });\n\n return filterAsync(entries, async entry => {\n return entriesPermissions.ensure({ owns: entry.createdBy }, { throw: false });\n });\n };\n const getEntry: CmsEntryContext[\"getEntry\"] = async (model, params) => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n\n const { where, sort } = params;\n\n await onEntryBeforeGet.publish({\n where,\n model\n });\n\n const [items] = await listEntries(model, {\n where,\n sort,\n limit: 1\n });\n\n const item = items.shift();\n\n if (!item) {\n throw new NotFoundError(`Entry not found!`);\n }\n return item;\n };\n const getEntryRevisions: CmsEntryContext[\"getEntryRevisions\"] = async (model, entryId) => {\n return storageOperations.entries.getRevisions(model, {\n id: entryId\n });\n };\n\n const listEntries = async <T = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> => {\n try {\n await entriesPermissions.ensure({ rwd: \"r\" });\n } catch {\n throw new NotAuthorizedError({\n data: {\n reason: 'Not allowed to perform \"read\" on \"cms.contentEntry\".'\n }\n });\n }\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { where: initialWhere, limit: initialLimit } = params;\n const limit = initialLimit && initialLimit > 0 ? initialLimit : 50;\n\n const where = {\n ...initialWhere\n };\n /**\n * Possibly only get records which are owned by current user.\n * Or if searching for the owner set that value - in the case that user can see other entries than their own.\n */\n if (await entriesPermissions.canAccessOnlyOwnRecords()) {\n where.ownedBy = getIdentity().id;\n }\n\n /**\n * Where must contain either latest or published keys.\n * We cannot list entries without one of those\n */\n if (where.latest && where.published) {\n throw new WebinyError(\n \"Cannot list entries that are both published and latest.\",\n \"LIST_ENTRIES_ERROR\",\n {\n where\n }\n );\n } else if (!where.latest && !where.published) {\n throw new WebinyError(\n \"Cannot list entries if we do not have latest or published defined.\",\n \"LIST_ENTRIES_ERROR\",\n {\n where\n }\n );\n }\n\n const fields = getSearchableFields({\n fields: model.fields,\n plugins: context.plugins,\n input: params.fields || []\n });\n\n try {\n await onEntryBeforeList.publish({\n where,\n model\n });\n\n const { hasMoreItems, totalCount, cursor, items } =\n await storageOperations.entries.list(model, {\n ...params,\n sort: createSort(params.sort),\n limit,\n where,\n fields\n });\n\n const meta = {\n hasMoreItems,\n totalCount,\n /**\n * Cursor should be null if there are no more items to load.\n * Just make sure of that, disregarding what is returned from the storageOperations.entries.list method.\n */\n cursor: hasMoreItems ? cursor : null\n };\n\n return [items as CmsEntry<T>[], meta];\n } catch (ex) {\n throw new WebinyError(\n \"Error while fetching entries from storage.\",\n \"LIST_ENTRIES_ERROR\",\n {\n params,\n error: {\n message: ex.message,\n code: ex.code,\n data: ex.data\n },\n model,\n fields\n }\n );\n }\n };\n const createEntry: CmsEntryContext[\"createEntry\"] = async (model, inputData, options) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n /**\n * Make sure we only work with fields that are defined in the model.\n */\n const initialInput = mapAndCleanCreateInputData(model, inputData);\n\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: initialInput,\n skipValidators: options?.skipValidators\n });\n\n const input = await referenceFieldsMapping({\n context,\n model,\n input: initialInput,\n validateEntries: true\n });\n\n const locale = getLocale();\n\n const owner = getCreatedBy();\n\n const { id, entryId, version } = createEntryId(inputData);\n /**\n * There is a possibility that user sends an ID in the input, so we will use that one.\n * There is no check if the ID is unique or not, that is up to the user.\n */\n const entry: CmsEntry = {\n webinyVersion: context.WEBINY_VERSION,\n tenant: getTenant().id,\n entryId,\n id,\n modelId: model.modelId,\n locale: locale.code,\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n createdBy: owner,\n ownedBy: owner,\n modifiedBy: null,\n version,\n locked: false,\n status: STATUS_DRAFT,\n values: input,\n location: {\n folderId: inputData.wbyAco_location?.folderId || ROOT_FOLDER\n }\n };\n\n let storageEntry: CmsStorageEntry | null = null;\n try {\n await onEntryBeforeCreate.publish({\n entry,\n input,\n model\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n\n const result = await storageOperations.entries.create(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterCreate.publish({\n entry,\n storageEntry: result,\n model,\n input\n });\n\n return entry;\n } catch (ex) {\n await onEntryCreateError.publish({\n error: ex,\n entry,\n model,\n input\n });\n throw new WebinyError(\n ex.message || \"Could not create content entry.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n ex.data || {\n error: ex,\n input,\n entry,\n storageEntry\n }\n );\n }\n };\n const createEntryRevisionFrom: CmsEntryContext[\"createEntryRevisionFrom\"] = async (\n model,\n sourceId,\n inputData,\n options\n ) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n /**\n * Make sure we only work with fields that are defined in the model.\n */\n const input = mapAndCleanUpdatedInputData(model, inputData);\n\n /**\n * Entries are identified by a common parent ID + Revision number.\n */\n const { id: uniqueId } = parseIdentifier(sourceId);\n\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id: sourceId\n });\n const latestStorageEntry = await storageOperations.entries.getLatestRevisionByEntryId(\n model,\n {\n id: uniqueId\n }\n );\n\n if (!originalStorageEntry) {\n throw new NotFoundError(\n `Entry \"${sourceId}\" of model \"${model.modelId}\" was not found.`\n );\n }\n\n /**\n * We need to convert data from DB to its original form before using it further.\n */\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n const initialValues = {\n ...originalEntry.values,\n ...input\n };\n\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: initialValues,\n entry: originalEntry,\n skipValidators: options?.skipValidators\n });\n\n const values = await referenceFieldsMapping({\n context,\n model,\n input: initialValues,\n validateEntries: false\n });\n\n await entriesPermissions.ensure({ owns: originalEntry.createdBy });\n\n const identity = getIdentity();\n\n const latestId = latestStorageEntry ? latestStorageEntry.id : sourceId;\n const { id, version: nextVersion } = increaseEntryIdVersion(latestId);\n\n const entry: CmsEntry = {\n ...originalEntry,\n id,\n version: nextVersion,\n savedOn: new Date().toISOString(),\n createdOn: new Date().toISOString(),\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n modifiedBy: null,\n locked: false,\n publishedOn: undefined,\n status: STATUS_DRAFT,\n values\n };\n\n let storageEntry: CmsStorageEntry | null = null;\n\n try {\n await onEntryBeforeCreateRevision.publish({\n input,\n entry,\n original: originalEntry,\n model\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n\n const result = await storageOperations.entries.createRevisionFrom(model, {\n entry,\n storageEntry\n });\n\n await onEntryRevisionAfterCreate.publish({\n input,\n entry,\n model,\n original: originalEntry,\n storageEntry: result\n });\n return entry;\n } catch (ex) {\n await onEntryCreateRevisionError.publish({\n entry,\n original: originalEntry,\n model,\n input,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not create entry from existing one.\",\n ex.code || \"CREATE_FROM_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry,\n originalEntry,\n originalStorageEntry\n }\n );\n }\n };\n const updateEntry: CmsEntryContext[\"updateEntry\"] = async (\n model,\n id,\n inputData,\n metaInput,\n options\n ) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n /**\n * Make sure we only work with fields that are defined in the model.\n */\n const input = mapAndCleanUpdatedInputData(model, inputData);\n\n /**\n * The entry we are going to update.\n */\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" of model \"${model.modelId}\" was not found.`);\n }\n\n if (originalStorageEntry.locked) {\n throw new WebinyError(\n `Cannot update entry because it's locked.`,\n \"CONTENT_ENTRY_UPDATE_ERROR\"\n );\n }\n\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: input,\n entry: originalEntry,\n skipValidators: options?.skipValidators\n });\n\n await entriesPermissions.ensure({ owns: originalEntry.createdBy });\n\n const initialValues = {\n /**\n * Existing values from the database, transformed back to original, of course.\n */\n ...originalEntry.values,\n /**\n * Add new values.\n */\n ...input\n };\n\n const values = await referenceFieldsMapping({\n context,\n model,\n input: initialValues,\n validateEntries: false\n });\n /**\n * If users wants to remove a key from meta values, they need to send meta key with the null value.\n */\n const meta = createEntryMeta(metaInput, originalEntry.meta);\n /**\n * We always send the full entry to the hooks and storage operations update.\n */\n const entry: CmsEntry = {\n ...originalEntry,\n savedOn: new Date().toISOString(),\n modifiedBy: getCreatedBy(),\n values,\n meta,\n status: transformEntryStatus(originalEntry.status)\n };\n const folderId = inputData.wbyAco_location?.folderId;\n if (folderId) {\n entry.location = {\n folderId\n };\n }\n\n let storageEntry: CmsStorageEntry | null = null;\n\n try {\n await onEntryBeforeUpdate.publish({\n entry,\n model,\n input,\n original: originalEntry\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n\n const result = await storageOperations.entries.update(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterUpdate.publish({\n entry,\n storageEntry: result,\n model,\n input,\n original: originalEntry\n });\n return entry;\n } catch (ex) {\n await onEntryUpdateError.publish({\n entry,\n model,\n input,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not update existing entry.\",\n ex.code || \"UPDATE_ERROR\",\n {\n error: ex,\n entry,\n storageEntry,\n originalEntry,\n input\n }\n );\n }\n };\n\n const validateEntry: CmsEntryContext[\"validateEntry\"] = async (model, id, inputData) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const input = mapAndCleanUpdatedInputData(model, inputData || {});\n let originalEntry: CmsEntry | undefined;\n if (id) {\n /**\n * The entry we are going to update.\n */\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" of model \"${model.modelId}\" was not found.`);\n }\n originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n }\n const result = await validateModelEntryData({\n context,\n model,\n data: input,\n entry: originalEntry\n });\n return result.length > 0 ? result : [];\n };\n\n const moveEntry: CmsEntryContext[\"moveEntry\"] = async (model, id, folderId) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n /**\n * The entry we are going to move to another folder.\n */\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" of model \"${model.modelId}\" was not found.`);\n }\n\n const entry = await entryFromStorageTransform(context, model, originalStorageEntry);\n /**\n * No need to continue if the entry is already in the requested folder.\n */\n if (entry.location?.folderId === folderId) {\n return entry;\n }\n\n try {\n await onEntryBeforeMove.publish({\n entry,\n model,\n folderId\n });\n await storageOperations.entries.move(model, id, folderId);\n await onEntryAfterMove.publish({\n entry,\n model,\n folderId\n });\n return entry;\n } catch (ex) {\n await onEntryMoveError.publish({\n entry,\n model,\n folderId,\n error: ex\n });\n throw WebinyError.from(ex, {\n message: `Could not move entry \"${id}\" of model \"${model.modelId}\".`,\n code: \"MOVE_ENTRY_ERROR\"\n });\n }\n };\n\n const republishEntry: CmsEntryContext[\"republishEntry\"] = async (model, id) => {\n await entriesPermissions.ensure({ rwd: \"w\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n /**\n * Fetch the entry from the storage.\n */\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" was not found!`);\n }\n\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n const values = await referenceFieldsMapping({\n context,\n model,\n input: originalEntry.values,\n validateEntries: false\n });\n\n const entry: CmsEntry = {\n ...originalEntry,\n status: STATUS_PUBLISHED,\n publishedOn: originalEntry.publishedOn || new Date().toISOString(),\n savedOn: new Date().toISOString(),\n webinyVersion: context.WEBINY_VERSION,\n values\n };\n\n const storageEntry = await entryToStorageTransform(context, model, entry);\n /**\n * First we need to update existing entry.\n */\n try {\n await storageOperations.entries.update(model, {\n entry,\n storageEntry\n });\n } catch (ex) {\n throw new WebinyError(\n \"Could not update existing entry with new data while re-publishing.\",\n \"REPUBLISH_UPDATE_ERROR\",\n {\n entry\n }\n );\n }\n /**\n * Then we move onto publishing it again.\n */\n try {\n await onEntryBeforeRepublish.publish({\n entry,\n model\n });\n\n const result = await storageOperations.entries.publish(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterRepublish.publish({\n entry,\n model,\n storageEntry: result\n });\n return entry;\n } catch (ex) {\n await onEntryRepublishError.publish({\n entry,\n model,\n error: ex\n });\n throw new WebinyError(\n \"Could not publish existing entry while re-publishing.\",\n \"REPUBLISH_PUBLISH_ERROR\",\n {\n entry\n }\n );\n }\n };\n const deleteEntryRevision: CmsEntryContext[\"deleteEntryRevision\"] = async (\n model,\n revisionId\n ) => {\n await entriesPermissions.ensure({ rwd: \"d\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { id: entryId, version } = parseIdentifier(revisionId);\n\n const storageEntryToDelete = await storageOperations.entries.getRevisionById(model, {\n id: revisionId\n });\n const latestStorageEntry = await storageOperations.entries.getLatestRevisionByEntryId(\n model,\n {\n id: entryId\n }\n );\n const previousStorageEntry = await storageOperations.entries.getPreviousRevision(model, {\n entryId,\n version: version as number\n });\n\n if (!storageEntryToDelete) {\n throw new NotFoundError(`Entry \"${revisionId}\" was not found!`);\n }\n\n await entriesPermissions.ensure({ owns: storageEntryToDelete.createdBy });\n\n const latestEntryRevisionId = latestStorageEntry ? latestStorageEntry.id : null;\n\n const entryToDelete = await entryFromStorageTransform(context, model, storageEntryToDelete);\n /**\n * If targeted record is the latest entry record and there is no previous one, we need to run full delete with hooks.\n * At this point deleteRevision hooks are not fired.\n */\n if (entryToDelete.id === latestEntryRevisionId && !previousStorageEntry) {\n return await deleteEntryHelper({\n model,\n entry: entryToDelete\n });\n }\n /**\n * If targeted record is latest entry revision, set the previous one as the new latest\n */\n let entryToSetAsLatest: CmsEntry | null = null;\n let storageEntryToSetAsLatest: CmsStorageEntry | null = null;\n if (entryToDelete.id === latestEntryRevisionId && previousStorageEntry) {\n entryToSetAsLatest = await entryFromStorageTransform(\n context,\n model,\n previousStorageEntry\n );\n storageEntryToSetAsLatest = previousStorageEntry;\n }\n\n try {\n await onEntryRevisionBeforeDelete.publish({\n entry: entryToDelete,\n model\n });\n\n await storageOperations.entries.deleteRevision(model, {\n entry: entryToDelete,\n storageEntry: storageEntryToDelete,\n latestEntry: entryToSetAsLatest,\n latestStorageEntry: storageEntryToSetAsLatest\n });\n\n await onEntryRevisionAfterDelete.publish({\n entry: entryToDelete,\n model\n });\n } catch (ex) {\n await onEntryRevisionDeleteError.publish({\n entry: entryToDelete,\n model,\n error: ex\n });\n throw new WebinyError(ex.message, ex.code || \"DELETE_REVISION_ERROR\", {\n error: ex,\n entry: entryToDelete,\n storageEntry: storageEntryToDelete,\n latestEntry: entryToSetAsLatest,\n latestStorageEntry: storageEntryToSetAsLatest\n });\n }\n };\n const deleteMultipleEntries: CmsEntryContext[\"deleteMultipleEntries\"] = async (\n model,\n params\n ) => {\n const { entries: input } = params;\n const maxDeletableEntries = 50;\n\n const entryIdList = new Set<string>();\n for (const id of input) {\n const { id: entryId } = parseIdentifier(id);\n entryIdList.add(entryId);\n }\n const ids = Array.from(entryIdList);\n\n if (ids.length > maxDeletableEntries) {\n throw new WebinyError(\n \"Cannot delete more than 50 entries at once.\",\n \"DELETE_ENTRIES_MAX\",\n {\n entries: ids\n }\n );\n }\n\n await entriesPermissions.ensure({ rwd: \"d\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { items: entries } = await storageOperations.entries.list(model, {\n where: {\n latest: true,\n entryId_in: ids\n },\n limit: maxDeletableEntries + 1\n });\n /**\n * We do not want to allow deleting entries that user does not own or cannot access.\n */\n const items = (\n await filterAsync(entries, async entry => {\n return entriesPermissions.ensure({ owns: entry.createdBy }, { throw: false });\n })\n ).map(entry => entry.id);\n\n try {\n await onEntryBeforeDeleteMultiple.publish({\n entries,\n ids,\n model\n });\n await storageOperations.entries.deleteMultipleEntries(model, {\n entries: items\n });\n await onEntryAfterDeleteMultiple.publish({\n entries,\n ids,\n model\n });\n return items.map(id => {\n return {\n id\n };\n });\n } catch (ex) {\n await onEntryDeleteMultipleError.publish({\n entries,\n ids,\n model,\n error: ex\n });\n throw new WebinyError(ex.message, ex.code || \"DELETE_ENTRIES_MULTIPLE_ERROR\", {\n error: ex,\n entries\n });\n }\n };\n\n const deleteEntry: CmsEntryContext[\"deleteEntry\"] = async (model, id, options) => {\n await entriesPermissions.ensure({ rwd: \"d\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { force } = options || {};\n\n const storageEntry = (await storageOperations.entries.getLatestRevisionByEntryId(model, {\n id\n })) as CmsEntry;\n /**\n * If there is no entry, and we do not force the deletion, just throw an error.\n */\n if (!storageEntry && !force) {\n throw new NotFoundError(`Entry \"${id}\" was not found!`);\n }\n /**\n * In the case we are forcing the deletion, we do not need the storageEntry to exist as it might be an error when loading single database record.\n *\n * This happens, sometimes, in the Elasticsearch system as the entry might get deleted from the DynamoDB but not from the Elasticsearch.\n * This is due to high load on the Elasticsearch at the time of the deletion.\n */\n //\n else if (!storageEntry && force) {\n const { id: entryId } = parseIdentifier(id);\n return await deleteEntryHelper({\n model,\n entry: {\n id,\n entryId\n } as CmsEntry\n });\n }\n\n await entriesPermissions.ensure({ owns: storageEntry.createdBy });\n\n const entry = await entryFromStorageTransform(context, model, storageEntry);\n\n return await deleteEntryHelper({\n model,\n entry\n });\n };\n const publishEntry: CmsEntryContext[\"publishEntry\"] = async (model, id) => {\n await entriesPermissions.ensure({ pw: \"p\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const originalStorageEntry = await storageOperations.entries.getRevisionById(model, {\n id\n });\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" in the model \"${model.modelId}\" was not found.`);\n }\n\n await entriesPermissions.ensure({ owns: originalStorageEntry.createdBy });\n\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n await validateModelEntryDataOrThrow({\n context,\n model,\n data: originalEntry.values,\n entry: originalEntry\n });\n\n const currentDate = new Date().toISOString();\n const entry: CmsEntry = {\n ...originalEntry,\n status: STATUS_PUBLISHED,\n locked: true,\n savedOn: currentDate,\n publishedOn: currentDate\n };\n\n let storageEntry: CmsStorageEntry | null = null;\n\n try {\n await onEntryBeforePublish.publish({\n entry,\n model\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n const result = await storageOperations.entries.publish(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterPublish.publish({\n entry,\n storageEntry: result,\n model\n });\n return entry;\n } catch (ex) {\n await onEntryPublishError.publish({\n entry,\n model,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not publish entry.\",\n ex.code || \"PUBLISH_ERROR\",\n {\n error: ex,\n entry,\n storageEntry,\n originalEntry,\n originalStorageEntry\n }\n );\n }\n };\n const unpublishEntry: CmsEntryContext[\"unpublishEntry\"] = async (model, id) => {\n await entriesPermissions.ensure({ pw: \"u\" });\n\n const { id: entryId } = parseIdentifier(id);\n\n const originalStorageEntry = await storageOperations.entries.getPublishedRevisionByEntryId(\n model,\n {\n id: entryId\n }\n );\n\n if (!originalStorageEntry) {\n throw new NotFoundError(`Entry \"${id}\" of model \"${model.modelId}\" was not found.`);\n }\n\n if (originalStorageEntry.id !== id) {\n throw new WebinyError(`Entry is not published.`, \"UNPUBLISH_ERROR\", {\n entry: originalStorageEntry\n });\n }\n\n await entriesPermissions.ensure({ owns: originalStorageEntry.createdBy });\n\n const originalEntry = await entryFromStorageTransform(context, model, originalStorageEntry);\n\n const entry: CmsEntry = {\n ...originalEntry,\n status: STATUS_UNPUBLISHED\n };\n\n let storageEntry: CmsStorageEntry | null = null;\n\n try {\n await onEntryBeforeUnpublish.publish({\n entry,\n model\n });\n\n storageEntry = await entryToStorageTransform(context, model, entry);\n\n const result = await storageOperations.entries.unpublish(model, {\n entry,\n storageEntry\n });\n\n await onEntryAfterUnpublish.publish({\n entry,\n storageEntry: result,\n model\n });\n\n return entry;\n } catch (ex) {\n await onEntryUnpublishError.publish({\n entry,\n model,\n error: ex\n });\n throw new WebinyError(\n ex.message || \"Could not unpublish entry.\",\n ex.code || \"UNPUBLISH_ERROR\",\n {\n originalEntry,\n originalStorageEntry,\n entry,\n storageEntry\n }\n );\n }\n };\n\n const getUniqueFieldValues: CmsEntryContext[\"getUniqueFieldValues\"] = async (model, params) => {\n await entriesPermissions.ensure({ rwd: \"r\" });\n await modelsPermissions.ensureCanAccessModel({\n model\n });\n\n const { where: initialWhere, fieldId } = params;\n\n const where = {\n ...initialWhere\n };\n /**\n * Possibly only get records which are owned by current user.\n * Or if searching for the owner set that value - in the case that user can see other entries than their own.\n */\n if (await entriesPermissions.canAccessOnlyOwnRecords()) {\n where.ownedBy = getIdentity().id;\n }\n\n /**\n * Where must contain either latest or published keys.\n * We cannot list entries without one of those\n */\n if (where.latest && where.published) {\n throw new WebinyError(\n \"Cannot list entries that are both published and latest.\",\n \"LIST_ENTRIES_ERROR\",\n {\n where\n }\n );\n } else if (!where.latest && !where.published) {\n throw new WebinyError(\n \"Cannot list entries if we do not have latest or published defined.\",\n \"LIST_ENTRIES_ERROR\",\n {\n where\n }\n );\n }\n /**\n * We need to verify that the field in question is searchable.\n */\n const fields = getSearchableFields({\n fields: model.fields,\n plugins: context.plugins,\n input: []\n });\n\n if (!fields.includes(fieldId)) {\n throw new WebinyError(\n \"Cannot list unique entry field values if the field is not searchable.\",\n \"LIST_UNIQUE_ENTRY_VALUES_ERROR\",\n {\n fieldId\n }\n );\n }\n\n try {\n return await storageOperations.entries.getUniqueFieldValues(model, {\n where,\n fieldId\n });\n } catch (ex) {\n throw new WebinyError(\n \"Error while fetching unique entry values from storage.\",\n \"LIST_UNIQUE_ENTRY_VALUES_ERROR\",\n {\n error: {\n message: ex.message,\n code: ex.code,\n data: ex.data\n },\n model,\n where,\n fieldId\n }\n );\n }\n };\n\n return {\n onEntryBeforeCreate,\n onEntryAfterCreate,\n onEntryCreateError,\n\n onEntryRevisionBeforeCreate: onEntryBeforeCreateRevision,\n onEntryRevisionAfterCreate,\n onEntryRevisionCreateError: onEntryCreateRevisionError,\n\n onEntryBeforeUpdate,\n onEntryAfterUpdate,\n onEntryUpdateError,\n\n onEntryBeforeMove,\n onEntryAfterMove,\n onEntryMoveError,\n\n onEntryBeforeDelete,\n onEntryAfterDelete,\n onEntryDeleteError,\n\n onEntryRevisionBeforeDelete,\n onEntryRevisionAfterDelete,\n onEntryRevisionDeleteError,\n\n onEntryBeforePublish,\n onEntryAfterPublish,\n onEntryPublishError,\n\n onEntryBeforeRepublish,\n onEntryAfterRepublish,\n onEntryRepublishError,\n\n onEntryBeforeUnpublish,\n onEntryAfterUnpublish,\n onEntryUnpublishError,\n\n onEntryBeforeGet,\n onEntryBeforeList,\n /**\n * Get entries by exact revision IDs from the database.\n */\n getEntriesByIds,\n /**\n * Get a single entry by revision ID from the database.\n */\n async getEntryById(model, id) {\n return context.benchmark.measure(\"headlessCms.crud.entries.getEntryById\", async () => {\n return getEntryById(model, id);\n });\n },\n /**\n * Get published revisions by entry IDs.\n */\n async getPublishedEntriesByIds(model: CmsModel, ids: string[]) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.getPublishedEntriesByIds\",\n async () => {\n return getPublishedEntriesByIds(model, ids);\n }\n );\n },\n /**\n * Get the latest revisions by entry IDs.\n */\n async getLatestEntriesByIds(model: CmsModel, ids: string[]) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.getLatestEntriesByIds\",\n async () => {\n return getLatestEntriesByIds(model, ids);\n }\n );\n },\n async getEntryRevisions(model, entryId) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.getEntryRevisions\",\n async () => {\n return getEntryRevisions(model, entryId);\n }\n );\n },\n /**\n * TODO determine if this method is required at all.\n *\n * @internal\n */\n async getEntry(model, params) {\n return context.benchmark.measure(\"headlessCms.crud.entries.getEntry\", async () => {\n return getEntry(model, params);\n });\n },\n /**\n * @description Should not be used directly. Internal use only!\n *\n * @internal\n */\n async listEntries<T = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> {\n return context.benchmark.measure(\"headlessCms.crud.entries.listEntries\", async () => {\n return listEntries(model, params);\n });\n },\n async listLatestEntries<T = CmsEntryValues>(\n this: HeadlessCms,\n model: CmsModel,\n params?: CmsEntryListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> {\n const where = params?.where || ({} as CmsEntryListWhere);\n\n return this.listEntries(model, {\n sort: [\"createdOn_DESC\"],\n ...(params || {}),\n where: {\n ...where,\n latest: true\n }\n });\n },\n async listPublishedEntries<T = CmsEntryValues>(\n model: CmsModel,\n params?: CmsEntryListParams\n ): Promise<[CmsEntry<T>[], CmsEntryMeta]> {\n const where = params?.where || ({} as CmsEntryListWhere);\n\n return this.listEntries(model, {\n sort: [\"createdOn_DESC\"],\n ...(params || {}),\n where: {\n ...where,\n published: true\n }\n });\n },\n async createEntry(model, input, options) {\n return context.benchmark.measure(\"headlessCms.crud.entries.createEntry\", async () => {\n return createEntry(model, input, options);\n });\n },\n async createEntryRevisionFrom(model, sourceId, input, options) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.createEntryRevisionFrom\",\n async () => {\n return createEntryRevisionFrom(model, sourceId, input, options);\n }\n );\n },\n async updateEntry(model, id, input, meta, options) {\n return context.benchmark.measure(\"headlessCms.crud.entries.updateEntry\", async () => {\n return updateEntry(model, id, input, meta, options);\n });\n },\n async validateEntry(model, id, input) {\n return context.benchmark.measure(\"headlessCms.crud.entries.validateEntry\", async () => {\n return validateEntry(model, id, input);\n });\n },\n async moveEntry(model, id, folderId) {\n return context.benchmark.measure(\"headlessCms.crud.entries.moveEntry\", async () => {\n return moveEntry(model, id, folderId);\n });\n },\n /**\n * Method used internally. Not documented and should not be used in users systems.\n * @internal\n */\n async republishEntry(model, id) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.republishEntry\",\n async () => {\n return republishEntry(model, id);\n }\n );\n },\n async deleteEntryRevision(model, id) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.deleteEntryRevision\",\n async () => {\n return deleteEntryRevision(model, id);\n }\n );\n },\n async deleteEntry(model, entryId, options) {\n return context.benchmark.measure(\"headlessCms.crud.entries.deleteEntry\", async () => {\n return deleteEntry(model, entryId, options);\n });\n },\n async deleteMultipleEntries(model, ids) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.deleteMultipleEntries\",\n async () => {\n return deleteMultipleEntries(model, ids);\n }\n );\n },\n async publishEntry(model, id) {\n return context.benchmark.measure(\"headlessCms.crud.entries.publishEntry\", async () => {\n return publishEntry(model, id);\n });\n },\n async unpublishEntry(model, id) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.unpublishEntry\",\n async () => {\n return unpublishEntry(model, id);\n }\n );\n },\n async getUniqueFieldValues(model, params) {\n return context.benchmark.measure(\n \"headlessCms.crud.entries.getUniqueFieldValues\",\n async () => {\n return getUniqueFieldValues(model, params);\n }\n );\n }\n };\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAmDA,IAAAK,oBAAA,GAAAL,OAAA;AAKA,IAA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ACD,MAAMkM,oBAAoBA,CAACnN,KAAK,EAAEgC,MAAM,EAAE;MACtC,OAAOI,OAAO,CAACsD,SAAS,CAACC,OAAO,CAC5B,+CAA+C,EAC/C,YAAY;QACR,OAAOwH,oBAAoB,CAACnN,KAAK,EAAEgC,MAAM,CAAC;MAC9C,CACJ,CAAC;IACL;EACJ,CAAC;AACL,CAAC;AAAC3D,OAAA,CAAA0D,sBAAA,GAAAA,sBAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["_responses","require","resolveUpdate","model","_","args","context","entry","cms","updateEntry","revision","data","options","Response","e","ErrorResponse","exports"],"sources":["resolveUpdate.ts"],"sourcesContent":["import { ErrorResponse, Response } from \"@webiny/handler-graphql/responses\";\nimport {\n CmsEntryResolverFactory as ResolverFactory,\n UpdateCmsEntryInput,\n UpdateCmsEntryOptionsInput\n} from \"~/types\";\n\ninterface ResolveUpdateArgs {\n revision: string;\n data: UpdateCmsEntryInput;\n options?: UpdateCmsEntryOptionsInput;\n}\ntype ResolveUpdate = ResolverFactory<any, ResolveUpdateArgs>;\n\nexport const resolveUpdate: ResolveUpdate =\n ({ model }) =>\n async (_, args: any, context) => {\n try {\n const entry = await context.cms.updateEntry(\n model,\n args.revision,\n args.data,\n {},\n args.options\n );\n\n return new Response(entry);\n } catch (e) {\n return new ErrorResponse(e);\n }\n };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAcO,MAAMC,aAA4B,GACrCA,CAAC;EAAEC;AAAM,CAAC,KACV,OAAOC,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;EAC7B,IAAI;IACA,MAAMC,KAAK,GAAG,MAAMD,OAAO,CAACE,GAAG,CAACC,WAAW,CACvCN,KAAK,EACLE,IAAI,CAACK,QAAQ,EACbL,IAAI,CAACM,IAAI,EACT,CAAC,CAAC,EACFN,IAAI,CAACO,OACT,CAAC;IAED,OAAO,IAAIC,mBAAQ,CAACN,KAAK,CAAC;EAC9B,CAAC,CAAC,OAAOO,CAAC,EAAE;IACR,OAAO,IAAIC,wBAAa,CAACD,CAAC,CAAC;EAC/B;AACJ,CAAC;AAACE,OAAA,CAAAd,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_responses","require","resolveUpdate","model","_","args","context","entry","cms","updateEntry","revision","data","options","Response","e","ErrorResponse","exports"],"sources":["resolveUpdate.ts"],"sourcesContent":["import { ErrorResponse, Response } from \"@webiny/handler-graphql/responses\";\nimport {\n CmsEntryResolverFactory as ResolverFactory,\n UpdateCmsEntryInput,\n UpdateCmsEntryOptionsInput\n} from \"~/types\";\n\ninterface ResolveUpdateArgs {\n revision: string;\n data: UpdateCmsEntryInput;\n options?: UpdateCmsEntryOptionsInput;\n}\ntype ResolveUpdate = ResolverFactory<any, ResolveUpdateArgs>;\n\nexport const resolveUpdate: ResolveUpdate =\n ({ model }) =>\n async (_, args, context) => {\n try {\n const entry = await context.cms.updateEntry(\n model,\n args.revision,\n args.data,\n {},\n args.options\n );\n\n return new Response(entry);\n } catch (e) {\n return new ErrorResponse(e);\n }\n };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAcO,MAAMC,aAA4B,GACrCA,CAAC;EAAEC;AAAM,CAAC,KACV,OAAOC,CAAC,EAAEC,IAAI,EAAEC,OAAO,KAAK;EACxB,IAAI;IACA,MAAMC,KAAK,GAAG,MAAMD,OAAO,CAACE,GAAG,CAACC,WAAW,CACvCN,KAAK,EACLE,IAAI,CAACK,QAAQ,EACbL,IAAI,CAACM,IAAI,EACT,CAAC,CAAC,EACFN,IAAI,CAACO,OACT,CAAC;IAED,OAAO,IAAIC,mBAAQ,CAACN,KAAK,CAAC;EAC9B,CAAC,CAAC,OAAOO,CAAC,EAAE;IACR,OAAO,IAAIC,wBAAa,CAACD,CAAC,CAAC;EAC/B;AACJ,CAAC;AAACE,OAAA,CAAAd,aAAA,GAAAA,aAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms",
3
- "version": "5.38.0-beta.0",
3
+ "version": "5.38.0-beta.2",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "cms:base"
@@ -20,19 +20,19 @@
20
20
  "dependencies": {
21
21
  "@babel/runtime": "7.22.6",
22
22
  "@graphql-tools/schema": "7.1.5",
23
- "@webiny/api": "5.38.0-beta.0",
24
- "@webiny/api-i18n": "5.38.0-beta.0",
25
- "@webiny/api-security": "5.38.0-beta.0",
26
- "@webiny/api-tenancy": "5.38.0-beta.0",
27
- "@webiny/error": "5.38.0-beta.0",
28
- "@webiny/handler": "5.38.0-beta.0",
29
- "@webiny/handler-aws": "5.38.0-beta.0",
30
- "@webiny/handler-db": "5.38.0-beta.0",
31
- "@webiny/handler-graphql": "5.38.0-beta.0",
32
- "@webiny/plugins": "5.38.0-beta.0",
33
- "@webiny/pubsub": "5.38.0-beta.0",
34
- "@webiny/utils": "5.38.0-beta.0",
35
- "@webiny/validation": "5.38.0-beta.0",
23
+ "@webiny/api": "5.38.0-beta.2",
24
+ "@webiny/api-i18n": "5.38.0-beta.2",
25
+ "@webiny/api-security": "5.38.0-beta.2",
26
+ "@webiny/api-tenancy": "5.38.0-beta.2",
27
+ "@webiny/error": "5.38.0-beta.2",
28
+ "@webiny/handler": "5.38.0-beta.2",
29
+ "@webiny/handler-aws": "5.38.0-beta.2",
30
+ "@webiny/handler-db": "5.38.0-beta.2",
31
+ "@webiny/handler-graphql": "5.38.0-beta.2",
32
+ "@webiny/plugins": "5.38.0-beta.2",
33
+ "@webiny/pubsub": "5.38.0-beta.2",
34
+ "@webiny/utils": "5.38.0-beta.2",
35
+ "@webiny/validation": "5.38.0-beta.2",
36
36
  "code-frame": "5.0.0",
37
37
  "dot-prop": "6.0.1",
38
38
  "graphql-tag": "2.12.6",
@@ -48,9 +48,9 @@
48
48
  "@babel/cli": "7.22.6",
49
49
  "@babel/core": "7.22.8",
50
50
  "@babel/preset-env": "7.22.7",
51
- "@webiny/api-wcp": "5.38.0-beta.0",
52
- "@webiny/cli": "5.38.0-beta.0",
53
- "@webiny/project-utils": "5.38.0-beta.0",
51
+ "@webiny/api-wcp": "5.38.0-beta.2",
52
+ "@webiny/cli": "5.38.0-beta.2",
53
+ "@webiny/project-utils": "5.38.0-beta.2",
54
54
  "apollo-graphql": "0.9.7",
55
55
  "get-yarn-workspaces": "1.0.2",
56
56
  "graphql": "15.8.0",
@@ -70,5 +70,5 @@
70
70
  "build": "yarn webiny run build",
71
71
  "watch": "yarn webiny run watch"
72
72
  },
73
- "gitHead": "5746389d4988626b50e2523ccfa0a9a5e398e0ed"
73
+ "gitHead": "63fa1cb573e06614cf4683d4648b9a9443d57158"
74
74
  }
package/types.d.ts CHANGED
@@ -1742,6 +1742,17 @@ export interface CmsEntryListWhere {
1742
1742
  * @internal
1743
1743
  */
1744
1744
  latest?: boolean;
1745
+ /**
1746
+ * ACO related parameters.
1747
+ */
1748
+ wbyAco_location?: {
1749
+ folderId?: string;
1750
+ folderId_not?: string;
1751
+ folderId_in?: string[];
1752
+ folderId_not_in?: string[];
1753
+ AND?: CmsEntryListWhere[];
1754
+ OR?: CmsEntryListWhere[];
1755
+ };
1745
1756
  /**
1746
1757
  * This is to allow querying by any content model field defined by the user.
1747
1758
  */
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["CONTENT_ENTRY_STATUS","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Context } from \"@webiny/api/types\";\nimport {\n GraphQLFieldResolver,\n GraphQLSchemaDefinition,\n Resolvers\n} from \"@webiny/handler-graphql/types\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\nimport { DbContext } from \"@webiny/handler-db/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection\";\nimport { ModelGroupsPermissions } from \"~/utils/permissions/ModelGroupsPermissions\";\nimport { ModelsPermissions } from \"~/utils/permissions/ModelsPermissions\";\nimport { EntriesPermissions } from \"~/utils/permissions/EntriesPermissions\";\nimport { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types\";\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\n\ninterface HeadlessCmsPermissions {\n groups: ModelGroupsPermissions;\n models: ModelsPermissions;\n entries: EntriesPermissions;\n}\n\nexport interface HeadlessCms\n extends CmsSystemContext,\n CmsGroupContext,\n CmsModelContext,\n CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\n /**\n * Requested locale\n */\n locale: string;\n /**\n * returns an instance of current locale\n */\n getLocale: () => I18NLocale;\n /**\n * Means this request is a READ API\n */\n READ: boolean;\n /**\n * Means this request is a MANAGE API\n */\n MANAGE: boolean;\n /**\n * Means this request is a PREVIEW API\n */\n PREVIEW: boolean;\n /**\n * The storage operations loaded for current context.\n */\n storageOperations: HeadlessCmsStorageOperations;\n /**\n * Permissions for groups, models and entries.\n *\n * @internal\n */\n permissions: HeadlessCmsPermissions;\n /**\n * Export operations.\n */\n export: HeadlessCmsExport;\n importing: HeadlessCmsImport;\n}\n\n/**\n * @description This combines all contexts used in the CMS into a single one.\n *\n * @category Context\n */\nexport interface CmsContext extends Context, DbContext, I18NContext {\n cms: HeadlessCms;\n}\n\ninterface CmsModelFieldPredefinedValuesValue {\n value: string;\n label: string;\n /**\n * Default selected predefined value.\n */\n selected?: boolean;\n}\n\n/**\n * Object containing content model field predefined options and values.\n *\n * @category CmsModelField\n */\nexport interface CmsModelFieldPredefinedValues {\n /**\n * Are predefined field values enabled?\n */\n enabled: boolean;\n /**\n * Predefined values array.\n */\n values: CmsModelFieldPredefinedValuesValue[];\n}\n\n/**\n * Object containing content model field renderer options.\n *\n * @category CmsModelField\n */\ninterface CmsModelFieldRenderer {\n /**\n * Name of the field renderer. Must have one in field renderer plugins.\n * Can be blank to let automatically determine the renderer.\n */\n name: string;\n}\n\n/**\n * A definition for content model field settings.\n *\n * @category ModelField\n * @category Database model\n */\nexport interface CmsModelFieldSettings {\n /**\n * Predefined values (text, number)\n * The default value for the field in case it is not predefined values field.\n */\n defaultValue?: string | number | null | undefined;\n /**\n * Object field has child fields.\n */\n fields?: CmsModelField[];\n /**\n * Is the file field images only one?\n */\n imagesOnly?: boolean;\n /**\n * Object field has child fields - so it needs to have a layout.\n */\n layout?: string[][];\n /**\n * Ref field.\n */\n models?: Pick<CmsModel, \"modelId\">[];\n /**\n * Date field.\n */\n type?: string;\n /**\n * Disable full text search explicitly on this field.\n */\n disableFullTextSearch?: boolean;\n /**\n * There are a lot of other settings that are possible to add, so we keep the type opened.\n */\n [key: string]: any;\n}\n\nexport type CmsModelFieldType =\n | \"boolean\"\n | \"datetime\"\n | \"file\"\n | \"long-text\"\n | \"number\"\n | \"object\"\n | \"ref\"\n | \"rich-text\"\n | \"text\"\n | \"dynamicZone\"\n | string;\n/**\n * A definition for content model field. This type exists on the app side as well.\n *\n * @category ModelField\n * @category Database model\n */\nexport interface CmsModelField {\n /**\n * A generated unique ID for the model field.\n * MUST be absolute unique throughout the models.\n * Must be in form of a-zA-Z0-9.\n *\n * We generate a unique id value when you're building a model via UI,\n * but when user is creating a model via a plugin it is up to them to be careful about this.\n */\n id: string;\n /**\n * A type of the field.\n * We are defining our built-in fields, so people know which are available by the default.\n */\n type: CmsModelFieldType;\n /**\n * A unique storage ID for storing actual values.\n * Must in form of a-zA-Z0-9@a-zA-Z0-9\n *\n * This is an auto-generated value: uses `id` and `type`\n *\n * This is used as path for the entry value.\n */\n storageId: `${string}@${string}` | string;\n /**\n * Field identifier for the model field that will be available to the outside world.\n * `storageId` is used as path (or column) to store the data.\n *\n * Must in form of a-zA-Z0-9.\n *\n * This value MUST be unique in the CmsModel.\n */\n fieldId: string;\n /**\n * A label for the field\n */\n label: string;\n /**\n * Text below the field to clarify what is it meant to be in the field value\n */\n helpText?: string | null;\n /**\n * Text to be displayed in the field\n */\n placeholderText?: string | null;\n /**\n * Are predefined values enabled? And list of them\n */\n predefinedValues?: CmsModelFieldPredefinedValues;\n /**\n * Field renderer. Blank if determined automatically.\n */\n renderer?: CmsModelFieldRenderer;\n /**\n * List of validations for the field\n *\n * @default []\n */\n validation?: CmsModelFieldValidation[];\n /**\n * List of validations for the list of values, when a field is set to accept a list of values.\n * These validations will be applied to the entire list, and `validation` (see above) will be applied\n * to each individual value in the list.\n *\n * @default []\n */\n listValidation?: CmsModelFieldValidation[];\n /**\n * Is this a multiple values field?\n *\n */\n multipleValues?: boolean;\n /**\n * Fields can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Any user defined settings.\n *\n * @default {}\n */\n settings?: CmsModelFieldSettings;\n}\n\nexport interface CmsDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n description: string;\n icon: string;\n fields: CmsModelField[];\n layout: string[][];\n validation: CmsModelFieldValidation[];\n}\n\n/**\n * A definition for dynamic-zone field to show possible type of the field in settings.\n */\nexport interface CmsModelDynamicZoneField extends CmsModelField {\n /**\n * Settings object for the field. Contains `templates` property.\n */\n settings: {\n templates: CmsDynamicZoneTemplate[];\n };\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\nexport interface CmsModelDynamicZoneFieldWithParent extends CmsModelDynamicZoneField {\n parent?: CmsModelDynamicZoneFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T = any> {\n /**\n * A value to be validated.\n */\n value: T;\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry;\n}\n\n/**\n * Definition for the field validator.\n *\n * @category Plugin\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorPluginValidateCb {\n (params: CmsModelFieldValidatorValidateParams): Promise<boolean>;\n}\nexport interface CmsModelFieldValidatorPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-model-field-validator\";\n /**\n * Actual validator definition.\n */\n validator: {\n /**\n * Name of the validator.\n */\n name: string;\n /**\n * Validation method.\n */\n validate: CmsModelFieldValidatorPluginValidateCb;\n };\n}\n\n/**\n * A pattern validator for the content entry field value.\n *\n * @category Plugin\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldPatternValidatorPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-validator-pattern\";\n /**\n * A pattern object for the validator.\n */\n pattern: {\n /**\n * name of the pattern.\n */\n name: string;\n /**\n * RegExp of the validator.\n */\n regex: string;\n /**\n * RegExp flags\n */\n flags: string;\n };\n}\n\n/**\n * Locked field in the content model\n *\n * @see CmsModel.lockedFields\n *\n * @category ModelField\n */\nexport interface LockedField {\n /**\n * Locked field storage ID - one used to store values.\n * We cannot change this due to old systems.\n */\n fieldId: string;\n /**\n * Is the field multiple values field?\n */\n multipleValues: boolean;\n /**\n * Field type.\n */\n type: string;\n [key: string]: any;\n}\n\n/**\n * @category Database model\n * @category CmsModel\n */\nexport interface CmsModelGroup {\n /**\n * Generated ID of the group\n */\n id: string;\n /**\n * Name of the group\n */\n name: string;\n}\n\n/**\n * Base CMS Model. Should not be exported and used outside of this package.\n *\n * @category Database model\n * @category CmsModel\n */\nexport interface CmsModel {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Unique ID for the content model. Created from name if not defined by user.\n */\n modelId: string;\n /**\n * Name of the content model in singular form to be used in the API.\n * example:\n * - Article\n * - Fruit\n * - Vegetable\n * - Car\n */\n singularApiName: string;\n /**\n * Name of the content model in plural form to be used in the API.\n * example:\n * - Articles\n * - Fruits\n * - Vegetables\n * - Cars\n */\n pluralApiName: string;\n /**\n * Model tenant.\n */\n tenant: string;\n /**\n * Locale this model belongs to.\n */\n locale: string;\n /**\n * Cms Group reference object.\n */\n group: CmsModelGroup;\n /**\n * Icon for the content model.\n */\n icon?: string | null;\n /**\n * Description for the content model.\n */\n description: string | null;\n /**\n * Date created\n */\n createdOn?: string;\n /**\n * Date saved. Changes on both save and create.\n */\n savedOn?: string;\n /**\n * CreatedBy object wrapper. Contains id, name and type of the user.\n */\n createdBy?: CmsIdentity;\n /**\n * List of fields defining entry values.\n */\n fields: CmsModelField[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: string[][];\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * List of locked fields. Updated when entry is saved and a field has been used.\n */\n lockedFields?: LockedField[];\n /**\n * The field that is being displayed as entry title.\n * It is picked as first available text field. Or user can select own field.\n */\n titleFieldId: string;\n /**\n * The field which is displayed as the description one.\n * Only way this is null or undefined is that there are no long-text fields to be set as description.\n */\n descriptionFieldId?: string | null;\n /**\n * The field which is displayed as the image.\n * Only way this is null or undefined is that there are no file fields, with images only set, to be set as image.\n */\n imageFieldId?: string | null;\n /**\n * The version of Webiny which this record was stored with.\n */\n webinyVersion: string;\n\n /**\n * Is model private?\n * This is meant to be used for some internal models - will not be visible in the schema.\n * Only available for the plugin constructed models.\n */\n isPrivate?: boolean;\n /**\n * Is this model created via plugin?\n */\n isPlugin?: boolean;\n}\n\n/**\n * When sending model to the storage operations, it must contain createValueKeyToStorageConverter and createValueKeyFromStorageConverter\n *\n * @category CmsModel\n */\nexport interface StorageOperationsCmsModel extends CmsModel {\n convertValueKeyToStorage: CmsModelConverterCallable;\n convertValueKeyFromStorage: CmsModelConverterCallable;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsModelFieldDefinition {\n fields: string;\n typeDefs?: string;\n}\n\ninterface CmsModelFieldToGraphQLCreateResolverParams<TField> {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: TField;\n createFieldResolvers: any;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\nexport interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {\n (params: CmsModelFieldToGraphQLCreateResolverParams<TField>):\n | GraphQLFieldResolver\n | { resolver: GraphQLFieldResolver | null; typeResolvers: Resolvers<CmsContext> }\n | false;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<\n TField extends CmsModelField = CmsModelField\n> {\n fields: TField[];\n originalFields: TField[];\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<\n TField extends CmsModelField = CmsModelField\n> {\n field: TField;\n originalField?: TField;\n validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFields<\n TField extends CmsModelField = CmsModelField\n> {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;\n}\n\n/**\n * @category Plugin\n * @category ModelField\n * @category GraphQL\n */\nexport interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = CmsModelField>\n extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-graphql\";\n /**\n * Field type name which must be exact as the one in `CmsEditorFieldTypePlugin` plugin.\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: string;\n /**\n * Is the field searchable via the GraphQL?\n *\n * ```ts\n * isSearchable: false\n * ```\n */\n isSearchable: boolean;\n /**\n * Is the field searchable via full text search?\n *\n * Field is not full text searchable by default.\n * ```ts\n * fullTextSearch: false\n * ```\n */\n fullTextSearch?: boolean;\n /**\n * Is the field sortable via the GraphQL?\n *\n * ```ts\n * isSortable: true\n * ```\n */\n isSortable: boolean;\n /**\n * Optional method which creates the storageId.\n * Primary use is for the datetime field, but if users has some specific fields, they can customize the storageId to their needs.\n *\n * ```ts\n * createStorageId: ({field}) => {\n * if (field.settings.type === \"time) {\n * return `${field.type}_time@${field.id}`\n * }\n * // use default method\n * return undefined;\n * }\n * ```\n */\n createStorageId?: (params: {\n model: CmsModel;\n field: Omit<TField, \"storageId\"> & Partial<Pick<TField, \"storageId\">>;\n }) => string | null | undefined;\n /**\n * Read API methods.\n */\n read: {\n /**\n * Definition for get filtering for GraphQL.\n *\n * ```ts\n * read: {\n * createGetFilters({ field }) {\n * return `${field.fieldId}: MyField`;\n * }\n * }\n * ```\n */\n createGetFilters?(params: { field: TField }): string;\n /**\n * Definition for list filtering for GraphQL.\n *\n * ```ts\n * read: {\n * createListFilters({ field }) {\n * return `\n * ${field.fieldId}: MyType\n * ${field.fieldId}_not: MyType\n * ${field.fieldId}_in: [MyType]\n * ${field.fieldId}_not_in: [MyType]\n * `;\n * }\n * }\n * ```\n */\n createListFilters?(params: {\n model: Pick<CmsModel, \"singularApiName\">;\n field: TField;\n plugins: CmsFieldTypePlugins;\n }): string;\n /**\n * Definition of the field type for GraphQL - be aware if multiple values is selected.\n *\n * ```ts\n * read: {\n * createTypeField({ field }) {\n * if (field.multipleValues) {\n * return `${field.fieldId}: [MyFieldType]`;\n * }\n *\n * return `${field.fieldId}: MyField`;\n * }\n * }\n * ```\n */\n createTypeField(params: {\n models: CmsModel[];\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }): CmsModelFieldDefinition | string | null;\n /**\n * Definition for field resolver.\n * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.\n *\n * ```ts\n * read: {\n * createResolver({ field }) {\n * return instance => {\n * return instance.values[field.storageId];\n * };\n * }\n * }\n * ```\n */\n createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;\n /**\n * Read API schema definitions for the field and resolvers for them.\n *\n * ```ts\n * read: {\n * createSchema() {\n * return {\n * typeDefs: `\n * myField {\n * id\n * date\n * }\n * `,\n * resolvers: {}\n * }\n * }\n * }\n * ```\n */\n createSchema?: (params: { models: CmsModel[] }) => GraphQLSchemaDefinition<CmsContext>;\n };\n manage: {\n /**\n * Definition for list filtering for GraphQL.\n *\n * ```ts\n * manage: {\n * createListFilters({ field }) {\n * return `\n * ${field.fieldId}: MyType\n * ${field.fieldId}_not: MyType\n * ${field.fieldId}_in: [MyType]\n * ${field.fieldId}_not_in: [MyType]\n * `;\n * }\n * }\n * ```\n */\n createListFilters?: (params: {\n model: Pick<CmsModel, \"singularApiName\">;\n field: TField;\n plugins: CmsFieldTypePlugins;\n }) => string;\n /**\n * Manage API schema definitions for the field and resolvers for them. Probably similar to `read.createSchema`.\n *\n * ```ts\n * createSchema() {\n * return {\n * typeDefs: `\n * myField {\n * id\n * date\n * }\n * `,\n * resolvers: {}\n * }\n * }\n * ```\n */\n createSchema?: (params: { models: CmsModel[] }) => GraphQLSchemaDefinition<CmsContext>;\n /**\n * Definition of the field type for GraphQL - be aware if multiple values is selected. Probably same as `read.createTypeField`.\n *\n * ```ts\n * manage: {\n * createTypeField({ field }) {\n * if (field.multipleValues) {\n * return field.fieldId + \": [MyType]\";\n * }\n *\n * return field.fieldId + \": MyType\";\n * }\n * }\n * ```\n */\n createTypeField: (params: {\n models: CmsModel[];\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }) => CmsModelFieldDefinition | string | null;\n /**\n * Definition for input GraphQL field type.\n *\n * ```ts\n * manage: {\n * createInputField({ field }) {\n * if (field.multipleValues) {\n * return field.fieldId + \": [MyField]\";\n * }\n *\n * return field.fieldId + \": MyField\";\n * }\n * }\n * ```\n */\n createInputField: (params: {\n models: CmsModel[];\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }) => CmsModelFieldDefinition | string | null;\n /**\n * Definition for field resolver.\n * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.\n *\n * ```ts\n * manage: {\n * createResolver({ field }) {\n * return instance => {\n * return instance.values[field.storageId];\n * };\n * }\n * }\n * ```\n */\n createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;\n };\n /**\n *\n * @param field\n */\n validateChildFields?: CmsModelFieldToGraphQLPluginValidateChildFields<TField>;\n}\n\n/**\n * Check for content model locked field.\n * A custom plugin definable by the user.\n *\n * @category CmsModel\n * @category Plugin\n */\nexport interface CmsModelLockedFieldPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-locked-field\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n */\n fieldType: string;\n /**\n * A method to check if field really is locked.\n */\n checkLockedField?: (params: { lockedField: LockedField; field: CmsModelField }) => void;\n /**\n * A method to get the locked field data.\n */\n getLockedFieldData?: (params: { field: CmsModelField }) => Record<string, any>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsFieldTypePlugins {\n [key: string]: CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * An interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface CmsIdentity {\n /**\n * ID if the user.\n */\n id: string;\n /**\n * Full name of the user.\n */\n displayName: string | null;\n /**\n * Type of the user (admin, user)\n */\n type: string;\n}\n\nexport interface OnSystemBeforeInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemAfterInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemInstallErrorTopicParams {\n error: Error;\n tenant: string;\n locale: string;\n}\n\nexport type CmsSystemContext = {\n getSystemVersion: () => Promise<string | null>;\n setSystemVersion: (version: string) => Promise<void>;\n installSystem: () => Promise<void>;\n /**\n * Lifecycle Events\n */\n onSystemBeforeInstall: Topic<OnSystemBeforeInstallTopicParams>;\n onSystemAfterInstall: Topic<OnSystemAfterInstallTopicParams>;\n onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;\n};\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n id?: string;\n name: string;\n slug?: string;\n description?: string | null;\n icon: string;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupUpdateInput {\n name?: string;\n slug?: string;\n description?: string;\n icon?: string;\n}\n\n/**\n * A representation of content model group in the database.\n *\n * @category CmsGroup\n * @category Database model\n */\nexport interface CmsGroup {\n /**\n * Generated ID.\n */\n id: string;\n /**\n * Name of the group.\n */\n name: string;\n /**\n * Slug for the group. Must be unique.\n */\n slug: string;\n /**\n * Group tenant.\n */\n tenant: string;\n /**\n * Locale this group belongs to.\n */\n locale: string;\n /**\n * Description for the group.\n */\n description: string | null;\n /**\n * Icon for the group. In a form of \"ico/ico\".\n */\n icon: string;\n /**\n * CreatedBy reference object.\n */\n createdBy?: CmsIdentity;\n /**\n * Date group was created on.\n */\n createdOn?: string;\n /**\n * Date group was created or changed on.\n */\n savedOn?: string;\n /**\n * Which Webiny version was this record stored with.\n */\n webinyVersion: string;\n /**\n * Is group private?\n * This is meant to be used for some internal groups - will not be visible in the schema.\n * Only available for the plugin constructed groups.\n */\n isPrivate?: boolean;\n /**\n * Is this group created via plugin?\n */\n isPlugin?: boolean;\n}\n\n/**\n * A `data.where` parameter received when listing content model groups.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupListParams {\n where: {\n tenant: string;\n locale: string;\n };\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupCreateErrorTopicParams {\n input: CmsGroupCreateInput;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupUpdateErrorTopicParams {\n input: CmsGroupUpdateInput;\n original: CmsGroup;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupDeleteErrorTopicParams {\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup>;\n /**\n * List all content model groups. Filterable via params.\n */\n listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;\n /**\n * Delete content model group by given id.\n */\n deleteGroup: (id: string) => Promise<boolean>;\n /**\n * Clear the cached groups.\n */\n clearGroupsCache: () => void;\n /**\n * Lifecycle Events\n */\n onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;\n onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;\n onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;\n onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;\n onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;\n onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;\n onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;\n}\n\n/**\n * Definition for content model field validator.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidation {\n name: string;\n message: string;\n settings?: {\n value?: string | number;\n values?: string[];\n preset?: string;\n [key: string]: any;\n };\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateInput {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Singular name of the content model to be used in the API.\n */\n singularApiName: string;\n /**\n * Plural name of the content model to be used in the API.\n */\n pluralApiName: string;\n /**\n * Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.\n */\n modelId?: string;\n /**\n * Description of the content model.\n */\n description?: string | null;\n /**\n * Group where to put the content model in.\n */\n group: string;\n /**\n * A list of content model fields to define the entry values.\n */\n fields?: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout?: string[][];\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Fields fieldId which are picked to represent the CMS entry.\n */\n titleFieldId?: string | null;\n descriptionFieldId?: string | null;\n imageFieldId?: string | null;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model from existing model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateFromInput extends CmsModelCreateInput {\n /**\n * Locale into which we want to clone the model into.\n */\n locale?: string;\n}\n\n/**\n * A definition for content model field received from the user.\n *\n * Input type for `CmsModelField`.\n * @see CmsModelField\n *\n * @category GraphQL params\n * @category ModelField\n */\nexport interface CmsModelFieldInput {\n /**\n * Generated ID.\n */\n id: string;\n /**\n * Type of the field. A plugin for the field must be defined.\n * @see CmsModelFieldToGraphQLPlugin\n */\n type: string;\n /**\n * Field outside world identifier for the field. Must be unique in the model.\n */\n fieldId: string;\n /**\n * Label for the field.\n */\n label: string;\n /**\n * Text to display below the field to help user what to write in the field.\n */\n helpText?: string | null;\n /**\n * Text to display in the field.\n */\n placeholderText?: string | null;\n /**\n * Fields can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Are multiple values allowed?\n */\n multipleValues?: boolean;\n /**\n * Predefined values options for the field. Check the reference for more information.\n */\n predefinedValues?: CmsModelFieldPredefinedValues;\n /**\n * Renderer options for the field. Check the reference for more information.\n */\n renderer?: CmsModelFieldRenderer;\n /**\n * List of validations for the field.\n */\n validation?: CmsModelFieldValidation[];\n /**\n * @see CmsModelField.listValidation\n */\n listValidation?: CmsModelFieldValidation[];\n /**\n * User defined settings.\n */\n settings?: Record<string, any>;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelUpdateInput {\n /**\n * A new content model name.\n */\n name?: string;\n /**\n * A new singular name of the content model to be used in the API.\n */\n singularApiName?: string;\n /**\n * A new plural name of the content model to be used in the API.\n */\n pluralApiName?: string;\n /**\n * A group we want to move the model to.\n */\n group?: string;\n /**\n * A new description of the content model.\n */\n description?: string | null;\n /**\n * A list of content model fields to define the entry values.\n */\n fields: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: string[][];\n /**\n * Fields fieldId which are picked to represent the CMS entry.\n */\n titleFieldId?: string | null;\n descriptionFieldId?: string | null;\n imageFieldId?: string | null;\n}\n\n/**\n * A plugin to load a CmsModelManager.\n *\n * @see CmsModelManager\n *\n * @category Plugin\n * @category CmsModel\n * @category CmsEntry\n */\nexport interface ModelManagerPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-content-model-manager\";\n /**\n * Specific model CmsModelManager loader. Can target exact modelId(s).\n * Be aware that if you define multiple plugins without `modelId`, last one will run.\n */\n modelId?: string[] | string;\n /**\n * Create a CmsModelManager for specific type - or new default one.\n * 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)\n */\n create: (context: CmsContext, model: CmsModel) => Promise<CmsModelManager>;\n}\n\n/**\n * A content entry values definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntryValues {\n [key: string]: any;\n}\n\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<T = CmsEntryValues> {\n /**\n * A version of the webiny this entry was created with.\n * This can be used when upgrading the system, so we know which entries to update.\n */\n webinyVersion: string;\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n /**\n * CreatedBy object reference.\n */\n createdBy: CmsIdentity;\n /**\n * OwnedBy object reference. Can be different from CreatedBy.\n */\n ownedBy: CmsIdentity;\n /**\n * ModifiedBy object reference. Last person who modified the entry.\n */\n modifiedBy?: CmsIdentity | null;\n /**\n * A string of Date.toISOString() type.\n * Populated on creation.\n */\n createdOn: string;\n /**\n * A string of Date.toISOString() type.\n * Populated every time entry is saved.\n */\n savedOn: string;\n /**\n * Model ID of the definition for the entry.\n * @see CmsModel\n */\n modelId: string;\n /**\n * A locale of the entry.\n * @see I18NLocale.code\n */\n locale: string;\n /**\n * A string of Date.toISOString() type - if published.\n * Populated when entry is published.\n */\n publishedOn?: string;\n /**\n * A revision version of the entry.\n */\n version: number;\n /**\n * Is the entry locked?\n */\n locked: boolean;\n /**\n * Status type of the entry.\n */\n status: CmsEntryStatus;\n /**\n * A mapped storageId -> value object.\n *\n * @see CmsModelField\n */\n values: T;\n /**\n * Advanced Content Organization\n */\n location?: {\n folderId?: string | null;\n };\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.\n * Be aware that when accessing properties in it on old systems, it will break if not checked first.\n *\n * Available only on the Manage API in entry GraphQL type `meta.data` property.\n */\n meta?: {\n [key: string]: any;\n };\n}\n\nexport interface CmsStorageEntry extends CmsEntry {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\n}\n\n/**\n * A definition for content model manager to be used in the code.\n * The default one uses `CmsEntryContext` methods internally, but devs can change to what every they want.\n *\n * @see CmsEntryContext\n *\n * @category Context\n * @category CmsEntry\n * @category CmsModel\n */\nexport interface CmsModelManager {\n /**\n * List only published entries in the content model.\n */\n listPublished: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * List latest entries in the content model. Used for administration.\n */\n listLatest: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * Get a list of published entries by the ID list.\n */\n getPublishedByIds: (ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Get a list of the latest entries by the ID list.\n */\n getLatestByIds: (ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Get an entry filtered by given params. Will always get one.\n */\n get: (id: string) => Promise<CmsEntry>;\n /**\n * Create an entry.\n */\n create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Update an entry.\n */\n update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Delete an entry.\n */\n delete: (id: string) => Promise<void>;\n}\n\n/**\n * Create\n */\nexport interface OnModelBeforeCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\n\nexport interface OnModelAfterCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\n\nexport interface OnModelCreateErrorTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Create From / Clone\n */\nexport interface OnModelBeforeCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelAfterCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelCreateFromErrorParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Update\n */\nexport interface OnModelBeforeUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelAfterUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelUpdateErrorTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Delete\n */\nexport interface OnModelBeforeDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelAfterDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelDeleteErrorTopicParams {\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Initialize\n */\nexport interface OnModelInitializeParams {\n model: CmsModel;\n data: Record<string, any>;\n}\n\n/**\n *\n */\nexport interface CmsModelUpdateDirectParams {\n model: CmsModel;\n original: CmsModel;\n}\n\n/**\n * Cms Model in the context.\n *\n * @category Context\n * @category CmsModel\n */\nexport interface CmsModelContext {\n /**\n * Get a single content model.\n */\n getModel: (modelId: string) => Promise<CmsModel | null>;\n /**\n * Get all content models.\n */\n listModels: () => Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel: (data: CmsModelCreateInput) => Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom: (modelId: string, data: CmsModelCreateFromInput) => Promise<CmsModel>;\n /**\n * Update content model without data validation. Used internally.\n * @hidden\n */\n updateModelDirect: (params: CmsModelUpdateDirectParams) => Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel: (modelId: string, data: CmsModelUpdateInput) => Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel: (modelId: string) => Promise<void>;\n /**\n * Possibility for users to trigger the model initialization.\n * They can hook into it and do what ever they want to.\n *\n * Primary idea behind this is creating the index, for the code models, in the ES.\n */\n initializeModel: (modelId: string, data: Record<string, any>) => Promise<boolean>;\n /**\n * Get an instance of CmsModelManager for given content modelId.\n *\n * @see CmsModelManager\n */\n getEntryManager: (model: CmsModel | string) => Promise<CmsModelManager>;\n /**\n * Get all content model managers mapped by modelId.\n * @see CmsModelManager\n */\n getEntryManagers: () => Map<string, CmsModelManager>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache: () => void;\n /**\n * Lifecycle Events\n */\n onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;\n onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;\n onModelCreateError: Topic<OnModelCreateErrorTopicParams>;\n onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;\n onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;\n onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;\n onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;\n onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;\n onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;\n onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;\n onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;\n onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;\n onModelInitialize: Topic<OnModelInitializeParams>;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef {\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n}\n\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Generated ID without the version.\n */\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n /**\n * Contains the owner of the entry. An \"owner\" is the identity who originally created the entry.\n * Subsequent revisions can be created by other identities, and those will be stored in `createdBy`,\n * but the `owner` is always the original author of the entry.\n *\n * Can be sent via the API or set internal if user can see only their own entries.\n */\n ownedBy?: string;\n ownedBy_not?: string;\n ownedBy_in?: string[];\n ownedBy_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n version?: number;\n version_lt?: number;\n version_gt?: number;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n published?: boolean;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n latest?: boolean;\n /**\n * This is to allow querying by any content model field defined by the user.\n */\n [key: string]:\n | string\n | number\n | boolean\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhere[]\n | CmsEntryListWhere\n | CmsEntryListWhereRef;\n /**\n * To allow querying via nested queries, we added the AND / OR properties.\n */\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n}\n\n/**\n * Entry listing sort.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport type CmsEntryListSort = string[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * Create\n */\nexport interface OnEntryBeforeCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateErrorTopicParams {\n error: Error;\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Revision Create\n */\nexport interface OnEntryRevisionBeforeCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionAfterCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateRevisionErrorTopicParams {\n error: Error;\n input: CreateFromCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Update\n */\nexport interface OnEntryBeforeUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUpdateErrorTopicParams {\n error: Error;\n input: UpdateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Move\n */\nexport interface OnEntryBeforeMoveTopicParams {\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterMoveTopicParams {\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryMoveErrorTopicParams {\n error: Error;\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Publish\n */\n\nexport interface OnEntryBeforePublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterPublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryPublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Republish\n */\nexport interface OnEntryBeforeRepublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterRepublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryRepublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Unpublish\n */\n\nexport interface OnEntryBeforeUnpublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterUnpublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUnpublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionAfterDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryBeforeDeleteMultipleTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n}\n\nexport interface OnEntryAfterDeleteMultipleTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n}\n\nexport interface OnEntryDeleteMultipleErrorTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n error: Error;\n}\n\nexport interface OnEntryBeforeGetTopicParams {\n model: CmsModel;\n where: CmsEntryListWhere;\n}\n\nexport interface EntryBeforeListTopicParams {\n where: CmsEntryListWhere;\n model: CmsModel;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput {\n id?: string;\n wbyAco_location?: {\n folderId?: string | null;\n };\n [key: string]: any;\n}\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput {\n [key: string]: any;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput {\n wbyAco_location?: {\n folderId?: string | null;\n };\n [key: string]: any;\n}\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface GetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\n/**\n * @category CmsEntry\n */\nexport interface CmsDeleteEntryOptions {\n /**\n * Runs the delete commands even if the entry is not found in the DynamoDB.\n * This is to force clean the entry records that might have been left behind a failed delete.\n */\n force?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface DeleteMultipleEntriesParams {\n entries: string[];\n}\n\nexport type DeleteMultipleEntriesResponse = { id: string }[];\n\nexport interface CmsEntryValidateResponse {\n [key: string]: any;\n}\n/**\n * Cms Entry CRUD methods in the context.\n *\n * @category Context\n * @category CmsEntry\n */\nexport interface CmsEntryContext {\n /**\n * Get a single content entry for a model.\n */\n getEntry: (model: CmsModel, params: CmsEntryGetParams) => Promise<CmsEntry>;\n /**\n * Get a list of entries for a model by a given ID (revision).\n */\n getEntriesByIds: (model: CmsModel, revisions: string[]) => Promise<CmsEntry[]>;\n /**\n * Get the entry for a model by a given ID.\n */\n getEntryById: (model: CmsModel, revision: string) => Promise<CmsEntry>;\n /**\n * List entries for a model. Internal method used by get, listLatest and listPublished.\n */\n listEntries: <T = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryListParams\n ) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * Lists the latest entries. Used for manage API.\n */\n listLatestEntries: <T = CmsEntryValues>(\n model: CmsModel,\n params?: CmsEntryListParams\n ) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * List published entries. Used for read API.\n */\n listPublishedEntries: <T = CmsEntryValues>(\n model: CmsModel,\n params?: CmsEntryListParams\n ) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * List published entries by IDs.\n */\n getPublishedEntriesByIds: (model: CmsModel, ids: string[]) => Promise<CmsEntry[]>;\n /**\n * List latest entries by IDs.\n */\n getLatestEntriesByIds: (model: CmsModel, ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Create a new content entry.\n */\n createEntry: (\n model: CmsModel,\n input: CreateCmsEntryInput,\n options?: CreateCmsEntryOptionsInput\n ) => Promise<CmsEntry>;\n /**\n * Create a new entry from already existing entry.\n */\n createEntryRevisionFrom: (\n model: CmsModel,\n id: string,\n input: CreateFromCmsEntryInput,\n options?: CreateRevisionCmsEntryOptionsInput\n ) => Promise<CmsEntry>;\n /**\n * Update existing entry.\n */\n updateEntry: (\n model: CmsModel,\n id: string,\n input: UpdateCmsEntryInput,\n meta?: Record<string, any>,\n options?: UpdateCmsEntryOptionsInput\n ) => Promise<CmsEntry>;\n /**\n * Validate the entry - either new one or existing one.\n */\n validateEntry: (\n model: CmsModel,\n id?: string,\n input?: UpdateCmsEntryInput\n ) => Promise<CmsEntryValidateResponse>;\n /**\n * Move entry, and all its revisions, to a new folder.\n */\n moveEntry: (model: CmsModel, id: string, folderId: string) => Promise<CmsEntry>;\n /**\n * Method that republishes entry with given identifier.\n * @internal\n */\n republishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Delete only a certain revision of the entry.\n */\n deleteEntryRevision: (model: CmsModel, id: string) => Promise<void>;\n /**\n * Delete entry with all its revisions.\n */\n deleteEntry: (model: CmsModel, id: string, options?: CmsDeleteEntryOptions) => Promise<void>;\n /**\n * Delete multiple entries\n */\n deleteMultipleEntries: (\n model: CmsModel,\n params: DeleteMultipleEntriesParams\n ) => Promise<DeleteMultipleEntriesResponse>;\n /**\n * Publish entry.\n */\n publishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Unpublish entry.\n */\n unpublishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Get all entry revisions.\n */\n getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;\n /**\n * List all unique values for a given field.\n *\n * @internal\n */\n getUniqueFieldValues: (\n model: CmsModel,\n params: GetUniqueFieldValuesParams\n ) => Promise<CmsEntryUniqueValue[]>;\n /**\n * Lifecycle Events\n */\n onEntryBeforeCreate: Topic<OnEntryBeforeCreateTopicParams>;\n onEntryAfterCreate: Topic<OnEntryAfterCreateTopicParams>;\n onEntryCreateError: Topic<OnEntryCreateErrorTopicParams>;\n\n onEntryRevisionBeforeCreate: Topic<OnEntryRevisionBeforeCreateTopicParams>;\n onEntryRevisionAfterCreate: Topic<OnEntryRevisionAfterCreateTopicParams>;\n onEntryRevisionCreateError: Topic<OnEntryCreateRevisionErrorTopicParams>;\n\n onEntryBeforeUpdate: Topic<OnEntryBeforeUpdateTopicParams>;\n onEntryAfterUpdate: Topic<OnEntryAfterUpdateTopicParams>;\n onEntryUpdateError: Topic<OnEntryUpdateErrorTopicParams>;\n\n onEntryBeforeMove: Topic<OnEntryBeforeMoveTopicParams>;\n onEntryAfterMove: Topic<OnEntryAfterMoveTopicParams>;\n onEntryMoveError: Topic<OnEntryMoveErrorTopicParams>;\n\n onEntryBeforeDelete: Topic<OnEntryBeforeDeleteTopicParams>;\n onEntryAfterDelete: Topic<OnEntryAfterDeleteTopicParams>;\n onEntryDeleteError: Topic<OnEntryDeleteErrorTopicParams>;\n\n onEntryRevisionBeforeDelete: Topic<OnEntryRevisionBeforeDeleteTopicParams>;\n onEntryRevisionAfterDelete: Topic<OnEntryRevisionAfterDeleteTopicParams>;\n onEntryRevisionDeleteError: Topic<OnEntryRevisionDeleteErrorTopicParams>;\n\n onEntryBeforePublish: Topic<OnEntryBeforePublishTopicParams>;\n onEntryAfterPublish: Topic<OnEntryAfterPublishTopicParams>;\n onEntryPublishError: Topic<OnEntryPublishErrorTopicParams>;\n\n onEntryBeforeRepublish: Topic<OnEntryBeforeRepublishTopicParams>;\n onEntryAfterRepublish: Topic<OnEntryAfterRepublishTopicParams>;\n onEntryRepublishError: Topic<OnEntryRepublishErrorTopicParams>;\n\n onEntryBeforeUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;\n onEntryAfterUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;\n onEntryUnpublishError: Topic<OnEntryUnpublishErrorTopicParams>;\n\n onEntryBeforeGet: Topic<OnEntryBeforeGetTopicParams>;\n onEntryBeforeList: Topic<EntryBeforeListTopicParams>;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * A base security permission for CMS.\n *\n * @category SecurityPermission\n */\nexport interface BaseCmsSecurityPermission extends SecurityPermission {\n own?: boolean;\n rwd: string | number;\n}\n\n/**\n * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n locale: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n [key: string]: any;\n}\n\nexport interface CmsGroupStorageOperationsListParams {\n where: CmsGroupStorageOperationsListWhereParams;\n sort?: string[];\n}\n\nexport interface CmsGroupStorageOperationsCreateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsUpdateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsDeleteParams {\n group: CmsGroup;\n}\n\n/**\n * Description of the CmsGroup CRUD operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsGroupStorageOperations {\n /**\n * Gets content model group by given id.\n */\n get: (params: CmsGroupStorageOperationsGetParams) => Promise<CmsGroup | null>;\n /**\n * List all content model groups. Filterable via params.\n */\n list: (params: CmsGroupStorageOperationsListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n create: (params: CmsGroupStorageOperationsCreateParams) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<CmsGroup>;\n /**\n * Delete the content model group.\n */\n delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<CmsGroup>;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n locale: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsDeleteParams {\n model: CmsModel;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsModelStorageOperations {\n /**\n * Gets content model by given id.\n */\n get: (params: CmsModelStorageOperationsGetParams) => Promise<CmsModel | null>;\n /**\n * List all content models. Filterable via params.\n */\n list: (params: CmsModelStorageOperationsListParams) => Promise<CmsModel[]>;\n /**\n * Create a new content model.\n */\n create: (params: CmsModelStorageOperationsCreateParams) => Promise<CmsModel>;\n /**\n * Update existing content model.\n */\n update: (params: CmsModelStorageOperationsUpdateParams) => Promise<CmsModel>;\n /**\n * Delete the content model.\n */\n delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<CmsModel>;\n}\n\nexport interface CmsEntryStorageOperationsGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n}\n\nexport interface CmsEntryStorageOperationsListParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit: number;\n after?: string | null;\n}\n\nexport interface CmsEntryStorageOperationsCreateParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: T;\n /**\n * Entry that was set as latest.\n */\n latestEntry: CmsEntry | null;\n /**\n * Entry that was set as latest, directly from storage, with transformations.\n */\n latestStorageEntry: T | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams {\n entry: CmsEntry;\n}\n\nexport interface CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\nexport interface CmsEntryStorageOperationsGetByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetLatestByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionsParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetLatestRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPreviousRevisionParams {\n entryId: string;\n version: number;\n}\n\nexport interface CmsEntryStorageOperationsListResponse<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Has more items to load with the current filtering?\n */\n hasMoreItems: boolean;\n /**\n * Items loaded with current filtering.\n */\n items: T[];\n /**\n * Pointer for where to start the new item set.\n */\n cursor: string | null;\n /**\n * Total amount of items with the current filter.\n */\n totalCount: number;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n *\n *\n * @category StorageOperations\n * @category CmsEntry\n */\nexport interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorageEntry> {\n /**\n * Get all the entries of the ids.\n */\n getByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<T[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<T | null>;\n /**\n * Gets entry by given params.\n */\n get: (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: (\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<T>>;\n /**\n * Create a new entry.\n */\n create: (model: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: (\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<T>;\n /**\n * Update existing entry.\n */\n update: (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;\n /**\n * Move entry and all its entries into a new folder.\n */\n move: (model: CmsModel, id: string, folderId: string) => Promise<void>;\n /**\n * Delete the entry revision.\n */\n deleteRevision: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ) => Promise<void>;\n /**\n * Delete the entry.\n */\n delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Delete multiple entries, with a limit on how much can be deleted in one call.\n */\n deleteMultipleEntries: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteEntriesParams\n ) => Promise<void>;\n /**\n * Publish the entry.\n */\n publish: (model: CmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;\n /**\n * Unpublish the entry.\n */\n unpublish: (model: CmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;\n /**\n * Method to list all the unique values for the given field id.\n * Simplest use case would be to aggregate tags for some content.\n * @internal\n */\n getUniqueFieldValues: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetUniqueFieldValuesParams\n ) => Promise<CmsEntryUniqueValue[]>;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\n}\n\nexport interface CmsSystem {\n version?: string;\n readAPIKey?: string;\n /**\n * System tenant.\n */\n tenant: string;\n}\n\nexport interface CmsSystemStorageOperationsGetParams {\n tenant: string;\n}\n\nexport interface CmsSystemStorageOperationsCreateParams {\n system: CmsSystem;\n}\n\nexport interface CmsSystemStorageOperationsUpdateParams {\n system: CmsSystem;\n}\n\nexport interface CmsSystemStorageOperations {\n /**\n * Get the system data.\n */\n get: (params: CmsSystemStorageOperationsGetParams) => Promise<CmsSystem | null>;\n /**\n * Create the system info in the storage.\n */\n create: (params: CmsSystemStorageOperationsCreateParams) => Promise<CmsSystem>;\n /**\n * Update the system info in the storage.\n */\n update: (params: CmsSystemStorageOperationsUpdateParams) => Promise<CmsSystem>;\n}\n\nexport interface HeadlessCmsStorageOperations<C = CmsContext> {\n name: string;\n system: CmsSystemStorageOperations;\n groups: CmsGroupStorageOperations;\n models: CmsModelStorageOperations;\n entries: CmsEntryStorageOperations;\n /**\n * Either attach something from the storage operations or run something in it.\n */\n beforeInit: (context: C) => Promise<void>;\n init?: (context: C) => Promise<void>;\n}\n"],"mappings":";;;;;;AAuEA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AAiDA;AACA;AACA;AACA;AACA;AACA;AAgGA;AACA;AACA;AAUA;AACA;AACA;AASA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AAmHA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AA+CA;AACA;AACA;AACA;AACA;AAiQA;AACA;AACA;AACA;AACA;AACA;AACA;AAoBA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AA4CA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AA0DA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAwCA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AAqDA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyDA;AACA;AACA;AACA;AACA;AACA;AA6CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AAuGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAoCA;AACA;AACA;AAiBA;AACA;AACA;AAoBA;AACA;AACA;AAoBA;AACA;AACA;AAcA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAuEA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AAgFA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AAqBA;AACA;AACA;AAwBA;AACA;AACA;AAuBA;AACA;AACA;AAoBA;AACA;AACA;AAmBA;AACA;AACA;AAkBA;AACA;AACA;AAgFA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AAMA;AACA;AACA;AASA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAsKA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AA8CA;AACA;AACA;AACA;AACA;AAoDA;AACA;AACA;AACA;AACA;AAiMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IAkIYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAAC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["CONTENT_ENTRY_STATUS","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Context } from \"@webiny/api/types\";\nimport {\n GraphQLFieldResolver,\n GraphQLSchemaDefinition,\n Resolvers\n} from \"@webiny/handler-graphql/types\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\nimport { DbContext } from \"@webiny/handler-db/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection\";\nimport { ModelGroupsPermissions } from \"~/utils/permissions/ModelGroupsPermissions\";\nimport { ModelsPermissions } from \"~/utils/permissions/ModelsPermissions\";\nimport { EntriesPermissions } from \"~/utils/permissions/EntriesPermissions\";\nimport { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types\";\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\n\ninterface HeadlessCmsPermissions {\n groups: ModelGroupsPermissions;\n models: ModelsPermissions;\n entries: EntriesPermissions;\n}\n\nexport interface HeadlessCms\n extends CmsSystemContext,\n CmsGroupContext,\n CmsModelContext,\n CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\n /**\n * Requested locale\n */\n locale: string;\n /**\n * returns an instance of current locale\n */\n getLocale: () => I18NLocale;\n /**\n * Means this request is a READ API\n */\n READ: boolean;\n /**\n * Means this request is a MANAGE API\n */\n MANAGE: boolean;\n /**\n * Means this request is a PREVIEW API\n */\n PREVIEW: boolean;\n /**\n * The storage operations loaded for current context.\n */\n storageOperations: HeadlessCmsStorageOperations;\n /**\n * Permissions for groups, models and entries.\n *\n * @internal\n */\n permissions: HeadlessCmsPermissions;\n /**\n * Export operations.\n */\n export: HeadlessCmsExport;\n importing: HeadlessCmsImport;\n}\n\n/**\n * @description This combines all contexts used in the CMS into a single one.\n *\n * @category Context\n */\nexport interface CmsContext extends Context, DbContext, I18NContext {\n cms: HeadlessCms;\n}\n\ninterface CmsModelFieldPredefinedValuesValue {\n value: string;\n label: string;\n /**\n * Default selected predefined value.\n */\n selected?: boolean;\n}\n\n/**\n * Object containing content model field predefined options and values.\n *\n * @category CmsModelField\n */\nexport interface CmsModelFieldPredefinedValues {\n /**\n * Are predefined field values enabled?\n */\n enabled: boolean;\n /**\n * Predefined values array.\n */\n values: CmsModelFieldPredefinedValuesValue[];\n}\n\n/**\n * Object containing content model field renderer options.\n *\n * @category CmsModelField\n */\ninterface CmsModelFieldRenderer {\n /**\n * Name of the field renderer. Must have one in field renderer plugins.\n * Can be blank to let automatically determine the renderer.\n */\n name: string;\n}\n\n/**\n * A definition for content model field settings.\n *\n * @category ModelField\n * @category Database model\n */\nexport interface CmsModelFieldSettings {\n /**\n * Predefined values (text, number)\n * The default value for the field in case it is not predefined values field.\n */\n defaultValue?: string | number | null | undefined;\n /**\n * Object field has child fields.\n */\n fields?: CmsModelField[];\n /**\n * Is the file field images only one?\n */\n imagesOnly?: boolean;\n /**\n * Object field has child fields - so it needs to have a layout.\n */\n layout?: string[][];\n /**\n * Ref field.\n */\n models?: Pick<CmsModel, \"modelId\">[];\n /**\n * Date field.\n */\n type?: string;\n /**\n * Disable full text search explicitly on this field.\n */\n disableFullTextSearch?: boolean;\n /**\n * There are a lot of other settings that are possible to add, so we keep the type opened.\n */\n [key: string]: any;\n}\n\nexport type CmsModelFieldType =\n | \"boolean\"\n | \"datetime\"\n | \"file\"\n | \"long-text\"\n | \"number\"\n | \"object\"\n | \"ref\"\n | \"rich-text\"\n | \"text\"\n | \"dynamicZone\"\n | string;\n/**\n * A definition for content model field. This type exists on the app side as well.\n *\n * @category ModelField\n * @category Database model\n */\nexport interface CmsModelField {\n /**\n * A generated unique ID for the model field.\n * MUST be absolute unique throughout the models.\n * Must be in form of a-zA-Z0-9.\n *\n * We generate a unique id value when you're building a model via UI,\n * but when user is creating a model via a plugin it is up to them to be careful about this.\n */\n id: string;\n /**\n * A type of the field.\n * We are defining our built-in fields, so people know which are available by the default.\n */\n type: CmsModelFieldType;\n /**\n * A unique storage ID for storing actual values.\n * Must in form of a-zA-Z0-9@a-zA-Z0-9\n *\n * This is an auto-generated value: uses `id` and `type`\n *\n * This is used as path for the entry value.\n */\n storageId: `${string}@${string}` | string;\n /**\n * Field identifier for the model field that will be available to the outside world.\n * `storageId` is used as path (or column) to store the data.\n *\n * Must in form of a-zA-Z0-9.\n *\n * This value MUST be unique in the CmsModel.\n */\n fieldId: string;\n /**\n * A label for the field\n */\n label: string;\n /**\n * Text below the field to clarify what is it meant to be in the field value\n */\n helpText?: string | null;\n /**\n * Text to be displayed in the field\n */\n placeholderText?: string | null;\n /**\n * Are predefined values enabled? And list of them\n */\n predefinedValues?: CmsModelFieldPredefinedValues;\n /**\n * Field renderer. Blank if determined automatically.\n */\n renderer?: CmsModelFieldRenderer;\n /**\n * List of validations for the field\n *\n * @default []\n */\n validation?: CmsModelFieldValidation[];\n /**\n * List of validations for the list of values, when a field is set to accept a list of values.\n * These validations will be applied to the entire list, and `validation` (see above) will be applied\n * to each individual value in the list.\n *\n * @default []\n */\n listValidation?: CmsModelFieldValidation[];\n /**\n * Is this a multiple values field?\n *\n */\n multipleValues?: boolean;\n /**\n * Fields can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Any user defined settings.\n *\n * @default {}\n */\n settings?: CmsModelFieldSettings;\n}\n\nexport interface CmsDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n description: string;\n icon: string;\n fields: CmsModelField[];\n layout: string[][];\n validation: CmsModelFieldValidation[];\n}\n\n/**\n * A definition for dynamic-zone field to show possible type of the field in settings.\n */\nexport interface CmsModelDynamicZoneField extends CmsModelField {\n /**\n * Settings object for the field. Contains `templates` property.\n */\n settings: {\n templates: CmsDynamicZoneTemplate[];\n };\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\nexport interface CmsModelDynamicZoneFieldWithParent extends CmsModelDynamicZoneField {\n parent?: CmsModelDynamicZoneFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T = any> {\n /**\n * A value to be validated.\n */\n value: T;\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry;\n}\n\n/**\n * Definition for the field validator.\n *\n * @category Plugin\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorPluginValidateCb {\n (params: CmsModelFieldValidatorValidateParams): Promise<boolean>;\n}\nexport interface CmsModelFieldValidatorPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-model-field-validator\";\n /**\n * Actual validator definition.\n */\n validator: {\n /**\n * Name of the validator.\n */\n name: string;\n /**\n * Validation method.\n */\n validate: CmsModelFieldValidatorPluginValidateCb;\n };\n}\n\n/**\n * A pattern validator for the content entry field value.\n *\n * @category Plugin\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldPatternValidatorPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-validator-pattern\";\n /**\n * A pattern object for the validator.\n */\n pattern: {\n /**\n * name of the pattern.\n */\n name: string;\n /**\n * RegExp of the validator.\n */\n regex: string;\n /**\n * RegExp flags\n */\n flags: string;\n };\n}\n\n/**\n * Locked field in the content model\n *\n * @see CmsModel.lockedFields\n *\n * @category ModelField\n */\nexport interface LockedField {\n /**\n * Locked field storage ID - one used to store values.\n * We cannot change this due to old systems.\n */\n fieldId: string;\n /**\n * Is the field multiple values field?\n */\n multipleValues: boolean;\n /**\n * Field type.\n */\n type: string;\n [key: string]: any;\n}\n\n/**\n * @category Database model\n * @category CmsModel\n */\nexport interface CmsModelGroup {\n /**\n * Generated ID of the group\n */\n id: string;\n /**\n * Name of the group\n */\n name: string;\n}\n\n/**\n * Base CMS Model. Should not be exported and used outside of this package.\n *\n * @category Database model\n * @category CmsModel\n */\nexport interface CmsModel {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Unique ID for the content model. Created from name if not defined by user.\n */\n modelId: string;\n /**\n * Name of the content model in singular form to be used in the API.\n * example:\n * - Article\n * - Fruit\n * - Vegetable\n * - Car\n */\n singularApiName: string;\n /**\n * Name of the content model in plural form to be used in the API.\n * example:\n * - Articles\n * - Fruits\n * - Vegetables\n * - Cars\n */\n pluralApiName: string;\n /**\n * Model tenant.\n */\n tenant: string;\n /**\n * Locale this model belongs to.\n */\n locale: string;\n /**\n * Cms Group reference object.\n */\n group: CmsModelGroup;\n /**\n * Icon for the content model.\n */\n icon?: string | null;\n /**\n * Description for the content model.\n */\n description: string | null;\n /**\n * Date created\n */\n createdOn?: string;\n /**\n * Date saved. Changes on both save and create.\n */\n savedOn?: string;\n /**\n * CreatedBy object wrapper. Contains id, name and type of the user.\n */\n createdBy?: CmsIdentity;\n /**\n * List of fields defining entry values.\n */\n fields: CmsModelField[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: string[][];\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * List of locked fields. Updated when entry is saved and a field has been used.\n */\n lockedFields?: LockedField[];\n /**\n * The field that is being displayed as entry title.\n * It is picked as first available text field. Or user can select own field.\n */\n titleFieldId: string;\n /**\n * The field which is displayed as the description one.\n * Only way this is null or undefined is that there are no long-text fields to be set as description.\n */\n descriptionFieldId?: string | null;\n /**\n * The field which is displayed as the image.\n * Only way this is null or undefined is that there are no file fields, with images only set, to be set as image.\n */\n imageFieldId?: string | null;\n /**\n * The version of Webiny which this record was stored with.\n */\n webinyVersion: string;\n\n /**\n * Is model private?\n * This is meant to be used for some internal models - will not be visible in the schema.\n * Only available for the plugin constructed models.\n */\n isPrivate?: boolean;\n /**\n * Is this model created via plugin?\n */\n isPlugin?: boolean;\n}\n\n/**\n * When sending model to the storage operations, it must contain createValueKeyToStorageConverter and createValueKeyFromStorageConverter\n *\n * @category CmsModel\n */\nexport interface StorageOperationsCmsModel extends CmsModel {\n convertValueKeyToStorage: CmsModelConverterCallable;\n convertValueKeyFromStorage: CmsModelConverterCallable;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsModelFieldDefinition {\n fields: string;\n typeDefs?: string;\n}\n\ninterface CmsModelFieldToGraphQLCreateResolverParams<TField> {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: TField;\n createFieldResolvers: any;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\nexport interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {\n (params: CmsModelFieldToGraphQLCreateResolverParams<TField>):\n | GraphQLFieldResolver\n | { resolver: GraphQLFieldResolver | null; typeResolvers: Resolvers<CmsContext> }\n | false;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<\n TField extends CmsModelField = CmsModelField\n> {\n fields: TField[];\n originalFields: TField[];\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<\n TField extends CmsModelField = CmsModelField\n> {\n field: TField;\n originalField?: TField;\n validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFields<\n TField extends CmsModelField = CmsModelField\n> {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;\n}\n\n/**\n * @category Plugin\n * @category ModelField\n * @category GraphQL\n */\nexport interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = CmsModelField>\n extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-graphql\";\n /**\n * Field type name which must be exact as the one in `CmsEditorFieldTypePlugin` plugin.\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: string;\n /**\n * Is the field searchable via the GraphQL?\n *\n * ```ts\n * isSearchable: false\n * ```\n */\n isSearchable: boolean;\n /**\n * Is the field searchable via full text search?\n *\n * Field is not full text searchable by default.\n * ```ts\n * fullTextSearch: false\n * ```\n */\n fullTextSearch?: boolean;\n /**\n * Is the field sortable via the GraphQL?\n *\n * ```ts\n * isSortable: true\n * ```\n */\n isSortable: boolean;\n /**\n * Optional method which creates the storageId.\n * Primary use is for the datetime field, but if users has some specific fields, they can customize the storageId to their needs.\n *\n * ```ts\n * createStorageId: ({field}) => {\n * if (field.settings.type === \"time) {\n * return `${field.type}_time@${field.id}`\n * }\n * // use default method\n * return undefined;\n * }\n * ```\n */\n createStorageId?: (params: {\n model: CmsModel;\n field: Omit<TField, \"storageId\"> & Partial<Pick<TField, \"storageId\">>;\n }) => string | null | undefined;\n /**\n * Read API methods.\n */\n read: {\n /**\n * Definition for get filtering for GraphQL.\n *\n * ```ts\n * read: {\n * createGetFilters({ field }) {\n * return `${field.fieldId}: MyField`;\n * }\n * }\n * ```\n */\n createGetFilters?(params: { field: TField }): string;\n /**\n * Definition for list filtering for GraphQL.\n *\n * ```ts\n * read: {\n * createListFilters({ field }) {\n * return `\n * ${field.fieldId}: MyType\n * ${field.fieldId}_not: MyType\n * ${field.fieldId}_in: [MyType]\n * ${field.fieldId}_not_in: [MyType]\n * `;\n * }\n * }\n * ```\n */\n createListFilters?(params: {\n model: Pick<CmsModel, \"singularApiName\">;\n field: TField;\n plugins: CmsFieldTypePlugins;\n }): string;\n /**\n * Definition of the field type for GraphQL - be aware if multiple values is selected.\n *\n * ```ts\n * read: {\n * createTypeField({ field }) {\n * if (field.multipleValues) {\n * return `${field.fieldId}: [MyFieldType]`;\n * }\n *\n * return `${field.fieldId}: MyField`;\n * }\n * }\n * ```\n */\n createTypeField(params: {\n models: CmsModel[];\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }): CmsModelFieldDefinition | string | null;\n /**\n * Definition for field resolver.\n * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.\n *\n * ```ts\n * read: {\n * createResolver({ field }) {\n * return instance => {\n * return instance.values[field.storageId];\n * };\n * }\n * }\n * ```\n */\n createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;\n /**\n * Read API schema definitions for the field and resolvers for them.\n *\n * ```ts\n * read: {\n * createSchema() {\n * return {\n * typeDefs: `\n * myField {\n * id\n * date\n * }\n * `,\n * resolvers: {}\n * }\n * }\n * }\n * ```\n */\n createSchema?: (params: { models: CmsModel[] }) => GraphQLSchemaDefinition<CmsContext>;\n };\n manage: {\n /**\n * Definition for list filtering for GraphQL.\n *\n * ```ts\n * manage: {\n * createListFilters({ field }) {\n * return `\n * ${field.fieldId}: MyType\n * ${field.fieldId}_not: MyType\n * ${field.fieldId}_in: [MyType]\n * ${field.fieldId}_not_in: [MyType]\n * `;\n * }\n * }\n * ```\n */\n createListFilters?: (params: {\n model: Pick<CmsModel, \"singularApiName\">;\n field: TField;\n plugins: CmsFieldTypePlugins;\n }) => string;\n /**\n * Manage API schema definitions for the field and resolvers for them. Probably similar to `read.createSchema`.\n *\n * ```ts\n * createSchema() {\n * return {\n * typeDefs: `\n * myField {\n * id\n * date\n * }\n * `,\n * resolvers: {}\n * }\n * }\n * ```\n */\n createSchema?: (params: { models: CmsModel[] }) => GraphQLSchemaDefinition<CmsContext>;\n /**\n * Definition of the field type for GraphQL - be aware if multiple values is selected. Probably same as `read.createTypeField`.\n *\n * ```ts\n * manage: {\n * createTypeField({ field }) {\n * if (field.multipleValues) {\n * return field.fieldId + \": [MyType]\";\n * }\n *\n * return field.fieldId + \": MyType\";\n * }\n * }\n * ```\n */\n createTypeField: (params: {\n models: CmsModel[];\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }) => CmsModelFieldDefinition | string | null;\n /**\n * Definition for input GraphQL field type.\n *\n * ```ts\n * manage: {\n * createInputField({ field }) {\n * if (field.multipleValues) {\n * return field.fieldId + \": [MyField]\";\n * }\n *\n * return field.fieldId + \": MyField\";\n * }\n * }\n * ```\n */\n createInputField: (params: {\n models: CmsModel[];\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }) => CmsModelFieldDefinition | string | null;\n /**\n * Definition for field resolver.\n * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.\n *\n * ```ts\n * manage: {\n * createResolver({ field }) {\n * return instance => {\n * return instance.values[field.storageId];\n * };\n * }\n * }\n * ```\n */\n createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;\n };\n /**\n *\n * @param field\n */\n validateChildFields?: CmsModelFieldToGraphQLPluginValidateChildFields<TField>;\n}\n\n/**\n * Check for content model locked field.\n * A custom plugin definable by the user.\n *\n * @category CmsModel\n * @category Plugin\n */\nexport interface CmsModelLockedFieldPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-locked-field\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n */\n fieldType: string;\n /**\n * A method to check if field really is locked.\n */\n checkLockedField?: (params: { lockedField: LockedField; field: CmsModelField }) => void;\n /**\n * A method to get the locked field data.\n */\n getLockedFieldData?: (params: { field: CmsModelField }) => Record<string, any>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsFieldTypePlugins {\n [key: string]: CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * An interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface CmsIdentity {\n /**\n * ID if the user.\n */\n id: string;\n /**\n * Full name of the user.\n */\n displayName: string | null;\n /**\n * Type of the user (admin, user)\n */\n type: string;\n}\n\nexport interface OnSystemBeforeInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemAfterInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemInstallErrorTopicParams {\n error: Error;\n tenant: string;\n locale: string;\n}\n\nexport type CmsSystemContext = {\n getSystemVersion: () => Promise<string | null>;\n setSystemVersion: (version: string) => Promise<void>;\n installSystem: () => Promise<void>;\n /**\n * Lifecycle Events\n */\n onSystemBeforeInstall: Topic<OnSystemBeforeInstallTopicParams>;\n onSystemAfterInstall: Topic<OnSystemAfterInstallTopicParams>;\n onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;\n};\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n id?: string;\n name: string;\n slug?: string;\n description?: string | null;\n icon: string;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupUpdateInput {\n name?: string;\n slug?: string;\n description?: string;\n icon?: string;\n}\n\n/**\n * A representation of content model group in the database.\n *\n * @category CmsGroup\n * @category Database model\n */\nexport interface CmsGroup {\n /**\n * Generated ID.\n */\n id: string;\n /**\n * Name of the group.\n */\n name: string;\n /**\n * Slug for the group. Must be unique.\n */\n slug: string;\n /**\n * Group tenant.\n */\n tenant: string;\n /**\n * Locale this group belongs to.\n */\n locale: string;\n /**\n * Description for the group.\n */\n description: string | null;\n /**\n * Icon for the group. In a form of \"ico/ico\".\n */\n icon: string;\n /**\n * CreatedBy reference object.\n */\n createdBy?: CmsIdentity;\n /**\n * Date group was created on.\n */\n createdOn?: string;\n /**\n * Date group was created or changed on.\n */\n savedOn?: string;\n /**\n * Which Webiny version was this record stored with.\n */\n webinyVersion: string;\n /**\n * Is group private?\n * This is meant to be used for some internal groups - will not be visible in the schema.\n * Only available for the plugin constructed groups.\n */\n isPrivate?: boolean;\n /**\n * Is this group created via plugin?\n */\n isPlugin?: boolean;\n}\n\n/**\n * A `data.where` parameter received when listing content model groups.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupListParams {\n where: {\n tenant: string;\n locale: string;\n };\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupCreateErrorTopicParams {\n input: CmsGroupCreateInput;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupUpdateErrorTopicParams {\n input: CmsGroupUpdateInput;\n original: CmsGroup;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupDeleteErrorTopicParams {\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup>;\n /**\n * List all content model groups. Filterable via params.\n */\n listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;\n /**\n * Delete content model group by given id.\n */\n deleteGroup: (id: string) => Promise<boolean>;\n /**\n * Clear the cached groups.\n */\n clearGroupsCache: () => void;\n /**\n * Lifecycle Events\n */\n onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;\n onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;\n onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;\n onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;\n onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;\n onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;\n onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;\n}\n\n/**\n * Definition for content model field validator.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidation {\n name: string;\n message: string;\n settings?: {\n value?: string | number;\n values?: string[];\n preset?: string;\n [key: string]: any;\n };\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateInput {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Singular name of the content model to be used in the API.\n */\n singularApiName: string;\n /**\n * Plural name of the content model to be used in the API.\n */\n pluralApiName: string;\n /**\n * Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.\n */\n modelId?: string;\n /**\n * Description of the content model.\n */\n description?: string | null;\n /**\n * Group where to put the content model in.\n */\n group: string;\n /**\n * A list of content model fields to define the entry values.\n */\n fields?: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout?: string[][];\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Fields fieldId which are picked to represent the CMS entry.\n */\n titleFieldId?: string | null;\n descriptionFieldId?: string | null;\n imageFieldId?: string | null;\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model from existing model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateFromInput extends CmsModelCreateInput {\n /**\n * Locale into which we want to clone the model into.\n */\n locale?: string;\n}\n\n/**\n * A definition for content model field received from the user.\n *\n * Input type for `CmsModelField`.\n * @see CmsModelField\n *\n * @category GraphQL params\n * @category ModelField\n */\nexport interface CmsModelFieldInput {\n /**\n * Generated ID.\n */\n id: string;\n /**\n * Type of the field. A plugin for the field must be defined.\n * @see CmsModelFieldToGraphQLPlugin\n */\n type: string;\n /**\n * Field outside world identifier for the field. Must be unique in the model.\n */\n fieldId: string;\n /**\n * Label for the field.\n */\n label: string;\n /**\n * Text to display below the field to help user what to write in the field.\n */\n helpText?: string | null;\n /**\n * Text to display in the field.\n */\n placeholderText?: string | null;\n /**\n * Fields can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Are multiple values allowed?\n */\n multipleValues?: boolean;\n /**\n * Predefined values options for the field. Check the reference for more information.\n */\n predefinedValues?: CmsModelFieldPredefinedValues;\n /**\n * Renderer options for the field. Check the reference for more information.\n */\n renderer?: CmsModelFieldRenderer;\n /**\n * List of validations for the field.\n */\n validation?: CmsModelFieldValidation[];\n /**\n * @see CmsModelField.listValidation\n */\n listValidation?: CmsModelFieldValidation[];\n /**\n * User defined settings.\n */\n settings?: Record<string, any>;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelUpdateInput {\n /**\n * A new content model name.\n */\n name?: string;\n /**\n * A new singular name of the content model to be used in the API.\n */\n singularApiName?: string;\n /**\n * A new plural name of the content model to be used in the API.\n */\n pluralApiName?: string;\n /**\n * A group we want to move the model to.\n */\n group?: string;\n /**\n * A new description of the content model.\n */\n description?: string | null;\n /**\n * A list of content model fields to define the entry values.\n */\n fields: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: string[][];\n /**\n * Fields fieldId which are picked to represent the CMS entry.\n */\n titleFieldId?: string | null;\n descriptionFieldId?: string | null;\n imageFieldId?: string | null;\n}\n\n/**\n * A plugin to load a CmsModelManager.\n *\n * @see CmsModelManager\n *\n * @category Plugin\n * @category CmsModel\n * @category CmsEntry\n */\nexport interface ModelManagerPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-content-model-manager\";\n /**\n * Specific model CmsModelManager loader. Can target exact modelId(s).\n * Be aware that if you define multiple plugins without `modelId`, last one will run.\n */\n modelId?: string[] | string;\n /**\n * Create a CmsModelManager for specific type - or new default one.\n * 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)\n */\n create: (context: CmsContext, model: CmsModel) => Promise<CmsModelManager>;\n}\n\n/**\n * A content entry values definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntryValues {\n [key: string]: any;\n}\n\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<T = CmsEntryValues> {\n /**\n * A version of the webiny this entry was created with.\n * This can be used when upgrading the system, so we know which entries to update.\n */\n webinyVersion: string;\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n /**\n * CreatedBy object reference.\n */\n createdBy: CmsIdentity;\n /**\n * OwnedBy object reference. Can be different from CreatedBy.\n */\n ownedBy: CmsIdentity;\n /**\n * ModifiedBy object reference. Last person who modified the entry.\n */\n modifiedBy?: CmsIdentity | null;\n /**\n * A string of Date.toISOString() type.\n * Populated on creation.\n */\n createdOn: string;\n /**\n * A string of Date.toISOString() type.\n * Populated every time entry is saved.\n */\n savedOn: string;\n /**\n * Model ID of the definition for the entry.\n * @see CmsModel\n */\n modelId: string;\n /**\n * A locale of the entry.\n * @see I18NLocale.code\n */\n locale: string;\n /**\n * A string of Date.toISOString() type - if published.\n * Populated when entry is published.\n */\n publishedOn?: string;\n /**\n * A revision version of the entry.\n */\n version: number;\n /**\n * Is the entry locked?\n */\n locked: boolean;\n /**\n * Status type of the entry.\n */\n status: CmsEntryStatus;\n /**\n * A mapped storageId -> value object.\n *\n * @see CmsModelField\n */\n values: T;\n /**\n * Advanced Content Organization\n */\n location?: {\n folderId?: string | null;\n };\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.\n * Be aware that when accessing properties in it on old systems, it will break if not checked first.\n *\n * Available only on the Manage API in entry GraphQL type `meta.data` property.\n */\n meta?: {\n [key: string]: any;\n };\n}\n\nexport interface CmsStorageEntry extends CmsEntry {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\n}\n\n/**\n * A definition for content model manager to be used in the code.\n * The default one uses `CmsEntryContext` methods internally, but devs can change to what every they want.\n *\n * @see CmsEntryContext\n *\n * @category Context\n * @category CmsEntry\n * @category CmsModel\n */\nexport interface CmsModelManager {\n /**\n * List only published entries in the content model.\n */\n listPublished: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * List latest entries in the content model. Used for administration.\n */\n listLatest: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * Get a list of published entries by the ID list.\n */\n getPublishedByIds: (ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Get a list of the latest entries by the ID list.\n */\n getLatestByIds: (ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Get an entry filtered by given params. Will always get one.\n */\n get: (id: string) => Promise<CmsEntry>;\n /**\n * Create an entry.\n */\n create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Update an entry.\n */\n update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Delete an entry.\n */\n delete: (id: string) => Promise<void>;\n}\n\n/**\n * Create\n */\nexport interface OnModelBeforeCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\n\nexport interface OnModelAfterCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\n\nexport interface OnModelCreateErrorTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Create From / Clone\n */\nexport interface OnModelBeforeCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelAfterCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelCreateFromErrorParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Update\n */\nexport interface OnModelBeforeUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelAfterUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelUpdateErrorTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Delete\n */\nexport interface OnModelBeforeDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelAfterDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelDeleteErrorTopicParams {\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Initialize\n */\nexport interface OnModelInitializeParams {\n model: CmsModel;\n data: Record<string, any>;\n}\n\n/**\n *\n */\nexport interface CmsModelUpdateDirectParams {\n model: CmsModel;\n original: CmsModel;\n}\n\n/**\n * Cms Model in the context.\n *\n * @category Context\n * @category CmsModel\n */\nexport interface CmsModelContext {\n /**\n * Get a single content model.\n */\n getModel: (modelId: string) => Promise<CmsModel | null>;\n /**\n * Get all content models.\n */\n listModels: () => Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel: (data: CmsModelCreateInput) => Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom: (modelId: string, data: CmsModelCreateFromInput) => Promise<CmsModel>;\n /**\n * Update content model without data validation. Used internally.\n * @hidden\n */\n updateModelDirect: (params: CmsModelUpdateDirectParams) => Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel: (modelId: string, data: CmsModelUpdateInput) => Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel: (modelId: string) => Promise<void>;\n /**\n * Possibility for users to trigger the model initialization.\n * They can hook into it and do what ever they want to.\n *\n * Primary idea behind this is creating the index, for the code models, in the ES.\n */\n initializeModel: (modelId: string, data: Record<string, any>) => Promise<boolean>;\n /**\n * Get an instance of CmsModelManager for given content modelId.\n *\n * @see CmsModelManager\n */\n getEntryManager: (model: CmsModel | string) => Promise<CmsModelManager>;\n /**\n * Get all content model managers mapped by modelId.\n * @see CmsModelManager\n */\n getEntryManagers: () => Map<string, CmsModelManager>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache: () => void;\n /**\n * Lifecycle Events\n */\n onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;\n onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;\n onModelCreateError: Topic<OnModelCreateErrorTopicParams>;\n onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;\n onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;\n onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;\n onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;\n onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;\n onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;\n onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;\n onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;\n onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;\n onModelInitialize: Topic<OnModelInitializeParams>;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef {\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n}\n\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Generated ID without the version.\n */\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n /**\n * Contains the owner of the entry. An \"owner\" is the identity who originally created the entry.\n * Subsequent revisions can be created by other identities, and those will be stored in `createdBy`,\n * but the `owner` is always the original author of the entry.\n *\n * Can be sent via the API or set internal if user can see only their own entries.\n */\n ownedBy?: string;\n ownedBy_not?: string;\n ownedBy_in?: string[];\n ownedBy_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n version?: number;\n version_lt?: number;\n version_gt?: number;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n published?: boolean;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n latest?: boolean;\n /**\n * ACO related parameters.\n */\n wbyAco_location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n };\n /**\n * This is to allow querying by any content model field defined by the user.\n */\n [key: string]:\n | string\n | number\n | boolean\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhere[]\n | CmsEntryListWhere\n | CmsEntryListWhereRef;\n /**\n * To allow querying via nested queries, we added the AND / OR properties.\n */\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n}\n\n/**\n * Entry listing sort.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport type CmsEntryListSort = string[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * Create\n */\nexport interface OnEntryBeforeCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateErrorTopicParams {\n error: Error;\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Revision Create\n */\nexport interface OnEntryRevisionBeforeCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionAfterCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateRevisionErrorTopicParams {\n error: Error;\n input: CreateFromCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Update\n */\nexport interface OnEntryBeforeUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUpdateErrorTopicParams {\n error: Error;\n input: UpdateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Move\n */\nexport interface OnEntryBeforeMoveTopicParams {\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterMoveTopicParams {\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryMoveErrorTopicParams {\n error: Error;\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Publish\n */\n\nexport interface OnEntryBeforePublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterPublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryPublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Republish\n */\nexport interface OnEntryBeforeRepublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterRepublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryRepublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Unpublish\n */\n\nexport interface OnEntryBeforeUnpublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterUnpublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUnpublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionAfterDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryBeforeDeleteMultipleTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n}\n\nexport interface OnEntryAfterDeleteMultipleTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n}\n\nexport interface OnEntryDeleteMultipleErrorTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n error: Error;\n}\n\nexport interface OnEntryBeforeGetTopicParams {\n model: CmsModel;\n where: CmsEntryListWhere;\n}\n\nexport interface EntryBeforeListTopicParams {\n where: CmsEntryListWhere;\n model: CmsModel;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput {\n id?: string;\n wbyAco_location?: {\n folderId?: string | null;\n };\n [key: string]: any;\n}\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput {\n [key: string]: any;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput {\n wbyAco_location?: {\n folderId?: string | null;\n };\n [key: string]: any;\n}\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface GetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\n/**\n * @category CmsEntry\n */\nexport interface CmsDeleteEntryOptions {\n /**\n * Runs the delete commands even if the entry is not found in the DynamoDB.\n * This is to force clean the entry records that might have been left behind a failed delete.\n */\n force?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface DeleteMultipleEntriesParams {\n entries: string[];\n}\n\nexport type DeleteMultipleEntriesResponse = { id: string }[];\n\nexport interface CmsEntryValidateResponse {\n [key: string]: any;\n}\n/**\n * Cms Entry CRUD methods in the context.\n *\n * @category Context\n * @category CmsEntry\n */\nexport interface CmsEntryContext {\n /**\n * Get a single content entry for a model.\n */\n getEntry: (model: CmsModel, params: CmsEntryGetParams) => Promise<CmsEntry>;\n /**\n * Get a list of entries for a model by a given ID (revision).\n */\n getEntriesByIds: (model: CmsModel, revisions: string[]) => Promise<CmsEntry[]>;\n /**\n * Get the entry for a model by a given ID.\n */\n getEntryById: (model: CmsModel, revision: string) => Promise<CmsEntry>;\n /**\n * List entries for a model. Internal method used by get, listLatest and listPublished.\n */\n listEntries: <T = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryListParams\n ) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * Lists the latest entries. Used for manage API.\n */\n listLatestEntries: <T = CmsEntryValues>(\n model: CmsModel,\n params?: CmsEntryListParams\n ) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * List published entries. Used for read API.\n */\n listPublishedEntries: <T = CmsEntryValues>(\n model: CmsModel,\n params?: CmsEntryListParams\n ) => Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * List published entries by IDs.\n */\n getPublishedEntriesByIds: (model: CmsModel, ids: string[]) => Promise<CmsEntry[]>;\n /**\n * List latest entries by IDs.\n */\n getLatestEntriesByIds: (model: CmsModel, ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Create a new content entry.\n */\n createEntry: (\n model: CmsModel,\n input: CreateCmsEntryInput,\n options?: CreateCmsEntryOptionsInput\n ) => Promise<CmsEntry>;\n /**\n * Create a new entry from already existing entry.\n */\n createEntryRevisionFrom: (\n model: CmsModel,\n id: string,\n input: CreateFromCmsEntryInput,\n options?: CreateRevisionCmsEntryOptionsInput\n ) => Promise<CmsEntry>;\n /**\n * Update existing entry.\n */\n updateEntry: (\n model: CmsModel,\n id: string,\n input: UpdateCmsEntryInput,\n meta?: Record<string, any>,\n options?: UpdateCmsEntryOptionsInput\n ) => Promise<CmsEntry>;\n /**\n * Validate the entry - either new one or existing one.\n */\n validateEntry: (\n model: CmsModel,\n id?: string,\n input?: UpdateCmsEntryInput\n ) => Promise<CmsEntryValidateResponse>;\n /**\n * Move entry, and all its revisions, to a new folder.\n */\n moveEntry: (model: CmsModel, id: string, folderId: string) => Promise<CmsEntry>;\n /**\n * Method that republishes entry with given identifier.\n * @internal\n */\n republishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Delete only a certain revision of the entry.\n */\n deleteEntryRevision: (model: CmsModel, id: string) => Promise<void>;\n /**\n * Delete entry with all its revisions.\n */\n deleteEntry: (model: CmsModel, id: string, options?: CmsDeleteEntryOptions) => Promise<void>;\n /**\n * Delete multiple entries\n */\n deleteMultipleEntries: (\n model: CmsModel,\n params: DeleteMultipleEntriesParams\n ) => Promise<DeleteMultipleEntriesResponse>;\n /**\n * Publish entry.\n */\n publishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Unpublish entry.\n */\n unpublishEntry: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Get all entry revisions.\n */\n getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;\n /**\n * List all unique values for a given field.\n *\n * @internal\n */\n getUniqueFieldValues: (\n model: CmsModel,\n params: GetUniqueFieldValuesParams\n ) => Promise<CmsEntryUniqueValue[]>;\n /**\n * Lifecycle Events\n */\n onEntryBeforeCreate: Topic<OnEntryBeforeCreateTopicParams>;\n onEntryAfterCreate: Topic<OnEntryAfterCreateTopicParams>;\n onEntryCreateError: Topic<OnEntryCreateErrorTopicParams>;\n\n onEntryRevisionBeforeCreate: Topic<OnEntryRevisionBeforeCreateTopicParams>;\n onEntryRevisionAfterCreate: Topic<OnEntryRevisionAfterCreateTopicParams>;\n onEntryRevisionCreateError: Topic<OnEntryCreateRevisionErrorTopicParams>;\n\n onEntryBeforeUpdate: Topic<OnEntryBeforeUpdateTopicParams>;\n onEntryAfterUpdate: Topic<OnEntryAfterUpdateTopicParams>;\n onEntryUpdateError: Topic<OnEntryUpdateErrorTopicParams>;\n\n onEntryBeforeMove: Topic<OnEntryBeforeMoveTopicParams>;\n onEntryAfterMove: Topic<OnEntryAfterMoveTopicParams>;\n onEntryMoveError: Topic<OnEntryMoveErrorTopicParams>;\n\n onEntryBeforeDelete: Topic<OnEntryBeforeDeleteTopicParams>;\n onEntryAfterDelete: Topic<OnEntryAfterDeleteTopicParams>;\n onEntryDeleteError: Topic<OnEntryDeleteErrorTopicParams>;\n\n onEntryRevisionBeforeDelete: Topic<OnEntryRevisionBeforeDeleteTopicParams>;\n onEntryRevisionAfterDelete: Topic<OnEntryRevisionAfterDeleteTopicParams>;\n onEntryRevisionDeleteError: Topic<OnEntryRevisionDeleteErrorTopicParams>;\n\n onEntryBeforePublish: Topic<OnEntryBeforePublishTopicParams>;\n onEntryAfterPublish: Topic<OnEntryAfterPublishTopicParams>;\n onEntryPublishError: Topic<OnEntryPublishErrorTopicParams>;\n\n onEntryBeforeRepublish: Topic<OnEntryBeforeRepublishTopicParams>;\n onEntryAfterRepublish: Topic<OnEntryAfterRepublishTopicParams>;\n onEntryRepublishError: Topic<OnEntryRepublishErrorTopicParams>;\n\n onEntryBeforeUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;\n onEntryAfterUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;\n onEntryUnpublishError: Topic<OnEntryUnpublishErrorTopicParams>;\n\n onEntryBeforeGet: Topic<OnEntryBeforeGetTopicParams>;\n onEntryBeforeList: Topic<EntryBeforeListTopicParams>;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * A base security permission for CMS.\n *\n * @category SecurityPermission\n */\nexport interface BaseCmsSecurityPermission extends SecurityPermission {\n own?: boolean;\n rwd: string | number;\n}\n\n/**\n * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n locale: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n [key: string]: any;\n}\n\nexport interface CmsGroupStorageOperationsListParams {\n where: CmsGroupStorageOperationsListWhereParams;\n sort?: string[];\n}\n\nexport interface CmsGroupStorageOperationsCreateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsUpdateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsDeleteParams {\n group: CmsGroup;\n}\n\n/**\n * Description of the CmsGroup CRUD operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsGroupStorageOperations {\n /**\n * Gets content model group by given id.\n */\n get: (params: CmsGroupStorageOperationsGetParams) => Promise<CmsGroup | null>;\n /**\n * List all content model groups. Filterable via params.\n */\n list: (params: CmsGroupStorageOperationsListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n create: (params: CmsGroupStorageOperationsCreateParams) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<CmsGroup>;\n /**\n * Delete the content model group.\n */\n delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<CmsGroup>;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n locale: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsDeleteParams {\n model: CmsModel;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsModelStorageOperations {\n /**\n * Gets content model by given id.\n */\n get: (params: CmsModelStorageOperationsGetParams) => Promise<CmsModel | null>;\n /**\n * List all content models. Filterable via params.\n */\n list: (params: CmsModelStorageOperationsListParams) => Promise<CmsModel[]>;\n /**\n * Create a new content model.\n */\n create: (params: CmsModelStorageOperationsCreateParams) => Promise<CmsModel>;\n /**\n * Update existing content model.\n */\n update: (params: CmsModelStorageOperationsUpdateParams) => Promise<CmsModel>;\n /**\n * Delete the content model.\n */\n delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<CmsModel>;\n}\n\nexport interface CmsEntryStorageOperationsGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n}\n\nexport interface CmsEntryStorageOperationsListParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit: number;\n after?: string | null;\n}\n\nexport interface CmsEntryStorageOperationsCreateParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: T;\n /**\n * Entry that was set as latest.\n */\n latestEntry: CmsEntry | null;\n /**\n * Entry that was set as latest, directly from storage, with transformations.\n */\n latestStorageEntry: T | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams {\n entry: CmsEntry;\n}\n\nexport interface CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\nexport interface CmsEntryStorageOperationsGetByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetLatestByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionsParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetLatestRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPreviousRevisionParams {\n entryId: string;\n version: number;\n}\n\nexport interface CmsEntryStorageOperationsListResponse<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Has more items to load with the current filtering?\n */\n hasMoreItems: boolean;\n /**\n * Items loaded with current filtering.\n */\n items: T[];\n /**\n * Pointer for where to start the new item set.\n */\n cursor: string | null;\n /**\n * Total amount of items with the current filter.\n */\n totalCount: number;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n *\n *\n * @category StorageOperations\n * @category CmsEntry\n */\nexport interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorageEntry> {\n /**\n * Get all the entries of the ids.\n */\n getByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<T[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<T | null>;\n /**\n * Gets entry by given params.\n */\n get: (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: (\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<T>>;\n /**\n * Create a new entry.\n */\n create: (model: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: (\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<T>;\n /**\n * Update existing entry.\n */\n update: (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;\n /**\n * Move entry and all its entries into a new folder.\n */\n move: (model: CmsModel, id: string, folderId: string) => Promise<void>;\n /**\n * Delete the entry revision.\n */\n deleteRevision: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ) => Promise<void>;\n /**\n * Delete the entry.\n */\n delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Delete multiple entries, with a limit on how much can be deleted in one call.\n */\n deleteMultipleEntries: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteEntriesParams\n ) => Promise<void>;\n /**\n * Publish the entry.\n */\n publish: (model: CmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;\n /**\n * Unpublish the entry.\n */\n unpublish: (model: CmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;\n /**\n * Method to list all the unique values for the given field id.\n * Simplest use case would be to aggregate tags for some content.\n * @internal\n */\n getUniqueFieldValues: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetUniqueFieldValuesParams\n ) => Promise<CmsEntryUniqueValue[]>;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\n}\n\nexport interface CmsSystem {\n version?: string;\n readAPIKey?: string;\n /**\n * System tenant.\n */\n tenant: string;\n}\n\nexport interface CmsSystemStorageOperationsGetParams {\n tenant: string;\n}\n\nexport interface CmsSystemStorageOperationsCreateParams {\n system: CmsSystem;\n}\n\nexport interface CmsSystemStorageOperationsUpdateParams {\n system: CmsSystem;\n}\n\nexport interface CmsSystemStorageOperations {\n /**\n * Get the system data.\n */\n get: (params: CmsSystemStorageOperationsGetParams) => Promise<CmsSystem | null>;\n /**\n * Create the system info in the storage.\n */\n create: (params: CmsSystemStorageOperationsCreateParams) => Promise<CmsSystem>;\n /**\n * Update the system info in the storage.\n */\n update: (params: CmsSystemStorageOperationsUpdateParams) => Promise<CmsSystem>;\n}\n\nexport interface HeadlessCmsStorageOperations<C = CmsContext> {\n name: string;\n system: CmsSystemStorageOperations;\n groups: CmsGroupStorageOperations;\n models: CmsModelStorageOperations;\n entries: CmsEntryStorageOperations;\n /**\n * Either attach something from the storage operations or run something in it.\n */\n beforeInit: (context: C) => Promise<void>;\n init?: (context: C) => Promise<void>;\n}\n"],"mappings":";;;;;;AAuEA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AAiDA;AACA;AACA;AACA;AACA;AACA;AAgGA;AACA;AACA;AAUA;AACA;AACA;AASA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AAwBA;AACA;AACA;AACA;AACA;AACA;AACA;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AAmHA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AA+CA;AACA;AACA;AACA;AACA;AAiQA;AACA;AACA;AACA;AACA;AACA;AACA;AAoBA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AA4CA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AA0DA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAwCA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AAqDA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyDA;AACA;AACA;AACA;AACA;AACA;AA6CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AAuGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAoCA;AACA;AACA;AAiBA;AACA;AACA;AAoBA;AACA;AACA;AAoBA;AACA;AACA;AAcA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAuEA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AA2FA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AAqBA;AACA;AACA;AAwBA;AACA;AACA;AAuBA;AACA;AACA;AAoBA;AACA;AACA;AAmBA;AACA;AACA;AAkBA;AACA;AACA;AAgFA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AAMA;AACA;AACA;AASA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAsKA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AA8CA;AACA;AACA;AACA;AACA;AAoDA;AACA;AACA;AACA;AACA;AAiMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IAkIYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAAC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA"}