@webiny/api-headless-cms 5.33.4 → 5.33.5-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/crud/contentModel.crud.js +3 -2
- package/crud/contentModel.crud.js.map +1 -1
- package/graphql/index.d.ts +1 -1
- package/graphql/schema/contentModels.js +5 -3
- package/graphql/schema/contentModels.js.map +1 -1
- package/graphqlFields/ref.js +10 -32
- package/graphqlFields/ref.js.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +23 -23
- package/types.d.ts +2 -1
- package/types.js.map +1 -1
|
@@ -571,7 +571,7 @@ const createModelsCrud = params => {
|
|
|
571
571
|
managers.delete(model.modelId);
|
|
572
572
|
},
|
|
573
573
|
|
|
574
|
-
async initializeModel(modelId) {
|
|
574
|
+
async initializeModel(modelId, data) {
|
|
575
575
|
/**
|
|
576
576
|
* We require that users have write permissions to initialize models.
|
|
577
577
|
* Maybe introduce another permission for it?
|
|
@@ -579,7 +579,8 @@ const createModelsCrud = params => {
|
|
|
579
579
|
await checkModelPermissions("w");
|
|
580
580
|
const model = await getModel(modelId);
|
|
581
581
|
await onModelInitialize.publish({
|
|
582
|
-
model
|
|
582
|
+
model,
|
|
583
|
+
data
|
|
583
584
|
});
|
|
584
585
|
return true;
|
|
585
586
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["featureVersion","semver","coerce","attachStorageIdToFields","fields","map","field","settings","storageId","fieldId","attachStorageIdToModelFields","model","webinyVersion","version","match","compare","createModelsCrud","params","getTenant","getIdentity","getLocale","storageOperations","context","loaders","listModels","DataLoader","models","list","where","tenant","id","locale","code","clearModelsCache","loader","Object","values","clearAll","managers","Map","updateManager","manager","contentModelManagerFactory","set","modelId","checkModelPermissions","check","checkPermissions","rwd","getModelsAsPlugins","plugins","byType","CmsModelPlugin","type","filter","plugin","t","l","contentModel","WEBINY_VERSION","validateModelFields","modelsGet","pluginModel","find","get","NotFoundError","modelsList","databaseModels","load","pluginsModels","concat","permission","filterAsync","validateOwnership","validateModelAccess","getModel","checkOwnership","checkModelAccess","getModelManager","target","has","m","onBeforeModelCreate","createTopic","onAfterModelCreate","onBeforeModelCreateFrom","onAfterModelCreateFrom","onBeforeModelUpdate","onAfterModelUpdate","onBeforeModelDelete","onAfterModelDelete","onModelInitialize","assignBeforeModelCreate","assignAfterModelCreate","assignBeforeModelUpdate","assignAfterModelUpdate","assignAfterModelCreateFrom","assignBeforeModelDelete","assignAfterModelDelete","createModel","inputData","createdData","CreateContentModelModel","populate","validate","input","toJSON","security","disableAuthorization","group","cms","getGroup","enableAuthorization","createFieldModels","identity","name","description","titleFieldId","createdBy","displayName","createdOn","Date","toISOString","savedOn","lockedFields","layout","publish","createdModel","create","updateModelDirect","initialModel","original","resultModel","update","createModelFrom","data","CreateContentModelModelFrom","i18n","groups","updateModel","updatedData","UpdateContentModelModel","onlyDirty","keys","length","groupData","deleteModel","delete","ex","WebinyError","message","error","initializeModel","getEntryManager","getManagers","getEntryManagers"],"sources":["contentModel.crud.ts"],"sourcesContent":["import {\n CmsContext,\n CmsModel,\n CmsModelContext,\n CmsModelManager,\n CmsModelPermission,\n HeadlessCmsStorageOperations,\n BeforeModelCreateTopicParams,\n AfterModelCreateTopicParams,\n BeforeModelUpdateTopicParams,\n AfterModelUpdateTopicParams,\n BeforeModelDeleteTopicParams,\n AfterModelDeleteTopicParams,\n OnModelInitializeParams,\n BeforeModelCreateFromTopicParams,\n AfterModelCreateFromTopicParams,\n CmsModelCreateInput,\n CmsModelUpdateInput,\n CmsModelCreateFromInput,\n CmsModelField\n} from \"~/types\";\nimport DataLoader from \"dataloader\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { contentModelManagerFactory } from \"./contentModel/contentModelManagerFactory\";\nimport {\n CreateContentModelModel,\n CreateContentModelModelFrom,\n UpdateContentModelModel\n} from \"./contentModel/models\";\nimport { createFieldModels } from \"./contentModel/createFieldModels\";\nimport WebinyError from \"@webiny/error\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { assignBeforeModelCreate } from \"./contentModel/beforeCreate\";\nimport { assignBeforeModelUpdate } from \"./contentModel/beforeUpdate\";\nimport { assignBeforeModelDelete } from \"./contentModel/beforeDelete\";\nimport { assignAfterModelCreate } from \"./contentModel/afterCreate\";\nimport { assignAfterModelUpdate } from \"./contentModel/afterUpdate\";\nimport { assignAfterModelDelete } from \"./contentModel/afterDelete\";\nimport { assignAfterModelCreateFrom } from \"./contentModel/afterCreateFrom\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport { checkPermissions } from \"~/utils/permissions\";\nimport { filterAsync } from \"~/utils/filterAsync\";\nimport { checkOwnership, validateOwnership } from \"~/utils/ownership\";\nimport { checkModelAccess, validateModelAccess } from \"~/utils/access\";\nimport { validateModelFields } from \"~/crud/contentModel/validateModelFields\";\nimport semver, { SemVer } from \"semver\";\n\n/**\n * TODO: remove for 5.34.0\n * Required because of the 5.33.0 upgrade.\n * Until the upgrade is done, API will break because there is no storageId assigned.\n */\nconst featureVersion = semver.coerce(\"5.33.0\") as SemVer;\n\nconst attachStorageIdToFields = (fields: CmsModelField[]): CmsModelField[] => {\n return fields.map(field => {\n if (field.settings?.fields) {\n field.settings.fields = attachStorageIdToFields(field.settings.fields);\n }\n if (!field.storageId) {\n field.storageId = field.fieldId;\n }\n return field;\n });\n};\n\nconst attachStorageIdToModelFields = (model: CmsModel): CmsModelField[] => {\n if (!model.webinyVersion) {\n return model.fields;\n }\n\n const version = semver.coerce(model.webinyVersion);\n if (!version) {\n return model.fields;\n }\n /**\n * Unfortunately we need to check for beta and next.\n * TODO remove after 5.33.0\n */\n if (model.webinyVersion.match(/beta|next/)) {\n return attachStorageIdToFields(model.fields);\n }\n if (semver.compare(version, featureVersion) >= 0) {\n return model.fields;\n }\n return attachStorageIdToFields(model.fields);\n};\n\nexport interface CreateModelsCrudParams {\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n storageOperations: HeadlessCmsStorageOperations;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n}\nexport const createModelsCrud = (params: CreateModelsCrudParams): CmsModelContext => {\n const { getTenant, getIdentity, getLocale, storageOperations, context } = params;\n\n const loaders = {\n listModels: new DataLoader(async () => {\n const models = await storageOperations.models.list({\n where: {\n tenant: getTenant().id,\n locale: getLocale().code\n }\n });\n return [\n models.map(model => {\n return {\n ...model,\n fields: attachStorageIdToModelFields(model),\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code\n };\n })\n ];\n })\n };\n\n const clearModelsCache = (): void => {\n for (const loader of Object.values(loaders)) {\n loader.clearAll();\n }\n };\n\n const managers = new Map<string, CmsModelManager>();\n const updateManager = async (\n context: CmsContext,\n model: CmsModel\n ): Promise<CmsModelManager> => {\n const manager = await contentModelManagerFactory(context, model);\n managers.set(model.modelId, manager);\n return manager;\n };\n\n const checkModelPermissions = (check: string): Promise<CmsModelPermission> => {\n return checkPermissions(context, \"cms.contentModel\", { rwd: check });\n };\n\n const getModelsAsPlugins = (): CmsModel[] => {\n const tenant = getTenant().id;\n const locale = getLocale().code;\n\n const models = context.plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n /**\n * We need to filter out models that are not for this tenant or locale.\n * If it does not have tenant or locale define, it is for every locale and tenant\n */\n .filter(plugin => {\n const { tenant: t, locale: l } = plugin.contentModel;\n if (t && t !== tenant) {\n return false;\n } else if (l && l !== locale) {\n return false;\n }\n return true;\n })\n .map<CmsModel>(plugin => {\n return {\n ...plugin.contentModel,\n tenant,\n locale,\n webinyVersion: context.WEBINY_VERSION\n };\n });\n /**\n * Only point where we can truly validate the user model is in the runtime.\n */\n for (const model of models) {\n validateModelFields({\n model,\n plugins: context.plugins\n });\n }\n return models;\n };\n\n const modelsGet = async (modelId: string): Promise<CmsModel> => {\n const pluginModel = getModelsAsPlugins().find(model => model.modelId === modelId);\n\n if (pluginModel) {\n return pluginModel;\n }\n\n const model = await storageOperations.models.get({\n tenant: getTenant().id,\n locale: getLocale().code,\n modelId\n });\n\n if (!model) {\n throw new NotFoundError(`Content model \"${modelId}\" was not found!`);\n }\n\n return {\n ...model,\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code\n };\n };\n\n const modelsList = async (): Promise<CmsModel[]> => {\n const databaseModels = await loaders.listModels.load(\"listModels\");\n\n const pluginsModels = getModelsAsPlugins();\n\n return databaseModels.concat(pluginsModels);\n };\n\n const listModels = async () => {\n const permission = await checkModelPermissions(\"r\");\n const models = await modelsList();\n return filterAsync(models, async model => {\n if (!validateOwnership(context, permission, model)) {\n return false;\n }\n return validateModelAccess(context, model);\n });\n };\n\n const getModel = async (modelId: string): Promise<CmsModel> => {\n const permission = await checkModelPermissions(\"r\");\n\n const model = await modelsGet(modelId);\n\n checkOwnership(context, permission, model);\n await checkModelAccess(context, model);\n\n return model;\n };\n\n const getModelManager: CmsModelContext[\"getModelManager\"] = async (\n target\n ): Promise<CmsModelManager> => {\n const modelId = typeof target === \"string\" ? target : target.modelId;\n if (managers.has(modelId)) {\n return managers.get(modelId) as CmsModelManager;\n }\n const models = await modelsList();\n const model = models.find(m => m.modelId === modelId);\n if (!model) {\n throw new NotFoundError(`There is no content model \"${modelId}\".`);\n }\n return await updateManager(context, model);\n };\n\n const onBeforeModelCreate = createTopic<BeforeModelCreateTopicParams>();\n const onAfterModelCreate = createTopic<AfterModelCreateTopicParams>();\n const onBeforeModelCreateFrom = createTopic<BeforeModelCreateFromTopicParams>();\n const onAfterModelCreateFrom = createTopic<AfterModelCreateFromTopicParams>();\n const onBeforeModelUpdate = createTopic<BeforeModelUpdateTopicParams>();\n const onAfterModelUpdate = createTopic<AfterModelUpdateTopicParams>();\n const onBeforeModelDelete = createTopic<BeforeModelDeleteTopicParams>();\n const onAfterModelDelete = createTopic<AfterModelDeleteTopicParams>();\n\n const onModelInitialize = createTopic<OnModelInitializeParams>(\"cms.onModelInitialize\");\n /**\n * We need to assign some default behaviors.\n */\n assignBeforeModelCreate({\n onBeforeModelCreate,\n onBeforeModelCreateFrom,\n plugins: context.plugins,\n storageOperations\n });\n assignAfterModelCreate({\n context,\n onAfterModelCreate\n });\n assignBeforeModelUpdate({\n onBeforeModelUpdate,\n plugins: context.plugins,\n storageOperations\n });\n assignAfterModelUpdate({\n context,\n onAfterModelUpdate\n });\n assignAfterModelCreateFrom({\n context,\n onAfterModelCreateFrom\n });\n assignBeforeModelDelete({\n onBeforeModelDelete,\n plugins: context.plugins,\n storageOperations\n });\n assignAfterModelDelete({\n context,\n onAfterModelDelete\n });\n\n return {\n onBeforeModelCreate,\n onAfterModelCreate,\n onBeforeModelCreateFrom,\n onAfterModelCreateFrom,\n onBeforeModelUpdate,\n onAfterModelUpdate,\n onBeforeModelDelete,\n onAfterModelDelete,\n onModelInitialize,\n clearModelsCache,\n getModel,\n listModels,\n async createModel(inputData) {\n await checkModelPermissions(\"w\");\n\n const createdData = new CreateContentModelModel().populate(inputData);\n await createdData.validate();\n const input: CmsModelCreateInput = await createdData.toJSON();\n\n context.security.disableAuthorization();\n const group = await context.cms.getGroup(input.group);\n context.security.enableAuthorization();\n if (!group) {\n throw new NotFoundError(`There is no group \"${input.group}\".`);\n }\n\n const fields = await createFieldModels(input.fields);\n\n const identity = getIdentity();\n const model: CmsModel = {\n name: input.name,\n description: input.description || \"\",\n modelId: input.modelId || \"\",\n titleFieldId: \"id\",\n locale: getLocale().code,\n tenant: getTenant().id,\n group: {\n id: group.id,\n name: group.name\n },\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n fields,\n lockedFields: [],\n layout: input.layout || [],\n webinyVersion: context.WEBINY_VERSION\n };\n\n await onBeforeModelCreate.publish({\n input,\n model\n });\n\n const createdModel = await storageOperations.models.create({\n model\n });\n\n loaders.listModels.clearAll();\n\n await updateManager(context, model);\n\n await onAfterModelCreate.publish({\n input,\n model: createdModel\n });\n\n return createdModel;\n },\n /**\n * Method does not check for permissions or ownership.\n * @internal\n */\n async updateModelDirect(params) {\n const { model: initialModel, original } = params;\n\n const model: CmsModel = {\n ...initialModel,\n tenant: initialModel.tenant || getTenant().id,\n locale: initialModel.locale || getLocale().code,\n webinyVersion: context.WEBINY_VERSION\n };\n\n await onBeforeModelUpdate.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model\n });\n\n const resultModel = await storageOperations.models.update({\n model\n });\n\n await updateManager(context, resultModel);\n\n loaders.listModels.clearAll();\n\n await onAfterModelUpdate.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model: resultModel\n });\n\n return resultModel;\n },\n async createModelFrom(modelId, data) {\n await checkModelPermissions(\"w\");\n /**\n * Get a model record; this will also perform ownership validation.\n */\n const original = await getModel(modelId);\n\n const createdData = new CreateContentModelModelFrom().populate({\n name: data.name,\n modelId: data.modelId,\n description: data.description || original.description,\n group: data.group,\n locale: data.locale\n });\n\n await createdData.validate();\n const input: CmsModelCreateFromInput = await createdData.toJSON();\n\n const locale = await context.i18n.getLocale(input.locale || original.locale);\n if (!locale) {\n throw new NotFoundError(`There is no locale \"${input.locale}\".`);\n }\n /**\n * Use storage operations directly because we cannot get group from different locale via context methods.\n */\n const group = await context.cms.storageOperations.groups.get({\n id: input.group,\n tenant: original.tenant,\n locale: locale.code\n });\n if (!group) {\n throw new NotFoundError(`There is no group \"${input.group}\".`);\n }\n\n const identity = getIdentity();\n const model: CmsModel = {\n ...original,\n locale: locale.code,\n group: {\n id: group.id,\n name: group.name\n },\n name: input.name,\n modelId: input.modelId || \"\",\n description: input.description || \"\",\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n lockedFields: [],\n webinyVersion: context.WEBINY_VERSION\n };\n\n await onBeforeModelCreateFrom.publish({\n input,\n model,\n original\n });\n\n const createdModel = await storageOperations.models.create({\n model\n });\n\n loaders.listModels.clearAll();\n\n await updateManager(context, model);\n\n await onAfterModelCreateFrom.publish({\n input,\n original,\n model: createdModel\n });\n\n return createdModel;\n },\n async updateModel(modelId, inputData) {\n await checkModelPermissions(\"w\");\n\n // Get a model record; this will also perform ownership validation.\n const original = await getModel(modelId);\n\n const updatedData = new UpdateContentModelModel().populate(inputData);\n await updatedData.validate();\n\n const input: CmsModelUpdateInput = await updatedData.toJSON({ onlyDirty: true });\n if (Object.keys(input).length === 0) {\n /**\n * We need to return the original if nothing is to be updated.\n */\n return original;\n }\n let group: CmsModel[\"group\"] = {\n id: original.group.id,\n name: original.group.name\n };\n if (input.group) {\n context.security.disableAuthorization();\n const groupData = await context.cms.getGroup(input.group);\n context.security.enableAuthorization();\n if (!groupData) {\n throw new NotFoundError(`There is no group \"${input.group}\".`);\n }\n group = {\n id: groupData.id,\n name: groupData.name\n };\n }\n const fields = await createFieldModels(inputData.fields);\n const model: CmsModel = {\n ...original,\n ...input,\n group,\n tenant: original.tenant || getTenant().id,\n locale: original.locale || getLocale().code,\n webinyVersion: context.WEBINY_VERSION,\n fields,\n savedOn: new Date().toISOString()\n };\n\n await onBeforeModelUpdate.publish({\n input,\n original,\n model\n });\n\n const resultModel = await storageOperations.models.update({\n model\n });\n\n await updateManager(context, resultModel);\n\n await onAfterModelUpdate.publish({\n input,\n original,\n model: resultModel\n });\n\n return resultModel;\n },\n async deleteModel(modelId) {\n await checkModelPermissions(\"d\");\n\n const model = await getModel(modelId);\n\n await onBeforeModelDelete.publish({\n model\n });\n\n try {\n await storageOperations.models.delete({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete the content model\",\n ex.code || \"CONTENT_MODEL_DELETE_ERROR\",\n {\n error: ex,\n modelId: model.modelId\n }\n );\n }\n\n await onAfterModelDelete.publish({\n model\n });\n\n managers.delete(model.modelId);\n },\n async initializeModel(modelId) {\n /**\n * We require that users have write permissions to initialize models.\n * Maybe introduce another permission for it?\n */\n await checkModelPermissions(\"w\");\n\n const model = await getModel(modelId);\n\n await onModelInitialize.publish({ model });\n\n return true;\n },\n getModelManager,\n getEntryManager: async model => {\n return getModelManager(model);\n },\n getManagers: () => managers,\n getEntryManagers: () => managers\n };\n};\n"],"mappings":";;;;;;;;;;;AAqBA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAGC,eAAA,CAAOC,MAAP,CAAc,QAAd,CAAvB;;AAEA,MAAMC,uBAAuB,GAAIC,MAAD,IAA8C;EAC1E,OAAOA,MAAM,CAACC,GAAP,CAAWC,KAAK,IAAI;IAAA;;IACvB,uBAAIA,KAAK,CAACC,QAAV,4CAAI,gBAAgBH,MAApB,EAA4B;MACxBE,KAAK,CAACC,QAAN,CAAeH,MAAf,GAAwBD,uBAAuB,CAACG,KAAK,CAACC,QAAN,CAAeH,MAAhB,CAA/C;IACH;;IACD,IAAI,CAACE,KAAK,CAACE,SAAX,EAAsB;MAClBF,KAAK,CAACE,SAAN,GAAkBF,KAAK,CAACG,OAAxB;IACH;;IACD,OAAOH,KAAP;EACH,CARM,CAAP;AASH,CAVD;;AAYA,MAAMI,4BAA4B,GAAIC,KAAD,IAAsC;EACvE,IAAI,CAACA,KAAK,CAACC,aAAX,EAA0B;IACtB,OAAOD,KAAK,CAACP,MAAb;EACH;;EAED,MAAMS,OAAO,GAAGZ,eAAA,CAAOC,MAAP,CAAcS,KAAK,CAACC,aAApB,CAAhB;;EACA,IAAI,CAACC,OAAL,EAAc;IACV,OAAOF,KAAK,CAACP,MAAb;EACH;EACD;AACJ;AACA;AACA;;;EACI,IAAIO,KAAK,CAACC,aAAN,CAAoBE,KAApB,CAA0B,WAA1B,CAAJ,EAA4C;IACxC,OAAOX,uBAAuB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OAAOyI,EAAP,EAAW;QACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,oCADZ,EAEFF,EAAE,CAACpH,IAAH,IAAW,4BAFT,EAGF;UACIuH,KAAK,EAAEH,EADX;UAEIxG,OAAO,EAAEjC,KAAK,CAACiC;QAFnB,CAHE,CAAN;MAQH;;MAED,MAAM8C,kBAAkB,CAACoC,OAAnB,CAA2B;QAC7BnH;MAD6B,CAA3B,CAAN;MAIA2B,QAAQ,CAAC6G,MAAT,CAAgBxI,KAAK,CAACiC,OAAtB;IACH,CAzRE;;IA0RH,MAAM4G,eAAN,CAAsB5G,OAAtB,EAA+B;MAC3B;AACZ;AACA;AACA;MACY,MAAMC,qBAAqB,CAAC,GAAD,CAA3B;MAEA,MAAMlC,KAAK,GAAG,MAAMgE,QAAQ,CAAC/B,OAAD,CAA5B;MAEA,MAAM+C,iBAAiB,CAACmC,OAAlB,CAA0B;QAAEnH;MAAF,CAA1B,CAAN;MAEA,OAAO,IAAP;IACH,CAtSE;;IAuSHmE,eAvSG;IAwSH2E,eAAe,EAAE,MAAM9I,KAAN,IAAe;MAC5B,OAAOmE,eAAe,CAACnE,KAAD,CAAtB;IACH,CA1SE;IA2SH+I,WAAW,EAAE,MAAMpH,QA3ShB;IA4SHqH,gBAAgB,EAAE,MAAMrH;EA5SrB,CAAP;AA8SH,CApfM"}
|
|
1
|
+
{"version":3,"names":["featureVersion","semver","coerce","attachStorageIdToFields","fields","map","field","settings","storageId","fieldId","attachStorageIdToModelFields","model","webinyVersion","version","match","compare","createModelsCrud","params","getTenant","getIdentity","getLocale","storageOperations","context","loaders","listModels","DataLoader","models","list","where","tenant","id","locale","code","clearModelsCache","loader","Object","values","clearAll","managers","Map","updateManager","manager","contentModelManagerFactory","set","modelId","checkModelPermissions","check","checkPermissions","rwd","getModelsAsPlugins","plugins","byType","CmsModelPlugin","type","filter","plugin","t","l","contentModel","WEBINY_VERSION","validateModelFields","modelsGet","pluginModel","find","get","NotFoundError","modelsList","databaseModels","load","pluginsModels","concat","permission","filterAsync","validateOwnership","validateModelAccess","getModel","checkOwnership","checkModelAccess","getModelManager","target","has","m","onBeforeModelCreate","createTopic","onAfterModelCreate","onBeforeModelCreateFrom","onAfterModelCreateFrom","onBeforeModelUpdate","onAfterModelUpdate","onBeforeModelDelete","onAfterModelDelete","onModelInitialize","assignBeforeModelCreate","assignAfterModelCreate","assignBeforeModelUpdate","assignAfterModelUpdate","assignAfterModelCreateFrom","assignBeforeModelDelete","assignAfterModelDelete","createModel","inputData","createdData","CreateContentModelModel","populate","validate","input","toJSON","security","disableAuthorization","group","cms","getGroup","enableAuthorization","createFieldModels","identity","name","description","titleFieldId","createdBy","displayName","createdOn","Date","toISOString","savedOn","lockedFields","layout","publish","createdModel","create","updateModelDirect","initialModel","original","resultModel","update","createModelFrom","data","CreateContentModelModelFrom","i18n","groups","updateModel","updatedData","UpdateContentModelModel","onlyDirty","keys","length","groupData","deleteModel","delete","ex","WebinyError","message","error","initializeModel","getEntryManager","getManagers","getEntryManagers"],"sources":["contentModel.crud.ts"],"sourcesContent":["import {\n CmsContext,\n CmsModel,\n CmsModelContext,\n CmsModelManager,\n CmsModelPermission,\n HeadlessCmsStorageOperations,\n BeforeModelCreateTopicParams,\n AfterModelCreateTopicParams,\n BeforeModelUpdateTopicParams,\n AfterModelUpdateTopicParams,\n BeforeModelDeleteTopicParams,\n AfterModelDeleteTopicParams,\n OnModelInitializeParams,\n BeforeModelCreateFromTopicParams,\n AfterModelCreateFromTopicParams,\n CmsModelCreateInput,\n CmsModelUpdateInput,\n CmsModelCreateFromInput,\n CmsModelField\n} from \"~/types\";\nimport DataLoader from \"dataloader\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { contentModelManagerFactory } from \"./contentModel/contentModelManagerFactory\";\nimport {\n CreateContentModelModel,\n CreateContentModelModelFrom,\n UpdateContentModelModel\n} from \"./contentModel/models\";\nimport { createFieldModels } from \"./contentModel/createFieldModels\";\nimport WebinyError from \"@webiny/error\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { assignBeforeModelCreate } from \"./contentModel/beforeCreate\";\nimport { assignBeforeModelUpdate } from \"./contentModel/beforeUpdate\";\nimport { assignBeforeModelDelete } from \"./contentModel/beforeDelete\";\nimport { assignAfterModelCreate } from \"./contentModel/afterCreate\";\nimport { assignAfterModelUpdate } from \"./contentModel/afterUpdate\";\nimport { assignAfterModelDelete } from \"./contentModel/afterDelete\";\nimport { assignAfterModelCreateFrom } from \"./contentModel/afterCreateFrom\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport { checkPermissions } from \"~/utils/permissions\";\nimport { filterAsync } from \"~/utils/filterAsync\";\nimport { checkOwnership, validateOwnership } from \"~/utils/ownership\";\nimport { checkModelAccess, validateModelAccess } from \"~/utils/access\";\nimport { validateModelFields } from \"~/crud/contentModel/validateModelFields\";\nimport semver, { SemVer } from \"semver\";\n\n/**\n * TODO: remove for 5.34.0\n * Required because of the 5.33.0 upgrade.\n * Until the upgrade is done, API will break because there is no storageId assigned.\n */\nconst featureVersion = semver.coerce(\"5.33.0\") as SemVer;\n\nconst attachStorageIdToFields = (fields: CmsModelField[]): CmsModelField[] => {\n return fields.map(field => {\n if (field.settings?.fields) {\n field.settings.fields = attachStorageIdToFields(field.settings.fields);\n }\n if (!field.storageId) {\n field.storageId = field.fieldId;\n }\n return field;\n });\n};\n\nconst attachStorageIdToModelFields = (model: CmsModel): CmsModelField[] => {\n if (!model.webinyVersion) {\n return model.fields;\n }\n\n const version = semver.coerce(model.webinyVersion);\n if (!version) {\n return model.fields;\n }\n /**\n * Unfortunately we need to check for beta and next.\n * TODO remove after 5.33.0\n */\n if (model.webinyVersion.match(/beta|next/)) {\n return attachStorageIdToFields(model.fields);\n }\n if (semver.compare(version, featureVersion) >= 0) {\n return model.fields;\n }\n return attachStorageIdToFields(model.fields);\n};\n\nexport interface CreateModelsCrudParams {\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n storageOperations: HeadlessCmsStorageOperations;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n}\nexport const createModelsCrud = (params: CreateModelsCrudParams): CmsModelContext => {\n const { getTenant, getIdentity, getLocale, storageOperations, context } = params;\n\n const loaders = {\n listModels: new DataLoader(async () => {\n const models = await storageOperations.models.list({\n where: {\n tenant: getTenant().id,\n locale: getLocale().code\n }\n });\n return [\n models.map(model => {\n return {\n ...model,\n fields: attachStorageIdToModelFields(model),\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code\n };\n })\n ];\n })\n };\n\n const clearModelsCache = (): void => {\n for (const loader of Object.values(loaders)) {\n loader.clearAll();\n }\n };\n\n const managers = new Map<string, CmsModelManager>();\n const updateManager = async (\n context: CmsContext,\n model: CmsModel\n ): Promise<CmsModelManager> => {\n const manager = await contentModelManagerFactory(context, model);\n managers.set(model.modelId, manager);\n return manager;\n };\n\n const checkModelPermissions = (check: string): Promise<CmsModelPermission> => {\n return checkPermissions(context, \"cms.contentModel\", { rwd: check });\n };\n\n const getModelsAsPlugins = (): CmsModel[] => {\n const tenant = getTenant().id;\n const locale = getLocale().code;\n\n const models = context.plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n /**\n * We need to filter out models that are not for this tenant or locale.\n * If it does not have tenant or locale define, it is for every locale and tenant\n */\n .filter(plugin => {\n const { tenant: t, locale: l } = plugin.contentModel;\n if (t && t !== tenant) {\n return false;\n } else if (l && l !== locale) {\n return false;\n }\n return true;\n })\n .map<CmsModel>(plugin => {\n return {\n ...plugin.contentModel,\n tenant,\n locale,\n webinyVersion: context.WEBINY_VERSION\n };\n });\n /**\n * Only point where we can truly validate the user model is in the runtime.\n */\n for (const model of models) {\n validateModelFields({\n model,\n plugins: context.plugins\n });\n }\n return models;\n };\n\n const modelsGet = async (modelId: string): Promise<CmsModel> => {\n const pluginModel = getModelsAsPlugins().find(model => model.modelId === modelId);\n\n if (pluginModel) {\n return pluginModel;\n }\n\n const model = await storageOperations.models.get({\n tenant: getTenant().id,\n locale: getLocale().code,\n modelId\n });\n\n if (!model) {\n throw new NotFoundError(`Content model \"${modelId}\" was not found!`);\n }\n\n return {\n ...model,\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code\n };\n };\n\n const modelsList = async (): Promise<CmsModel[]> => {\n const databaseModels = await loaders.listModels.load(\"listModels\");\n\n const pluginsModels = getModelsAsPlugins();\n\n return databaseModels.concat(pluginsModels);\n };\n\n const listModels = async () => {\n const permission = await checkModelPermissions(\"r\");\n const models = await modelsList();\n return filterAsync(models, async model => {\n if (!validateOwnership(context, permission, model)) {\n return false;\n }\n return validateModelAccess(context, model);\n });\n };\n\n const getModel = async (modelId: string): Promise<CmsModel> => {\n const permission = await checkModelPermissions(\"r\");\n\n const model = await modelsGet(modelId);\n\n checkOwnership(context, permission, model);\n await checkModelAccess(context, model);\n\n return model;\n };\n\n const getModelManager: CmsModelContext[\"getModelManager\"] = async (\n target\n ): Promise<CmsModelManager> => {\n const modelId = typeof target === \"string\" ? target : target.modelId;\n if (managers.has(modelId)) {\n return managers.get(modelId) as CmsModelManager;\n }\n const models = await modelsList();\n const model = models.find(m => m.modelId === modelId);\n if (!model) {\n throw new NotFoundError(`There is no content model \"${modelId}\".`);\n }\n return await updateManager(context, model);\n };\n\n const onBeforeModelCreate = createTopic<BeforeModelCreateTopicParams>();\n const onAfterModelCreate = createTopic<AfterModelCreateTopicParams>();\n const onBeforeModelCreateFrom = createTopic<BeforeModelCreateFromTopicParams>();\n const onAfterModelCreateFrom = createTopic<AfterModelCreateFromTopicParams>();\n const onBeforeModelUpdate = createTopic<BeforeModelUpdateTopicParams>();\n const onAfterModelUpdate = createTopic<AfterModelUpdateTopicParams>();\n const onBeforeModelDelete = createTopic<BeforeModelDeleteTopicParams>();\n const onAfterModelDelete = createTopic<AfterModelDeleteTopicParams>();\n\n const onModelInitialize = createTopic<OnModelInitializeParams>(\"cms.onModelInitialize\");\n /**\n * We need to assign some default behaviors.\n */\n assignBeforeModelCreate({\n onBeforeModelCreate,\n onBeforeModelCreateFrom,\n plugins: context.plugins,\n storageOperations\n });\n assignAfterModelCreate({\n context,\n onAfterModelCreate\n });\n assignBeforeModelUpdate({\n onBeforeModelUpdate,\n plugins: context.plugins,\n storageOperations\n });\n assignAfterModelUpdate({\n context,\n onAfterModelUpdate\n });\n assignAfterModelCreateFrom({\n context,\n onAfterModelCreateFrom\n });\n assignBeforeModelDelete({\n onBeforeModelDelete,\n plugins: context.plugins,\n storageOperations\n });\n assignAfterModelDelete({\n context,\n onAfterModelDelete\n });\n\n return {\n onBeforeModelCreate,\n onAfterModelCreate,\n onBeforeModelCreateFrom,\n onAfterModelCreateFrom,\n onBeforeModelUpdate,\n onAfterModelUpdate,\n onBeforeModelDelete,\n onAfterModelDelete,\n onModelInitialize,\n clearModelsCache,\n getModel,\n listModels,\n async createModel(inputData) {\n await checkModelPermissions(\"w\");\n\n const createdData = new CreateContentModelModel().populate(inputData);\n await createdData.validate();\n const input: CmsModelCreateInput = await createdData.toJSON();\n\n context.security.disableAuthorization();\n const group = await context.cms.getGroup(input.group);\n context.security.enableAuthorization();\n if (!group) {\n throw new NotFoundError(`There is no group \"${input.group}\".`);\n }\n\n const fields = await createFieldModels(input.fields);\n\n const identity = getIdentity();\n const model: CmsModel = {\n name: input.name,\n description: input.description || \"\",\n modelId: input.modelId || \"\",\n titleFieldId: \"id\",\n locale: getLocale().code,\n tenant: getTenant().id,\n group: {\n id: group.id,\n name: group.name\n },\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n fields,\n lockedFields: [],\n layout: input.layout || [],\n webinyVersion: context.WEBINY_VERSION\n };\n\n await onBeforeModelCreate.publish({\n input,\n model\n });\n\n const createdModel = await storageOperations.models.create({\n model\n });\n\n loaders.listModels.clearAll();\n\n await updateManager(context, model);\n\n await onAfterModelCreate.publish({\n input,\n model: createdModel\n });\n\n return createdModel;\n },\n /**\n * Method does not check for permissions or ownership.\n * @internal\n */\n async updateModelDirect(params) {\n const { model: initialModel, original } = params;\n\n const model: CmsModel = {\n ...initialModel,\n tenant: initialModel.tenant || getTenant().id,\n locale: initialModel.locale || getLocale().code,\n webinyVersion: context.WEBINY_VERSION\n };\n\n await onBeforeModelUpdate.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model\n });\n\n const resultModel = await storageOperations.models.update({\n model\n });\n\n await updateManager(context, resultModel);\n\n loaders.listModels.clearAll();\n\n await onAfterModelUpdate.publish({\n input: {} as CmsModelUpdateInput,\n original,\n model: resultModel\n });\n\n return resultModel;\n },\n async createModelFrom(modelId, data) {\n await checkModelPermissions(\"w\");\n /**\n * Get a model record; this will also perform ownership validation.\n */\n const original = await getModel(modelId);\n\n const createdData = new CreateContentModelModelFrom().populate({\n name: data.name,\n modelId: data.modelId,\n description: data.description || original.description,\n group: data.group,\n locale: data.locale\n });\n\n await createdData.validate();\n const input: CmsModelCreateFromInput = await createdData.toJSON();\n\n const locale = await context.i18n.getLocale(input.locale || original.locale);\n if (!locale) {\n throw new NotFoundError(`There is no locale \"${input.locale}\".`);\n }\n /**\n * Use storage operations directly because we cannot get group from different locale via context methods.\n */\n const group = await context.cms.storageOperations.groups.get({\n id: input.group,\n tenant: original.tenant,\n locale: locale.code\n });\n if (!group) {\n throw new NotFoundError(`There is no group \"${input.group}\".`);\n }\n\n const identity = getIdentity();\n const model: CmsModel = {\n ...original,\n locale: locale.code,\n group: {\n id: group.id,\n name: group.name\n },\n name: input.name,\n modelId: input.modelId || \"\",\n description: input.description || \"\",\n createdBy: {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n },\n createdOn: new Date().toISOString(),\n savedOn: new Date().toISOString(),\n lockedFields: [],\n webinyVersion: context.WEBINY_VERSION\n };\n\n await onBeforeModelCreateFrom.publish({\n input,\n model,\n original\n });\n\n const createdModel = await storageOperations.models.create({\n model\n });\n\n loaders.listModels.clearAll();\n\n await updateManager(context, model);\n\n await onAfterModelCreateFrom.publish({\n input,\n original,\n model: createdModel\n });\n\n return createdModel;\n },\n async updateModel(modelId, inputData) {\n await checkModelPermissions(\"w\");\n\n // Get a model record; this will also perform ownership validation.\n const original = await getModel(modelId);\n\n const updatedData = new UpdateContentModelModel().populate(inputData);\n await updatedData.validate();\n\n const input: CmsModelUpdateInput = await updatedData.toJSON({ onlyDirty: true });\n if (Object.keys(input).length === 0) {\n /**\n * We need to return the original if nothing is to be updated.\n */\n return original;\n }\n let group: CmsModel[\"group\"] = {\n id: original.group.id,\n name: original.group.name\n };\n if (input.group) {\n context.security.disableAuthorization();\n const groupData = await context.cms.getGroup(input.group);\n context.security.enableAuthorization();\n if (!groupData) {\n throw new NotFoundError(`There is no group \"${input.group}\".`);\n }\n group = {\n id: groupData.id,\n name: groupData.name\n };\n }\n const fields = await createFieldModels(inputData.fields);\n const model: CmsModel = {\n ...original,\n ...input,\n group,\n tenant: original.tenant || getTenant().id,\n locale: original.locale || getLocale().code,\n webinyVersion: context.WEBINY_VERSION,\n fields,\n savedOn: new Date().toISOString()\n };\n\n await onBeforeModelUpdate.publish({\n input,\n original,\n model\n });\n\n const resultModel = await storageOperations.models.update({\n model\n });\n\n await updateManager(context, resultModel);\n\n await onAfterModelUpdate.publish({\n input,\n original,\n model: resultModel\n });\n\n return resultModel;\n },\n async deleteModel(modelId) {\n await checkModelPermissions(\"d\");\n\n const model = await getModel(modelId);\n\n await onBeforeModelDelete.publish({\n model\n });\n\n try {\n await storageOperations.models.delete({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete the content model\",\n ex.code || \"CONTENT_MODEL_DELETE_ERROR\",\n {\n error: ex,\n modelId: model.modelId\n }\n );\n }\n\n await onAfterModelDelete.publish({\n model\n });\n\n managers.delete(model.modelId);\n },\n async initializeModel(modelId, data) {\n /**\n * We require that users have write permissions to initialize models.\n * Maybe introduce another permission for it?\n */\n await checkModelPermissions(\"w\");\n\n const model = await getModel(modelId);\n\n await onModelInitialize.publish({ model, data });\n\n return true;\n },\n getModelManager,\n getEntryManager: async model => {\n return getModelManager(model);\n },\n getManagers: () => managers,\n getEntryManagers: () => managers\n };\n};\n"],"mappings":";;;;;;;;;;;AAqBA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAGC,eAAA,CAAOC,MAAP,CAAc,QAAd,CAAvB;;AAEA,MAAMC,uBAAuB,GAAIC,MAAD,IAA8C;EAC1E,OAAOA,MAAM,CAACC,GAAP,CAAWC,KAAK,IAAI;IAAA;;IACvB,uBAAIA,KAAK,CAACC,QAAV,4CAAI,gBAAgBH,MAApB,EAA4B;MACxBE,KAAK,CAACC,QAAN,CAAeH,MAAf,GAAwBD,uBAAuB,CAACG,KAAK,CAACC,QAAN,CAAeH,MAAhB,CAA/C;IACH;;IACD,IAAI,CAACE,KAAK,CAACE,SAAX,EAAsB;MAClBF,KAAK,CAACE,SAAN,GAAkBF,KAAK,CAACG,OAAxB;IACH;;IACD,OAAOH,KAAP;EACH,CARM,CAAP;AASH,CAVD;;AAYA,MAAMI,4BAA4B,GAAIC,KAAD,IAAsC;EACvE,IAAI,CAACA,KAAK,CAACC,aAAX,EAA0B;IACtB,OAAOD,KAAK,CAACP,MAAb;EACH;;EAED,MAAMS,OAAO,GAAGZ,eAAA,CAAOC,MAAP,CAAcS,KAAK,CAACC,aAApB,CAAhB;;EACA,IAAI,CAACC,OAAL,EAAc;IACV,OAAOF,KAAK,CAACP,MAAb;EACH;EACD;AACJ;AACA;AACA;;;EACI,IAAIO,KAAK,CAACC,aAAN,CAAoBE,KAApB,CAA0B,WAA1B,CAAJ,EAA4C;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N;MAGH,CAJD,CAIE,OAAOyI,EAAP,EAAW;QACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,oCADZ,EAEFF,EAAE,CAACpH,IAAH,IAAW,4BAFT,EAGF;UACIuH,KAAK,EAAEH,EADX;UAEIxG,OAAO,EAAEjC,KAAK,CAACiC;QAFnB,CAHE,CAAN;MAQH;;MAED,MAAM8C,kBAAkB,CAACoC,OAAnB,CAA2B;QAC7BnH;MAD6B,CAA3B,CAAN;MAIA2B,QAAQ,CAAC6G,MAAT,CAAgBxI,KAAK,CAACiC,OAAtB;IACH,CAzRE;;IA0RH,MAAM4G,eAAN,CAAsB5G,OAAtB,EAA+B2F,IAA/B,EAAqC;MACjC;AACZ;AACA;AACA;MACY,MAAM1F,qBAAqB,CAAC,GAAD,CAA3B;MAEA,MAAMlC,KAAK,GAAG,MAAMgE,QAAQ,CAAC/B,OAAD,CAA5B;MAEA,MAAM+C,iBAAiB,CAACmC,OAAlB,CAA0B;QAAEnH,KAAF;QAAS4H;MAAT,CAA1B,CAAN;MAEA,OAAO,IAAP;IACH,CAtSE;;IAuSHzD,eAvSG;IAwSH2E,eAAe,EAAE,MAAM9I,KAAN,IAAe;MAC5B,OAAOmE,eAAe,CAACnE,KAAD,CAAtB;IACH,CA1SE;IA2SH+I,WAAW,EAAE,MAAMpH,QA3ShB;IA4SHqH,gBAAgB,EAAE,MAAMrH;EA5SrB,CAAP;AA8SH,CApfM"}
|
package/graphql/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/types";
|
|
|
2
2
|
import { GraphQLHandlerFactoryParams } from "./graphQLHandlerFactory";
|
|
3
3
|
import { CmsContext } from "../types";
|
|
4
4
|
export declare type CreateGraphQLParams = GraphQLHandlerFactoryParams;
|
|
5
|
-
export declare const createGraphQL: (params: CreateGraphQLParams) => (import("@webiny/
|
|
5
|
+
export declare const createGraphQL: (params: CreateGraphQLParams) => (import("@webiny/api").ContextPlugin<CmsContext> | GraphQLSchemaPlugin<CmsContext> | import("@webiny/plugins/types").PluginCollection)[];
|
|
@@ -91,11 +91,12 @@ const createModelsSchema = context => {
|
|
|
91
91
|
},
|
|
92
92
|
initializeModel: async (_, args, context) => {
|
|
93
93
|
const {
|
|
94
|
-
modelId
|
|
94
|
+
modelId,
|
|
95
|
+
data
|
|
95
96
|
} = args;
|
|
96
97
|
|
|
97
98
|
try {
|
|
98
|
-
const result = await context.cms.initializeModel(modelId);
|
|
99
|
+
const result = await context.cms.initializeModel(modelId, data || {});
|
|
99
100
|
return new _handlerGraphql.Response(result);
|
|
100
101
|
} catch (e) {
|
|
101
102
|
return new _handlerGraphql.ErrorResponse(e);
|
|
@@ -190,7 +191,8 @@ const createModelsSchema = context => {
|
|
|
190
191
|
|
|
191
192
|
deleteContentModel(modelId: ID!): CmsDeleteResponse
|
|
192
193
|
|
|
193
|
-
|
|
194
|
+
# users can send anything into the data variable
|
|
195
|
+
initializeModel(modelId: ID!, data: JSON): InitializeModelResponse!
|
|
194
196
|
}
|
|
195
197
|
`;
|
|
196
198
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createModelsSchema","context","resolvers","Query","getContentModel","_","args","model","cms","getModel","modelId","isPrivate","NotFoundError","Response","e","ErrorResponse","listContentModels","__","models","listModels","filter","CmsContentModel","plugin","plugins","byType","CmsModelPlugin","type","some","item","contentModel","manageSchema","MANAGE","createContentModel","createModel","data","createContentModelFrom","createModelFrom","updateContentModel","updateModel","deleteContentModel","deleteModel","initializeModel","result","GraphQLSchemaPlugin","typeDefs"],"sources":["contentModels.ts"],"sourcesContent":["import { ErrorResponse, NotFoundError, Response } from \"@webiny/handler-graphql\";\nimport { CmsContext } from \"~/types\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin\";\nimport { Resolvers } from \"@webiny/handler-graphql/types\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\n\nexport const createModelsSchema = (context: CmsContext): GraphQLSchemaPlugin<CmsContext> => {\n const resolvers: Resolvers<CmsContext> = {\n Query: {\n getContentModel: async (_: unknown, args: any, context) => {\n try {\n const model = await context.cms.getModel(args.modelId);\n if (model?.isPrivate === true) {\n if (!model) {\n throw new NotFoundError(\n `Content model \"${args.modelId}\" was not found!`\n );\n }\n }\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listContentModels: async (_: unknown, __: unknown, context: CmsContext) => {\n try {\n const models = await context.cms.listModels();\n return new Response(models.filter(model => model.isPrivate !== true));\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n CmsContentModel: {\n plugin: async (model, _, context): Promise<boolean> => {\n return context.plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n .some(item => item.contentModel.modelId === model.modelId);\n }\n }\n };\n\n let manageSchema = \"\";\n if (context.cms.MANAGE) {\n resolvers[\"Mutation\"] = {\n createContentModel: async (_: unknown, args: any, context) => {\n try {\n const model = await context.cms.createModel(args.data);\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n createContentModelFrom: async (_: unknown, args: any, context) => {\n try {\n const model = await context.cms.createModelFrom(args.modelId, args.data);\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateContentModel: async (_: unknown, args: any, context) => {\n const { modelId, data } = args;\n try {\n const model = await context.cms.updateModel(modelId, data);\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteContentModel: async (_: unknown, args: any, context) => {\n const { modelId } = args;\n try {\n await context.cms.deleteModel(modelId);\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n initializeModel: async (_, args, context) => {\n const { modelId } = args;\n\n try {\n const result = await context.cms.initializeModel(modelId);\n return new Response(result);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n };\n\n manageSchema = /* GraphQL */ `\n input CmsPredefinedValueInput {\n label: String!\n value: String!\n selected: Boolean\n }\n\n input CmsPredefinedValuesInput {\n enabled: Boolean\n values: [CmsPredefinedValueInput]\n }\n input CmsFieldRendererInput {\n name: String\n }\n\n input CmsFieldValidationInput {\n name: String!\n message: String\n settings: JSON\n }\n\n input CmsContentModelFieldInput {\n id: ID!\n label: String!\n helpText: String\n placeholderText: String\n # we never use user input - this is here to the GraphQL does not break when posting from our UI\n # used for debugging purposes\n storageId: String\n fieldId: String!\n type: String!\n multipleValues: Boolean\n predefinedValues: CmsPredefinedValuesInput\n renderer: CmsFieldRendererInput\n validation: [CmsFieldValidationInput]\n listValidation: [CmsFieldValidationInput]\n settings: JSON\n }\n\n input CmsContentModelCreateInput {\n name: String!\n modelId: String\n group: RefInput!\n description: String\n layout: [[ID!]!]\n fields: [CmsContentModelFieldInput!]\n titleFieldId: String\n }\n\n input CmsContentModelCreateFromInput {\n name: String!\n modelId: String\n group: RefInput!\n description: String\n locale: String\n }\n\n input CmsContentModelUpdateInput {\n name: String\n group: RefInput\n description: String\n layout: [[ID!]!]!\n fields: [CmsContentModelFieldInput!]!\n titleFieldId: String\n }\n\n type InitializeModelResponse {\n data: Boolean\n error: CmsError\n }\n\n extend type Mutation {\n createContentModel(data: CmsContentModelCreateInput!): CmsContentModelResponse\n\n createContentModelFrom(\n modelId: ID!\n data: CmsContentModelCreateFromInput!\n ): CmsContentModelResponse\n\n updateContentModel(\n modelId: ID!\n data: CmsContentModelUpdateInput!\n ): CmsContentModelResponse\n\n deleteContentModel(modelId: ID!): CmsDeleteResponse\n\n initializeModel(modelId: ID!): InitializeModelResponse!\n }\n `;\n }\n\n return new GraphQLSchemaPlugin<CmsContext>({\n typeDefs: /* GraphQL */ `\n type CmsFieldValidation {\n name: String!\n message: String\n settings: JSON\n }\n\n type CmsFieldRenderer {\n name: String\n }\n\n type CmsPredefinedValue {\n label: String\n value: String\n selected: Boolean\n }\n\n type CmsPredefinedValues {\n enabled: Boolean\n values: [CmsPredefinedValue]\n }\n\n type CmsContentModelField {\n id: ID!\n # auto-generated value\n # used for debugging purposes\n storageId: String\n fieldId: String!\n label: String!\n helpText: String\n placeholderText: String\n type: String!\n multipleValues: Boolean\n predefinedValues: CmsPredefinedValues\n renderer: CmsFieldRenderer\n validation: [CmsFieldValidation!]\n listValidation: [CmsFieldValidation!]\n settings: JSON\n }\n\n type CmsContentModel {\n name: String!\n modelId: String!\n description: String\n group: CmsContentModelGroup!\n createdOn: DateTime\n savedOn: DateTime\n createdBy: CmsCreatedBy\n fields: [CmsContentModelField!]!\n lockedFields: [JSON]\n layout: [[String!]!]!\n titleFieldId: String\n\n # Returns true if the content model is registered via a plugin.\n plugin: Boolean!\n }\n\n type CmsContentModelResponse {\n data: CmsContentModel\n error: CmsError\n }\n\n type CmsContentModelListResponse {\n data: [CmsContentModel]\n meta: CmsListMeta\n error: CmsError\n }\n\n extend type Query {\n getContentModel(modelId: ID!, where: JSON, sort: String): CmsContentModelResponse\n\n listContentModels: CmsContentModelListResponse\n }\n\n ${manageSchema}\n `,\n resolvers\n });\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEO,MAAMA,kBAAkB,GAAIC,OAAD,IAA0D;EACxF,MAAMC,SAAgC,GAAG;IACrCC,KAAK,EAAE;MACHC,eAAe,EAAE,OAAOC,CAAP,EAAmBC,IAAnB,EAA8BL,OAA9B,KAA0C;QACvD,IAAI;UACA,MAAMM,KAAK,GAAG,MAAMN,OAAO,CAACO,GAAR,CAAYC,QAAZ,CAAqBH,IAAI,CAACI,OAA1B,CAApB;;UACA,IAAI,CAAAH,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEI,SAAP,MAAqB,IAAzB,EAA+B;YAC3B,IAAI,CAACJ,KAAL,EAAY;cACR,MAAM,IAAIK,6BAAJ,CACD,kBAAiBN,IAAI,CAACI,OAAQ,kBAD7B,CAAN;YAGH;UACJ;;UACD,OAAO,IAAIG,wBAAJ,CAAaN,KAAb,CAAP;QACH,CAVD,CAUE,OAAOO,CAAP,EAAU;U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AAM,GAAG,MAAMzC,OAAO,CAACO,GAAR,CAAYiC,eAAZ,CAA4B/B,OAA5B,CAArB;UACA,OAAO,IAAIG,wBAAJ,CAAa6B,MAAb,CAAP;QACH,CAHD,CAGE,OAAO5B,CAAP,EAAU;UACR,OAAO,IAAIC,6BAAJ,CAAkBD,CAAlB,CAAP;QACH;MACJ;IA5CmB,CAAxB;IA+CAgB,YAAY;IAAG;IAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAxFQ;EAyFH;;EAED,OAAO,IAAIa,wCAAJ,CAAoC;IACvCC,QAAQ;IAAE;IAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcd,YAAa;AAC3B,SA5E+C;IA6EvC5B;EA7EuC,CAApC,CAAP;AA+EH,CA/PM"}
|
|
1
|
+
{"version":3,"names":["createModelsSchema","context","resolvers","Query","getContentModel","_","args","model","cms","getModel","modelId","isPrivate","NotFoundError","Response","e","ErrorResponse","listContentModels","__","models","listModels","filter","CmsContentModel","plugin","plugins","byType","CmsModelPlugin","type","some","item","contentModel","manageSchema","MANAGE","createContentModel","createModel","data","createContentModelFrom","createModelFrom","updateContentModel","updateModel","deleteContentModel","deleteModel","initializeModel","result","GraphQLSchemaPlugin","typeDefs"],"sources":["contentModels.ts"],"sourcesContent":["import { ErrorResponse, NotFoundError, Response } from \"@webiny/handler-graphql\";\nimport { CmsContext } from \"~/types\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin\";\nimport { Resolvers } from \"@webiny/handler-graphql/types\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\n\nexport const createModelsSchema = (context: CmsContext): GraphQLSchemaPlugin<CmsContext> => {\n const resolvers: Resolvers<CmsContext> = {\n Query: {\n getContentModel: async (_: unknown, args: any, context) => {\n try {\n const model = await context.cms.getModel(args.modelId);\n if (model?.isPrivate === true) {\n if (!model) {\n throw new NotFoundError(\n `Content model \"${args.modelId}\" was not found!`\n );\n }\n }\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listContentModels: async (_: unknown, __: unknown, context: CmsContext) => {\n try {\n const models = await context.cms.listModels();\n return new Response(models.filter(model => model.isPrivate !== true));\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n CmsContentModel: {\n plugin: async (model, _, context): Promise<boolean> => {\n return context.plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n .some(item => item.contentModel.modelId === model.modelId);\n }\n }\n };\n\n let manageSchema = \"\";\n if (context.cms.MANAGE) {\n resolvers[\"Mutation\"] = {\n createContentModel: async (_: unknown, args: any, context) => {\n try {\n const model = await context.cms.createModel(args.data);\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n createContentModelFrom: async (_: unknown, args: any, context) => {\n try {\n const model = await context.cms.createModelFrom(args.modelId, args.data);\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateContentModel: async (_: unknown, args: any, context) => {\n const { modelId, data } = args;\n try {\n const model = await context.cms.updateModel(modelId, data);\n return new Response(model);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteContentModel: async (_: unknown, args: any, context) => {\n const { modelId } = args;\n try {\n await context.cms.deleteModel(modelId);\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n initializeModel: async (_, args, context) => {\n const { modelId, data } = args;\n\n try {\n const result = await context.cms.initializeModel(modelId, data || {});\n return new Response(result);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n };\n\n manageSchema = /* GraphQL */ `\n input CmsPredefinedValueInput {\n label: String!\n value: String!\n selected: Boolean\n }\n\n input CmsPredefinedValuesInput {\n enabled: Boolean\n values: [CmsPredefinedValueInput]\n }\n input CmsFieldRendererInput {\n name: String\n }\n\n input CmsFieldValidationInput {\n name: String!\n message: String\n settings: JSON\n }\n\n input CmsContentModelFieldInput {\n id: ID!\n label: String!\n helpText: String\n placeholderText: String\n # we never use user input - this is here to the GraphQL does not break when posting from our UI\n # used for debugging purposes\n storageId: String\n fieldId: String!\n type: String!\n multipleValues: Boolean\n predefinedValues: CmsPredefinedValuesInput\n renderer: CmsFieldRendererInput\n validation: [CmsFieldValidationInput]\n listValidation: [CmsFieldValidationInput]\n settings: JSON\n }\n\n input CmsContentModelCreateInput {\n name: String!\n modelId: String\n group: RefInput!\n description: String\n layout: [[ID!]!]\n fields: [CmsContentModelFieldInput!]\n titleFieldId: String\n }\n\n input CmsContentModelCreateFromInput {\n name: String!\n modelId: String\n group: RefInput!\n description: String\n locale: String\n }\n\n input CmsContentModelUpdateInput {\n name: String\n group: RefInput\n description: String\n layout: [[ID!]!]!\n fields: [CmsContentModelFieldInput!]!\n titleFieldId: String\n }\n\n type InitializeModelResponse {\n data: Boolean\n error: CmsError\n }\n\n extend type Mutation {\n createContentModel(data: CmsContentModelCreateInput!): CmsContentModelResponse\n\n createContentModelFrom(\n modelId: ID!\n data: CmsContentModelCreateFromInput!\n ): CmsContentModelResponse\n\n updateContentModel(\n modelId: ID!\n data: CmsContentModelUpdateInput!\n ): CmsContentModelResponse\n\n deleteContentModel(modelId: ID!): CmsDeleteResponse\n\n # users can send anything into the data variable\n initializeModel(modelId: ID!, data: JSON): InitializeModelResponse!\n }\n `;\n }\n\n return new GraphQLSchemaPlugin<CmsContext>({\n typeDefs: /* GraphQL */ `\n type CmsFieldValidation {\n name: String!\n message: String\n settings: JSON\n }\n\n type CmsFieldRenderer {\n name: String\n }\n\n type CmsPredefinedValue {\n label: String\n value: String\n selected: Boolean\n }\n\n type CmsPredefinedValues {\n enabled: Boolean\n values: [CmsPredefinedValue]\n }\n\n type CmsContentModelField {\n id: ID!\n # auto-generated value\n # used for debugging purposes\n storageId: String\n fieldId: String!\n label: String!\n helpText: String\n placeholderText: String\n type: String!\n multipleValues: Boolean\n predefinedValues: CmsPredefinedValues\n renderer: CmsFieldRenderer\n validation: [CmsFieldValidation!]\n listValidation: [CmsFieldValidation!]\n settings: JSON\n }\n\n type CmsContentModel {\n name: String!\n modelId: String!\n description: String\n group: CmsContentModelGroup!\n createdOn: DateTime\n savedOn: DateTime\n createdBy: CmsCreatedBy\n fields: [CmsContentModelField!]!\n lockedFields: [JSON]\n layout: [[String!]!]!\n titleFieldId: String\n\n # Returns true if the content model is registered via a plugin.\n plugin: Boolean!\n }\n\n type CmsContentModelResponse {\n data: CmsContentModel\n error: CmsError\n }\n\n type CmsContentModelListResponse {\n data: [CmsContentModel]\n meta: CmsListMeta\n error: CmsError\n }\n\n extend type Query {\n getContentModel(modelId: ID!, where: JSON, sort: String): CmsContentModelResponse\n\n listContentModels: CmsContentModelListResponse\n }\n\n ${manageSchema}\n `,\n resolvers\n });\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEO,MAAMA,kBAAkB,GAAIC,OAAD,IAA0D;EACxF,M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A;AACA;AACA;AACA;AACA;AACA,SAzFQ;EA0FH;;EAED,OAAO,IAAIa,wCAAJ,CAAoC;IACvCC,QAAQ;IAAE;IAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcd,YAAa;AAC3B,SA5E+C;IA6EvC5B;EA7EuC,CAApC,CAAP;AA+EH,CAhQM"}
|
package/graphqlFields/ref.js
CHANGED
|
@@ -20,7 +20,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
|
|
22
22
|
const createUnionTypeName = (model, field) => {
|
|
23
|
-
return `${(0, _createTypeName.createReadTypeName)(model.modelId)}${(0, _createTypeName.createReadTypeName)(field.fieldId)}`;
|
|
23
|
+
return `${(0, _createTypeName.createReadTypeName)(model.modelId)}_${(0, _createTypeName.createReadTypeName)(field.fieldId)}`;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const createListFilters = ({
|
|
@@ -85,7 +85,13 @@ const createRefField = () => {
|
|
|
85
85
|
|
|
86
86
|
const models = ((_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.models) || [];
|
|
87
87
|
const gqlType = models.length > 1 ? createUnionTypeName(model, field) : (0, _createTypeName.createReadTypeName)(models[0].modelId);
|
|
88
|
-
|
|
88
|
+
const typeDefs = models.length > 1 ? `union ${gqlType} = ${getFieldModels(field).map(({
|
|
89
|
+
modelId
|
|
90
|
+
}) => (0, _createTypeName.createReadTypeName)(modelId)).join(" | ")}` : "";
|
|
91
|
+
return {
|
|
92
|
+
fields: field.fieldId + `: ${field.multipleValues ? `[${gqlType}]` : gqlType}`,
|
|
93
|
+
typeDefs
|
|
94
|
+
};
|
|
89
95
|
},
|
|
90
96
|
|
|
91
97
|
/**
|
|
@@ -182,37 +188,9 @@ const createRefField = () => {
|
|
|
182
188
|
};
|
|
183
189
|
},
|
|
184
190
|
|
|
185
|
-
createSchema({
|
|
186
|
-
models
|
|
187
|
-
}) {
|
|
188
|
-
const unionFields = [];
|
|
189
|
-
|
|
190
|
-
for (const model of models) {
|
|
191
|
-
// Generate a dedicated union type for every `ref` field which has more than 1 content model assigned.
|
|
192
|
-
model.fields.filter(field => {
|
|
193
|
-
var _field$settings3;
|
|
194
|
-
|
|
195
|
-
return field.type === "ref" && (((_field$settings3 = field.settings) === null || _field$settings3 === void 0 ? void 0 : _field$settings3.models) || []).length > 1;
|
|
196
|
-
}).forEach(field => unionFields.push({
|
|
197
|
-
model,
|
|
198
|
-
field,
|
|
199
|
-
typeName: createUnionTypeName(model, field)
|
|
200
|
-
}));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const unionFieldsTypeDef = unionFields.map(({
|
|
204
|
-
field,
|
|
205
|
-
typeName
|
|
206
|
-
}) => `union ${typeName} = ${getFieldModels(field).map(({
|
|
207
|
-
modelId
|
|
208
|
-
}) => (0, _createTypeName.createReadTypeName)(modelId)).join(" | ")}`).join("\n");
|
|
209
|
-
const filteringTypeDef = `
|
|
210
|
-
${createFilteringTypeDef()}
|
|
211
|
-
|
|
212
|
-
${unionFieldsTypeDef}
|
|
213
|
-
`;
|
|
191
|
+
createSchema() {
|
|
214
192
|
return {
|
|
215
|
-
typeDefs:
|
|
193
|
+
typeDefs: createFilteringTypeDef(),
|
|
216
194
|
resolvers: {}
|
|
217
195
|
};
|
|
218
196
|
},
|
package/graphqlFields/ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createUnionTypeName","model","field","createReadTypeName","modelId","fieldId","createListFilters","createFilteringTypeDef","appendTypename","entries","typename","map","item","__typename","getFieldModels","settings","Array","isArray","models","modelIdToTypeName","Map","createRefField","name","type","fieldType","isSortable","isSearchable","read","createTypeField","gqlType","length","multipleValues","createResolver","params","set","parent","_","context","cms","initialValue","value","entriesByModel","reduce","collection","ref","includes","entryId","push","getters","Object","keys","idList","getModelManager","READ","getPublishedByIds","getLatestByIds","get","Promise","all","then","results","result","concat","revisions","createSchema","unionFields","fields","filter","forEach","typeName","unionFieldsTypeDef","join","filteringTypeDef","typeDefs","resolvers","manage","RefField","id","parseIdentifier","createInputField","createGraphQLInputField"],"sources":["ref.ts"],"sourcesContent":["import {\n CmsEntry,\n CmsContext,\n CmsModelFieldToGraphQLPlugin,\n CmsModel,\n CmsModelField\n} from \"~/types\";\nimport { createReadTypeName } from \"~/utils/createTypeName\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createGraphQLInputField } from \"./helpers\";\n\ninterface RefFieldValue {\n id?: string;\n entryId: string;\n modelId: string;\n}\n\ninterface UnionField {\n model: CmsModel;\n field: CmsModelField;\n typeName: string;\n}\n\nconst createUnionTypeName = (model: CmsModel, field: CmsModelField) => {\n return `${createReadTypeName(model.modelId)}${createReadTypeName(field.fieldId)}`;\n};\n\ninterface CreateListFilterParams {\n field: CmsModelField;\n}\nconst createListFilters = ({ field }: CreateListFilterParams) => {\n return `\n ${field.fieldId}: RefFieldWhereInput\n `;\n};\n\nconst createFilteringTypeDef = () => {\n return `\n input RefFieldWhereInput {\n id: String\n id_not: String\n id_in: [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\nconst appendTypename = (entries: CmsEntry[], typename: string): CmsEntry[] => {\n return entries.map(item => {\n return {\n ...item,\n __typename: typename\n };\n });\n};\n/**\n * We cast settings.models as object to have modelId because internally we know that it is so.\n * Internal stuff so we are sure that settings.models contains what we require.\n */\nconst getFieldModels = (field: CmsModelField): Pick<CmsModel, \"modelId\">[] => {\n if (!field.settings || Array.isArray(field.settings.models) === false) {\n return [];\n }\n return field.settings.models as Pick<CmsModel, \"modelId\">[];\n};\n\nconst modelIdToTypeName = new Map();\n\nexport const createRefField = (): CmsModelFieldToGraphQLPlugin => {\n return {\n name: \"cms-model-field-to-graphql-ref\",\n type: \"cms-model-field-to-graphql\",\n fieldType: \"ref\",\n isSortable: false,\n isSearchable: true,\n read: {\n createTypeField({ model, field }) {\n const models = field.settings?.models || [];\n const gqlType =\n models.length > 1\n ? createUnionTypeName(model, field)\n : createReadTypeName(models[0].modelId);\n\n return field.fieldId + `: ${field.multipleValues ? `[${gqlType}]` : gqlType}`;\n },\n /**\n * TS is complaining about mixed types for createResolver.\n * TODO @ts-refactor @pavel Maybe we should have a single createResolver method?\n */\n // @ts-ignore\n createResolver(params) {\n const { field } = params;\n // Create a map of model types and corresponding modelIds so resolvers don't need to perform the lookup.\n const models = field.settings?.models || [];\n for (const item of models) {\n modelIdToTypeName.set(item.modelId, createReadTypeName(item.modelId));\n }\n\n return async (parent, _, context: CmsContext) => {\n const { cms } = context;\n\n // Get field value for this entry\n const initialValue = parent[field.fieldId] as RefFieldValue | RefFieldValue[];\n\n if (!initialValue) {\n return null;\n }\n\n if (field.multipleValues) {\n /**\n * We cast because value really can be array and single value.\n * At this point, we are 99% sure that it is an array (+ we check for it)\n */\n const value = initialValue as RefFieldValue[];\n if (Array.isArray(value) === false || value.length === 0) {\n return [];\n }\n\n const entriesByModel = value.reduce((collection, ref) => {\n if (!collection[ref.modelId]) {\n collection[ref.modelId] = [];\n } else if (collection[ref.modelId].includes(ref.entryId) === true) {\n return collection;\n }\n\n collection[ref.modelId].push(ref.entryId);\n\n return collection;\n }, {} as Record<string, string[]>);\n\n const getters = Object.keys(entriesByModel).map(async modelId => {\n const idList = entriesByModel[modelId];\n // Get model manager, to get access to CRUD methods\n const model = await cms.getModelManager(modelId);\n\n let entries: CmsEntry[];\n // `read` API works with `published` data\n if (cms.READ) {\n entries = await model.getPublishedByIds(idList);\n }\n // `preview` and `manage` with `latest` data\n else {\n entries = await model.getLatestByIds(idList);\n }\n\n return appendTypename(entries, modelIdToTypeName.get(modelId));\n });\n\n return await Promise.all(getters).then((results: any[]) =>\n results.reduce((result, item) => result.concat(item), [])\n );\n }\n\n const value = initialValue as RefFieldValue;\n\n // Get model manager, to get access to CRUD methods\n const model = await cms.getModelManager(value.modelId);\n\n let revisions: CmsEntry[];\n // `read` API works with `published` data\n if (cms.READ) {\n revisions = await model.getPublishedByIds([value.entryId]);\n }\n // `preview` API works with `latest` data\n else {\n revisions = await model.getLatestByIds([value.entryId]);\n }\n\n /**\n * If there are no revisions we must return null.\n */\n if (!revisions || revisions.length === 0) {\n return null;\n }\n return {\n ...revisions[0],\n __typename: modelIdToTypeName.get(value.modelId)\n };\n };\n },\n createSchema({ models }) {\n const unionFields: UnionField[] = [];\n for (const model of models) {\n // Generate a dedicated union type for every `ref` field which has more than 1 content model assigned.\n model.fields\n .filter(\n field =>\n field.type === \"ref\" && (field.settings?.models || []).length > 1\n )\n .forEach(field =>\n unionFields.push({\n model,\n field,\n typeName: createUnionTypeName(model, field)\n })\n );\n }\n const unionFieldsTypeDef = unionFields\n .map(\n ({ field, typeName }) =>\n `union ${typeName} = ${getFieldModels(field)\n .map(({ modelId }) => createReadTypeName(modelId))\n .join(\" | \")}`\n )\n .join(\"\\n\");\n\n const filteringTypeDef = `\n ${createFilteringTypeDef()}\n \n ${unionFieldsTypeDef}\n `;\n\n return {\n typeDefs: filteringTypeDef,\n resolvers: {}\n };\n },\n createListFilters\n },\n manage: {\n createSchema() {\n /**\n * entryId in RefFieldInput is deprecated but cannot mark it as GraphQL does not allow marking input fields as deprecated\n */\n return {\n typeDefs: `\n type RefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n \n input RefFieldInput {\n modelId: String!\n id: ID!\n }\n \n ${createFilteringTypeDef()}\n `,\n resolvers: {\n RefField: {\n entryId: (parent: RefFieldValue) => {\n const { id } = parseIdentifier(parent.entryId || parent.id);\n return id;\n },\n id: (parent: RefFieldValue) => {\n return parent.id || parent.entryId;\n }\n }\n }\n };\n },\n createTypeField({ field }) {\n if (field.multipleValues) {\n return `${field.fieldId}: [RefField!]`;\n }\n return `${field.fieldId}: RefField`;\n },\n createInputField({ field }) {\n return createGraphQLInputField(field, \"RefFieldInput\");\n },\n createListFilters\n }\n };\n};\n"],"mappings":";;;;;;;;;;;AAOA;;AACA;;AACA;;;;;;AAcA,MAAMA,mBAAmB,GAAG,CAACC,KAAD,EAAkBC,KAAlB,KAA2C;EACnE,OAAQ,GAAE,IAAAC,kCAAA,EAAmBF,KAAK,CAACG,OAAzB,CAAkC,GAAE,IAAAD,kCAAA,EAAmBD,KAAK,CAACG,OAAzB,CAAkC,EAAhF;AACH,CAFD;;AAOA,MAAMC,iBAAiB,GAAG,CAAC;EAAEJ;AAAF,CAAD,KAAuC;EAC7D,OAAQ;AACZ,UAAUA,KAAK,CAACG,OAAQ;AACxB,KAFI;AAGH,CAJD;;AAMA,MAAME,sBAAsB,GAAG,MAAM;EACjC,OAAQ;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAXI;AAYH,CAbD;;AAeA,MAAMC,cAAc,GAAG,CAACC,OAAD,EAAsBC,QAAtB,KAAuD;EAC1E,OAAOD,OAAO,CAACE,GAAR,CAAYC,IAAI,IAAI;IACvB,uCACOA,IADP;MAEIC,UAAU,EAAEH;IAFhB;EAIH,CALM,CAAP;AAMH,CA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A;QACgB,OAAO;UACHS,QAAQ,EAAG;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsBlE,sBAAsB,EAAG;AAC/C,iBAduB;UAeHmE,SAAS,EAAE;YACPE,QAAQ,EAAE;cACN9B,OAAO,EAAGX,MAAD,IAA2B;gBAChC,MAAM;kBAAE0C;gBAAF,IAAS,IAAAC,sBAAA,EAAgB3C,MAAM,CAACW,OAAP,IAAkBX,MAAM,CAAC0C,EAAzC,CAAf;gBACA,OAAOA,EAAP;cACH,CAJK;cAKNA,EAAE,EAAG1C,MAAD,IAA2B;gBAC3B,OAAOA,MAAM,CAAC0C,EAAP,IAAa1C,MAAM,CAACW,OAA3B;cACH;YAPK;UADH;QAfR,CAAP;MA2BH,CAhCG;;MAiCJlB,eAAe,CAAC;QAAE1B;MAAF,CAAD,EAAY;QACvB,IAAIA,KAAK,CAAC6B,cAAV,EAA0B;UACtB,OAAQ,GAAE7B,KAAK,CAACG,OAAQ,eAAxB;QACH;;QACD,OAAQ,GAAEH,KAAK,CAACG,OAAQ,YAAxB;MACH,CAtCG;;MAuCJ0E,gBAAgB,CAAC;QAAE7E;MAAF,CAAD,EAAY;QACxB,OAAO,IAAA8E,gCAAA,EAAwB9E,KAAxB,EAA+B,eAA/B,CAAP;MACH,CAzCG;;MA0CJI;IA1CI;EAtJL,CAAP;AAmMH,CApMM"}
|
|
1
|
+
{"version":3,"names":["createUnionTypeName","model","field","createReadTypeName","modelId","fieldId","createListFilters","createFilteringTypeDef","appendTypename","entries","typename","map","item","__typename","getFieldModels","settings","Array","isArray","models","modelIdToTypeName","Map","createRefField","name","type","fieldType","isSortable","isSearchable","read","createTypeField","gqlType","length","typeDefs","join","fields","multipleValues","createResolver","params","set","parent","_","context","cms","initialValue","value","entriesByModel","reduce","collection","ref","includes","entryId","push","getters","Object","keys","idList","getModelManager","READ","getPublishedByIds","getLatestByIds","get","Promise","all","then","results","result","concat","revisions","createSchema","resolvers","manage","RefField","id","parseIdentifier","createInputField","createGraphQLInputField"],"sources":["ref.ts"],"sourcesContent":["import {\n CmsEntry,\n CmsContext,\n CmsModelFieldToGraphQLPlugin,\n CmsModel,\n CmsModelField\n} from \"~/types\";\nimport { createReadTypeName } from \"~/utils/createTypeName\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createGraphQLInputField } from \"./helpers\";\n\ninterface RefFieldValue {\n id?: string;\n entryId: string;\n modelId: string;\n}\n\nconst createUnionTypeName = (model: CmsModel, field: CmsModelField) => {\n return `${createReadTypeName(model.modelId)}_${createReadTypeName(field.fieldId)}`;\n};\n\ninterface CreateListFilterParams {\n field: CmsModelField;\n}\nconst createListFilters = ({ field }: CreateListFilterParams) => {\n return `\n ${field.fieldId}: RefFieldWhereInput\n `;\n};\n\nconst createFilteringTypeDef = () => {\n return `\n input RefFieldWhereInput {\n id: String\n id_not: String\n id_in: [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\nconst appendTypename = (entries: CmsEntry[], typename: string): CmsEntry[] => {\n return entries.map(item => {\n return {\n ...item,\n __typename: typename\n };\n });\n};\n/**\n * We cast settings.models as object to have modelId because internally we know that it is so.\n * Internal stuff so we are sure that settings.models contains what we require.\n */\nconst getFieldModels = (field: CmsModelField): Pick<CmsModel, \"modelId\">[] => {\n if (!field.settings || Array.isArray(field.settings.models) === false) {\n return [];\n }\n return field.settings.models as Pick<CmsModel, \"modelId\">[];\n};\n\nconst modelIdToTypeName = new Map();\n\nexport const createRefField = (): CmsModelFieldToGraphQLPlugin => {\n return {\n name: \"cms-model-field-to-graphql-ref\",\n type: \"cms-model-field-to-graphql\",\n fieldType: \"ref\",\n isSortable: false,\n isSearchable: true,\n read: {\n createTypeField({ model, field }) {\n const models = field.settings?.models || [];\n const gqlType =\n models.length > 1\n ? createUnionTypeName(model, field)\n : createReadTypeName(models[0].modelId);\n\n const typeDefs =\n models.length > 1\n ? `union ${gqlType} = ${getFieldModels(field)\n .map(({ modelId }) => createReadTypeName(modelId))\n .join(\" | \")}`\n : \"\";\n\n return {\n fields: field.fieldId + `: ${field.multipleValues ? `[${gqlType}]` : gqlType}`,\n typeDefs\n };\n },\n /**\n * TS is complaining about mixed types for createResolver.\n * TODO @ts-refactor @pavel Maybe we should have a single createResolver method?\n */\n // @ts-ignore\n createResolver(params) {\n const { field } = params;\n // Create a map of model types and corresponding modelIds so resolvers don't need to perform the lookup.\n const models = field.settings?.models || [];\n for (const item of models) {\n modelIdToTypeName.set(item.modelId, createReadTypeName(item.modelId));\n }\n\n return async (parent, _, context: CmsContext) => {\n const { cms } = context;\n\n // Get field value for this entry\n const initialValue = parent[field.fieldId] as RefFieldValue | RefFieldValue[];\n\n if (!initialValue) {\n return null;\n }\n\n if (field.multipleValues) {\n /**\n * We cast because value really can be array and single value.\n * At this point, we are 99% sure that it is an array (+ we check for it)\n */\n const value = initialValue as RefFieldValue[];\n if (Array.isArray(value) === false || value.length === 0) {\n return [];\n }\n\n const entriesByModel = value.reduce((collection, ref) => {\n if (!collection[ref.modelId]) {\n collection[ref.modelId] = [];\n } else if (collection[ref.modelId].includes(ref.entryId) === true) {\n return collection;\n }\n\n collection[ref.modelId].push(ref.entryId);\n\n return collection;\n }, {} as Record<string, string[]>);\n\n const getters = Object.keys(entriesByModel).map(async modelId => {\n const idList = entriesByModel[modelId];\n // Get model manager, to get access to CRUD methods\n const model = await cms.getModelManager(modelId);\n\n let entries: CmsEntry[];\n // `read` API works with `published` data\n if (cms.READ) {\n entries = await model.getPublishedByIds(idList);\n }\n // `preview` and `manage` with `latest` data\n else {\n entries = await model.getLatestByIds(idList);\n }\n\n return appendTypename(entries, modelIdToTypeName.get(modelId));\n });\n\n return await Promise.all(getters).then((results: any[]) =>\n results.reduce((result, item) => result.concat(item), [])\n );\n }\n\n const value = initialValue as RefFieldValue;\n\n // Get model manager, to get access to CRUD methods\n const model = await cms.getModelManager(value.modelId);\n\n let revisions: CmsEntry[];\n // `read` API works with `published` data\n if (cms.READ) {\n revisions = await model.getPublishedByIds([value.entryId]);\n }\n // `preview` API works with `latest` data\n else {\n revisions = await model.getLatestByIds([value.entryId]);\n }\n\n /**\n * If there are no revisions we must return null.\n */\n if (!revisions || revisions.length === 0) {\n return null;\n }\n return {\n ...revisions[0],\n __typename: modelIdToTypeName.get(value.modelId)\n };\n };\n },\n createSchema() {\n return {\n typeDefs: createFilteringTypeDef(),\n resolvers: {}\n };\n },\n createListFilters\n },\n manage: {\n createSchema() {\n /**\n * entryId in RefFieldInput is deprecated but cannot mark it as GraphQL does not allow marking input fields as deprecated\n */\n return {\n typeDefs: `\n type RefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n \n input RefFieldInput {\n modelId: String!\n id: ID!\n }\n \n ${createFilteringTypeDef()}\n `,\n resolvers: {\n RefField: {\n entryId: (parent: RefFieldValue) => {\n const { id } = parseIdentifier(parent.entryId || parent.id);\n return id;\n },\n id: (parent: RefFieldValue) => {\n return parent.id || parent.entryId;\n }\n }\n }\n };\n },\n createTypeField({ field }) {\n if (field.multipleValues) {\n return `${field.fieldId}: [RefField!]`;\n }\n return `${field.fieldId}: RefField`;\n },\n createInputField({ field }) {\n return createGraphQLInputField(field, \"RefFieldInput\");\n },\n createListFilters\n }\n };\n};\n"],"mappings":";;;;;;;;;;;AAOA;;AACA;;AACA;;;;;;AAQA,MAAMA,mBAAmB,GAAG,CAACC,KAAD,EAAkBC,KAAlB,KAA2C;EACnE,OAAQ,GAAE,IAAAC,kCAAA,EAAmBF,KAAK,CAACG,OAAzB,CAAkC,IAAG,IAAAD,kCAAA,EAAmBD,KAAK,CAACG,OAAzB,CAAkC,EAAjF;AACH,CAFD;;AAOA,MAAMC,iBAAiB,GAAG,CAAC;EAAEJ;AAAF,CAAD,KAAuC;EAC7D,OAAQ;AACZ,UAAUA,KAAK,CAACG,OAAQ;AACxB,KAFI;AAGH,CAJD;;AAMA,MAAME,sBAAsB,GAAG,MAAM;EACjC,OAAQ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;cACH,CAJK;cAKNA,EAAE,EAAGjC,MAAD,IAA2B;gBAC3B,OAAOA,MAAM,CAACiC,EAAP,IAAajC,MAAM,CAACW,OAA3B;cACH;YAPK;UADH;QAfR,CAAP;MA2BH,CAhCG;;MAiCJrB,eAAe,CAAC;QAAE1B;MAAF,CAAD,EAAY;QACvB,IAAIA,KAAK,CAACgC,cAAV,EAA0B;UACtB,OAAQ,GAAEhC,KAAK,CAACG,OAAQ,eAAxB;QACH;;QACD,OAAQ,GAAEH,KAAK,CAACG,OAAQ,YAAxB;MACH,CAtCG;;MAuCJoE,gBAAgB,CAAC;QAAEvE;MAAF,CAAD,EAAY;QACxB,OAAO,IAAAwE,gCAAA,EAAwBxE,KAAxB,EAA+B,eAA/B,CAAP;MACH,CAzCG;;MA0CJI;IA1CI;EAjIL,CAAP;AA8KH,CA/KM"}
|
package/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CreateGraphQLParams } from "./graphql";
|
|
|
2
2
|
import { CrudParams } from "./crud";
|
|
3
3
|
import { entryFieldFromStorageTransform, entryFromStorageTransform, entryToStorageTransform } from "./utils/entryStorage";
|
|
4
4
|
export declare type CreateHeadlessCmsGraphQLParams = CreateGraphQLParams;
|
|
5
|
-
export declare const createHeadlessCmsGraphQL: (params?: CreateHeadlessCmsGraphQLParams) => (import("./plugins").CmsParametersPlugin | (import("@webiny/
|
|
5
|
+
export declare const createHeadlessCmsGraphQL: (params?: CreateHeadlessCmsGraphQLParams) => (import("./plugins").CmsParametersPlugin | (import("@webiny/api").ContextPlugin<import("./types").CmsContext> | import("@webiny/handler-graphql/types").GraphQLSchemaPlugin<import("./types").CmsContext> | import("@webiny/plugins/types").PluginCollection)[])[];
|
|
6
6
|
export declare type ContentContextParams = CrudParams;
|
|
7
7
|
export declare const createHeadlessCmsContext: (params: ContentContextParams) => (import("./types").CmsModelFieldToGraphQLPlugin[] | import("./types").ModelManagerPlugin | import("@webiny/api").ContextPlugin<import("./types").CmsContext> | import("./plugins").StorageTransformPlugin<any, any> | import("@webiny/api-upgrade").UpgradePlugin<import("./types").CmsContext>[] | (import("./types").CmsModelFieldValidatorPlugin | import("./types").CmsModelFieldPatternValidatorPlugin[])[] | (import("./fieldConverters/CmsModelObjectFieldConverterPlugin").CmsModelObjectFieldConverterPlugin | import("./fieldConverters/CmsModelDefaultFieldConverterPlugin").CmsModelDefaultFieldConverterPlugin)[])[];
|
|
8
8
|
export * from "./graphqlFields";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms",
|
|
3
|
-
"version": "5.33.
|
|
3
|
+
"version": "5.33.5-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms:base"
|
|
@@ -21,22 +21,22 @@
|
|
|
21
21
|
"@babel/runtime": "7.18.9",
|
|
22
22
|
"@commodo/fields": "1.1.2-beta.20",
|
|
23
23
|
"@graphql-tools/schema": "7.1.5",
|
|
24
|
-
"@webiny/api": "5.33.
|
|
25
|
-
"@webiny/api-file-manager": "5.33.
|
|
26
|
-
"@webiny/api-i18n": "5.33.
|
|
27
|
-
"@webiny/api-i18n-ddb": "5.33.
|
|
28
|
-
"@webiny/api-security": "5.33.
|
|
29
|
-
"@webiny/api-tenancy": "5.33.
|
|
30
|
-
"@webiny/api-upgrade": "5.33.
|
|
31
|
-
"@webiny/error": "5.33.
|
|
32
|
-
"@webiny/handler": "5.33.
|
|
33
|
-
"@webiny/handler-aws": "5.33.
|
|
34
|
-
"@webiny/handler-db": "5.33.
|
|
35
|
-
"@webiny/handler-graphql": "5.33.
|
|
36
|
-
"@webiny/plugins": "5.33.
|
|
37
|
-
"@webiny/pubsub": "5.33.
|
|
38
|
-
"@webiny/utils": "5.33.
|
|
39
|
-
"@webiny/validation": "5.33.
|
|
24
|
+
"@webiny/api": "5.33.5-beta.0",
|
|
25
|
+
"@webiny/api-file-manager": "5.33.5-beta.0",
|
|
26
|
+
"@webiny/api-i18n": "5.33.5-beta.0",
|
|
27
|
+
"@webiny/api-i18n-ddb": "5.33.5-beta.0",
|
|
28
|
+
"@webiny/api-security": "5.33.5-beta.0",
|
|
29
|
+
"@webiny/api-tenancy": "5.33.5-beta.0",
|
|
30
|
+
"@webiny/api-upgrade": "5.33.5-beta.0",
|
|
31
|
+
"@webiny/error": "5.33.5-beta.0",
|
|
32
|
+
"@webiny/handler": "5.33.5-beta.0",
|
|
33
|
+
"@webiny/handler-aws": "5.33.5-beta.0",
|
|
34
|
+
"@webiny/handler-db": "5.33.5-beta.0",
|
|
35
|
+
"@webiny/handler-graphql": "5.33.5-beta.0",
|
|
36
|
+
"@webiny/plugins": "5.33.5-beta.0",
|
|
37
|
+
"@webiny/pubsub": "5.33.5-beta.0",
|
|
38
|
+
"@webiny/utils": "5.33.5-beta.0",
|
|
39
|
+
"@webiny/validation": "5.33.5-beta.0",
|
|
40
40
|
"code-frame": "5.0.0",
|
|
41
41
|
"commodo-fields-object": "1.0.6",
|
|
42
42
|
"dataloader": "2.1.0",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"@babel/core": "^7.16.0",
|
|
55
55
|
"@babel/preset-env": "^7.16.4",
|
|
56
56
|
"@babel/preset-flow": "^7.16.0",
|
|
57
|
-
"@webiny/api-security-so-ddb": "^5.33.
|
|
58
|
-
"@webiny/api-tenancy-so-ddb": "^5.33.
|
|
59
|
-
"@webiny/api-wcp": "^5.33.
|
|
60
|
-
"@webiny/cli": "^5.33.
|
|
61
|
-
"@webiny/project-utils": "^5.33.
|
|
57
|
+
"@webiny/api-security-so-ddb": "^5.33.5-beta.0",
|
|
58
|
+
"@webiny/api-tenancy-so-ddb": "^5.33.5-beta.0",
|
|
59
|
+
"@webiny/api-wcp": "^5.33.5-beta.0",
|
|
60
|
+
"@webiny/cli": "^5.33.5-beta.0",
|
|
61
|
+
"@webiny/project-utils": "^5.33.5-beta.0",
|
|
62
62
|
"apollo-graphql": "^0.9.5",
|
|
63
63
|
"get-yarn-workspaces": "^1.0.2",
|
|
64
64
|
"graphql": "^15.7.2",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"build": "yarn webiny run build",
|
|
79
79
|
"watch": "yarn webiny run watch"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "2d8919d669aefd7df32749e6a4b365a50e1d7be1"
|
|
82
82
|
}
|
package/types.d.ts
CHANGED
|
@@ -1377,6 +1377,7 @@ export interface AfterModelDeleteTopicParams {
|
|
|
1377
1377
|
}
|
|
1378
1378
|
export interface OnModelInitializeParams {
|
|
1379
1379
|
model: CmsModel;
|
|
1380
|
+
data: Record<string, any>;
|
|
1380
1381
|
}
|
|
1381
1382
|
export interface CmsModelUpdateDirectParams {
|
|
1382
1383
|
model: CmsModel;
|
|
@@ -1424,7 +1425,7 @@ export interface CmsModelContext {
|
|
|
1424
1425
|
*
|
|
1425
1426
|
* Primary idea behind this is creating the index, for the code models, in the ES.
|
|
1426
1427
|
*/
|
|
1427
|
-
initializeModel: (modelId: string) => Promise<boolean>;
|
|
1428
|
+
initializeModel: (modelId: string, data: Record<string, any>) => Promise<boolean>;
|
|
1428
1429
|
/**
|
|
1429
1430
|
* Get a instance of CmsModelManager for given content modelId.
|
|
1430
1431
|
*
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CONTENT_ENTRY_STATUS"],"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 { TenancyContext } from \"@webiny/api-tenancy/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 { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport { UpgradePlugin } from \"@webiny/api-upgrade/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection\";\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\nexport interface HeadlessCms\n extends CmsSettingsContext,\n 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/**\n * @description This combines all contexts used in the CMS into a single one.\n *\n * @category Context\n */\nexport interface CmsContext\n extends Context,\n DbContext,\n // HttpContext,\n I18NContext,\n FileManagerContext,\n TenancyContext {\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 * 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 * 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 * 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/**\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:\n | \"boolean\"\n | \"datetime\"\n | \"file\"\n | \"long-text\"\n | \"number\"\n | \"object\"\n | \"ref\"\n | \"rich-text\"\n | \"text\"\n | string;\n /**\n * A unique storage ID for storing actual values.\n * Must in form of a-zA-Z0-9@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 * @internal\n */\n storageId: 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 * Any user defined settings.\n *\n * @default {}\n */\n settings?: CmsModelFieldSettings;\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | 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 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(params: CmsModelFieldValidatorValidateParams): Promise<boolean>;\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 * Cms Model defining an entry.\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 * 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: {\n /**\n * Generated ID of the group\n */\n id: string;\n /**\n * Name of the group\n */\n name: string;\n };\n /**\n * Description for the content model.\n */\n description: string;\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?: CreatedBy;\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 * 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 version of Webiny which this record was stored with.\n */\n webinyVersion: string;\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\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 {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: CmsModelField;\n createFieldResolvers: any;\n}\nexport interface CmsModelFieldToGraphQLCreateResolver {\n (params: CmsModelFieldToGraphQLCreateResolverParams):\n | GraphQLFieldResolver\n | { resolver: GraphQLFieldResolver | null; typeResolvers: Resolvers<CmsContext> }\n | false;\n}\n\n/**\n * @category Plugin\n * @category ModelField\n * @category GraphQL\n */\nexport interface CmsModelFieldToGraphQLPlugin 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: CmsModelField;\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: { model: CmsModel; field: CmsModelField }): 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: { model: CmsModel; field: CmsModelField }): 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 model: CmsModel;\n field: CmsModelField;\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;\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: { model: CmsModel; field: CmsModelField }) => 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 model: CmsModel;\n field: CmsModelField;\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 model: CmsModel;\n field: CmsModelField;\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;\n };\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 * A interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface CreatedBy {\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\n/**\n * Representation of settings database model.\n *\n * @category Database model\n */\nexport interface CmsSettings {\n /**\n * Last content model change. Used to cache GraphQL schema.\n */\n contentModelLastChange: Date;\n /**\n * Settings tenant.\n */\n tenant: string;\n /**\n * Settings locale.\n */\n locale: string;\n}\n\n/**\n * Settings CRUD in context.\n *\n * @category Context\n */\nexport interface CmsSettingsContext {\n /**\n * Gets settings model from the database.\n */\n getSettings: () => Promise<CmsSettings | null>;\n /**\n * Updates settings model with a new date.\n */\n updateModelLastChange: () => Promise<void>;\n /**\n * Get the datetime when content model last changed.\n */\n getModelLastChange: () => Promise<Date>;\n}\n\nexport interface BeforeInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface AfterInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport type CmsSystemContext = {\n getSystemVersion: () => Promise<string | null>;\n setSystemVersion: (version: string) => Promise<void>;\n getReadAPIKey(): Promise<string | null>;\n installSystem: () => Promise<void>;\n upgradeSystem: (version: string) => Promise<boolean>;\n /**\n * Events\n */\n onBeforeSystemInstall: Topic<BeforeInstallTopicParams>;\n onAfterSystemInstall: Topic<AfterInstallTopicParams>;\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 name: string;\n slug?: string;\n description?: string;\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;\n /**\n * Icon for the group. In a form of \"ico/ico\".\n */\n icon: string;\n /**\n * CreatedBy reference object.\n */\n createdBy?: CreatedBy;\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\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 [key: string]: any;\n };\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface BeforeGroupCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface AfterGroupCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface BeforeGroupUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface AfterGroupUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface BeforeGroupDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface AfterGroupDeleteTopicParams {\n group: CmsGroup;\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 | null>;\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 * Events.\n */\n onBeforeGroupCreate: Topic<BeforeGroupCreateTopicParams>;\n onAfterGroupCreate: Topic<AfterGroupCreateTopicParams>;\n onBeforeGroupUpdate: Topic<BeforeGroupUpdateTopicParams>;\n onAfterGroupUpdate: Topic<AfterGroupUpdateTopicParams>;\n onBeforeGroupDelete: Topic<BeforeGroupDeleteTopicParams>;\n onAfterGroupDelete: Topic<AfterGroupDeleteTopicParams>;\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 * 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;\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 * 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\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;\n /**\n * Text to display in the field.\n */\n placeholderText?: 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 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;\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 * 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\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 * 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 * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry {\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: CreatedBy;\n /**\n * OwnedBy object reference. Can be different from CreatedBy.\n */\n ownedBy: CreatedBy;\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: CmsEntryValues;\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow - will be always inserted after 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\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 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 a entry.\n */\n create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Update a entry.\n */\n update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Delete a entry.\n */\n delete: (id: string) => Promise<void>;\n}\n\nexport interface BeforeModelCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\nexport interface AfterModelCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\nexport interface BeforeModelCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface AfterModelCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface BeforeModelUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface AfterModelUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface BeforeModelDeleteTopicParams {\n model: CmsModel;\n}\nexport interface AfterModelDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelInitializeParams {\n model: CmsModel;\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) => Promise<boolean>;\n /**\n * Get a instance of CmsModelManager for given content modelId.\n *\n * @see CmsModelManager\n *\n * @deprecated use the getEntryManager() method instead\n */\n getModelManager: (model: CmsModel | string) => Promise<CmsModelManager>;\n getEntryManager: (model: CmsModel | string) => Promise<CmsModelManager>;\n /**\n * Get all content model managers mapped by modelId.\n * @see CmsModelManager\n * @deprecated use getEntryManagers instead\n */\n getManagers: () => Map<string, CmsModelManager>;\n getEntryManagers: () => Map<string, CmsModelManager>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache: () => void;\n /**\n * Events.\n */\n onBeforeModelCreate: Topic<BeforeModelCreateTopicParams>;\n onAfterModelCreate: Topic<AfterModelCreateTopicParams>;\n onBeforeModelCreateFrom: Topic<BeforeModelCreateFromTopicParams>;\n onAfterModelCreateFrom: Topic<AfterModelCreateFromTopicParams>;\n onBeforeModelUpdate: Topic<BeforeModelUpdateTopicParams>;\n onAfterModelUpdate: Topic<AfterModelUpdateTopicParams>;\n onBeforeModelDelete: Topic<BeforeModelDeleteTopicParams>;\n onAfterModelDelete: Topic<AfterModelDeleteTopicParams>;\n onModelInitialize: Topic<OnModelInitializeParams>;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus =\n | \"published\"\n | \"unpublished\"\n | \"reviewRequested\"\n | \"changesRequested\"\n | \"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 * 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]: any | CmsEntryListWhereRef;\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\nexport interface BeforeEntryCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface AfterEntryCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryCreateRevisionTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryCreateRevisionTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface AfterEntryUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryPublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryPublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryUnpublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryUnpublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryRequestChangesTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryRequestChangesTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryRequestReviewTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryRequestReviewTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface AfterEntryDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface BeforeEntryDeleteRevisionTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface AfterEntryDeleteRevisionTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface BeforeEntryGetTopicParams {\n model: StorageOperationsCmsModel;\n where: CmsEntryListWhere;\n}\n\nexport interface BeforeEntryListTopicParams {\n where: CmsEntryListWhere;\n model: StorageOperationsCmsModel;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput {\n [key: string]: any;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput {\n [key: string]: any;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput {\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 | null>;\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: (\n model: CmsModel,\n params: CmsEntryListParams\n ) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * Lists latest entries. Used for manage API.\n */\n listLatestEntries: (\n model: CmsModel,\n params?: CmsEntryListParams\n ) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * List published entries. Used for read API.\n */\n listPublishedEntries: (\n model: CmsModel,\n params?: CmsEntryListParams\n ) => Promise<[CmsEntry[], 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: (model: CmsModel, input: CreateCmsEntryInput) => 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 ) => 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 ) => 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) => Promise<void>;\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 * Request a review for the entry.\n */\n requestEntryReview: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Request changes for the entry.\n */\n requestEntryChanges: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Get all entry revisions.\n */\n getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;\n /**\n * Events.\n */\n onBeforeEntryCreate: Topic<BeforeEntryCreateTopicParams>;\n onAfterEntryCreate: Topic<AfterEntryCreateTopicParams>;\n onBeforeEntryCreateRevision: Topic<BeforeEntryCreateRevisionTopicParams>;\n onAfterEntryCreateRevision: Topic<AfterEntryCreateRevisionTopicParams>;\n onBeforeEntryUpdate: Topic<BeforeEntryUpdateTopicParams>;\n onAfterEntryUpdate: Topic<AfterEntryUpdateTopicParams>;\n onBeforeEntryDelete: Topic<BeforeEntryDeleteTopicParams>;\n onAfterEntryDelete: Topic<AfterEntryDeleteTopicParams>;\n onBeforeEntryDeleteRevision: Topic<BeforeEntryDeleteRevisionTopicParams>;\n onAfterEntryDeleteRevision: Topic<AfterEntryDeleteRevisionTopicParams>;\n onBeforeEntryPublish: Topic<BeforeEntryPublishTopicParams>;\n onAfterEntryPublish: Topic<AfterEntryPublishTopicParams>;\n onBeforeEntryUnpublish: Topic<BeforeEntryUnpublishTopicParams>;\n onAfterEntryUnpublish: Topic<AfterEntryUnpublishTopicParams>;\n onBeforeEntryRequestChanges: Topic<BeforeEntryRequestChangesTopicParams>;\n onAfterEntryRequestChanges: Topic<AfterEntryRequestChangesTopicParams>;\n onBeforeEntryRequestReview: Topic<BeforeEntryRequestReviewTopicParams>;\n onAfterEntryRequestReview: Topic<AfterEntryRequestReviewTopicParams>;\n onBeforeEntryGet: Topic<BeforeEntryGetTopicParams>;\n onBeforeEntryList: Topic<BeforeEntryListTopicParams>;\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 * Settings security permission.\n *\n * @category SecurityPermission\n */\nexport interface CmsSettingsPermission extends SecurityPermission {} // eslint-disable-line\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 * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n /**\n * A object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * A object representing `key: group.id` values where key is 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 * A object representing `key: group.id` values where key is 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 * A object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * A object representing `key: group.id` values where key is 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}\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 /**\n * Entry that is going to be deleted.\n */\n entry: CmsEntry;\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 CmsEntryStorageOperationsRequestChangesParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Entry data updated with the required properties.\n */\n entry: CmsEntry;\n /**\n * Entry that is prepared for the storageOperations, with the transformations.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsRequestReviewParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Entry that is prepared for the storageOperations.\n */\n entry: CmsEntry;\n /**\n * Entry that is prepared for the storageOperations, with the transformations.\n */\n storageEntry: T;\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}\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: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<T[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<T | null>;\n /**\n * Gets entry by given params.\n */\n get: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) => Promise<T | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<T>>;\n /**\n * Create a new entry.\n */\n create: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateParams<T>\n ) => Promise<T>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<T>;\n /**\n * Update existing entry.\n */\n update: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUpdateParams<T>\n ) => Promise<T>;\n /**\n * Delete the entry revision.\n */\n deleteRevision: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ) => Promise<void>;\n /**\n * Delete the entry.\n */\n delete: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteParams\n ) => Promise<void>;\n /**\n * Publish the entry.\n */\n publish: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsPublishParams<T>\n ) => Promise<T>;\n /**\n * Unpublish the entry.\n */\n unpublish: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUnpublishParams<T>\n ) => Promise<T>;\n /**\n * Request changes the entry.\n */\n requestChanges: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestChangesParams<T>\n ) => Promise<T>;\n /**\n * Request review the entry.\n */\n requestReview: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestReviewParams<T>\n ) => Promise<CmsEntry>;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\",\n CHANGES_REQUESTED = \"changesRequested\",\n REVIEW_REQUESTED = \"reviewRequested\"\n}\n\nexport interface CmsSettingsStorageOperationsGetParams {\n locale: string;\n tenant: string;\n}\n\nexport interface CmsSettingsStorageOperationsCreateParams {\n settings: CmsSettings;\n}\n\nexport interface CmsSettingsStorageOperationsUpdateParams {\n settings: CmsSettings;\n}\n\nexport interface CmsSettingsStorageOperations {\n /**\n * Get the settings from the storage.\n */\n get: (params: CmsSettingsStorageOperationsGetParams) => Promise<CmsSettings | null>;\n /**\n * Create settings in the storage.\n */\n create: (params: CmsSettingsStorageOperationsCreateParams) => Promise<CmsSettings>;\n /**\n * Update the settings in the storage.\n */\n update: (params: CmsSettingsStorageOperationsUpdateParams) => Promise<CmsSettings>;\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 system: CmsSystemStorageOperations;\n settings: CmsSettingsStorageOperations;\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 * An upgrade to run if necessary.\n */\n upgrade?: UpgradePlugin | null;\n}\n"],"mappings":";;;;;;;AAoDA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;;AA6FA;AACA;AACA;;AAKA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;;AAmFA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;;AAgPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAsDA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAqCA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;;AAwCA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqDA;AACA;AACA;AACA;AACA;AACA;;AAoCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;;AAwFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgFA;AACA;AACA;AACA;AACA;AACA;;AAwEA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;;AAiEA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AAiIA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;;AA0HA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACqE;;AAErE;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AA6CA;AACA;AACA;AACA;AACA;;AAoDA;AACA;AACA;AACA;AACA;;AAoNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAyIYA,oB;;;WAAAA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,oCAAAA,oB"}
|
|
1
|
+
{"version":3,"names":["CONTENT_ENTRY_STATUS"],"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 { TenancyContext } from \"@webiny/api-tenancy/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 { FileManagerContext } from \"@webiny/api-file-manager/types\";\nimport { UpgradePlugin } from \"@webiny/api-upgrade/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection\";\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\nexport interface HeadlessCms\n extends CmsSettingsContext,\n 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/**\n * @description This combines all contexts used in the CMS into a single one.\n *\n * @category Context\n */\nexport interface CmsContext\n extends Context,\n DbContext,\n // HttpContext,\n I18NContext,\n FileManagerContext,\n TenancyContext {\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 * 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 * 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 * 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/**\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:\n | \"boolean\"\n | \"datetime\"\n | \"file\"\n | \"long-text\"\n | \"number\"\n | \"object\"\n | \"ref\"\n | \"rich-text\"\n | \"text\"\n | string;\n /**\n * A unique storage ID for storing actual values.\n * Must in form of a-zA-Z0-9@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 * @internal\n */\n storageId: 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 * Any user defined settings.\n *\n * @default {}\n */\n settings?: CmsModelFieldSettings;\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | 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 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(params: CmsModelFieldValidatorValidateParams): Promise<boolean>;\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 * Cms Model defining an entry.\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 * 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: {\n /**\n * Generated ID of the group\n */\n id: string;\n /**\n * Name of the group\n */\n name: string;\n };\n /**\n * Description for the content model.\n */\n description: string;\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?: CreatedBy;\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 * 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 version of Webiny which this record was stored with.\n */\n webinyVersion: string;\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\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 {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: CmsModelField;\n createFieldResolvers: any;\n}\nexport interface CmsModelFieldToGraphQLCreateResolver {\n (params: CmsModelFieldToGraphQLCreateResolverParams):\n | GraphQLFieldResolver\n | { resolver: GraphQLFieldResolver | null; typeResolvers: Resolvers<CmsContext> }\n | false;\n}\n\n/**\n * @category Plugin\n * @category ModelField\n * @category GraphQL\n */\nexport interface CmsModelFieldToGraphQLPlugin 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: CmsModelField;\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: { model: CmsModel; field: CmsModelField }): 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: { model: CmsModel; field: CmsModelField }): 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 model: CmsModel;\n field: CmsModelField;\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;\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: { model: CmsModel; field: CmsModelField }) => 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 model: CmsModel;\n field: CmsModelField;\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 model: CmsModel;\n field: CmsModelField;\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;\n };\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 * A interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface CreatedBy {\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\n/**\n * Representation of settings database model.\n *\n * @category Database model\n */\nexport interface CmsSettings {\n /**\n * Last content model change. Used to cache GraphQL schema.\n */\n contentModelLastChange: Date;\n /**\n * Settings tenant.\n */\n tenant: string;\n /**\n * Settings locale.\n */\n locale: string;\n}\n\n/**\n * Settings CRUD in context.\n *\n * @category Context\n */\nexport interface CmsSettingsContext {\n /**\n * Gets settings model from the database.\n */\n getSettings: () => Promise<CmsSettings | null>;\n /**\n * Updates settings model with a new date.\n */\n updateModelLastChange: () => Promise<void>;\n /**\n * Get the datetime when content model last changed.\n */\n getModelLastChange: () => Promise<Date>;\n}\n\nexport interface BeforeInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface AfterInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport type CmsSystemContext = {\n getSystemVersion: () => Promise<string | null>;\n setSystemVersion: (version: string) => Promise<void>;\n getReadAPIKey(): Promise<string | null>;\n installSystem: () => Promise<void>;\n upgradeSystem: (version: string) => Promise<boolean>;\n /**\n * Events\n */\n onBeforeSystemInstall: Topic<BeforeInstallTopicParams>;\n onAfterSystemInstall: Topic<AfterInstallTopicParams>;\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 name: string;\n slug?: string;\n description?: string;\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;\n /**\n * Icon for the group. In a form of \"ico/ico\".\n */\n icon: string;\n /**\n * CreatedBy reference object.\n */\n createdBy?: CreatedBy;\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\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 [key: string]: any;\n };\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface BeforeGroupCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface AfterGroupCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface BeforeGroupUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface AfterGroupUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface BeforeGroupDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface AfterGroupDeleteTopicParams {\n group: CmsGroup;\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 | null>;\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 * Events.\n */\n onBeforeGroupCreate: Topic<BeforeGroupCreateTopicParams>;\n onAfterGroupCreate: Topic<AfterGroupCreateTopicParams>;\n onBeforeGroupUpdate: Topic<BeforeGroupUpdateTopicParams>;\n onAfterGroupUpdate: Topic<AfterGroupUpdateTopicParams>;\n onBeforeGroupDelete: Topic<BeforeGroupDeleteTopicParams>;\n onAfterGroupDelete: Topic<AfterGroupDeleteTopicParams>;\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 * 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;\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 * 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\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;\n /**\n * Text to display in the field.\n */\n placeholderText?: 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 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;\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 * 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\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 * 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 * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry {\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: CreatedBy;\n /**\n * OwnedBy object reference. Can be different from CreatedBy.\n */\n ownedBy: CreatedBy;\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: CmsEntryValues;\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow - will be always inserted after 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\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 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 a entry.\n */\n create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Update a entry.\n */\n update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Delete a entry.\n */\n delete: (id: string) => Promise<void>;\n}\n\nexport interface BeforeModelCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\nexport interface AfterModelCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\nexport interface BeforeModelCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface AfterModelCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface BeforeModelUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface AfterModelUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface BeforeModelDeleteTopicParams {\n model: CmsModel;\n}\nexport interface AfterModelDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelInitializeParams {\n model: CmsModel;\n data: Record<string, any>;\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 a instance of CmsModelManager for given content modelId.\n *\n * @see CmsModelManager\n *\n * @deprecated use the getEntryManager() method instead\n */\n getModelManager: (model: CmsModel | string) => Promise<CmsModelManager>;\n getEntryManager: (model: CmsModel | string) => Promise<CmsModelManager>;\n /**\n * Get all content model managers mapped by modelId.\n * @see CmsModelManager\n * @deprecated use getEntryManagers instead\n */\n getManagers: () => Map<string, CmsModelManager>;\n getEntryManagers: () => Map<string, CmsModelManager>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache: () => void;\n /**\n * Events.\n */\n onBeforeModelCreate: Topic<BeforeModelCreateTopicParams>;\n onAfterModelCreate: Topic<AfterModelCreateTopicParams>;\n onBeforeModelCreateFrom: Topic<BeforeModelCreateFromTopicParams>;\n onAfterModelCreateFrom: Topic<AfterModelCreateFromTopicParams>;\n onBeforeModelUpdate: Topic<BeforeModelUpdateTopicParams>;\n onAfterModelUpdate: Topic<AfterModelUpdateTopicParams>;\n onBeforeModelDelete: Topic<BeforeModelDeleteTopicParams>;\n onAfterModelDelete: Topic<AfterModelDeleteTopicParams>;\n onModelInitialize: Topic<OnModelInitializeParams>;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus =\n | \"published\"\n | \"unpublished\"\n | \"reviewRequested\"\n | \"changesRequested\"\n | \"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 * 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]: any | CmsEntryListWhereRef;\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\nexport interface BeforeEntryCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface AfterEntryCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryCreateRevisionTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryCreateRevisionTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface AfterEntryUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryPublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryPublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryUnpublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryUnpublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryRequestChangesTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryRequestChangesTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryRequestReviewTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface AfterEntryRequestReviewTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface BeforeEntryDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface AfterEntryDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface BeforeEntryDeleteRevisionTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface AfterEntryDeleteRevisionTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface BeforeEntryGetTopicParams {\n model: StorageOperationsCmsModel;\n where: CmsEntryListWhere;\n}\n\nexport interface BeforeEntryListTopicParams {\n where: CmsEntryListWhere;\n model: StorageOperationsCmsModel;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput {\n [key: string]: any;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput {\n [key: string]: any;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput {\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 | null>;\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: (\n model: CmsModel,\n params: CmsEntryListParams\n ) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * Lists latest entries. Used for manage API.\n */\n listLatestEntries: (\n model: CmsModel,\n params?: CmsEntryListParams\n ) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * List published entries. Used for read API.\n */\n listPublishedEntries: (\n model: CmsModel,\n params?: CmsEntryListParams\n ) => Promise<[CmsEntry[], 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: (model: CmsModel, input: CreateCmsEntryInput) => 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 ) => 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 ) => 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) => Promise<void>;\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 * Request a review for the entry.\n */\n requestEntryReview: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Request changes for the entry.\n */\n requestEntryChanges: (model: CmsModel, id: string) => Promise<CmsEntry>;\n /**\n * Get all entry revisions.\n */\n getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;\n /**\n * Events.\n */\n onBeforeEntryCreate: Topic<BeforeEntryCreateTopicParams>;\n onAfterEntryCreate: Topic<AfterEntryCreateTopicParams>;\n onBeforeEntryCreateRevision: Topic<BeforeEntryCreateRevisionTopicParams>;\n onAfterEntryCreateRevision: Topic<AfterEntryCreateRevisionTopicParams>;\n onBeforeEntryUpdate: Topic<BeforeEntryUpdateTopicParams>;\n onAfterEntryUpdate: Topic<AfterEntryUpdateTopicParams>;\n onBeforeEntryDelete: Topic<BeforeEntryDeleteTopicParams>;\n onAfterEntryDelete: Topic<AfterEntryDeleteTopicParams>;\n onBeforeEntryDeleteRevision: Topic<BeforeEntryDeleteRevisionTopicParams>;\n onAfterEntryDeleteRevision: Topic<AfterEntryDeleteRevisionTopicParams>;\n onBeforeEntryPublish: Topic<BeforeEntryPublishTopicParams>;\n onAfterEntryPublish: Topic<AfterEntryPublishTopicParams>;\n onBeforeEntryUnpublish: Topic<BeforeEntryUnpublishTopicParams>;\n onAfterEntryUnpublish: Topic<AfterEntryUnpublishTopicParams>;\n onBeforeEntryRequestChanges: Topic<BeforeEntryRequestChangesTopicParams>;\n onAfterEntryRequestChanges: Topic<AfterEntryRequestChangesTopicParams>;\n onBeforeEntryRequestReview: Topic<BeforeEntryRequestReviewTopicParams>;\n onAfterEntryRequestReview: Topic<AfterEntryRequestReviewTopicParams>;\n onBeforeEntryGet: Topic<BeforeEntryGetTopicParams>;\n onBeforeEntryList: Topic<BeforeEntryListTopicParams>;\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 * Settings security permission.\n *\n * @category SecurityPermission\n */\nexport interface CmsSettingsPermission extends SecurityPermission {} // eslint-disable-line\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 * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n /**\n * A object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * A object representing `key: group.id` values where key is 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 * A object representing `key: group.id` values where key is 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 * A object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * A object representing `key: group.id` values where key is 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}\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 /**\n * Entry that is going to be deleted.\n */\n entry: CmsEntry;\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 CmsEntryStorageOperationsRequestChangesParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Entry data updated with the required properties.\n */\n entry: CmsEntry;\n /**\n * Entry that is prepared for the storageOperations, with the transformations.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsRequestReviewParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Entry that is prepared for the storageOperations.\n */\n entry: CmsEntry;\n /**\n * Entry that is prepared for the storageOperations, with the transformations.\n */\n storageEntry: T;\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}\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: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<T[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<T | null>;\n /**\n * Gets entry by given params.\n */\n get: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) => Promise<T | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<T>>;\n /**\n * Create a new entry.\n */\n create: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateParams<T>\n ) => Promise<T>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<T>;\n /**\n * Update existing entry.\n */\n update: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUpdateParams<T>\n ) => Promise<T>;\n /**\n * Delete the entry revision.\n */\n deleteRevision: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ) => Promise<void>;\n /**\n * Delete the entry.\n */\n delete: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsDeleteParams\n ) => Promise<void>;\n /**\n * Publish the entry.\n */\n publish: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsPublishParams<T>\n ) => Promise<T>;\n /**\n * Unpublish the entry.\n */\n unpublish: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsUnpublishParams<T>\n ) => Promise<T>;\n /**\n * Request changes the entry.\n */\n requestChanges: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestChangesParams<T>\n ) => Promise<T>;\n /**\n * Request review the entry.\n */\n requestReview: (\n model: StorageOperationsCmsModel,\n params: CmsEntryStorageOperationsRequestReviewParams<T>\n ) => Promise<CmsEntry>;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\",\n CHANGES_REQUESTED = \"changesRequested\",\n REVIEW_REQUESTED = \"reviewRequested\"\n}\n\nexport interface CmsSettingsStorageOperationsGetParams {\n locale: string;\n tenant: string;\n}\n\nexport interface CmsSettingsStorageOperationsCreateParams {\n settings: CmsSettings;\n}\n\nexport interface CmsSettingsStorageOperationsUpdateParams {\n settings: CmsSettings;\n}\n\nexport interface CmsSettingsStorageOperations {\n /**\n * Get the settings from the storage.\n */\n get: (params: CmsSettingsStorageOperationsGetParams) => Promise<CmsSettings | null>;\n /**\n * Create settings in the storage.\n */\n create: (params: CmsSettingsStorageOperationsCreateParams) => Promise<CmsSettings>;\n /**\n * Update the settings in the storage.\n */\n update: (params: CmsSettingsStorageOperationsUpdateParams) => Promise<CmsSettings>;\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 system: CmsSystemStorageOperations;\n settings: CmsSettingsStorageOperations;\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 * An upgrade to run if necessary.\n */\n upgrade?: UpgradePlugin | null;\n}\n"],"mappings":";;;;;;;AAoDA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;;AA6FA;AACA;AACA;;AAKA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;;AAmFA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;;AAgPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAsDA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAqCA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;;AAwCA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqDA;AACA;AACA;AACA;AACA;AACA;;AAoCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;;AAwFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiFA;AACA;AACA;AACA;AACA;AACA;;AAwEA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;;AAiEA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AAiIA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;;AA0HA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACqE;;AAErE;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;;AA6CA;AACA;AACA;AACA;AACA;;AAoDA;AACA;AACA;AACA;AACA;;AAoNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAyIYA,oB;;;WAAAA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,oCAAAA,oB"}
|