@webiny/api-headless-cms 0.0.0-unstable.d65ec29d44 → 0.0.0-unstable.e3f4727c56

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.
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.createSystemCrud = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _crypto = _interopRequireDefault(require("crypto"));
10
9
  var _apiSecurity = require("@webiny/api-security");
11
- var _apiUpgrade = require("@webiny/api-upgrade");
12
10
  var _error = _interopRequireDefault(require("@webiny/error"));
13
11
  var _pubsub = require("@webiny/pubsub");
14
12
  const initialContentModelGroup = {
@@ -28,9 +26,6 @@ const createSystemCrud = params => {
28
26
  const onSystemBeforeInstall = (0, _pubsub.createTopic)("cms.onSystemBeforeInstall");
29
27
  const onSystemAfterInstall = (0, _pubsub.createTopic)("cms.onSystemAfterInstall");
30
28
  const onSystemInstallError = (0, _pubsub.createTopic)("cms.onSystemInstallError");
31
- const createReadAPIKey = () => {
32
- return _crypto.default.randomBytes(Math.ceil(48 / 2)).toString("hex");
33
- };
34
29
  const getVersion = async () => {
35
30
  if (!getTenant()) {
36
31
  return null;
@@ -72,25 +67,6 @@ const createSystemCrud = params => {
72
67
  onSystemInstallError,
73
68
  getSystemVersion: getVersion,
74
69
  setSystemVersion: setVersion,
75
- getReadAPIKey: async () => {
76
- const original = await storageOperations.system.get({
77
- tenant: getTenant().id
78
- });
79
- if (!original) {
80
- return null;
81
- }
82
- if (!original.readAPIKey) {
83
- const readAPIKey = createReadAPIKey();
84
- const system = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, original), {}, {
85
- readAPIKey
86
- });
87
- await storageOperations.system.update({
88
- system
89
- });
90
- return readAPIKey;
91
- }
92
- return original.readAPIKey;
93
- },
94
70
  installSystem: async () => {
95
71
  const identity = getIdentity();
96
72
  if (!identity) {
@@ -121,7 +97,6 @@ const createSystemCrud = params => {
121
97
  }
122
98
  const system = {
123
99
  version: context.WEBINY_VERSION,
124
- readAPIKey: createReadAPIKey(),
125
100
  tenant: getTenant().id
126
101
  };
127
102
  /**
@@ -145,41 +120,6 @@ const createSystemCrud = params => {
145
120
  });
146
121
  throw new _error.default(ex.message, ex.code, ex.data);
147
122
  }
148
- },
149
- async upgradeSystem(version) {
150
- const identity = getIdentity();
151
- if (!identity) {
152
- throw new _apiSecurity.NotAuthorizedError();
153
- }
154
- const upgradePlugins = context.plugins.byType("api-upgrade").filter(pl => pl.app === "headless-cms");
155
- const installedAppVersion = await this.getSystemVersion();
156
- let plugin = undefined;
157
- try {
158
- plugin = (0, _apiUpgrade.getApplicablePlugin)({
159
- deployedVersion: context.WEBINY_VERSION,
160
- installedAppVersion,
161
- upgradePlugins,
162
- upgradeToVersion: version
163
- });
164
- } catch (ex) {
165
- /**
166
- * We just let the error disappear if is UPGRADE_NOT_AVAILABLE code
167
- * and rethrow if is not.
168
- * This is because we want upgrade to pass if there is no plugin available.
169
- */
170
- if (ex.code !== _apiUpgrade.ErrorCode.UPGRADE_NOT_AVAILABLE) {
171
- throw ex;
172
- }
173
- }
174
- if (plugin) {
175
- await plugin.apply(context);
176
- }
177
-
178
- /**
179
- * Store new app version.
180
- */
181
- await setVersion(version);
182
- return true;
183
123
  }
184
124
  };
185
125
  };
@@ -1 +1 @@
1
- {"version":3,"names":["initialContentModelGroup","name","slug","description","icon","createSystemCrud","params","getTenant","getLocale","storageOperations","context","getIdentity","onSystemBeforeInstall","createTopic","onSystemAfterInstall","onSystemInstallError","createReadAPIKey","crypto","randomBytes","Math","ceil","toString","getVersion","system","get","tenant","id","version","setVersion","original","create","update","onBeforeSystemInstall","onAfterSystemInstall","getSystemVersion","setSystemVersion","getReadAPIKey","readAPIKey","installSystem","identity","NotAuthorizedError","publish","locale","code","cms","createGroup","ex","WebinyError","message","group","WEBINY_VERSION","error","data","upgradeSystem","upgradePlugins","plugins","byType","filter","pl","app","installedAppVersion","plugin","undefined","getApplicablePlugin","deployedVersion","upgradeToVersion","ErrorCode","UPGRADE_NOT_AVAILABLE","apply"],"sources":["system.crud.ts"],"sourcesContent":["import crypto from \"crypto\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\nimport { ErrorCode, getApplicablePlugin } from \"@webiny/api-upgrade\";\nimport { UpgradePlugin } from \"@webiny/api-upgrade/types\";\nimport WebinyError from \"@webiny/error\";\nimport {\n OnSystemAfterInstallTopicParams,\n OnSystemBeforeInstallTopicParams,\n CmsContext,\n CmsSystem,\n CmsSystemContext,\n HeadlessCms,\n HeadlessCmsStorageOperations,\n OnSystemInstallErrorTopicParams\n} from \"~/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\n\nconst initialContentModelGroup = {\n name: \"Ungrouped\",\n slug: \"ungrouped\",\n description: \"A generic content model group\",\n icon: \"fas/star\"\n};\n\ninterface CreateSystemCrudParams {\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n storageOperations: HeadlessCmsStorageOperations;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n}\nexport const createSystemCrud = (params: CreateSystemCrudParams): CmsSystemContext => {\n const { getTenant, getLocale, storageOperations, context, getIdentity } = params;\n\n const onSystemBeforeInstall = createTopic<OnSystemBeforeInstallTopicParams>(\n \"cms.onSystemBeforeInstall\"\n );\n const onSystemAfterInstall = createTopic<OnSystemAfterInstallTopicParams>(\n \"cms.onSystemAfterInstall\"\n );\n\n const onSystemInstallError = createTopic<OnSystemInstallErrorTopicParams>(\n \"cms.onSystemInstallError\"\n );\n\n const createReadAPIKey = () => {\n return crypto.randomBytes(Math.ceil(48 / 2)).toString(\"hex\");\n };\n\n const getVersion = async () => {\n if (!getTenant()) {\n return null;\n }\n\n const system = await storageOperations.system.get({\n tenant: getTenant().id\n });\n\n return system?.version || null;\n };\n\n const setVersion = async (version: string) => {\n const original = await storageOperations.system.get({\n tenant: getTenant().id\n });\n const system: CmsSystem = {\n ...(original || {}),\n version,\n tenant: getTenant().id\n };\n if (!original) {\n await storageOperations.system.create({\n system\n });\n return;\n }\n await storageOperations.system.update({\n system\n });\n };\n\n return {\n /**\n * Deprecated - will be removed in 5.36.0\n */\n onBeforeSystemInstall: onSystemBeforeInstall,\n onAfterSystemInstall: onSystemAfterInstall,\n /**\n * Released in 5.34.0\n */\n onSystemBeforeInstall,\n onSystemAfterInstall,\n onSystemInstallError,\n getSystemVersion: getVersion,\n setSystemVersion: setVersion,\n getReadAPIKey: async () => {\n const original = await storageOperations.system.get({\n tenant: getTenant().id\n });\n\n if (!original) {\n return null;\n }\n\n if (!original.readAPIKey) {\n const readAPIKey = createReadAPIKey();\n const system: CmsSystem = {\n ...original,\n readAPIKey\n };\n await storageOperations.system.update({\n system\n });\n return readAPIKey;\n }\n\n return original.readAPIKey;\n },\n installSystem: async (): Promise<void> => {\n const identity = getIdentity();\n if (!identity) {\n throw new NotAuthorizedError();\n }\n\n const version = await getVersion();\n if (version) {\n return;\n }\n try {\n /**\n * First trigger before install event.\n */\n await onSystemBeforeInstall.publish({\n tenant: getTenant().id,\n locale: getLocale().code\n });\n\n /**\n * Add default content model group.\n */\n try {\n await context.cms.createGroup(initialContentModelGroup);\n } catch (ex) {\n throw new WebinyError(\n ex.message,\n \"CMS_INSTALLATION_CONTENT_MODEL_GROUP_ERROR\",\n {\n group: initialContentModelGroup\n }\n );\n }\n\n const system: CmsSystem = {\n version: context.WEBINY_VERSION,\n readAPIKey: createReadAPIKey(),\n tenant: getTenant().id\n };\n /**\n * We need to create the system data.\n */\n await storageOperations.system.create({\n system\n });\n /**\n * And trigger after install event.\n */\n await onSystemAfterInstall.publish({\n tenant: getTenant().id,\n locale: getLocale().code\n });\n } catch (ex) {\n await onSystemInstallError.publish({\n error: ex,\n tenant: getTenant().id,\n locale: getLocale().code\n });\n throw new WebinyError(ex.message, ex.code, ex.data);\n }\n },\n async upgradeSystem(this: HeadlessCms, version) {\n const identity = getIdentity();\n if (!identity) {\n throw new NotAuthorizedError();\n }\n\n const upgradePlugins = context.plugins\n .byType<UpgradePlugin>(\"api-upgrade\")\n .filter(pl => pl.app === \"headless-cms\");\n\n const installedAppVersion = await this.getSystemVersion();\n\n let plugin: UpgradePlugin | undefined = undefined;\n try {\n plugin = getApplicablePlugin({\n deployedVersion: context.WEBINY_VERSION,\n installedAppVersion,\n upgradePlugins,\n upgradeToVersion: version\n });\n } catch (ex) {\n /**\n * We just let the error disappear if is UPGRADE_NOT_AVAILABLE code\n * and rethrow if is not.\n * This is because we want upgrade to pass if there is no plugin available.\n */\n if (ex.code !== ErrorCode.UPGRADE_NOT_AVAILABLE) {\n throw ex;\n }\n }\n\n if (plugin) {\n await plugin.apply(context);\n }\n\n /**\n * Store new app version.\n */\n await setVersion(version);\n\n return true;\n }\n };\n};\n"],"mappings":"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"}
1
+ {"version":3,"names":["initialContentModelGroup","name","slug","description","icon","createSystemCrud","params","getTenant","getLocale","storageOperations","context","getIdentity","onSystemBeforeInstall","createTopic","onSystemAfterInstall","onSystemInstallError","getVersion","system","get","tenant","id","version","setVersion","original","create","update","onBeforeSystemInstall","onAfterSystemInstall","getSystemVersion","setSystemVersion","installSystem","identity","NotAuthorizedError","publish","locale","code","cms","createGroup","ex","WebinyError","message","group","WEBINY_VERSION","error","data"],"sources":["system.crud.ts"],"sourcesContent":["import { NotAuthorizedError } from \"@webiny/api-security\";\nimport WebinyError from \"@webiny/error\";\nimport {\n OnSystemAfterInstallTopicParams,\n OnSystemBeforeInstallTopicParams,\n CmsContext,\n CmsSystem,\n CmsSystemContext,\n HeadlessCmsStorageOperations,\n OnSystemInstallErrorTopicParams\n} from \"~/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\n\nconst initialContentModelGroup = {\n name: \"Ungrouped\",\n slug: \"ungrouped\",\n description: \"A generic content model group\",\n icon: \"fas/star\"\n};\n\ninterface CreateSystemCrudParams {\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n storageOperations: HeadlessCmsStorageOperations;\n context: CmsContext;\n getIdentity: () => SecurityIdentity;\n}\nexport const createSystemCrud = (params: CreateSystemCrudParams): CmsSystemContext => {\n const { getTenant, getLocale, storageOperations, context, getIdentity } = params;\n\n const onSystemBeforeInstall = createTopic<OnSystemBeforeInstallTopicParams>(\n \"cms.onSystemBeforeInstall\"\n );\n const onSystemAfterInstall = createTopic<OnSystemAfterInstallTopicParams>(\n \"cms.onSystemAfterInstall\"\n );\n\n const onSystemInstallError = createTopic<OnSystemInstallErrorTopicParams>(\n \"cms.onSystemInstallError\"\n );\n\n const getVersion = async () => {\n if (!getTenant()) {\n return null;\n }\n\n const system = await storageOperations.system.get({\n tenant: getTenant().id\n });\n\n return system?.version || null;\n };\n\n const setVersion = async (version: string) => {\n const original = await storageOperations.system.get({\n tenant: getTenant().id\n });\n const system: CmsSystem = {\n ...(original || {}),\n version,\n tenant: getTenant().id\n };\n if (!original) {\n await storageOperations.system.create({\n system\n });\n return;\n }\n await storageOperations.system.update({\n system\n });\n };\n\n return {\n /**\n * Deprecated - will be removed in 5.36.0\n */\n onBeforeSystemInstall: onSystemBeforeInstall,\n onAfterSystemInstall: onSystemAfterInstall,\n /**\n * Released in 5.34.0\n */\n onSystemBeforeInstall,\n onSystemAfterInstall,\n onSystemInstallError,\n getSystemVersion: getVersion,\n setSystemVersion: setVersion,\n installSystem: async (): Promise<void> => {\n const identity = getIdentity();\n if (!identity) {\n throw new NotAuthorizedError();\n }\n\n const version = await getVersion();\n if (version) {\n return;\n }\n try {\n /**\n * First trigger before install event.\n */\n await onSystemBeforeInstall.publish({\n tenant: getTenant().id,\n locale: getLocale().code\n });\n\n /**\n * Add default content model group.\n */\n try {\n await context.cms.createGroup(initialContentModelGroup);\n } catch (ex) {\n throw new WebinyError(\n ex.message,\n \"CMS_INSTALLATION_CONTENT_MODEL_GROUP_ERROR\",\n {\n group: initialContentModelGroup\n }\n );\n }\n\n const system: CmsSystem = {\n version: context.WEBINY_VERSION,\n tenant: getTenant().id\n };\n /**\n * We need to create the system data.\n */\n await storageOperations.system.create({\n system\n });\n /**\n * And trigger after install event.\n */\n await onSystemAfterInstall.publish({\n tenant: getTenant().id,\n locale: getLocale().code\n });\n } catch (ex) {\n await onSystemInstallError.publish({\n error: ex,\n tenant: getTenant().id,\n locale: getLocale().code\n });\n throw new WebinyError(ex.message, ex.code, ex.data);\n }\n }\n };\n};\n"],"mappings":"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"}
package/graphql/system.js CHANGED
@@ -32,9 +32,6 @@ const plugin = new _handlerGraphql.GraphQLSchemaPlugin({
32
32
  extend type CmsMutation {
33
33
  # Install CMS
34
34
  install: CmsBooleanResponse
35
-
36
- # Upgrade CMS
37
- upgrade(version: String!): CmsBooleanResponse
38
35
  }
39
36
  `,
40
37
  resolvers: {
@@ -70,19 +67,6 @@ const plugin = new _handlerGraphql.GraphQLSchemaPlugin({
70
67
  } catch (e) {
71
68
  return new _handlerGraphql.ErrorResponse(e);
72
69
  }
73
- },
74
- upgrade: async (_, args, {
75
- cms
76
- }) => {
77
- const {
78
- version
79
- } = args;
80
- try {
81
- await cms.upgradeSystem(version);
82
- return new _handlerGraphql.Response(true);
83
- } catch (e) {
84
- return new _handlerGraphql.ErrorResponse(e);
85
- }
86
70
  }
87
71
  }
88
72
  }
@@ -1 +1 @@
1
- {"version":3,"names":["emptyResolver","plugin","GraphQLSchemaPlugin","typeDefs","resolvers","Query","cms","Mutation","CmsQuery","version","_","__","context","getSystemVersion","e","ErrorResponse","CmsMutation","install","code","message","installSystem","Response","upgrade","args","upgradeSystem","name","createSystemSchemaPlugin","ContextPlugin","type","plugins","register"],"sources":["system.ts"],"sourcesContent":["import { ErrorResponse, GraphQLSchemaPlugin, Response } from \"@webiny/handler-graphql\";\nimport { CmsContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\n\nconst emptyResolver = () => ({});\n\nconst plugin = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n extend type Query {\n cms: CmsQuery\n }\n\n extend type Mutation {\n cms: CmsMutation\n }\n\n type CmsQuery {\n _empty: String\n }\n\n type CmsMutation {\n _empty: String\n }\n extend type CmsQuery {\n # Get installed version\n version: String\n }\n\n extend type CmsMutation {\n # Install CMS\n install: CmsBooleanResponse\n\n # Upgrade CMS\n upgrade(version: String!): CmsBooleanResponse\n }\n `,\n resolvers: {\n Query: {\n cms: emptyResolver\n },\n Mutation: {\n cms: emptyResolver\n },\n CmsQuery: {\n version: async (_: any, __: any, context: CmsContext) => {\n try {\n return context.cms.getSystemVersion();\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n CmsMutation: {\n install: async (_: any, __: any, { cms }: CmsContext) => {\n try {\n const version = await cms.getSystemVersion();\n if (version) {\n return new ErrorResponse({\n code: \"CMS_INSTALLATION_ERROR\",\n message: \"CMS is already installed.\"\n });\n }\n\n await cms.installSystem();\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n upgrade: async (_: any, args: any, { cms }: CmsContext) => {\n const { version } = args;\n try {\n await cms.upgradeSystem(version);\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n }\n});\nplugin.name = \"cms.graphql.schema.system\";\n/**\n * We only register system schema plugin if the endpoint is not manage/preview/read.\n */\nexport const createSystemSchemaPlugin = (): ContextPlugin<CmsContext> => {\n return new ContextPlugin<CmsContext>(async context => {\n if (context.cms?.type) {\n return;\n }\n context.plugins.register(plugin);\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAEA,MAAMA,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,MAAM,GAAG,IAAIC,mCAAmB,CAAC;EACnCC,QAAQ,EAAE,aAAe;AAC7B;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,KAAK;EACDC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN;IACT,CAAC;IACDO,QAAQ,EAAE;MACND,GAAG,EAAEN;IACT,CAAC;IACDQ,QAAQ,EAAE;MACNC,OAAO,EAAE,OAAOC,CAAM,EAAEC,EAAO,EAAEC,OAAmB,KAAK;QACrD,IAAI;UACA,OAAOA,OAAO,CAACN,GAAG,CAACO,gBAAgB,EAAE;QACzC,CAAC,CAAC,OAAOC,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ,CAAC;IACDE,WAAW,EAAE;MACTC,OAAO,EAAE,OAAOP,CAAM,EAAEC,EAAO,EAAE;QAAEL;MAAgB,CAAC,KAAK;QACrD,IAAI;UACA,MAAMG,OAAO,GAAG,MAAMH,GAAG,CAACO,gBAAgB,EAAE;UAC5C,IAAIJ,OAAO,EAAE;YACT,OAAO,IAAIM,6BAAa,CAAC;cACrBG,IAAI,EAAE,wBAAwB;cAC9BC,OAAO,EAAE;YACb,CAAC,CAAC;UACN;UAEA,MAAMb,GAAG,CAACc,aAAa,EAAE;UACzB,OAAO,IAAIC,wBAAQ,CAAC,IAAI,CAAC;QAC7B,CAAC,CAAC,OAAOP,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ,CAAC;MACDQ,OAAO,EAAE,OAAOZ,CAAM,EAAEa,IAAS,EAAE;QAAEjB;MAAgB,CAAC,KAAK;QACvD,MAAM;UAAEG;QAAQ,CAAC,GAAGc,IAAI;QACxB,IAAI;UACA,MAAMjB,GAAG,CAACkB,aAAa,CAACf,OAAO,CAAC;UAChC,OAAO,IAAIY,wBAAQ,CAAC,IAAI,CAAC;QAC7B,CAAC,CAAC,OAAOP,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ;EACJ;AACJ,CAAC,CAAC;AACFb,MAAM,CAACwB,IAAI,GAAG,2BAA2B;AACzC;AACA;AACA;AACO,MAAMC,wBAAwB,GAAG,MAAiC;EACrE,OAAO,IAAIC,kBAAa,CAAa,MAAMf,OAAO,IAAI;IAAA;IAClD,oBAAIA,OAAO,CAACN,GAAG,yCAAX,aAAasB,IAAI,EAAE;MACnB;IACJ;IACAhB,OAAO,CAACiB,OAAO,CAACC,QAAQ,CAAC7B,MAAM,CAAC;EACpC,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["emptyResolver","plugin","GraphQLSchemaPlugin","typeDefs","resolvers","Query","cms","Mutation","CmsQuery","version","_","__","context","getSystemVersion","e","ErrorResponse","CmsMutation","install","code","message","installSystem","Response","name","createSystemSchemaPlugin","ContextPlugin","type","plugins","register"],"sources":["system.ts"],"sourcesContent":["import { ErrorResponse, GraphQLSchemaPlugin, Response } from \"@webiny/handler-graphql\";\nimport { CmsContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\n\nconst emptyResolver = () => ({});\n\nconst plugin = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n extend type Query {\n cms: CmsQuery\n }\n\n extend type Mutation {\n cms: CmsMutation\n }\n\n type CmsQuery {\n _empty: String\n }\n\n type CmsMutation {\n _empty: String\n }\n extend type CmsQuery {\n # Get installed version\n version: String\n }\n\n extend type CmsMutation {\n # Install CMS\n install: CmsBooleanResponse\n }\n `,\n resolvers: {\n Query: {\n cms: emptyResolver\n },\n Mutation: {\n cms: emptyResolver\n },\n CmsQuery: {\n version: async (_: any, __: any, context: CmsContext) => {\n try {\n return context.cms.getSystemVersion();\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n CmsMutation: {\n install: async (_: any, __: any, { cms }: CmsContext) => {\n try {\n const version = await cms.getSystemVersion();\n if (version) {\n return new ErrorResponse({\n code: \"CMS_INSTALLATION_ERROR\",\n message: \"CMS is already installed.\"\n });\n }\n\n await cms.installSystem();\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n }\n});\nplugin.name = \"cms.graphql.schema.system\";\n/**\n * We only register system schema plugin if the endpoint is not manage/preview/read.\n */\nexport const createSystemSchemaPlugin = (): ContextPlugin<CmsContext> => {\n return new ContextPlugin<CmsContext>(async context => {\n if (context.cms?.type) {\n return;\n }\n context.plugins.register(plugin);\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAEA,MAAMA,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,MAAM,GAAG,IAAIC,mCAAmB,CAAC;EACnCC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN;IACT,CAAC;IACDO,QAAQ,EAAE;MACND,GAAG,EAAEN;IACT,CAAC;IACDQ,QAAQ,EAAE;MACNC,OAAO,EAAE,OAAOC,CAAM,EAAEC,EAAO,EAAEC,OAAmB,KAAK;QACrD,IAAI;UACA,OAAOA,OAAO,CAACN,GAAG,CAACO,gBAAgB,EAAE;QACzC,CAAC,CAAC,OAAOC,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ,CAAC;IACDE,WAAW,EAAE;MACTC,OAAO,EAAE,OAAOP,CAAM,EAAEC,EAAO,EAAE;QAAEL;MAAgB,CAAC,KAAK;QACrD,IAAI;UACA,MAAMG,OAAO,GAAG,MAAMH,GAAG,CAACO,gBAAgB,EAAE;UAC5C,IAAIJ,OAAO,EAAE;YACT,OAAO,IAAIM,6BAAa,CAAC;cACrBG,IAAI,EAAE,wBAAwB;cAC9BC,OAAO,EAAE;YACb,CAAC,CAAC;UACN;UAEA,MAAMb,GAAG,CAACc,aAAa,EAAE;UACzB,OAAO,IAAIC,wBAAQ,CAAC,IAAI,CAAC;QAC7B,CAAC,CAAC,OAAOP,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ;EACJ;AACJ,CAAC,CAAC;AACFb,MAAM,CAACqB,IAAI,GAAG,2BAA2B;AACzC;AACA;AACA;AACO,MAAMC,wBAAwB,GAAG,MAAiC;EACrE,OAAO,IAAIC,kBAAa,CAAa,MAAMZ,OAAO,IAAI;IAAA;IAClD,oBAAIA,OAAO,CAACN,GAAG,yCAAX,aAAamB,IAAI,EAAE;MACnB;IACJ;IACAb,OAAO,CAACc,OAAO,CAACC,QAAQ,CAAC1B,MAAM,CAAC;EACpC,CAAC,CAAC;AACN,CAAC;AAAC"}
package/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { entryFieldFromStorageTransform, entryFromStorageTransform, entryToStora
4
4
  export declare type CreateHeadlessCmsGraphQLParams = CreateGraphQLParams;
5
5
  export declare const createHeadlessCmsGraphQL: (params?: CreateHeadlessCmsGraphQLParams) => (import("./plugins").CmsParametersPlugin | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("./types").CmsContext> | import("@webiny/api").ContextPlugin<import("./types").CmsContext> | import("@webiny/plugins/types").PluginCollection)[];
6
6
  export declare type ContentContextParams = CrudParams;
7
- export declare const createHeadlessCmsContext: (params: ContentContextParams) => (import("./types").ModelManagerPlugin | import("./plugins").StorageTransformPlugin<any, any, import("./types").CmsModelField> | import("@webiny/api").ContextPlugin<import("./types").CmsContext> | import("@webiny/api-upgrade").UpgradePlugin<import("./types").CmsContext>[] | import("./plugins").StorageTransformPlugin<any, any, import("./types").CmsModelDynamicZoneField> | import("./types").CmsModelFieldToGraphQLPlugin<any>[] | (import("./types").CmsModelFieldValidatorPlugin | import("./types").CmsModelFieldPatternValidatorPlugin[])[] | (import("./fieldConverters/CmsModelObjectFieldConverterPlugin").CmsModelObjectFieldConverterPlugin | import("./fieldConverters/CmsModelDefaultFieldConverterPlugin").CmsModelDefaultFieldConverterPlugin | import("./fieldConverters/CmsModelDynamicZoneFieldConverterPlugin").CmsModelDynamicZoneFieldConverterPlugin)[])[];
7
+ export declare const createHeadlessCmsContext: (params: ContentContextParams) => (import("./types").ModelManagerPlugin | import("./plugins").StorageTransformPlugin<any, any, import("./types").CmsModelField> | import("@webiny/api").ContextPlugin<import("./types").CmsContext> | import("./plugins").StorageTransformPlugin<any, any, import("./types").CmsModelDynamicZoneField> | import("./types").CmsModelFieldToGraphQLPlugin<any>[] | (import("./types").CmsModelFieldValidatorPlugin | import("./types").CmsModelFieldPatternValidatorPlugin[])[] | (import("./fieldConverters/CmsModelObjectFieldConverterPlugin").CmsModelObjectFieldConverterPlugin | import("./fieldConverters/CmsModelDefaultFieldConverterPlugin").CmsModelDefaultFieldConverterPlugin | import("./fieldConverters/CmsModelDynamicZoneFieldConverterPlugin").CmsModelDynamicZoneFieldConverterPlugin)[])[];
8
8
  export * from "./graphqlFields";
9
9
  export * from "./plugins";
10
10
  export { entryToStorageTransform, entryFieldFromStorageTransform, entryFromStorageTransform };
package/index.js CHANGED
@@ -30,7 +30,6 @@ Object.defineProperty(exports, "entryToStorageTransform", {
30
30
  }
31
31
  });
32
32
  var _graphql = require("./graphql");
33
- var _upgrades = require("./upgrades");
34
33
  var _modelManager = require("./modelManager");
35
34
  var _graphqlFields = require("./graphqlFields");
36
35
  Object.keys(_graphqlFields).forEach(function (key) {
@@ -81,6 +80,6 @@ const createHeadlessCmsContext = params => {
81
80
  /**
82
81
  * Context for all Lambdas - everything is loaded now.
83
82
  */
84
- (0, _context.createContextPlugin)(params), (0, _modelManager.createDefaultModelManager)(), (0, _graphqlFields.createGraphQLFields)(), (0, _fieldConverters.createFieldConverters)(), (0, _validators.createValidators)(), (0, _default.createDefaultStorageTransform)(), (0, _object.createObjectStorageTransform)(), (0, _dynamicZoneStorage.createDynamicZoneStorageTransform)(), (0, _upgrades.createUpgrades)()];
83
+ (0, _context.createContextPlugin)(params), (0, _modelManager.createDefaultModelManager)(), (0, _graphqlFields.createGraphQLFields)(), (0, _fieldConverters.createFieldConverters)(), (0, _validators.createValidators)(), (0, _default.createDefaultStorageTransform)(), (0, _object.createObjectStorageTransform)(), (0, _dynamicZoneStorage.createDynamicZoneStorageTransform)()];
85
84
  };
86
85
  exports.createHeadlessCmsContext = createHeadlessCmsContext;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createHeadlessCmsGraphQL","params","createPathParameterPlugin","createHeaderParameterPlugin","createContextParameterPlugin","baseCreateGraphQL","createHeadlessCmsContext","createContextPlugin","createDefaultModelManager","createGraphQLFields","createFieldConverters","createValidators","createDefaultStorageTransform","createObjectStorageTransform","createDynamicZoneStorageTransform","createUpgrades"],"sources":["index.ts"],"sourcesContent":["import { createGraphQL as baseCreateGraphQL, CreateGraphQLParams } from \"~/graphql\";\nimport { createUpgrades } from \"~/upgrades\";\nimport { createDefaultModelManager } from \"~/modelManager\";\nimport { createGraphQLFields } from \"~/graphqlFields\";\nimport { createValidators } from \"~/validators\";\nimport { createDefaultStorageTransform } from \"~/storage/default\";\nimport { createObjectStorageTransform } from \"~/storage/object\";\nimport { createDynamicZoneStorageTransform } from \"~/graphqlFields/dynamicZone/dynamicZoneStorage\";\nimport {\n createContextParameterPlugin,\n createHeaderParameterPlugin,\n createPathParameterPlugin\n} from \"~/parameters\";\nimport { createContextPlugin, CrudParams } from \"~/context\";\nimport {\n entryFieldFromStorageTransform,\n entryFromStorageTransform,\n entryToStorageTransform\n} from \"./utils/entryStorage\";\nimport { createFieldConverters } from \"~/fieldConverters\";\n\nexport type CreateHeadlessCmsGraphQLParams = CreateGraphQLParams;\nexport const createHeadlessCmsGraphQL = (params: CreateHeadlessCmsGraphQLParams = {}) => {\n return [\n /**\n * PathParameter plugins are used to determine the type of the cms endpoint\n */\n createPathParameterPlugin(),\n createHeaderParameterPlugin(),\n createContextParameterPlugin(),\n /**\n * At this point we can create, or not create, CMS GraphQL Schema.\n */\n ...baseCreateGraphQL(params)\n ];\n};\n\nexport type ContentContextParams = CrudParams;\nexport const createHeadlessCmsContext = (params: ContentContextParams) => {\n return [\n /**\n * Context for all Lambdas - everything is loaded now.\n */\n createContextPlugin(params),\n createDefaultModelManager(),\n createGraphQLFields(),\n createFieldConverters(),\n createValidators(),\n createDefaultStorageTransform(),\n createObjectStorageTransform(),\n createDynamicZoneStorageTransform(),\n createUpgrades()\n ];\n};\nexport * from \"~/graphqlFields\";\nexport * from \"~/plugins\";\nexport { entryToStorageTransform, entryFieldFromStorageTransform, entryFromStorageTransform };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAmDA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAlDA;AACA;AACA;AACA;AACA;AAKA;AACA;AAKA;AAoCA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAjCO,MAAMA,wBAAwB,GAAG,CAACC,MAAsC,GAAG,CAAC,CAAC,KAAK;EACrF,OAAO;EACH;AACR;AACA;EACQ,IAAAC,qCAAyB,GAAE,EAC3B,IAAAC,uCAA2B,GAAE,EAC7B,IAAAC,wCAA4B,GAAE;EAC9B;AACR;AACA;EACQ,GAAG,IAAAC,sBAAiB,EAACJ,MAAM,CAAC,CAC/B;AACL,CAAC;AAAC;AAGK,MAAMK,wBAAwB,GAAIL,MAA4B,IAAK;EACtE,OAAO;EACH;AACR;AACA;EACQ,IAAAM,4BAAmB,EAACN,MAAM,CAAC,EAC3B,IAAAO,uCAAyB,GAAE,EAC3B,IAAAC,kCAAmB,GAAE,EACrB,IAAAC,sCAAqB,GAAE,EACvB,IAAAC,4BAAgB,GAAE,EAClB,IAAAC,sCAA6B,GAAE,EAC/B,IAAAC,oCAA4B,GAAE,EAC9B,IAAAC,qDAAiC,GAAE,EACnC,IAAAC,wBAAc,GAAE,CACnB;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["createHeadlessCmsGraphQL","params","createPathParameterPlugin","createHeaderParameterPlugin","createContextParameterPlugin","baseCreateGraphQL","createHeadlessCmsContext","createContextPlugin","createDefaultModelManager","createGraphQLFields","createFieldConverters","createValidators","createDefaultStorageTransform","createObjectStorageTransform","createDynamicZoneStorageTransform"],"sources":["index.ts"],"sourcesContent":["import { createGraphQL as baseCreateGraphQL, CreateGraphQLParams } from \"~/graphql\";\nimport { createDefaultModelManager } from \"~/modelManager\";\nimport { createGraphQLFields } from \"~/graphqlFields\";\nimport { createValidators } from \"~/validators\";\nimport { createDefaultStorageTransform } from \"~/storage/default\";\nimport { createObjectStorageTransform } from \"~/storage/object\";\nimport { createDynamicZoneStorageTransform } from \"~/graphqlFields/dynamicZone/dynamicZoneStorage\";\nimport {\n createContextParameterPlugin,\n createHeaderParameterPlugin,\n createPathParameterPlugin\n} from \"~/parameters\";\nimport { createContextPlugin, CrudParams } from \"~/context\";\nimport {\n entryFieldFromStorageTransform,\n entryFromStorageTransform,\n entryToStorageTransform\n} from \"./utils/entryStorage\";\nimport { createFieldConverters } from \"~/fieldConverters\";\n\nexport type CreateHeadlessCmsGraphQLParams = CreateGraphQLParams;\nexport const createHeadlessCmsGraphQL = (params: CreateHeadlessCmsGraphQLParams = {}) => {\n return [\n /**\n * PathParameter plugins are used to determine the type of the cms endpoint\n */\n createPathParameterPlugin(),\n createHeaderParameterPlugin(),\n createContextParameterPlugin(),\n /**\n * At this point we can create, or not create, CMS GraphQL Schema.\n */\n ...baseCreateGraphQL(params)\n ];\n};\n\nexport type ContentContextParams = CrudParams;\nexport const createHeadlessCmsContext = (params: ContentContextParams) => {\n return [\n /**\n * Context for all Lambdas - everything is loaded now.\n */\n createContextPlugin(params),\n createDefaultModelManager(),\n createGraphQLFields(),\n createFieldConverters(),\n createValidators(),\n createDefaultStorageTransform(),\n createObjectStorageTransform(),\n createDynamicZoneStorageTransform()\n ];\n};\nexport * from \"~/graphqlFields\";\nexport * from \"~/plugins\";\nexport { entryToStorageTransform, entryFieldFromStorageTransform, entryFromStorageTransform };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAkDA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAjDA;AACA;AACA;AACA;AACA;AAKA;AACA;AAKA;AAmCA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAhCO,MAAMA,wBAAwB,GAAG,CAACC,MAAsC,GAAG,CAAC,CAAC,KAAK;EACrF,OAAO;EACH;AACR;AACA;EACQ,IAAAC,qCAAyB,GAAE,EAC3B,IAAAC,uCAA2B,GAAE,EAC7B,IAAAC,wCAA4B,GAAE;EAC9B;AACR;AACA;EACQ,GAAG,IAAAC,sBAAiB,EAACJ,MAAM,CAAC,CAC/B;AACL,CAAC;AAAC;AAGK,MAAMK,wBAAwB,GAAIL,MAA4B,IAAK;EACtE,OAAO;EACH;AACR;AACA;EACQ,IAAAM,4BAAmB,EAACN,MAAM,CAAC,EAC3B,IAAAO,uCAAyB,GAAE,EAC3B,IAAAC,kCAAmB,GAAE,EACrB,IAAAC,sCAAqB,GAAE,EACvB,IAAAC,4BAAgB,GAAE,EAClB,IAAAC,sCAA6B,GAAE,EAC/B,IAAAC,oCAA4B,GAAE,EAC9B,IAAAC,qDAAiC,GAAE,CACtC;AACL,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms",
3
- "version": "0.0.0-unstable.d65ec29d44",
3
+ "version": "0.0.0-unstable.e3f4727c56",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "cms:base"
@@ -20,22 +20,21 @@
20
20
  "dependencies": {
21
21
  "@babel/runtime": "7.20.13",
22
22
  "@graphql-tools/schema": "7.1.5",
23
- "@webiny/api": "0.0.0-unstable.d65ec29d44",
24
- "@webiny/api-file-manager": "0.0.0-unstable.d65ec29d44",
25
- "@webiny/api-i18n": "0.0.0-unstable.d65ec29d44",
26
- "@webiny/api-i18n-ddb": "0.0.0-unstable.d65ec29d44",
27
- "@webiny/api-security": "0.0.0-unstable.d65ec29d44",
28
- "@webiny/api-tenancy": "0.0.0-unstable.d65ec29d44",
29
- "@webiny/api-upgrade": "0.0.0-unstable.d65ec29d44",
30
- "@webiny/error": "0.0.0-unstable.d65ec29d44",
31
- "@webiny/handler": "0.0.0-unstable.d65ec29d44",
32
- "@webiny/handler-aws": "0.0.0-unstable.d65ec29d44",
33
- "@webiny/handler-db": "0.0.0-unstable.d65ec29d44",
34
- "@webiny/handler-graphql": "0.0.0-unstable.d65ec29d44",
35
- "@webiny/plugins": "0.0.0-unstable.d65ec29d44",
36
- "@webiny/pubsub": "0.0.0-unstable.d65ec29d44",
37
- "@webiny/utils": "0.0.0-unstable.d65ec29d44",
38
- "@webiny/validation": "0.0.0-unstable.d65ec29d44",
23
+ "@webiny/api": "0.0.0-unstable.e3f4727c56",
24
+ "@webiny/api-file-manager": "0.0.0-unstable.e3f4727c56",
25
+ "@webiny/api-i18n": "0.0.0-unstable.e3f4727c56",
26
+ "@webiny/api-i18n-ddb": "0.0.0-unstable.e3f4727c56",
27
+ "@webiny/api-security": "0.0.0-unstable.e3f4727c56",
28
+ "@webiny/api-tenancy": "0.0.0-unstable.e3f4727c56",
29
+ "@webiny/error": "0.0.0-unstable.e3f4727c56",
30
+ "@webiny/handler": "0.0.0-unstable.e3f4727c56",
31
+ "@webiny/handler-aws": "0.0.0-unstable.e3f4727c56",
32
+ "@webiny/handler-db": "0.0.0-unstable.e3f4727c56",
33
+ "@webiny/handler-graphql": "0.0.0-unstable.e3f4727c56",
34
+ "@webiny/plugins": "0.0.0-unstable.e3f4727c56",
35
+ "@webiny/pubsub": "0.0.0-unstable.e3f4727c56",
36
+ "@webiny/utils": "0.0.0-unstable.e3f4727c56",
37
+ "@webiny/validation": "0.0.0-unstable.e3f4727c56",
39
38
  "code-frame": "5.0.0",
40
39
  "dataloader": "2.2.1",
41
40
  "dot-prop": "6.0.1",
@@ -52,11 +51,11 @@
52
51
  "@babel/cli": "^7.19.3",
53
52
  "@babel/core": "^7.19.3",
54
53
  "@babel/preset-env": "^7.19.4",
55
- "@webiny/api-security-so-ddb": "^0.0.0-unstable.d65ec29d44",
56
- "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.d65ec29d44",
57
- "@webiny/api-wcp": "^0.0.0-unstable.d65ec29d44",
58
- "@webiny/cli": "^0.0.0-unstable.d65ec29d44",
59
- "@webiny/project-utils": "^0.0.0-unstable.d65ec29d44",
54
+ "@webiny/api-security-so-ddb": "^0.0.0-unstable.e3f4727c56",
55
+ "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.e3f4727c56",
56
+ "@webiny/api-wcp": "^0.0.0-unstable.e3f4727c56",
57
+ "@webiny/cli": "^0.0.0-unstable.e3f4727c56",
58
+ "@webiny/project-utils": "^0.0.0-unstable.e3f4727c56",
60
59
  "apollo-graphql": "^0.9.5",
61
60
  "get-yarn-workspaces": "^1.0.2",
62
61
  "graphql": "^15.7.2",
@@ -76,5 +75,5 @@
76
75
  "build": "yarn webiny run build",
77
76
  "watch": "yarn webiny run watch"
78
77
  },
79
- "gitHead": "d65ec29d4408dff33cb4e30a943bf7d2dabceb4d"
78
+ "gitHead": "e3f4727c567484dc53e1efceacfb37dbacd7f4de"
80
79
  }
package/types.d.ts CHANGED
@@ -5,7 +5,6 @@ import { GraphQLFieldResolver, GraphQLSchemaDefinition, Resolvers } from "@webin
5
5
  import { SecurityPermission } from "@webiny/api-security/types";
6
6
  import { DbContext } from "@webiny/handler-db/types";
7
7
  import { FileManagerContext } from "@webiny/api-file-manager/types";
8
- import { UpgradePlugin } from "@webiny/api-upgrade/types";
9
8
  import { Topic } from "@webiny/pubsub/types";
10
9
  import { CmsModelConverterCallable } from "./utils/converters/ConverterCollection";
11
10
  export declare type ApiEndpoint = "manage" | "preview" | "read";
@@ -874,9 +873,7 @@ export interface OnSystemInstallErrorTopicParams {
874
873
  export declare type CmsSystemContext = {
875
874
  getSystemVersion: () => Promise<string | null>;
876
875
  setSystemVersion: (version: string) => Promise<void>;
877
- getReadAPIKey(): Promise<string | null>;
878
876
  installSystem: () => Promise<void>;
879
- upgradeSystem: (version: string) => Promise<boolean>;
880
877
  /**
881
878
  * Lifecycle events - deprecated
882
879
  */
@@ -2633,9 +2630,5 @@ export interface HeadlessCmsStorageOperations<C = CmsContext> {
2633
2630
  */
2634
2631
  beforeInit?: (context: C) => Promise<void>;
2635
2632
  init?: (context: C) => Promise<void>;
2636
- /**
2637
- * An upgrade to run if necessary.
2638
- */
2639
- upgrade?: UpgradePlugin | null;
2640
2633
  }
2641
2634
  export {};
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 {\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 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 | \"dynamicZone\"\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 * Fields can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Any user defined settings.\n *\n * @default {}\n */\n settings?: CmsModelFieldSettings;\n}\n\nexport interface CmsDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n description: string;\n icon: string;\n fields: CmsModelField[];\n layout: string[][];\n validation: CmsModelFieldValidation[];\n}\n\n/**\n * A definition for dynamic-zone field to show possible type of the field in settings.\n */\nexport interface CmsModelDynamicZoneField extends CmsModelField {\n /**\n * Settings object for the field. Contains `templates` property.\n */\n settings: {\n templates: CmsDynamicZoneTemplate[];\n };\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\nexport interface CmsModelDynamicZoneFieldWithParent extends CmsModelDynamicZoneField {\n parent?: CmsModelDynamicZoneFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T = any> {\n /**\n * A value to be validated.\n */\n value: T;\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry;\n}\n\n/**\n * Definition for the field validator.\n *\n * @category Plugin\n * @category ModelField\n * @category FieldValidation\n */\nexport interface 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 * @category Database model\n * @category CmsModel\n */\nexport interface CmsModelGroup {\n /**\n * Generated ID of the group\n */\n id: string;\n /**\n * Name of the group\n */\n name: string;\n}\n/**\n * 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: CmsModelGroup;\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 * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * List of locked fields. Updated when entry is saved and a field has been used.\n */\n lockedFields?: LockedField[];\n /**\n * The field that is being displayed as entry title.\n * It is picked as first available text field. Or user can select own field.\n */\n titleFieldId: string;\n /**\n * The 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<TField> {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: TField;\n createFieldResolvers: any;\n}\nexport interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {\n (params: CmsModelFieldToGraphQLCreateResolverParams<TField>):\n | GraphQLFieldResolver\n | { resolver: GraphQLFieldResolver | null; typeResolvers: Resolvers<CmsContext> }\n | false;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<\n TField extends CmsModelField = CmsModelField\n> {\n fields: TField[];\n originalFields: TField[];\n}\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;\n}\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<\n TField extends CmsModelField = CmsModelField\n> {\n field: TField;\n originalField?: TField;\n validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;\n}\nexport interface CmsModelFieldToGraphQLPluginValidateChildFields<\n TField extends CmsModelField = CmsModelField\n> {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;\n}\n/**\n * @category Plugin\n * @category ModelField\n * @category GraphQL\n */\nexport interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = CmsModelField>\n extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-graphql\";\n /**\n * Field type name which must be exact as the one in `CmsEditorFieldTypePlugin` plugin.\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: string;\n /**\n * Is the field searchable via the GraphQL?\n *\n * ```ts\n * isSearchable: false\n * ```\n */\n isSearchable: boolean;\n /**\n * Is the field searchable via full text search?\n *\n * Field is not full text searchable by default.\n * ```ts\n * fullTextSearch: false\n * ```\n */\n fullTextSearch?: boolean;\n /**\n * Is the field sortable via the GraphQL?\n *\n * ```ts\n * isSortable: true\n * ```\n */\n isSortable: boolean;\n /**\n * Optional method which creates the storageId.\n * Primary use is for the datetime field, but if users has some specific fields, they can customize the storageId to their needs.\n *\n * ```ts\n * createStorageId: ({field}) => {\n * if (field.settings.type === \"time) {\n * return `${field.type}_time@${field.id}`\n * }\n * // use default method\n * return undefined;\n * }\n * ```\n */\n createStorageId?: (params: { model: CmsModel; field: TField }) => 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: TField }): string;\n /**\n * Definition for list filtering for GraphQL.\n *\n * ```ts\n * read: {\n * createListFilters({ field }) {\n * return `\n * ${field.fieldId}: MyType\n * ${field.fieldId}_not: MyType\n * ${field.fieldId}_in: [MyType]\n * ${field.fieldId}_not_in: [MyType]\n * `;\n * }\n * }\n * ```\n */\n createListFilters?(params: {\n model: CmsModel;\n field: TField;\n plugins: CmsFieldTypePlugins;\n }): string;\n /**\n * Definition of the field type for GraphQL - be aware if multiple values is selected.\n *\n * ```ts\n * read: {\n * createTypeField({ field }) {\n * if (field.multipleValues) {\n * return `${field.fieldId}: [MyFieldType]`;\n * }\n *\n * return `${field.fieldId}: MyField`;\n * }\n * }\n * ```\n */\n createTypeField(params: {\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }): CmsModelFieldDefinition | string | null;\n /**\n * Definition for field resolver.\n * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.\n *\n * ```ts\n * read: {\n * createResolver({ field }) {\n * return instance => {\n * return instance.values[field.storageId];\n * };\n * }\n * }\n * ```\n */\n createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;\n /**\n * Read API schema definitions for the field and resolvers for them.\n *\n * ```ts\n * read: {\n * createSchema() {\n * return {\n * typeDefs: `\n * myField {\n * id\n * date\n * }\n * `,\n * resolvers: {}\n * }\n * }\n * }\n * ```\n */\n createSchema?: (params: { models: CmsModel[] }) => GraphQLSchemaDefinition<CmsContext>;\n };\n manage: {\n /**\n * Definition for list filtering for GraphQL.\n *\n * ```ts\n * manage: {\n * createListFilters({ field }) {\n * return `\n * ${field.fieldId}: MyType\n * ${field.fieldId}_not: MyType\n * ${field.fieldId}_in: [MyType]\n * ${field.fieldId}_not_in: [MyType]\n * `;\n * }\n * }\n * ```\n */\n createListFilters?: (params: {\n model: CmsModel;\n field: TField;\n plugins: CmsFieldTypePlugins;\n }) => string;\n /**\n * Manage API schema definitions for the field and resolvers for them. Probably similar to `read.createSchema`.\n *\n * ```ts\n * createSchema() {\n * return {\n * typeDefs: `\n * myField {\n * id\n * date\n * }\n * `,\n * resolvers: {}\n * }\n * }\n * ```\n */\n createSchema?: (params: { models: CmsModel[] }) => GraphQLSchemaDefinition<CmsContext>;\n /**\n * Definition of the field type for GraphQL - be aware if multiple values is selected. Probably same as `read.createTypeField`.\n *\n * ```ts\n * manage: {\n * createTypeField({ field }) {\n * if (field.multipleValues) {\n * return field.fieldId + \": [MyType]\";\n * }\n *\n * return field.fieldId + \": MyType\";\n * }\n * }\n * ```\n */\n createTypeField: (params: {\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }) => CmsModelFieldDefinition | string | null;\n /**\n * Definition for input GraphQL field type.\n *\n * ```ts\n * manage: {\n * createInputField({ field }) {\n * if (field.multipleValues) {\n * return field.fieldId + \": [MyField]\";\n * }\n *\n * return field.fieldId + \": MyField\";\n * }\n * }\n * ```\n */\n createInputField: (params: {\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }) => CmsModelFieldDefinition | string | null;\n /**\n * Definition for field resolver.\n * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.\n *\n * ```ts\n * manage: {\n * createResolver({ field }) {\n * return instance => {\n * return instance.values[field.storageId];\n * };\n * }\n * }\n * ```\n */\n createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;\n };\n /**\n *\n * @param field\n */\n validateChildFields?: CmsModelFieldToGraphQLPluginValidateChildFields<TField>;\n}\n\n/**\n * Check for content model locked field.\n * A custom plugin definable by the user.\n *\n * @category CmsModel\n * @category Plugin\n */\nexport interface CmsModelLockedFieldPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-locked-field\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n */\n fieldType: string;\n /**\n * A method to check if field really is locked.\n */\n checkLockedField?: (params: { lockedField: LockedField; field: CmsModelField }) => void;\n /**\n * A method to get the locked field data.\n */\n getLockedFieldData?: (params: { field: CmsModelField }) => Record<string, any>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsFieldTypePlugins {\n [key: string]: CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * An interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface 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 OnSystemBeforeInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemAfterInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemInstallErrorTopicParams {\n error: Error;\n tenant: string;\n locale: string;\n}\n\nexport type CmsSystemContext = {\n getSystemVersion: () => Promise<string | null>;\n setSystemVersion: (version: string) => Promise<void>;\n getReadAPIKey(): Promise<string | null>;\n installSystem: () => Promise<void>;\n upgradeSystem: (version: string) => Promise<boolean>;\n /**\n * Lifecycle events - deprecated\n */\n /**\n * @deprecated\n */\n onBeforeSystemInstall: Topic<OnSystemBeforeInstallTopicParams>;\n /**\n * @deprecated\n */\n onAfterSystemInstall: Topic<OnSystemAfterInstallTopicParams>;\n /**\n * Released in 5.34.0\n */\n onSystemBeforeInstall: Topic<OnSystemBeforeInstallTopicParams>;\n onSystemAfterInstall: Topic<OnSystemAfterInstallTopicParams>;\n onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;\n};\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n 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 OnGroupBeforeCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterCreateTopicParams {\n group: CmsGroup;\n}\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupCreateErrorTopicParams {\n input: CmsGroupCreateInput;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupUpdateErrorTopicParams {\n input: CmsGroupUpdateInput;\n original: CmsGroup;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterDeleteTopicParams {\n group: CmsGroup;\n}\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupDeleteErrorTopicParams {\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup | 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 * Lifecycle events - deprecated\n */\n /**\n * @deprecated\n */\n onBeforeGroupCreate: Topic<OnGroupBeforeCreateTopicParams>;\n /**\n * @deprecated\n */\n onAfterGroupCreate: Topic<OnGroupAfterCreateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeGroupUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n /**\n * @deprecated\n */\n onAfterGroupUpdate: Topic<OnGroupAfterUpdateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeGroupDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n /**\n * @deprecated\n */\n onAfterGroupDelete: Topic<OnGroupAfterDeleteTopicParams>;\n /**\n * Lifecycle events released in 5.33.0\n */\n onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;\n onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;\n onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;\n onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;\n onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;\n onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;\n onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;\n}\n\n/**\n * Definition for content model field validator.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidation {\n name: string;\n message: string;\n settings?: {\n value?: string | number;\n values?: string[];\n preset?: string;\n [key: string]: any;\n };\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateInput {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.\n */\n modelId?: string;\n /**\n * Description of the content model.\n */\n description?: string | null;\n /**\n * Group where to put the content model in.\n */\n group: string;\n /**\n * A list of content model fields to define the entry values.\n */\n fields?: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout?: string[][];\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * 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 | null;\n /**\n * Text to display in the field.\n */\n placeholderText?: string | null;\n /**\n * Fields can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Are multiple values allowed?\n */\n multipleValues?: boolean;\n /**\n * Predefined values options for the field. Check the reference for more information.\n */\n predefinedValues?: CmsModelFieldPredefinedValues;\n /**\n * Renderer options for the field. Check the reference for more information.\n */\n renderer?: CmsModelFieldRenderer;\n /**\n * List of validations for the field.\n */\n validation?: CmsModelFieldValidation[];\n /**\n * @see CmsModelField.listValidation\n */\n listValidation: CmsModelFieldValidation[];\n /**\n * User defined settings.\n */\n settings?: Record<string, any>;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelUpdateInput {\n /**\n * A new content model name.\n */\n name?: string;\n /**\n * A group we want to move the model to.\n */\n group?: string;\n /**\n * A new description of the content model.\n */\n description?: string | null;\n /**\n * A list of content model fields to define the entry values.\n */\n fields: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: string[][];\n /**\n * 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<T = CmsEntryValues> {\n /**\n * A version of the webiny this entry was created with.\n * This can be used when upgrading the system, so we know which entries to update.\n */\n webinyVersion: string;\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n /**\n * CreatedBy object reference.\n */\n createdBy: 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: T;\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.\n * Be aware that when accessing properties in it on old systems, it will break if not checked first.\n *\n * Available only on the Manage API in entry GraphQL type `meta.data` property.\n */\n meta?: {\n [key: string]: any;\n };\n}\n\nexport interface CmsStorageEntry extends CmsEntry {\n [key: string]: any;\n}\n\n/**\n * A definition for content model manager to be used in the code.\n * The default one uses `CmsEntryContext` methods internally, but devs can change to what every they want.\n *\n * @see CmsEntryContext\n *\n * @category Context\n * @category CmsEntry\n * @category CmsModel\n */\nexport interface CmsModelManager {\n /**\n * List only published entries in the content model.\n */\n listPublished: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * List latest entries in the content model. Used for administration.\n */\n listLatest: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * Get a list of published entries by the ID list.\n */\n getPublishedByIds: (ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Get a list of the latest entries by the ID list.\n */\n getLatestByIds: (ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Get an entry filtered by given params. Will always get one.\n */\n get: (id: string) => Promise<CmsEntry>;\n /**\n * Create an entry.\n */\n create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Update an entry.\n */\n update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Delete an entry.\n */\n delete: (id: string) => Promise<void>;\n}\n\n/**\n * Create\n */\nexport interface OnModelBeforeCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\nexport interface OnModelAfterCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\nexport interface OnModelCreateErrorTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Create From / Clone\n */\nexport interface OnModelBeforeCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface OnModelAfterCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface OnModelCreateFromErrorParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Update\n */\nexport interface OnModelBeforeUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface OnModelAfterUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface OnModelUpdateErrorTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n/**\n * Delete\n */\nexport interface OnModelBeforeDeleteTopicParams {\n model: CmsModel;\n}\nexport interface OnModelAfterDeleteTopicParams {\n model: CmsModel;\n}\nexport interface OnModelDeleteErrorTopicParams {\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Initialize\n */\nexport interface OnModelInitializeParams {\n model: CmsModel;\n data: Record<string, any>;\n}\n\n/**\n *\n */\nexport interface CmsModelUpdateDirectParams {\n model: CmsModel;\n original: CmsModel;\n}\n\n/**\n * Cms Model in the context.\n *\n * @category Context\n * @category CmsModel\n */\nexport interface CmsModelContext {\n /**\n * Get a single content model.\n */\n getModel: (modelId: string) => Promise<CmsModel | null>;\n /**\n * Get all content models.\n */\n listModels: () => Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel: (data: CmsModelCreateInput) => Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom: (modelId: string, data: CmsModelCreateFromInput) => Promise<CmsModel>;\n /**\n * Update content model without data validation. Used internally.\n * @hidden\n */\n updateModelDirect: (params: CmsModelUpdateDirectParams) => Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel: (modelId: string, data: CmsModelUpdateInput) => Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel: (modelId: string) => Promise<void>;\n /**\n * Possibility for users to trigger the model initialization.\n * They can hook into it and do what ever they want to.\n *\n * Primary idea behind this is creating the index, for the code models, in the ES.\n */\n initializeModel: (modelId: string, data: Record<string, any>) => Promise<boolean>;\n /**\n * Get an instance of CmsModelManager for given content modelId.\n *\n * @see CmsModelManager\n *\n * @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 * Lifecycle events - deprecated.\n */\n /**\n * @deprecated\n */\n onBeforeModelCreate: Topic<OnModelBeforeCreateTopicParams>;\n /**\n * @deprecated\n */\n onAfterModelCreate: Topic<OnModelAfterCreateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeModelCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;\n /**\n * @deprecated\n */\n onAfterModelCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;\n /**\n * @deprecated\n */\n onBeforeModelUpdate: Topic<OnModelBeforeUpdateTopicParams>;\n /**\n * @deprecated\n */\n onAfterModelUpdate: Topic<OnModelAfterUpdateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeModelDelete: Topic<OnModelBeforeDeleteTopicParams>;\n /**\n * @deprecated\n */\n onAfterModelDelete: Topic<OnModelAfterDeleteTopicParams>;\n /**\n * Lifecycle events - released in 5.33.0\n */\n onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;\n onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;\n onModelCreateError: Topic<OnModelCreateErrorTopicParams>;\n onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;\n onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;\n onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;\n onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;\n onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;\n onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;\n onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;\n onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;\n onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;\n onModelInitialize: Topic<OnModelInitializeParams>;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef {\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n}\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Generated ID without the version.\n */\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n /**\n * Contains the owner of the entry. An \"owner\" is the identity who originally created the entry.\n * Subsequent revisions can be created by other identities, and those will be stored in `createdBy`,\n * but the `owner` is always the original author of the entry.\n *\n * Can be sent via the API or set internal if user can see only their own entries.\n */\n ownedBy?: string;\n ownedBy_not?: string;\n ownedBy_in?: string[];\n ownedBy_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n version?: number;\n version_lt?: number;\n version_gt?: number;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n published?: boolean;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n latest?: boolean;\n /**\n * This is to allow querying by any content model field defined by the user.\n */\n [key: string]:\n | string\n | number\n | boolean\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhere[]\n | CmsEntryListWhere\n | CmsEntryListWhereRef;\n /**\n * To allow querying via nested queries, we added the AND / OR properties.\n */\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n}\n\n/**\n * Entry listing sort.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport type CmsEntryListSort = string[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * Create\n */\nexport interface OnEntryBeforeCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface OnEntryAfterCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateErrorTopicParams {\n error: Error;\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Revision Create\n */\nexport interface OnEntryRevisionBeforeCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryRevisionAfterCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateRevisionErrorTopicParams {\n error: Error;\n input: CreateFromCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Update\n */\nexport interface OnEntryBeforeUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface OnEntryAfterUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUpdateErrorTopicParams {\n error: Error;\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Publish\n */\n\nexport interface OnEntryBeforePublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryAfterPublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryPublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\n/**\n * Republish\n */\nexport interface OnEntryBeforeRepublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryAfterRepublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryRepublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\n/**\n * Unpublish\n */\n\nexport interface OnEntryBeforeUnpublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryAfterUnpublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUnpublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface OnEntryAfterDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryRevisionBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface OnEntryRevisionAfterDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryRevisionDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryBeforeGetTopicParams {\n model: StorageOperationsCmsModel;\n where: CmsEntryListWhere;\n}\n\nexport interface EntryBeforeListTopicParams {\n where: CmsEntryListWhere;\n model: StorageOperationsCmsModel;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput {\n id?: string;\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 the 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 * Get all entry revisions.\n */\n getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;\n /**\n * Lifecyle events - deprecated.\n */\n /**\n * @deprecated\n */\n onBeforeEntryCreate: Topic<OnEntryBeforeCreateTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryCreate: Topic<OnEntryAfterCreateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryCreateRevision: Topic<OnEntryRevisionBeforeCreateTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryCreateRevision: Topic<OnEntryRevisionAfterCreateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryUpdate: Topic<OnEntryBeforeUpdateTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryUpdate: Topic<OnEntryAfterUpdateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryDelete: Topic<OnEntryBeforeDeleteTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryDelete: Topic<OnEntryAfterDeleteTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryDeleteRevision: Topic<OnEntryRevisionBeforeDeleteTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryDeleteRevision: Topic<OnEntryRevisionAfterDeleteTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryPublish: Topic<OnEntryBeforePublishTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryPublish: Topic<OnEntryAfterPublishTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryGet: Topic<OnEntryBeforeGetTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryList: Topic<EntryBeforeListTopicParams>;\n /**\n * Lifecycle events released in 5.33.0\n */\n onEntryBeforeCreate: Topic<OnEntryBeforeCreateTopicParams>;\n onEntryAfterCreate: Topic<OnEntryAfterCreateTopicParams>;\n onEntryCreateError: Topic<OnEntryCreateErrorTopicParams>;\n\n onEntryRevisionBeforeCreate: Topic<OnEntryRevisionBeforeCreateTopicParams>;\n onEntryRevisionAfterCreate: Topic<OnEntryRevisionAfterCreateTopicParams>;\n onEntryRevisionCreateError: Topic<OnEntryCreateRevisionErrorTopicParams>;\n\n onEntryBeforeUpdate: Topic<OnEntryBeforeUpdateTopicParams>;\n onEntryAfterUpdate: Topic<OnEntryAfterUpdateTopicParams>;\n onEntryUpdateError: Topic<OnEntryUpdateErrorTopicParams>;\n\n onEntryBeforeDelete: Topic<OnEntryBeforeDeleteTopicParams>;\n onEntryAfterDelete: Topic<OnEntryAfterDeleteTopicParams>;\n onEntryDeleteError: Topic<OnEntryDeleteErrorTopicParams>;\n\n onEntryRevisionBeforeDelete: Topic<OnEntryRevisionBeforeDeleteTopicParams>;\n onEntryRevisionAfterDelete: Topic<OnEntryRevisionAfterDeleteTopicParams>;\n onEntryRevisionDeleteError: Topic<OnEntryRevisionDeleteErrorTopicParams>;\n\n onEntryBeforePublish: Topic<OnEntryBeforePublishTopicParams>;\n onEntryAfterPublish: Topic<OnEntryAfterPublishTopicParams>;\n onEntryPublishError: Topic<OnEntryPublishErrorTopicParams>;\n\n onEntryBeforeRepublish: Topic<OnEntryBeforeRepublishTopicParams>;\n onEntryAfterRepublish: Topic<OnEntryAfterRepublishTopicParams>;\n onEntryRepublishError: Topic<OnEntryRepublishErrorTopicParams>;\n\n onEntryBeforeUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;\n onEntryAfterUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;\n onEntryUnpublishError: Topic<OnEntryUnpublishErrorTopicParams>;\n\n onEntryBeforeGet: Topic<OnEntryBeforeGetTopicParams>;\n onEntryBeforeList: Topic<EntryBeforeListTopicParams>;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * 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 * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n locale: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n [key: string]: any;\n}\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 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\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\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 name: string;\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":";;;;;;AAmDA;AACA;AACA;AACA;AACA;AAmBA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AA4BA;AACA;AACA;AACA;AACA;AACA;AA6GA;AACA;AACA;AAUA;AACA;AACA;AAQA;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;AAiBA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AA8EA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAyCA;AACA;AACA;AACA;AACA;AA2PA;AACA;AACA;AACA;AACA;AACA;AACA;AAoBA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AAyDA;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;AAIA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAmEA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AA4CA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyDA;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;AAoCA;AACA;AACA;AAeA;AACA;AACA;AAkBA;AACA;AACA;AAiBA;AACA;AACA;AAYA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AA+GA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AAgFA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AAoBA;AACA;AACA;AAwBA;AACA;AACA;AAsBA;AACA;AACA;AAmBA;AACA;AACA;AAkBA;AACA;AACA;AA2DA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AAmMA;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;AA0LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IAmIYA,oBAAoB;AAAA;AAAA,WAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,oCAApBA,oBAAoB"}
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 {\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 { 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 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 | \"dynamicZone\"\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 * Fields can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Any user defined settings.\n *\n * @default {}\n */\n settings?: CmsModelFieldSettings;\n}\n\nexport interface CmsDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n description: string;\n icon: string;\n fields: CmsModelField[];\n layout: string[][];\n validation: CmsModelFieldValidation[];\n}\n\n/**\n * A definition for dynamic-zone field to show possible type of the field in settings.\n */\nexport interface CmsModelDynamicZoneField extends CmsModelField {\n /**\n * Settings object for the field. Contains `templates` property.\n */\n settings: {\n templates: CmsDynamicZoneTemplate[];\n };\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\nexport interface CmsModelDynamicZoneFieldWithParent extends CmsModelDynamicZoneField {\n parent?: CmsModelDynamicZoneFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T = any> {\n /**\n * A value to be validated.\n */\n value: T;\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry;\n}\n\n/**\n * Definition for the field validator.\n *\n * @category Plugin\n * @category ModelField\n * @category FieldValidation\n */\nexport interface 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 * @category Database model\n * @category CmsModel\n */\nexport interface CmsModelGroup {\n /**\n * Generated ID of the group\n */\n id: string;\n /**\n * Name of the group\n */\n name: string;\n}\n/**\n * 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: CmsModelGroup;\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 * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * List of locked fields. Updated when entry is saved and a field has been used.\n */\n lockedFields?: LockedField[];\n /**\n * The field that is being displayed as entry title.\n * It is picked as first available text field. Or user can select own field.\n */\n titleFieldId: string;\n /**\n * The 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<TField> {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: TField;\n createFieldResolvers: any;\n}\nexport interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {\n (params: CmsModelFieldToGraphQLCreateResolverParams<TField>):\n | GraphQLFieldResolver\n | { resolver: GraphQLFieldResolver | null; typeResolvers: Resolvers<CmsContext> }\n | false;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<\n TField extends CmsModelField = CmsModelField\n> {\n fields: TField[];\n originalFields: TField[];\n}\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;\n}\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<\n TField extends CmsModelField = CmsModelField\n> {\n field: TField;\n originalField?: TField;\n validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;\n}\nexport interface CmsModelFieldToGraphQLPluginValidateChildFields<\n TField extends CmsModelField = CmsModelField\n> {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;\n}\n/**\n * @category Plugin\n * @category ModelField\n * @category GraphQL\n */\nexport interface CmsModelFieldToGraphQLPlugin<TField extends CmsModelField = CmsModelField>\n extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-graphql\";\n /**\n * Field type name which must be exact as the one in `CmsEditorFieldTypePlugin` plugin.\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: string;\n /**\n * Is the field searchable via the GraphQL?\n *\n * ```ts\n * isSearchable: false\n * ```\n */\n isSearchable: boolean;\n /**\n * Is the field searchable via full text search?\n *\n * Field is not full text searchable by default.\n * ```ts\n * fullTextSearch: false\n * ```\n */\n fullTextSearch?: boolean;\n /**\n * Is the field sortable via the GraphQL?\n *\n * ```ts\n * isSortable: true\n * ```\n */\n isSortable: boolean;\n /**\n * Optional method which creates the storageId.\n * Primary use is for the datetime field, but if users has some specific fields, they can customize the storageId to their needs.\n *\n * ```ts\n * createStorageId: ({field}) => {\n * if (field.settings.type === \"time) {\n * return `${field.type}_time@${field.id}`\n * }\n * // use default method\n * return undefined;\n * }\n * ```\n */\n createStorageId?: (params: { model: CmsModel; field: TField }) => 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: TField }): string;\n /**\n * Definition for list filtering for GraphQL.\n *\n * ```ts\n * read: {\n * createListFilters({ field }) {\n * return `\n * ${field.fieldId}: MyType\n * ${field.fieldId}_not: MyType\n * ${field.fieldId}_in: [MyType]\n * ${field.fieldId}_not_in: [MyType]\n * `;\n * }\n * }\n * ```\n */\n createListFilters?(params: {\n model: CmsModel;\n field: TField;\n plugins: CmsFieldTypePlugins;\n }): string;\n /**\n * Definition of the field type for GraphQL - be aware if multiple values is selected.\n *\n * ```ts\n * read: {\n * createTypeField({ field }) {\n * if (field.multipleValues) {\n * return `${field.fieldId}: [MyFieldType]`;\n * }\n *\n * return `${field.fieldId}: MyField`;\n * }\n * }\n * ```\n */\n createTypeField(params: {\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }): CmsModelFieldDefinition | string | null;\n /**\n * Definition for field resolver.\n * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.\n *\n * ```ts\n * read: {\n * createResolver({ field }) {\n * return instance => {\n * return instance.values[field.storageId];\n * };\n * }\n * }\n * ```\n */\n createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;\n /**\n * Read API schema definitions for the field and resolvers for them.\n *\n * ```ts\n * read: {\n * createSchema() {\n * return {\n * typeDefs: `\n * myField {\n * id\n * date\n * }\n * `,\n * resolvers: {}\n * }\n * }\n * }\n * ```\n */\n createSchema?: (params: { models: CmsModel[] }) => GraphQLSchemaDefinition<CmsContext>;\n };\n manage: {\n /**\n * Definition for list filtering for GraphQL.\n *\n * ```ts\n * manage: {\n * createListFilters({ field }) {\n * return `\n * ${field.fieldId}: MyType\n * ${field.fieldId}_not: MyType\n * ${field.fieldId}_in: [MyType]\n * ${field.fieldId}_not_in: [MyType]\n * `;\n * }\n * }\n * ```\n */\n createListFilters?: (params: {\n model: CmsModel;\n field: TField;\n plugins: CmsFieldTypePlugins;\n }) => string;\n /**\n * Manage API schema definitions for the field and resolvers for them. Probably similar to `read.createSchema`.\n *\n * ```ts\n * createSchema() {\n * return {\n * typeDefs: `\n * myField {\n * id\n * date\n * }\n * `,\n * resolvers: {}\n * }\n * }\n * ```\n */\n createSchema?: (params: { models: CmsModel[] }) => GraphQLSchemaDefinition<CmsContext>;\n /**\n * Definition of the field type for GraphQL - be aware if multiple values is selected. Probably same as `read.createTypeField`.\n *\n * ```ts\n * manage: {\n * createTypeField({ field }) {\n * if (field.multipleValues) {\n * return field.fieldId + \": [MyType]\";\n * }\n *\n * return field.fieldId + \": MyType\";\n * }\n * }\n * ```\n */\n createTypeField: (params: {\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }) => CmsModelFieldDefinition | string | null;\n /**\n * Definition for input GraphQL field type.\n *\n * ```ts\n * manage: {\n * createInputField({ field }) {\n * if (field.multipleValues) {\n * return field.fieldId + \": [MyField]\";\n * }\n *\n * return field.fieldId + \": MyField\";\n * }\n * }\n * ```\n */\n createInputField: (params: {\n model: CmsModel;\n field: TField;\n fieldTypePlugins: CmsFieldTypePlugins;\n }) => CmsModelFieldDefinition | string | null;\n /**\n * Definition for field resolver.\n * By default, it is simple return of the `instance.values[storageId]` but if required, users can define their own.\n *\n * ```ts\n * manage: {\n * createResolver({ field }) {\n * return instance => {\n * return instance.values[field.storageId];\n * };\n * }\n * }\n * ```\n */\n createResolver?: CmsModelFieldToGraphQLCreateResolver<TField>;\n };\n /**\n *\n * @param field\n */\n validateChildFields?: CmsModelFieldToGraphQLPluginValidateChildFields<TField>;\n}\n\n/**\n * Check for content model locked field.\n * A custom plugin definable by the user.\n *\n * @category CmsModel\n * @category Plugin\n */\nexport interface CmsModelLockedFieldPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-locked-field\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n */\n fieldType: string;\n /**\n * A method to check if field really is locked.\n */\n checkLockedField?: (params: { lockedField: LockedField; field: CmsModelField }) => void;\n /**\n * A method to get the locked field data.\n */\n getLockedFieldData?: (params: { field: CmsModelField }) => Record<string, any>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsFieldTypePlugins {\n [key: string]: CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * An interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface 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 OnSystemBeforeInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemAfterInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemInstallErrorTopicParams {\n error: Error;\n tenant: string;\n locale: string;\n}\n\nexport type CmsSystemContext = {\n getSystemVersion: () => Promise<string | null>;\n setSystemVersion: (version: string) => Promise<void>;\n installSystem: () => Promise<void>;\n /**\n * Lifecycle events - deprecated\n */\n /**\n * @deprecated\n */\n onBeforeSystemInstall: Topic<OnSystemBeforeInstallTopicParams>;\n /**\n * @deprecated\n */\n onAfterSystemInstall: Topic<OnSystemAfterInstallTopicParams>;\n /**\n * Released in 5.34.0\n */\n onSystemBeforeInstall: Topic<OnSystemBeforeInstallTopicParams>;\n onSystemAfterInstall: Topic<OnSystemAfterInstallTopicParams>;\n onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;\n};\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n 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 OnGroupBeforeCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterCreateTopicParams {\n group: CmsGroup;\n}\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupCreateErrorTopicParams {\n input: CmsGroupCreateInput;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupUpdateErrorTopicParams {\n input: CmsGroupUpdateInput;\n original: CmsGroup;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterDeleteTopicParams {\n group: CmsGroup;\n}\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupDeleteErrorTopicParams {\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup | 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 * Lifecycle events - deprecated\n */\n /**\n * @deprecated\n */\n onBeforeGroupCreate: Topic<OnGroupBeforeCreateTopicParams>;\n /**\n * @deprecated\n */\n onAfterGroupCreate: Topic<OnGroupAfterCreateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeGroupUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n /**\n * @deprecated\n */\n onAfterGroupUpdate: Topic<OnGroupAfterUpdateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeGroupDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n /**\n * @deprecated\n */\n onAfterGroupDelete: Topic<OnGroupAfterDeleteTopicParams>;\n /**\n * Lifecycle events released in 5.33.0\n */\n onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;\n onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;\n onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;\n onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;\n onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;\n onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;\n onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;\n}\n\n/**\n * Definition for content model field validator.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidation {\n name: string;\n message: string;\n settings?: {\n value?: string | number;\n values?: string[];\n preset?: string;\n [key: string]: any;\n };\n}\n\n/**\n * A GraphQL `params.data` parameter received when creating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelCreateInput {\n /**\n * Name of the content model.\n */\n name: string;\n /**\n * Unique ID of the content model. Created from name if not sent by the user. Cannot be changed.\n */\n modelId?: string;\n /**\n * Description of the content model.\n */\n description?: string | null;\n /**\n * Group where to put the content model in.\n */\n group: string;\n /**\n * A list of content model fields to define the entry values.\n */\n fields?: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout?: string[][];\n /**\n * Models can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * 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 | null;\n /**\n * Text to display in the field.\n */\n placeholderText?: string | null;\n /**\n * Fields can be tagged to give them contextual meaning.\n */\n tags?: string[];\n /**\n * Are multiple values allowed?\n */\n multipleValues?: boolean;\n /**\n * Predefined values options for the field. Check the reference for more information.\n */\n predefinedValues?: CmsModelFieldPredefinedValues;\n /**\n * Renderer options for the field. Check the reference for more information.\n */\n renderer?: CmsModelFieldRenderer;\n /**\n * List of validations for the field.\n */\n validation?: CmsModelFieldValidation[];\n /**\n * @see CmsModelField.listValidation\n */\n listValidation: CmsModelFieldValidation[];\n /**\n * User defined settings.\n */\n settings?: Record<string, any>;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelUpdateInput {\n /**\n * A new content model name.\n */\n name?: string;\n /**\n * A group we want to move the model to.\n */\n group?: string;\n /**\n * A new description of the content model.\n */\n description?: string | null;\n /**\n * A list of content model fields to define the entry values.\n */\n fields: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: string[][];\n /**\n * 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<T = CmsEntryValues> {\n /**\n * A version of the webiny this entry was created with.\n * This can be used when upgrading the system, so we know which entries to update.\n */\n webinyVersion: string;\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n /**\n * CreatedBy object reference.\n */\n createdBy: 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: T;\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.\n * Be aware that when accessing properties in it on old systems, it will break if not checked first.\n *\n * Available only on the Manage API in entry GraphQL type `meta.data` property.\n */\n meta?: {\n [key: string]: any;\n };\n}\n\nexport interface CmsStorageEntry extends CmsEntry {\n [key: string]: any;\n}\n\n/**\n * A definition for content model manager to be used in the code.\n * The default one uses `CmsEntryContext` methods internally, but devs can change to what every they want.\n *\n * @see CmsEntryContext\n *\n * @category Context\n * @category CmsEntry\n * @category CmsModel\n */\nexport interface CmsModelManager {\n /**\n * List only published entries in the content model.\n */\n listPublished: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * List latest entries in the content model. Used for administration.\n */\n listLatest: (params: CmsEntryListParams) => Promise<[CmsEntry[], CmsEntryMeta]>;\n /**\n * Get a list of published entries by the ID list.\n */\n getPublishedByIds: (ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Get a list of the latest entries by the ID list.\n */\n getLatestByIds: (ids: string[]) => Promise<CmsEntry[]>;\n /**\n * Get an entry filtered by given params. Will always get one.\n */\n get: (id: string) => Promise<CmsEntry>;\n /**\n * Create an entry.\n */\n create: (data: CreateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Update an entry.\n */\n update: (id: string, data: UpdateCmsEntryInput) => Promise<CmsEntry>;\n /**\n * Delete an entry.\n */\n delete: (id: string) => Promise<void>;\n}\n\n/**\n * Create\n */\nexport interface OnModelBeforeCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\nexport interface OnModelAfterCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\nexport interface OnModelCreateErrorTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Create From / Clone\n */\nexport interface OnModelBeforeCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface OnModelAfterCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface OnModelCreateFromErrorParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Update\n */\nexport interface OnModelBeforeUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface OnModelAfterUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\nexport interface OnModelUpdateErrorTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n/**\n * Delete\n */\nexport interface OnModelBeforeDeleteTopicParams {\n model: CmsModel;\n}\nexport interface OnModelAfterDeleteTopicParams {\n model: CmsModel;\n}\nexport interface OnModelDeleteErrorTopicParams {\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Initialize\n */\nexport interface OnModelInitializeParams {\n model: CmsModel;\n data: Record<string, any>;\n}\n\n/**\n *\n */\nexport interface CmsModelUpdateDirectParams {\n model: CmsModel;\n original: CmsModel;\n}\n\n/**\n * Cms Model in the context.\n *\n * @category Context\n * @category CmsModel\n */\nexport interface CmsModelContext {\n /**\n * Get a single content model.\n */\n getModel: (modelId: string) => Promise<CmsModel | null>;\n /**\n * Get all content models.\n */\n listModels: () => Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel: (data: CmsModelCreateInput) => Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom: (modelId: string, data: CmsModelCreateFromInput) => Promise<CmsModel>;\n /**\n * Update content model without data validation. Used internally.\n * @hidden\n */\n updateModelDirect: (params: CmsModelUpdateDirectParams) => Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel: (modelId: string, data: CmsModelUpdateInput) => Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel: (modelId: string) => Promise<void>;\n /**\n * Possibility for users to trigger the model initialization.\n * They can hook into it and do what ever they want to.\n *\n * Primary idea behind this is creating the index, for the code models, in the ES.\n */\n initializeModel: (modelId: string, data: Record<string, any>) => Promise<boolean>;\n /**\n * Get an instance of CmsModelManager for given content modelId.\n *\n * @see CmsModelManager\n *\n * @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 * Lifecycle events - deprecated.\n */\n /**\n * @deprecated\n */\n onBeforeModelCreate: Topic<OnModelBeforeCreateTopicParams>;\n /**\n * @deprecated\n */\n onAfterModelCreate: Topic<OnModelAfterCreateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeModelCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;\n /**\n * @deprecated\n */\n onAfterModelCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;\n /**\n * @deprecated\n */\n onBeforeModelUpdate: Topic<OnModelBeforeUpdateTopicParams>;\n /**\n * @deprecated\n */\n onAfterModelUpdate: Topic<OnModelAfterUpdateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeModelDelete: Topic<OnModelBeforeDeleteTopicParams>;\n /**\n * @deprecated\n */\n onAfterModelDelete: Topic<OnModelAfterDeleteTopicParams>;\n /**\n * Lifecycle events - released in 5.33.0\n */\n onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;\n onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;\n onModelCreateError: Topic<OnModelCreateErrorTopicParams>;\n onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;\n onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;\n onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;\n onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;\n onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;\n onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;\n onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;\n onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;\n onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;\n onModelInitialize: Topic<OnModelInitializeParams>;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef {\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n}\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Generated ID without the version.\n */\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n /**\n * Contains the owner of the entry. An \"owner\" is the identity who originally created the entry.\n * Subsequent revisions can be created by other identities, and those will be stored in `createdBy`,\n * but the `owner` is always the original author of the entry.\n *\n * Can be sent via the API or set internal if user can see only their own entries.\n */\n ownedBy?: string;\n ownedBy_not?: string;\n ownedBy_in?: string[];\n ownedBy_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n version?: number;\n version_lt?: number;\n version_gt?: number;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n published?: boolean;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n latest?: boolean;\n /**\n * This is to allow querying by any content model field defined by the user.\n */\n [key: string]:\n | string\n | number\n | boolean\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhere[]\n | CmsEntryListWhere\n | CmsEntryListWhereRef;\n /**\n * To allow querying via nested queries, we added the AND / OR properties.\n */\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n}\n\n/**\n * Entry listing sort.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport type CmsEntryListSort = string[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * Create\n */\nexport interface OnEntryBeforeCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface OnEntryAfterCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateErrorTopicParams {\n error: Error;\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Revision Create\n */\nexport interface OnEntryRevisionBeforeCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryRevisionAfterCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateRevisionErrorTopicParams {\n error: Error;\n input: CreateFromCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Update\n */\nexport interface OnEntryBeforeUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface OnEntryAfterUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUpdateErrorTopicParams {\n error: Error;\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Publish\n */\n\nexport interface OnEntryBeforePublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryAfterPublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryPublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\n/**\n * Republish\n */\nexport interface OnEntryBeforeRepublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryAfterRepublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryRepublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\n/**\n * Unpublish\n */\n\nexport interface OnEntryBeforeUnpublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryAfterUnpublishTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUnpublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface OnEntryAfterDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryRevisionBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\nexport interface OnEntryRevisionAfterDeleteTopicParams {\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryRevisionDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: StorageOperationsCmsModel;\n}\n\nexport interface OnEntryBeforeGetTopicParams {\n model: StorageOperationsCmsModel;\n where: CmsEntryListWhere;\n}\n\nexport interface EntryBeforeListTopicParams {\n where: CmsEntryListWhere;\n model: StorageOperationsCmsModel;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput {\n id?: string;\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 the 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 * Get all entry revisions.\n */\n getEntryRevisions: (model: CmsModel, id: string) => Promise<CmsEntry[]>;\n /**\n * Lifecyle events - deprecated.\n */\n /**\n * @deprecated\n */\n onBeforeEntryCreate: Topic<OnEntryBeforeCreateTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryCreate: Topic<OnEntryAfterCreateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryCreateRevision: Topic<OnEntryRevisionBeforeCreateTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryCreateRevision: Topic<OnEntryRevisionAfterCreateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryUpdate: Topic<OnEntryBeforeUpdateTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryUpdate: Topic<OnEntryAfterUpdateTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryDelete: Topic<OnEntryBeforeDeleteTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryDelete: Topic<OnEntryAfterDeleteTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryDeleteRevision: Topic<OnEntryRevisionBeforeDeleteTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryDeleteRevision: Topic<OnEntryRevisionAfterDeleteTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryPublish: Topic<OnEntryBeforePublishTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryPublish: Topic<OnEntryAfterPublishTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;\n /**\n * @deprecated\n */\n onAfterEntryUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryGet: Topic<OnEntryBeforeGetTopicParams>;\n /**\n * @deprecated\n */\n onBeforeEntryList: Topic<EntryBeforeListTopicParams>;\n /**\n * Lifecycle events released in 5.33.0\n */\n onEntryBeforeCreate: Topic<OnEntryBeforeCreateTopicParams>;\n onEntryAfterCreate: Topic<OnEntryAfterCreateTopicParams>;\n onEntryCreateError: Topic<OnEntryCreateErrorTopicParams>;\n\n onEntryRevisionBeforeCreate: Topic<OnEntryRevisionBeforeCreateTopicParams>;\n onEntryRevisionAfterCreate: Topic<OnEntryRevisionAfterCreateTopicParams>;\n onEntryRevisionCreateError: Topic<OnEntryCreateRevisionErrorTopicParams>;\n\n onEntryBeforeUpdate: Topic<OnEntryBeforeUpdateTopicParams>;\n onEntryAfterUpdate: Topic<OnEntryAfterUpdateTopicParams>;\n onEntryUpdateError: Topic<OnEntryUpdateErrorTopicParams>;\n\n onEntryBeforeDelete: Topic<OnEntryBeforeDeleteTopicParams>;\n onEntryAfterDelete: Topic<OnEntryAfterDeleteTopicParams>;\n onEntryDeleteError: Topic<OnEntryDeleteErrorTopicParams>;\n\n onEntryRevisionBeforeDelete: Topic<OnEntryRevisionBeforeDeleteTopicParams>;\n onEntryRevisionAfterDelete: Topic<OnEntryRevisionAfterDeleteTopicParams>;\n onEntryRevisionDeleteError: Topic<OnEntryRevisionDeleteErrorTopicParams>;\n\n onEntryBeforePublish: Topic<OnEntryBeforePublishTopicParams>;\n onEntryAfterPublish: Topic<OnEntryAfterPublishTopicParams>;\n onEntryPublishError: Topic<OnEntryPublishErrorTopicParams>;\n\n onEntryBeforeRepublish: Topic<OnEntryBeforeRepublishTopicParams>;\n onEntryAfterRepublish: Topic<OnEntryAfterRepublishTopicParams>;\n onEntryRepublishError: Topic<OnEntryRepublishErrorTopicParams>;\n\n onEntryBeforeUnpublish: Topic<OnEntryBeforeUnpublishTopicParams>;\n onEntryAfterUnpublish: Topic<OnEntryAfterUnpublishTopicParams>;\n onEntryUnpublishError: Topic<OnEntryUnpublishErrorTopicParams>;\n\n onEntryBeforeGet: Topic<OnEntryBeforeGetTopicParams>;\n onEntryBeforeList: Topic<EntryBeforeListTopicParams>;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * 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 * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n locale: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n [key: string]: any;\n}\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 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\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\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 name: string;\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"],"mappings":";;;;;;AAkDA;AACA;AACA;AACA;AACA;AAmBA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AA4BA;AACA;AACA;AACA;AACA;AACA;AA6GA;AACA;AACA;AAUA;AACA;AACA;AAQA;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;AAiBA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AA8EA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAyCA;AACA;AACA;AACA;AACA;AA2PA;AACA;AACA;AACA;AACA;AACA;AACA;AAoBA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AAuDA;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;AAIA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAmEA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AA4CA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyDA;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;AAoCA;AACA;AACA;AAeA;AACA;AACA;AAkBA;AACA;AACA;AAiBA;AACA;AACA;AAYA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AA+GA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AAgFA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AAoBA;AACA;AACA;AAwBA;AACA;AACA;AAsBA;AACA;AACA;AAmBA;AACA;AACA;AAkBA;AACA;AACA;AA2DA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AAmMA;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;AA0LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IAmIYA,oBAAoB;AAAA;AAAA,WAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,oCAApBA,oBAAoB"}
@@ -1,18 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.createUpgrade = void 0;
9
+
8
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
9
12
  var _error = _interopRequireDefault(require("@webiny/error"));
13
+
10
14
  const assignStorageId = fields => {
11
15
  return fields.map(field => {
12
16
  const settings = (0, _objectSpread2.default)({}, field.settings || {});
17
+
13
18
  if (settings.fields && Array.isArray(settings.fields) === true) {
14
19
  settings.fields = assignStorageId(settings.fields);
15
20
  }
21
+
16
22
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, field), {}, {
17
23
  storageId: field.fieldId,
18
24
  settings
@@ -22,15 +28,20 @@ const assignStorageId = fields => {
22
28
  /**
23
29
  * If at least one field does not have storageId define, we should definitely update the model.
24
30
  */
31
+
32
+
25
33
  const shouldUpdate = fields => {
26
34
  return fields.some(field => {
27
35
  var _field$settings;
36
+
28
37
  if ((_field$settings = field.settings) !== null && _field$settings !== void 0 && _field$settings.fields) {
29
38
  return shouldUpdate(field.settings.fields);
30
39
  }
40
+
31
41
  return !field.storageId;
32
42
  });
33
43
  };
44
+
34
45
  const upgradeTenantModels = async params => {
35
46
  const {
36
47
  tenant,
@@ -40,16 +51,19 @@ const upgradeTenantModels = async params => {
40
51
  /**
41
52
  * We need all locales for this tenant, so we can go and find all models for all the locales.
42
53
  */
54
+
43
55
  const [locales] = await i18n.locales.storageOperations.list({
44
56
  where: {
45
57
  tenant: tenant.id
46
58
  },
47
59
  limit: 100
48
60
  });
61
+
49
62
  if (locales.length === 0) {
50
63
  console.log(`There are no locales under the tenant "${tenant.id}".`);
51
64
  return;
52
65
  }
66
+
53
67
  for (const locale of locales) {
54
68
  /**
55
69
  * We need all the models that are not plugin models.
@@ -60,27 +74,30 @@ const upgradeTenantModels = async params => {
60
74
  locale: locale.code
61
75
  }
62
76
  });
77
+
63
78
  if (models.length === 0) {
64
79
  console.log(`No models in tenant "${tenant.id}" and locale "${locale.code}" combination.`);
65
80
  continue;
66
81
  }
67
-
68
82
  /**
69
83
  * Then we need to go into each of the model fields and add the storageId, which is the same as the fieldId
70
84
  */
85
+
86
+
71
87
  const updatedModels = models.filter(model => {
72
88
  /**
73
89
  * If model has at least one field with no storageId, continue with the update.
74
90
  */
75
91
  const toUpdate = shouldUpdate(model.fields);
76
-
77
92
  /**
78
93
  * If not updating the model, lets log it - just in case...
79
94
  */
95
+
80
96
  if (!toUpdate) {
81
97
  console.log(`Skipping update of model "${model.modelId} - ${tenant.id} - ${locale.code}".`);
82
98
  return false;
83
99
  }
100
+
84
101
  return true;
85
102
  }).map(model => {
86
103
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, model), {}, {
@@ -90,6 +107,7 @@ const upgradeTenantModels = async params => {
90
107
  /**
91
108
  * And update all the models
92
109
  */
110
+
93
111
  for (const model of updatedModels) {
94
112
  try {
95
113
  await cms.storageOperations.models.update({
@@ -105,8 +123,11 @@ const upgradeTenantModels = async params => {
105
123
  /**
106
124
  * In the end we need to write the new cms system version.
107
125
  */
126
+
127
+
108
128
  await cms.setSystemVersion("5.33.0");
109
129
  };
130
+
110
131
  const createUpgrade = () => {
111
132
  return {
112
133
  type: "api-upgrade",
@@ -119,13 +140,14 @@ const createUpgrade = () => {
119
140
  cms,
120
141
  i18n
121
142
  } = context;
122
-
123
143
  /**
124
144
  * We need to be able to access all data.
125
145
  */
146
+
126
147
  security.disableAuthorization();
127
148
  const initialTenant = tenancy.getCurrentTenant();
128
149
  const tenants = await tenancy.listTenants();
150
+
129
151
  try {
130
152
  for (const tenant of tenants) {
131
153
  tenancy.setCurrentTenant(tenant);
@@ -156,4 +178,5 @@ const createUpgrade = () => {
156
178
  }
157
179
  };
158
180
  };
181
+
159
182
  exports.createUpgrade = createUpgrade;
@@ -1 +1 @@
1
- {"version":3,"names":["assignStorageId","fields","map","field","settings","Array","isArray","storageId","fieldId","shouldUpdate","some","upgradeTenantModels","params","tenant","cms","i18n","locales","storageOperations","list","where","id","limit","length","console","log","locale","models","code","updatedModels","filter","model","toUpdate","modelId","update","ex","WebinyError","setSystemVersion","createUpgrade","type","version","app","apply","context","security","tenancy","disableAuthorization","initialTenant","getCurrentTenant","tenants","listTenants","setCurrentTenant","JSON","stringify","message","data","enableAuthorization"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { UpgradePlugin } from \"@webiny/api-upgrade\";\nimport { CmsContext, CmsModelField, HeadlessCms } from \"~/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NContextObject } from \"@webiny/api-i18n/types\";\n\nconst assignStorageId = (fields: CmsModelField[]): CmsModelField[] => {\n return fields.map(field => {\n const settings = {\n ...(field.settings || {})\n };\n if (settings.fields && Array.isArray(settings.fields) === true) {\n settings.fields = assignStorageId(settings.fields);\n }\n return {\n ...field,\n storageId: field.fieldId,\n settings\n };\n });\n};\n/**\n * If at least one field does not have storageId define, we should definitely update the model.\n */\nconst shouldUpdate = (fields: CmsModelField[]): boolean => {\n return fields.some(field => {\n if (field.settings?.fields) {\n return shouldUpdate(field.settings.fields);\n }\n return !field.storageId;\n });\n};\n\ninterface UpgradeTenantModelsParams {\n tenant: Tenant;\n cms: HeadlessCms;\n i18n: I18NContextObject;\n}\n\nconst upgradeTenantModels = async (params: UpgradeTenantModelsParams): Promise<void> => {\n const { tenant, cms, i18n } = params;\n /**\n * We need all locales for this tenant, so we can go and find all models for all the locales.\n */\n const [locales] = await i18n.locales.storageOperations.list({\n where: {\n tenant: tenant.id\n },\n limit: 100\n });\n if (locales.length === 0) {\n console.log(`There are no locales under the tenant \"${tenant.id}\".`);\n return;\n }\n for (const locale of locales) {\n /**\n * We need all the models that are not plugin models.\n */\n const models = await cms.storageOperations.models.list({\n where: {\n tenant: tenant.id,\n locale: locale.code\n }\n });\n if (models.length === 0) {\n console.log(\n `No models in tenant \"${tenant.id}\" and locale \"${locale.code}\" combination.`\n );\n continue;\n }\n\n /**\n * Then we need to go into each of the model fields and add the storageId, which is the same as the fieldId\n */\n const updatedModels = models\n .filter(model => {\n /**\n * If model has at least one field with no storageId, continue with the update.\n */\n const toUpdate = shouldUpdate(model.fields);\n\n /**\n * If not updating the model, lets log it - just in case...\n */\n if (!toUpdate) {\n console.log(\n `Skipping update of model \"${model.modelId} - ${tenant.id} - ${locale.code}\".`\n );\n return false;\n }\n return true;\n })\n .map(model => {\n return {\n ...model,\n fields: assignStorageId(model.fields)\n };\n });\n /**\n * And update all the models\n */\n for (const model of updatedModels) {\n try {\n await cms.storageOperations.models.update({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not update CMS model ${model.modelId}`,\n \"MODEL_UPGRADE_ERROR\",\n {\n model\n }\n );\n }\n }\n }\n /**\n * In the end we need to write the new cms system version.\n */\n await cms.setSystemVersion(\"5.33.0\");\n};\n\nexport const createUpgrade = (): UpgradePlugin<CmsContext> => {\n return {\n type: \"api-upgrade\",\n version: \"5.33.0\",\n app: \"headless-cms\",\n apply: async context => {\n const { security, tenancy, cms, i18n } = context;\n\n /**\n * We need to be able to access all data.\n */\n security.disableAuthorization();\n\n const initialTenant = tenancy.getCurrentTenant();\n\n const tenants = await tenancy.listTenants();\n try {\n for (const tenant of tenants) {\n tenancy.setCurrentTenant(tenant);\n await upgradeTenantModels({\n tenant,\n cms,\n i18n\n });\n }\n } catch (ex) {\n console.log(\n `Upgrade error: ${JSON.stringify({\n message: ex.message,\n code: ex.code,\n data: ex.data\n })}`\n );\n throw new WebinyError(\n `Could not finish the 5.33.0 upgrade. Please contact Webiny team on Slack and share the error.`,\n \"UPGRADE_ERROR\",\n {\n message: ex.message,\n code: ex.code,\n data: ex.data\n }\n );\n } finally {\n /**\n * Always enable the security after all the code runs.\n */\n security.enableAuthorization();\n tenancy.setCurrentTenant(initialTenant);\n }\n }\n };\n};\n"],"mappings":"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"}
1
+ {"version":3,"names":["assignStorageId","fields","map","field","settings","Array","isArray","storageId","fieldId","shouldUpdate","some","upgradeTenantModels","params","tenant","cms","i18n","locales","storageOperations","list","where","id","limit","length","console","log","locale","models","code","updatedModels","filter","model","toUpdate","modelId","update","ex","WebinyError","setSystemVersion","createUpgrade","type","version","app","apply","context","security","tenancy","disableAuthorization","initialTenant","getCurrentTenant","tenants","listTenants","setCurrentTenant","JSON","stringify","message","data","enableAuthorization"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { UpgradePlugin } from \"@webiny/api-upgrade\";\nimport { CmsContext, CmsModelField, HeadlessCms } from \"~/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NContextObject } from \"@webiny/api-i18n/types\";\n\nconst assignStorageId = (fields: CmsModelField[]): CmsModelField[] => {\n return fields.map(field => {\n const settings = {\n ...(field.settings || {})\n };\n if (settings.fields && Array.isArray(settings.fields) === true) {\n settings.fields = assignStorageId(settings.fields);\n }\n return {\n ...field,\n storageId: field.fieldId,\n settings\n };\n });\n};\n/**\n * If at least one field does not have storageId define, we should definitely update the model.\n */\nconst shouldUpdate = (fields: CmsModelField[]): boolean => {\n return fields.some(field => {\n if (field.settings?.fields) {\n return shouldUpdate(field.settings.fields);\n }\n return !field.storageId;\n });\n};\n\ninterface UpgradeTenantModelsParams {\n tenant: Tenant;\n cms: HeadlessCms;\n i18n: I18NContextObject;\n}\n\nconst upgradeTenantModels = async (params: UpgradeTenantModelsParams): Promise<void> => {\n const { tenant, cms, i18n } = params;\n /**\n * We need all locales for this tenant, so we can go and find all models for all the locales.\n */\n const [locales] = await i18n.locales.storageOperations.list({\n where: {\n tenant: tenant.id\n },\n limit: 100\n });\n if (locales.length === 0) {\n console.log(`There are no locales under the tenant \"${tenant.id}\".`);\n return;\n }\n for (const locale of locales) {\n /**\n * We need all the models that are not plugin models.\n */\n const models = await cms.storageOperations.models.list({\n where: {\n tenant: tenant.id,\n locale: locale.code\n }\n });\n if (models.length === 0) {\n console.log(\n `No models in tenant \"${tenant.id}\" and locale \"${locale.code}\" combination.`\n );\n continue;\n }\n\n /**\n * Then we need to go into each of the model fields and add the storageId, which is the same as the fieldId\n */\n const updatedModels = models\n .filter(model => {\n /**\n * If model has at least one field with no storageId, continue with the update.\n */\n const toUpdate = shouldUpdate(model.fields);\n\n /**\n * If not updating the model, lets log it - just in case...\n */\n if (!toUpdate) {\n console.log(\n `Skipping update of model \"${model.modelId} - ${tenant.id} - ${locale.code}\".`\n );\n return false;\n }\n return true;\n })\n .map(model => {\n return {\n ...model,\n fields: assignStorageId(model.fields)\n };\n });\n /**\n * And update all the models\n */\n for (const model of updatedModels) {\n try {\n await cms.storageOperations.models.update({\n model\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not update CMS model ${model.modelId}`,\n \"MODEL_UPGRADE_ERROR\",\n {\n model\n }\n );\n }\n }\n }\n /**\n * In the end we need to write the new cms system version.\n */\n await cms.setSystemVersion(\"5.33.0\");\n};\n\nexport const createUpgrade = (): UpgradePlugin<CmsContext> => {\n return {\n type: \"api-upgrade\",\n version: \"5.33.0\",\n app: \"headless-cms\",\n apply: async context => {\n const { security, tenancy, cms, i18n } = context;\n\n /**\n * We need to be able to access all data.\n */\n security.disableAuthorization();\n\n const initialTenant = tenancy.getCurrentTenant();\n\n const tenants = await tenancy.listTenants();\n try {\n for (const tenant of tenants) {\n tenancy.setCurrentTenant(tenant);\n await upgradeTenantModels({\n tenant,\n cms,\n i18n\n });\n }\n } catch (ex) {\n console.log(\n `Upgrade error: ${JSON.stringify({\n message: ex.message,\n code: ex.code,\n data: ex.data\n })}`\n );\n throw new WebinyError(\n `Could not finish the 5.33.0 upgrade. Please contact Webiny team on Slack and share the error.`,\n \"UPGRADE_ERROR\",\n {\n message: ex.message,\n code: ex.code,\n data: ex.data\n }\n );\n } finally {\n /**\n * Always enable the security after all the code runs.\n */\n security.enableAuthorization();\n tenancy.setCurrentTenant(initialTenant);\n }\n }\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAMA,MAAMA,eAAe,GAAIC,MAAD,IAA8C;EAClE,OAAOA,MAAM,CAACC,GAAP,CAAWC,KAAK,IAAI;IACvB,MAAMC,QAAQ,mCACND,KAAK,CAACC,QAAN,IAAkB,EADZ,CAAd;;IAGA,IAAIA,QAAQ,CAACH,MAAT,IAAmBI,KAAK,CAACC,OAAN,CAAcF,QAAQ,CAACH,MAAvB,MAAmC,IAA1D,EAAgE;MAC5DG,QAAQ,CAACH,MAAT,GAAkBD,eAAe,CAACI,QAAQ,CAACH,MAAV,CAAjC;IACH;;IACD,mEACOE,KADP;MAEII,SAAS,EAAEJ,KAAK,CAACK,OAFrB;MAGIJ;IAHJ;EAKH,CAZM,CAAP;AAaH,CAdD;AAeA;AACA;AACA;;;AACA,MAAMK,YAAY,GAAIR,MAAD,IAAsC;EACvD,OAAOA,MAAM,CAACS,IAAP,CAAYP,KAAK,IAAI;IAAA;;IACxB,uBAAIA,KAAK,CAACC,QAAV,4CAAI,gBAAgBH,MAApB,EAA4B;MACxB,OAAOQ,YAAY,CAACN,KAAK,CAACC,QAAN,CAAeH,MAAhB,CAAnB;IACH;;IACD,OAAO,CAACE,KAAK,CAACI,SAAd;EACH,CALM,CAAP;AAMH,CAPD;;AAeA,MAAMI,mBAAmB,GAAG,MAAOC,MAAP,IAA4D;EACpF,MAAM;IAAEC,MAAF;IAAUC,GAAV;IAAeC;EAAf,IAAwBH,MAA9B;EACA;AACJ;AACA;;EACI,MAAM,CAACI,OAAD,IAAY,MAAMD,IAAI,CAACC,OAAL,CAAaC,iBAAb,CAA+BC,IAA/B,CAAoC;IACxDC,KAAK,EAAE;MACHN,MAAM,EAAEA,MAAM,CAACO;IADZ,CADiD;IAIxDC,KAAK,EAAE;EAJiD,CAApC,CAAxB;;EAMA,IAAIL,OAAO,CAACM,MAAR,KAAmB,CAAvB,EAA0B;IACtBC,OAAO,CAACC,GAAR,CAAa,0CAAyCX,MAAM,CAACO,EAAG,IAAhE;IACA;EACH;;EACD,KAAK,MAAMK,MAAX,IAAqBT,OAArB,EAA8B;IAC1B;AACR;AACA;IACQ,MAAMU,MAAM,GAAG,MAAMZ,GAAG,CAACG,iBAAJ,CAAsBS,MAAtB,CAA6BR,IAA7B,CAAkC;MACnDC,KAAK,EAAE;QACHN,MAAM,EAAEA,MAAM,CAACO,EADZ;QAEHK,MAAM,EAAEA,MAAM,CAACE;MAFZ;IAD4C,CAAlC,CAArB;;IAMA,IAAID,MAAM,CAACJ,MAAP,KAAkB,CAAtB,EAAyB;MACrBC,OAAO,CAACC,GAAR,CACK,wBAAuBX,MAAM,CAACO,EAAG,iBAAgBK,MAAM,CAACE,IAAK,gBADlE;MAGA;IACH;IAED;AACR;AACA;;;IACQ,MAAMC,aAAa,GAAGF,MAAM,CACvBG,MADiB,CACVC,KAAK,IAAI;MACb;AAChB;AACA;MACgB,MAAMC,QAAQ,GAAGtB,YAAY,CAACqB,KAAK,CAAC7B,MAAP,CAA7B;MAEA;AAChB;AACA;;MACgB,IAAI,CAAC8B,QAAL,EAAe;QACXR,OAAO,CAACC,GAAR,CACK,6BAA4BM,KAAK,CAACE,OAAQ,MAAKnB,MAAM,CAACO,EAAG,MAAKK,MAAM,CAACE,IAAK,IAD/E;QAGA,OAAO,KAAP;MACH;;MACD,OAAO,IAAP;IACH,CAjBiB,EAkBjBzB,GAlBiB,CAkBb4B,KAAK,IAAI;MACV,mEACOA,KADP;QAEI7B,MAAM,EAAED,eAAe,CAAC8B,KAAK,CAAC7B,MAAP;MAF3B;IAIH,CAvBiB,CAAtB;IAwBA;AACR;AACA;;IACQ,KAAK,MAAM6B,KAAX,IAAoBF,aAApB,EAAmC;MAC/B,IAAI;QACA,MAAMd,GAAG,CAACG,iBAAJ,CAAsBS,MAAtB,CAA6BO,MAA7B,CAAoC;UACtCH;QADsC,CAApC,CAAN;MAGH,CAJD,CAIE,OAAOI,EAAP,EAAW;QACT,MAAM,IAAIC,cAAJ,CACD,8BAA6BL,KAAK,CAACE,OAAQ,EAD1C,EAEF,qBAFE,EAGF;UACIF;QADJ,CAHE,CAAN;MAOH;IACJ;EACJ;EACD;AACJ;AACA;;;EACI,MAAMhB,GAAG,CAACsB,gBAAJ,CAAqB,QAArB,CAAN;AACH,CAlFD;;AAoFO,MAAMC,aAAa,GAAG,MAAiC;EAC1D,OAAO;IACHC,IAAI,EAAE,aADH;IAEHC,OAAO,EAAE,QAFN;IAGHC,GAAG,EAAE,cAHF;IAIHC,KAAK,EAAE,MAAMC,OAAN,IAAiB;MACpB,MAAM;QAAEC,QAAF;QAAYC,OAAZ;QAAqB9B,GAArB;QAA0BC;MAA1B,IAAmC2B,OAAzC;MAEA;AACZ;AACA;;MACYC,QAAQ,CAACE,oBAAT;MAEA,MAAMC,aAAa,GAAGF,OAAO,CAACG,gBAAR,EAAtB;MAEA,MAAMC,OAAO,GAAG,MAAMJ,OAAO,CAACK,WAAR,EAAtB;;MACA,IAAI;QACA,KAAK,MAAMpC,MAAX,IAAqBmC,OAArB,EAA8B;UAC1BJ,OAAO,CAACM,gBAAR,CAAyBrC,MAAzB;UACA,MAAMF,mBAAmB,CAAC;YACtBE,MADsB;YAEtBC,GAFsB;YAGtBC;UAHsB,CAAD,CAAzB;QAKH;MACJ,CATD,CASE,OAAOmB,EAAP,EAAW;QACTX,OAAO,CAACC,GAAR,CACK,kBAAiB2B,IAAI,CAACC,SAAL,CAAe;UAC7BC,OAAO,EAAEnB,EAAE,CAACmB,OADiB;UAE7B1B,IAAI,EAAEO,EAAE,CAACP,IAFoB;UAG7B2B,IAAI,EAAEpB,EAAE,CAACoB;QAHoB,CAAf,CAIf,EALP;QAOA,MAAM,IAAInB,cAAJ,CACD,+FADC,EAEF,eAFE,EAGF;UACIkB,OAAO,EAAEnB,EAAE,CAACmB,OADhB;UAEI1B,IAAI,EAAEO,EAAE,CAACP,IAFb;UAGI2B,IAAI,EAAEpB,EAAE,CAACoB;QAHb,CAHE,CAAN;MASH,CA1BD,SA0BU;QACN;AAChB;AACA;QACgBX,QAAQ,CAACY,mBAAT;QACAX,OAAO,CAACM,gBAAR,CAAyBJ,aAAzB;MACH;IACJ;EAhDE,CAAP;AAkDH,CAnDM"}
package/upgrades/index.js CHANGED
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createUpgrades = void 0;
7
+
7
8
  var _ = require("./5.33.0");
9
+
8
10
  const createUpgrades = () => [(0, _.createUpgrade)()];
11
+
9
12
  exports.createUpgrades = createUpgrades;
@@ -1 +1 @@
1
- {"version":3,"names":["createUpgrades","create533Upgrade"],"sources":["index.ts"],"sourcesContent":["import { createUpgrade as create533Upgrade } from \"~/upgrades/5.33.0\";\n\nexport const createUpgrades = () => [create533Upgrade()];\n"],"mappings":";;;;;;AAAA;AAEO,MAAMA,cAAc,GAAG,MAAM,CAAC,IAAAC,eAAgB,GAAE,CAAC;AAAC"}
1
+ {"version":3,"names":["createUpgrades","create533Upgrade"],"sources":["index.ts"],"sourcesContent":["import { createUpgrade as create533Upgrade } from \"~/upgrades/5.33.0\";\n\nexport const createUpgrades = () => [create533Upgrade()];\n"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,cAAc,GAAG,MAAM,CAAC,IAAAC,eAAA,GAAD,CAA7B"}