@webiny/api-headless-cms 5.41.4-beta.6 → 5.42.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/constants.js +1 -1
  2. package/constants.js.map +1 -1
  3. package/crud/AccessControl/AccessControl.js.map +1 -1
  4. package/crud/contentEntry/afterDelete.d.ts +5 -1
  5. package/crud/contentEntry/afterDelete.js +9 -1
  6. package/crud/contentEntry/afterDelete.js.map +1 -1
  7. package/crud/contentEntry/entryDataValidation.js.map +1 -1
  8. package/crud/contentEntry/markLockedFields.d.ts +1 -1
  9. package/crud/contentEntry/markLockedFields.js.map +1 -1
  10. package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
  11. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js.map +1 -1
  12. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js.map +1 -1
  13. package/crud/contentEntry/useCases/ListEntries/GetEntry.js.map +1 -1
  14. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js.map +1 -1
  15. package/crud/contentEntry.crud.js.map +1 -1
  16. package/crud/contentModel/beforeCreate.js.map +1 -1
  17. package/crud/contentModel/beforeDelete.js.map +1 -1
  18. package/crud/contentModel/createFieldStorageId.js.map +1 -1
  19. package/crud/contentModel/validate/endingAllowed.js.map +1 -1
  20. package/crud/contentModel/validate/isModelEndingAllowed.js.map +1 -1
  21. package/crud/contentModel/validate/modelId.js.map +1 -1
  22. package/crud/contentModel/validate/pluralApiName.js.map +1 -1
  23. package/crud/contentModel/validate/singularApiName.js.map +1 -1
  24. package/crud/contentModel/validateModelFields.js.map +1 -1
  25. package/crud/contentModel/validateStorageId.js.map +1 -1
  26. package/crud/contentModel/validation.js.map +1 -1
  27. package/crud/contentModel.crud.js +17 -4
  28. package/crud/contentModel.crud.js.map +1 -1
  29. package/crud/contentModelGroup/beforeCreate.js.map +1 -1
  30. package/crud/contentModelGroup/beforeDelete.js.map +1 -1
  31. package/crud/contentModelGroup/beforeUpdate.js.map +1 -1
  32. package/crud/contentModelGroup.crud.js.map +1 -1
  33. package/export/crud/imports/importModels.js.map +1 -1
  34. package/export/crud/imports/validateGroups.js.map +1 -1
  35. package/export/crud/imports/validateModels.js.map +1 -1
  36. package/export/graphql/index.js.map +1 -1
  37. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
  38. package/graphql/checkEndpointAccess.js.map +1 -1
  39. package/graphql/generateSchema.js +6 -1
  40. package/graphql/generateSchema.js.map +1 -1
  41. package/graphql/getSchema/generateCacheId.js.map +1 -1
  42. package/graphql/getSchema.js +3 -2
  43. package/graphql/getSchema.js.map +1 -1
  44. package/graphql/handleRequest.js.map +1 -1
  45. package/graphql/scalars/RevisionId.js.map +1 -1
  46. package/graphql/schema/baseContentSchema.js.map +1 -1
  47. package/graphql/schema/baseSchema.js.map +1 -1
  48. package/graphql/schema/contentEntries.js.map +1 -1
  49. package/graphql/schema/contentModelGroups.js.map +1 -1
  50. package/graphql/schema/contentModels.d.ts +2 -3
  51. package/graphql/schema/contentModels.js +7 -4
  52. package/graphql/schema/contentModels.js.map +1 -1
  53. package/graphql/schema/createManageResolvers.d.ts +1 -2
  54. package/graphql/schema/createManageResolvers.js.map +1 -1
  55. package/graphql/schema/createManageSDL.js.map +1 -1
  56. package/graphql/schema/createPreviewResolvers.d.ts +1 -2
  57. package/graphql/schema/createPreviewResolvers.js.map +1 -1
  58. package/graphql/schema/createReadResolvers.d.ts +1 -2
  59. package/graphql/schema/createReadResolvers.js.map +1 -1
  60. package/graphql/schema/createReadSDL.js.map +1 -1
  61. package/graphql/schema/createSingularResolvers.d.ts +1 -2
  62. package/graphql/schema/createSingularResolvers.js.map +1 -1
  63. package/graphql/schema/createSingularSDL.js.map +1 -1
  64. package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
  65. package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -1
  66. package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
  67. package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
  68. package/graphql/schema/schemaPlugins.d.ts +1 -1
  69. package/graphql/schema/schemaPlugins.js +9 -9
  70. package/graphql/schema/schemaPlugins.js.map +1 -1
  71. package/graphql/system.js.map +1 -1
  72. package/graphqlFields/boolean.js.map +1 -1
  73. package/graphqlFields/datetime.js.map +1 -1
  74. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
  75. package/graphqlFields/file.js.map +1 -1
  76. package/graphqlFields/helpers.js.map +1 -1
  77. package/graphqlFields/json.js.map +1 -1
  78. package/graphqlFields/longText.js.map +1 -1
  79. package/graphqlFields/number.js.map +1 -1
  80. package/graphqlFields/object.js.map +1 -1
  81. package/graphqlFields/ref.js.map +1 -1
  82. package/graphqlFields/richText.js.map +1 -1
  83. package/graphqlFields/text.js.map +1 -1
  84. package/htmlRenderer/createLexicalHTMLRenderer.js +1 -1
  85. package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -1
  86. package/modelManager/SingletonModelManager.js.map +1 -1
  87. package/package.json +29 -34
  88. package/parameters/header.js.map +1 -1
  89. package/parameters/manual.js.map +1 -1
  90. package/parameters/path.js.map +1 -1
  91. package/plugins/CmsModelPlugin.js.map +1 -1
  92. package/storage/date.js.map +1 -1
  93. package/storage/dynamicZone.js.map +1 -1
  94. package/storage/object.js.map +1 -1
  95. package/types/modelField.d.ts +4 -0
  96. package/types/modelField.js.map +1 -1
  97. package/types/types.d.ts +8 -1
  98. package/types/types.js.map +1 -1
  99. package/utils/caching/Cache.d.ts +4 -1
  100. package/utils/caching/Cache.js +4 -7
  101. package/utils/caching/Cache.js.map +1 -1
  102. package/utils/caching/types.d.ts +1 -0
  103. package/utils/caching/types.js.map +1 -1
  104. package/utils/converters/Converter.js.map +1 -1
  105. package/utils/converters/ConverterCollection.js.map +1 -1
  106. package/utils/converters/valueKeyStorageConverter.js.map +1 -1
  107. package/utils/createModelField.js.map +1 -1
  108. package/utils/createTypeFromFields.js.map +1 -1
  109. package/utils/entryStorage.js.map +1 -1
  110. package/utils/getSchemaFromFieldPlugins.js.map +1 -1
  111. package/utils/renderFields.js +2 -0
  112. package/utils/renderFields.js.map +1 -1
  113. package/utils/renderListFilterFields.js.map +1 -1
  114. package/utils/renderSortEnum.js.map +1 -1
  115. package/validators/dateGte.js.map +1 -1
  116. package/validators/dateLte.js.map +1 -1
  117. package/validators/gte.js.map +1 -1
  118. package/validators/in.js.map +1 -1
  119. package/validators/lte.js.map +1 -1
  120. package/validators/maxLength.js.map +1 -1
  121. package/validators/minLength.js.map +1 -1
  122. package/validators/patternPlugins/email.js.map +1 -1
  123. package/validators/patternPlugins/lowerCase.js.map +1 -1
  124. package/validators/patternPlugins/lowerCaseSpace.js.map +1 -1
  125. package/validators/patternPlugins/upperCase.js.map +1 -1
  126. package/validators/patternPlugins/upperCaseSpace.js.map +1 -1
  127. package/validators/timeGte.js.map +1 -1
  128. package/validators/timeLte.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["modelField.ts"],"sourcesContent":["import { CmsModel } from \"./model\";\nimport { GenericRecord } from \"@webiny/api/types\";\n\nexport type CmsModelFieldType =\n | \"boolean\"\n | \"datetime\"\n | \"file\"\n | \"long-text\"\n | \"number\"\n | \"json\"\n | \"object\"\n | \"ref\"\n | \"rich-text\"\n | \"text\"\n | \"dynamicZone\"\n | string;\n\nexport type ICmsModelFieldStorageId = `${string}@${string}` | string;\n/**\n * A definition for content model field. This type exists on the app side as well.\n *\n * @category ModelField\n * @category Database model\n */\nexport interface CmsModelField {\n /**\n * A generated unique ID for the model field.\n * MUST be absolute unique throughout the models.\n * Must be in form of a-zA-Z0-9.\n *\n * We generate a unique id value when you're building a model via UI,\n * but when user is creating a model via a plugin it is up to them to be careful about this.\n */\n id: string;\n /**\n * A type of the field.\n * We are defining our built-in fields, so people know which are available by the default.\n */\n type: CmsModelFieldType;\n /**\n * A unique storage ID for storing actual values.\n * Must in form of a-zA-Z0-9@a-zA-Z0-9\n *\n * This is an auto-generated value: uses `id` and `type`\n *\n * This is used as path for the entry value.\n */\n storageId: ICmsModelFieldStorageId;\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 | null;\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\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 | null;\n /**\n * List of validations for the field.\n */\n validation?: CmsModelFieldValidation[];\n /**\n * @see CmsModelField.listValidation\n */\n listValidation?: CmsModelFieldValidation[];\n /**\n * User defined settings.\n */\n settings?: Record<string, any>;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelUpdateInput {\n /**\n * A new content model name.\n */\n name?: string;\n /**\n * A new singular name of the content model to be used in the API.\n */\n singularApiName?: string;\n /**\n * A new plural name of the content model to be used in the API.\n */\n pluralApiName?: string;\n /**\n * A group we want to move the model to.\n */\n group?: string;\n /**\n * A new description of the content model.\n */\n description?: string | null;\n /**\n * A list of content model fields to define the entry values.\n */\n fields: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: string[][];\n /**\n * Fields fieldId which are picked to represent the CMS entry.\n */\n titleFieldId?: string | null;\n descriptionFieldId?: string | null;\n imageFieldId?: string | null;\n}\n\n/**\n * 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\n [key: string]: any;\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 * Renderer settings allow you to configure field renderer on a field level.\n */\n settings?: GenericRecord<string> | null;\n}\n\n/**\n * A definition for content model field settings.\n *\n * @category ModelField\n * @category Database model\n */\nexport interface CmsModelFieldSettings {\n /**\n * Predefined values (text, number)\n * The default value for the field in case it is not predefined values field.\n */\n defaultValue?: string | boolean | number | null | undefined;\n /**\n * Object field has child fields.\n */\n fields?: CmsModelField[];\n /**\n * Is the file field images only one?\n */\n imagesOnly?: boolean;\n /**\n * Object field has child fields - so it needs to have a layout.\n */\n layout?: string[][];\n /**\n * Ref field.\n */\n models?: Pick<CmsModel, \"modelId\">[];\n /**\n * Date field.\n */\n type?: string;\n /**\n * Disable full text search explicitly on this field.\n */\n disableFullTextSearch?: boolean;\n\n /**\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/**\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 * 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\ninterface CmsModelFieldPredefinedValuesValue {\n value: string;\n label: string;\n /**\n * Default selected predefined value.\n */\n selected?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["modelField.ts"],"sourcesContent":["import { CmsModel } from \"./model\";\nimport { GenericRecord } from \"@webiny/api/types\";\n\nexport type CmsModelFieldType =\n | \"boolean\"\n | \"datetime\"\n | \"file\"\n | \"long-text\"\n | \"number\"\n | \"json\"\n | \"object\"\n | \"ref\"\n | \"rich-text\"\n | \"text\"\n | \"dynamicZone\"\n | string;\n\nexport type ICmsModelFieldStorageId = `${string}@${string}` | string;\n/**\n * A definition for content model field. This type exists on the app side as well.\n *\n * @category ModelField\n * @category Database model\n */\nexport interface CmsModelField {\n /**\n * A generated unique ID for the model field.\n * MUST be absolute unique throughout the models.\n * Must be in form of a-zA-Z0-9.\n *\n * We generate a unique id value when you're building a model via UI,\n * but when user is creating a model via a plugin it is up to them to be careful about this.\n */\n id: string;\n /**\n * A type of the field.\n * We are defining our built-in fields, so people know which are available by the default.\n */\n type: CmsModelFieldType;\n /**\n * A unique storage ID for storing actual values.\n * Must in form of a-zA-Z0-9@a-zA-Z0-9\n *\n * This is an auto-generated value: uses `id` and `type`\n *\n * This is used as path for the entry value.\n */\n storageId: ICmsModelFieldStorageId;\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 | null;\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\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 | null;\n /**\n * List of validations for the field.\n */\n validation?: CmsModelFieldValidation[];\n /**\n * @see CmsModelField.listValidation\n */\n listValidation?: CmsModelFieldValidation[];\n /**\n * User defined settings.\n */\n settings?: Record<string, any>;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model.\n *\n * @category GraphQL params\n * @category CmsModel\n */\nexport interface CmsModelUpdateInput {\n /**\n * A new content model name.\n */\n name?: string;\n /**\n * A new singular name of the content model to be used in the API.\n */\n singularApiName?: string;\n /**\n * A new plural name of the content model to be used in the API.\n */\n pluralApiName?: string;\n /**\n * A group we want to move the model to.\n */\n group?: string;\n /**\n * A new description of the content model.\n */\n description?: string | null;\n /**\n * A list of content model fields to define the entry values.\n */\n fields: CmsModelFieldInput[];\n /**\n * Admin UI field layout\n *\n * ```ts\n * layout: [\n * [field1id, field2id],\n * [field3id]\n * ]\n * ```\n */\n layout: string[][];\n /**\n * Tags for the content model.\n */\n tags?: string[];\n /**\n * Fields fieldId which are picked to represent the CMS entry.\n */\n titleFieldId?: string | null;\n descriptionFieldId?: string | null;\n imageFieldId?: string | null;\n}\n\n/**\n * 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\n [key: string]: any;\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 * Renderer settings allow you to configure field renderer on a field level.\n */\n settings?: GenericRecord<string> | null;\n}\n\n/**\n * A definition for content model field settings.\n *\n * @category ModelField\n * @category Database model\n */\nexport interface CmsModelFieldSettings {\n /**\n * Predefined values (text, number)\n * The default value for the field in case it is not predefined values field.\n */\n defaultValue?: string | boolean | number | null | undefined;\n /**\n * Object field has child fields.\n */\n fields?: CmsModelField[];\n /**\n * Is the file field images only one?\n */\n imagesOnly?: boolean;\n /**\n * Object field has child fields - so it needs to have a layout.\n */\n layout?: string[][];\n /**\n * Ref field.\n */\n models?: Pick<CmsModel, \"modelId\">[];\n /**\n * Date field.\n */\n type?: string;\n /**\n * Disable full text search explicitly on this field.\n */\n disableFullTextSearch?: boolean;\n\n /**\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/**\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 * 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\ninterface CmsModelFieldPredefinedValuesValue {\n value: string;\n label: string;\n /**\n * Default selected predefined value.\n */\n selected?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
package/types/types.d.ts CHANGED
@@ -738,6 +738,13 @@ export interface CmsModelUpdateDirectParams {
738
738
  model: CmsModel;
739
739
  original: CmsModel;
740
740
  }
741
+ export interface ICmsModelListParams {
742
+ /**
743
+ * Defaults to true.
744
+ */
745
+ includePrivate?: boolean;
746
+ includePlugins?: boolean;
747
+ }
741
748
  /**
742
749
  * Cms Model in the context.
743
750
  *
@@ -758,7 +765,7 @@ export interface CmsModelContext {
758
765
  /**
759
766
  * Get all content models.
760
767
  */
761
- listModels(): Promise<CmsModel[]>;
768
+ listModels(params?: ICmsModelListParams): Promise<CmsModel[]>;
762
769
  /**
763
770
  * Create a content model.
764
771
  */
@@ -1 +1 @@
1
- {"version":3,"names":["CONTENT_ENTRY_STATUS","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Context, GenericRecord } from \"@webiny/api/types\";\nimport { GraphQLFieldResolver, GraphQLRequestBody, Resolvers } from \"@webiny/handler-graphql/types\";\nimport { processRequestBody } from \"@webiny/handler-graphql\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\nimport { DbContext } from \"@webiny/handler-db/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection\";\nimport { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types\";\nimport { AccessControl } from \"~/crud/AccessControl/AccessControl\";\nimport { CmsModelToAstConverter } from \"~/utils/contentModelAst/CmsModelToAstConverter\";\nimport { CmsModelFieldToGraphQLPlugin } from \"./plugins\";\nimport { CmsEntryContext } from \"./context\";\nimport { CmsModelField, CmsModelFieldValidation, CmsModelUpdateInput } from \"./modelField\";\nimport { CmsModel, CmsModelCreateFromInput, CmsModelCreateInput } from \"./model\";\nimport { CmsGroup } from \"./modelGroup\";\nimport { CmsIdentity } from \"./identity\";\nimport { ISingletonModelManager } from \"~/modelManager\";\n\nexport interface CmsError {\n message: string;\n code: string;\n data: GenericRecord;\n stack?: string;\n}\n\nexport interface CmsError {\n message: string;\n code: string;\n data: GenericRecord;\n stack?: string;\n}\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\n\nexport interface HeadlessCms\n extends CmsSystemContext,\n CmsGroupContext,\n CmsModelContext,\n CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\n /**\n * Requested locale\n */\n locale: string;\n /**\n * returns an instance of current locale\n */\n getLocale: () => I18NLocale;\n /**\n * Means this request is a READ API\n */\n READ: boolean;\n /**\n * Means this request is a MANAGE API\n */\n MANAGE: boolean;\n /**\n * Means this request is a PREVIEW API\n */\n PREVIEW: boolean;\n /**\n * The storage operations loaded for current context.\n */\n storageOperations: HeadlessCmsStorageOperations;\n\n /**\n * Use to ensure perform authorization and ensure identities have access to the groups, models and entries.\n */\n accessControl: AccessControl;\n\n /**\n * Export operations.\n */\n export: HeadlessCmsExport;\n importing: HeadlessCmsImport;\n getExecutableSchema: GetExecutableSchema;\n}\n\nexport type GetExecutableSchema = (\n type: ApiEndpoint\n) => Promise<\n <TData = Record<string, any>, TExtensions = Record<string, any>>(\n input: GraphQLRequestBody | GraphQLRequestBody[]\n ) => ReturnType<typeof processRequestBody<TData, TExtensions>>\n>;\n\n/**\n * @description This combines all contexts used in the CMS into a single one.\n *\n * @category Context\n */\nexport interface CmsContext extends Context, DbContext, I18NContext {\n cms: HeadlessCms;\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T = any> {\n /**\n * A value to be validated.\n */\n value: T;\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry;\n}\n\n/**\n * 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\nexport interface CmsModelFieldToGraphQLNormalizeInputParams<TField> {\n model: CmsModel;\n field: TField;\n input: GenericRecord<string> | Array<GenericRecord<string>>;\n}\n\ninterface CmsModelFieldToGraphQLCreateResolverParams<TField> {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: TField;\n createFieldResolvers: any;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\nexport interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {\n (params: CmsModelFieldToGraphQLCreateResolverParams<TField>):\n | GraphQLFieldResolver\n | {\n resolver: GraphQLFieldResolver | null;\n typeResolvers: Resolvers<CmsContext>;\n }\n | false;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<\n TField extends CmsModelField = CmsModelField\n> {\n fields: TField[];\n originalFields: TField[];\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<\n TField extends CmsModelField = CmsModelField\n> {\n field: TField;\n originalField?: TField;\n validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFields<\n TField extends CmsModelField = CmsModelField\n> {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsFieldTypePlugins {\n [key: string]: CmsModelFieldToGraphQLPlugin;\n}\n\nexport interface OnSystemBeforeInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemAfterInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemInstallErrorTopicParams {\n error: Error;\n tenant: string;\n locale: string;\n}\n\nexport type CmsSystemContext = {\n getSystemVersion: () => Promise<string | null>;\n setSystemVersion: (version: string) => Promise<void>;\n installSystem: () => Promise<void>;\n /**\n * Lifecycle Events\n */\n onSystemBeforeInstall: Topic<OnSystemBeforeInstallTopicParams>;\n onSystemAfterInstall: Topic<OnSystemAfterInstallTopicParams>;\n onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;\n};\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n id?: string;\n name: string;\n slug?: string;\n description?: string | null;\n icon: string;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupUpdateInput {\n name?: string;\n slug?: string;\n description?: string;\n icon?: string;\n}\n\n/**\n * A `data.where` parameter received when listing content model groups.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupListParams {\n where: {\n tenant: string;\n locale: string;\n };\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupCreateErrorTopicParams {\n input: CmsGroupCreateInput;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupUpdateErrorTopicParams {\n input: CmsGroupUpdateInput;\n original: CmsGroup;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupDeleteErrorTopicParams {\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup>;\n /**\n * List all content model groups. Filterable via params.\n */\n listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;\n /**\n * Delete content model group by given id.\n */\n deleteGroup: (id: string) => Promise<boolean>;\n /**\n * Clear the cached groups.\n */\n clearGroupsCache: () => void;\n /**\n * Lifecycle Events\n */\n onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;\n onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;\n onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;\n onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;\n onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;\n onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;\n onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;\n}\n\n/**\n * 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<T = any>(context: CmsContext, model: CmsModel): Promise<CmsModelManager<T>>;\n}\n\n/**\n * A content entry values definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntryValues {\n [key: string]: any;\n}\n\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<T = CmsEntryValues> {\n /**\n * A version of the webiny this entry was created with.\n * This can be used when upgrading the system, so we know which entries to update.\n */\n webinyVersion: string;\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n\n /**\n * Revision-level meta fields. 👇\n */\n\n /**\n * An ISO 8601 date/time string.\n */\n revisionCreatedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionSavedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionModifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionDeletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionRestoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionFirstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionLastPublishedOn: string | null;\n\n /**\n * Identity that last ionCreated the entry.\n */\n revisionCreatedBy: CmsIdentity;\n /**\n * Identity that last ionSaved the entry.\n */\n revisionSavedBy: CmsIdentity;\n /**\n * Identity that last ionModified the entry.\n */\n revisionModifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the revision.\n */\n revisionDeletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the revision.\n */\n revisionRestoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n revisionFirstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n revisionLastPublishedBy: CmsIdentity | null;\n\n /**\n * An ISO 8601 date/time string.\n */\n createdOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n savedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n modifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n deletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n restoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n firstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n lastPublishedOn: string | null;\n\n /**\n * Identity that last created the entry.\n */\n createdBy: CmsIdentity;\n /**\n * Identity that last saved the entry.\n */\n savedBy: CmsIdentity;\n /**\n * Identity that last modified the entry.\n */\n modifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the entry.\n */\n deletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the entry.\n */\n restoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n firstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * Deprecated fields. 👇\n */\n\n /**\n * @deprecated Will be removed with the 5.41.0 release. Use `createdBy` field instead.\n */\n ownedBy?: CmsIdentity | null;\n\n /**\n * @deprecated Will be removed with the 5.41.0 release. Use `firstPublishedOn` or `lastPublishedOn` field instead.\n */\n publishedOn?: string | null;\n\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 revision version of the entry.\n */\n version: number;\n /**\n * Is the entry locked?\n */\n locked: boolean;\n /**\n * Status type of the entry.\n */\n status: CmsEntryStatus;\n /**\n * A mapped storageId -> value object.\n *\n * @see CmsModelField\n */\n values: T;\n /**\n * Advanced Content Organization\n */\n location?: {\n folderId?: string | null;\n };\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.\n * Be aware that when accessing properties in it on old systems, it will break if not checked first.\n *\n * Available only on the Manage API in entry GraphQL type `meta.data` property.\n */\n meta?: {\n [key: string]: any;\n };\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean | null;\n /**\n * This field preserves the original folderId value, as the ROOT_FOLDER is set upon deletion.\n * The value is utilized when restoring the entry from the trash bin.\n */\n binOriginalFolderId?: string | null;\n}\n\nexport interface CmsStorageEntry extends CmsEntry {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\n}\n\n/**\n * A definition for content model manager to be used in the code.\n * The default one uses `CmsEntryContext` methods internally, but devs can change to what every they want.\n *\n * @see CmsEntryContext\n *\n * @category Context\n * @category CmsEntry\n * @category CmsModel\n */\nexport interface CmsModelManager<T = CmsEntryValues> {\n model: CmsModel;\n /**\n * List only published entries in the content model.\n */\n listPublished(params: CmsEntryListParams): Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * List latest entries in the content model. Used for administration.\n */\n listLatest(params: CmsEntryListParams): Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * Get a list of published entries by the ID list.\n */\n getPublishedByIds(ids: string[]): Promise<CmsEntry<T>[]>;\n /**\n * Get a list of the latest entries by the ID list.\n */\n getLatestByIds(ids: string[]): Promise<CmsEntry<T>[]>;\n /**\n * Get an entry filtered by given params. Will always get one.\n */\n get(id: string): Promise<CmsEntry<T>>;\n /**\n * Create an entry.\n */\n create<I>(\n data: CreateCmsEntryInput & I,\n options?: CreateCmsEntryOptionsInput\n ): Promise<CmsEntry<T>>;\n /**\n * Update an entry.\n */\n update(\n id: string,\n data: UpdateCmsEntryInput,\n options?: UpdateCmsEntryOptionsInput\n ): Promise<CmsEntry<T>>;\n /**\n * Delete an entry.\n */\n delete(id: string): Promise<void>;\n}\n\nexport type ICmsEntryManager<T = GenericRecord> = CmsModelManager<T>;\n\n/**\n * Create\n */\nexport interface OnModelBeforeCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\n\nexport interface OnModelAfterCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\n\nexport interface OnModelCreateErrorTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Create From / Clone\n */\nexport interface OnModelBeforeCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelAfterCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelCreateFromErrorParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Update\n */\nexport interface OnModelBeforeUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelAfterUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelUpdateErrorTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Delete\n */\nexport interface OnModelBeforeDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelAfterDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelDeleteErrorTopicParams {\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Initialize\n */\nexport interface OnModelInitializeParams {\n model: CmsModel;\n data: Record<string, any>;\n}\n\n/**\n *\n */\nexport interface CmsModelUpdateDirectParams {\n model: CmsModel;\n original: CmsModel;\n}\n\n/**\n * Cms Model in the context.\n *\n * @category Context\n * @category CmsModel\n */\nexport interface CmsModelContext {\n /**\n * Get a single content model.\n *\n * @throws NotFoundError\n */\n getModel(modelId: string): Promise<CmsModel>;\n /**\n * Get model to AST converter.\n */\n getModelToAstConverter: () => CmsModelToAstConverter;\n /**\n * Get all content models.\n */\n listModels(): Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel(data: CmsModelCreateInput): Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom(modelId: string, data: CmsModelCreateFromInput): Promise<CmsModel>;\n /**\n * Update content model without data validation. Used internally.\n * @hidden\n */\n updateModelDirect(params: CmsModelUpdateDirectParams): Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel(modelId: string, data: CmsModelUpdateInput): Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel(modelId: string): Promise<void>;\n /**\n * Possibility for users to trigger the model initialization.\n * They can hook into it and do what ever they want to.\n *\n * Primary idea behind this is creating the index, for the code models, in the ES.\n */\n initializeModel(modelId: string, data: Record<string, any>): Promise<boolean>;\n /**\n * Get an instance of CmsModelManager for given content modelId.\n *\n * @see CmsModelManager\n */\n getEntryManager<T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel | string\n ): Promise<ICmsEntryManager<T>>;\n /**\n * A model manager for a model which has a single entry.\n */\n getSingletonEntryManager<T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel | string\n ): Promise<ISingletonModelManager<T>>;\n /**\n * Get all content model managers mapped by modelId.\n * @see CmsModelManager\n */\n getEntryManagers(): Map<string, ICmsEntryManager>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache(): void;\n /**\n * Lifecycle Events\n */\n onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;\n onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;\n onModelCreateError: Topic<OnModelCreateErrorTopicParams>;\n onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;\n onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;\n onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;\n onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;\n onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;\n onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;\n onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;\n onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;\n onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;\n onModelInitialize: Topic<OnModelInitializeParams>;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef {\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n}\n\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Generated ID without the version.\n */\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n /**\n * Status of the entry.\n */\n status?: CmsEntryStatus;\n status_not?: CmsEntryStatus;\n status_in?: CmsEntryStatus[];\n status_not_in?: CmsEntryStatus[];\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedBy?: string;\n revisionCreatedBy_not?: string;\n revisionCreatedBy_in?: string[];\n revisionCreatedBy_not_in?: string[];\n\n revisionModifiedBy?: string;\n revisionModifiedBy_not?: string;\n revisionModifiedBy_in?: string[];\n revisionModifiedBy_not_in?: string[];\n\n revisionSavedBy?: string;\n revisionSavedBy_not?: string;\n revisionSavedBy_in?: string[];\n revisionSavedBy_not_in?: string[];\n\n revisionFirstPublishedBy?: string;\n revisionFirstPublishedBy_not?: string;\n revisionFirstPublishedBy_in?: string[];\n revisionFirstPublishedBy_not_in?: string[];\n\n revisionLastPublishedBy?: string;\n revisionLastPublishedBy_not?: string;\n revisionLastPublishedBy_in?: string[];\n revisionLastPublishedBy_not_in?: string[];\n\n /**\n * Entry-level meta fields. 👇\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n\n modifiedBy?: string;\n modifiedBy_not?: string;\n modifiedBy_in?: string[];\n modifiedBy_not_in?: string[];\n\n savedBy?: string;\n savedBy_not?: string;\n savedBy_in?: string[];\n savedBy_not_in?: string[];\n\n firstPublishedBy?: string;\n firstPublishedBy_not?: string;\n firstPublishedBy_in?: string[];\n firstPublishedBy_not_in?: string[];\n\n lastPublishedBy?: string;\n lastPublishedBy_not?: string;\n lastPublishedBy_in?: string[];\n lastPublishedBy_not_in?: string[];\n\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n version?: number;\n version_lt?: number;\n version_gt?: number;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n published?: boolean;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n latest?: boolean;\n /**\n * ACO related parameters.\n */\n wbyAco_location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n };\n\n /**\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 | Date\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhere[]\n | CmsEntryListWhere\n | CmsEntryListWhereRef;\n\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 CmsEntryListSortAsc = `${string}_ASC`;\nexport type CmsEntryListSortDesc = `${string}_DESC`;\nexport type CmsEntryListSort = (CmsEntryListSortAsc | CmsEntryListSortDesc)[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * Create\n */\nexport interface OnEntryBeforeCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateErrorTopicParams {\n error: Error;\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Revision Create\n */\nexport interface OnEntryRevisionBeforeCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionAfterCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateRevisionErrorTopicParams {\n error: Error;\n input: CreateFromCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Update\n */\nexport interface OnEntryBeforeUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUpdateErrorTopicParams {\n error: Error;\n input: UpdateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Move\n */\nexport interface OnEntryBeforeMoveTopicParams {\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterMoveTopicParams {\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryMoveErrorTopicParams {\n error: Error;\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Publish\n */\nexport interface OnEntryBeforePublishTopicParams {\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterPublishTopicParams {\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryPublishErrorTopicParams {\n error: Error;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Republish\n */\nexport interface OnEntryBeforeRepublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterRepublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryRepublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Unpublish\n */\nexport interface OnEntryBeforeUnpublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterUnpublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUnpublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Delete\n */\nexport interface OnEntryBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n permanent: boolean;\n}\n\nexport interface OnEntryAfterDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n permanent: boolean;\n}\n\nexport interface OnEntryDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n permanent: boolean;\n model: CmsModel;\n}\n\n/**\n * Restore from bin\n */\nexport interface OnEntryBeforeRestoreFromBinTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterRestoreFromBinTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryRestoreFromBinErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Delete Revision\n */\nexport interface OnEntryRevisionBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionAfterDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Delete multiple\n */\nexport interface OnEntryBeforeDeleteMultipleTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n}\n\nexport interface OnEntryAfterDeleteMultipleTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n}\n\nexport interface OnEntryDeleteMultipleErrorTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n error: Error;\n}\n\n/**\n * Get\n */\nexport interface OnEntryBeforeGetTopicParams {\n model: CmsModel;\n where: CmsEntryListWhere;\n}\n\n/**\n * List\n */\nexport interface EntryBeforeListTopicParams {\n where: CmsEntryListWhere;\n model: CmsModel;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport type CreateCmsEntryInput<TValues = CmsEntryValues> = TValues & {\n id?: string;\n status?: CmsEntryStatus;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n createdBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n};\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date;\n revisionSavedOn?: Date;\n revisionModifiedOn?: Date;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity;\n revisionSavedBy?: CmsIdentity;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date;\n savedOn?: Date;\n modifiedOn?: Date;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n [key: string]: any;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport type UpdateCmsEntryInput<TValues = CmsEntryValues> = TValues & {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string | null;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string | null;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionFirstPublishedOn?: Date | string | null;\n revisionLastPublishedOn?: Date | string | null;\n revisionModifiedBy?: CmsIdentity | null;\n revisionCreatedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity | null;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedBy?: CmsIdentity | null;\n revisionLastPublishedBy?: CmsIdentity | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string | null;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string | null;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n firstPublishedOn?: Date | string | null;\n lastPublishedOn?: Date | string | null;\n createdBy?: CmsIdentity | null;\n modifiedBy?: CmsIdentity | null;\n savedBy?: CmsIdentity | null;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedBy?: CmsIdentity | null;\n lastPublishedBy?: CmsIdentity | null;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n};\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface GetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\n/**\n * @category CmsEntry\n */\nexport interface CmsDeleteEntryOptions {\n /**\n * Runs the delete commands even if the entry is not found in the DynamoDB.\n * This is to force clean the entry records that might have been left behind a failed delete.\n */\n force?: boolean;\n /**\n * Destroying the entry directly, without moving it to the bin.\n */\n permanently?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface DeleteMultipleEntriesParams {\n entries: string[];\n}\n\nexport type DeleteMultipleEntriesResponse = {\n id: string;\n}[];\n\nexport interface CmsEntryValidateResponse {\n [key: string]: any;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * A base security permission for CMS.\n *\n * @category SecurityPermission\n */\nexport interface BaseCmsSecurityPermission extends SecurityPermission {\n own?: boolean;\n rwd: string;\n}\n\n/**\n * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n locale: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n\n [key: string]: any;\n}\n\nexport interface CmsGroupStorageOperationsListParams {\n where: CmsGroupStorageOperationsListWhereParams;\n sort?: string[];\n}\n\nexport interface CmsGroupStorageOperationsCreateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsUpdateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsDeleteParams {\n group: CmsGroup;\n}\n\n/**\n * Description of the CmsGroup CRUD operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsGroupStorageOperations {\n /**\n * Gets content model group by given id.\n */\n get: (params: CmsGroupStorageOperationsGetParams) => Promise<CmsGroup | null>;\n /**\n * List all content model groups. Filterable via params.\n */\n list: (params: CmsGroupStorageOperationsListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n create: (params: CmsGroupStorageOperationsCreateParams) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<CmsGroup>;\n /**\n * Delete the content model group.\n */\n delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<CmsGroup>;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n locale: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsDeleteParams {\n model: CmsModel;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsModelStorageOperations {\n /**\n * Gets content model by given id.\n */\n get: (params: CmsModelStorageOperationsGetParams) => Promise<CmsModel | null>;\n /**\n * List all content models. Filterable via params.\n */\n list: (params: CmsModelStorageOperationsListParams) => Promise<CmsModel[]>;\n /**\n * Create a new content model.\n */\n create: (params: CmsModelStorageOperationsCreateParams) => Promise<CmsModel>;\n /**\n * Update existing content model.\n */\n update: (params: CmsModelStorageOperationsUpdateParams) => Promise<CmsModel>;\n /**\n * Delete the content model.\n */\n delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<CmsModel>;\n}\n\nexport interface CmsEntryStorageOperationsGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n}\n\nexport interface CmsEntryStorageOperationsListParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit: number;\n after?: string | null;\n}\n\nexport interface CmsEntryStorageOperationsCreateParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: T;\n /**\n * Entry that was set as latest.\n */\n latestEntry: CmsEntry | null;\n /**\n * Entry that was set as latest, directly from storage, with transformations.\n */\n latestStorageEntry: T | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams {\n entry: CmsEntry;\n}\n\nexport interface CmsEntryStorageOperationsMoveToBinParams<\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 CmsEntryStorageOperationsRestoreFromBinParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as restored.\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 CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\nexport interface CmsEntryStorageOperationsGetByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetLatestByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionsParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetLatestRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPreviousRevisionParams {\n entryId: string;\n version: number;\n}\n\nexport interface CmsEntryStorageOperationsListResponse<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Has more items to load with the current filtering?\n */\n hasMoreItems: boolean;\n /**\n * Items loaded with current filtering.\n */\n items: T[];\n /**\n * Pointer for where to start the new item set.\n */\n cursor: string | null;\n /**\n * Total amount of items with the current filter.\n */\n totalCount: number;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n *\n *\n * @category StorageOperations\n * @category CmsEntry\n */\nexport interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorageEntry> {\n /**\n * Get all the entries of the ids.\n */\n getByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<T[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<T | null>;\n /**\n * Gets entry by given params.\n */\n get: (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: (\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<T>>;\n /**\n * Create a new entry.\n */\n create: (model: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: (\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<T>;\n /**\n * Update existing entry.\n */\n update: (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;\n /**\n * Move entry and all its entries into a new folder.\n */\n move: (model: CmsModel, id: string, folderId: string) => Promise<void>;\n /**\n * Delete the entry revision.\n */\n deleteRevision: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ) => Promise<void>;\n /**\n * Delete the entry.\n */\n delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Move the entry to bin.\n */\n moveToBin: (model: CmsModel, params: CmsEntryStorageOperationsMoveToBinParams) => Promise<void>;\n /**\n * Restore the entry from the bin.\n */\n restoreFromBin: (\n model: CmsModel,\n params: CmsEntryStorageOperationsRestoreFromBinParams<T>\n ) => Promise<T>;\n /**\n * Delete multiple entries, with a limit on how much can be deleted in one call.\n */\n deleteMultipleEntries: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteEntriesParams\n ) => Promise<void>;\n /**\n * Publish the entry.\n */\n publish: (model: CmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;\n /**\n * Unpublish the entry.\n */\n unpublish: (model: CmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;\n /**\n * Method to list all the unique values for the given field id.\n * Simplest use case would be to aggregate tags for some content.\n * @internal\n */\n getUniqueFieldValues: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetUniqueFieldValuesParams\n ) => Promise<CmsEntryUniqueValue[]>;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\n}\n\nexport interface CmsSystem {\n version?: string;\n readAPIKey?: string;\n /**\n * System tenant.\n */\n tenant: string;\n}\n\nexport interface CmsSystemStorageOperationsGetParams {\n tenant: string;\n}\n\nexport interface CmsSystemStorageOperationsCreateParams {\n system: CmsSystem;\n}\n\nexport interface CmsSystemStorageOperationsUpdateParams {\n system: CmsSystem;\n}\n\nexport interface CmsSystemStorageOperations {\n /**\n * Get the system data.\n */\n get: (params: CmsSystemStorageOperationsGetParams) => Promise<CmsSystem | null>;\n /**\n * Create the system info in the storage.\n */\n create: (params: CmsSystemStorageOperationsCreateParams) => Promise<CmsSystem>;\n /**\n * Update the system info in the storage.\n */\n update: (params: CmsSystemStorageOperationsUpdateParams) => Promise<CmsSystem>;\n}\n\nexport interface HeadlessCmsStorageOperations<C = CmsContext> {\n name: string;\n system: CmsSystemStorageOperations;\n groups: CmsGroupStorageOperations;\n models: CmsModelStorageOperations;\n entries: CmsEntryStorageOperations;\n /**\n * Either attach something from the storage operations or run something in it.\n */\n beforeInit: (context: C) => Promise<void>;\n init?: (context: C) => Promise<void>;\n}\n"],"mappings":";;;;;;AA2FA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgCA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAwDA;AACA;AACA;AAiCA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAwCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AA4NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA8CA;AACA;AACA;AAiBA;AACA;AACA;AAoBA;AACA;AACA;AAoBA;AACA;AACA;AAcA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAqFA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AA4IA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AAqBA;AACA;AACA;AAwBA;AACA;AACA;AAuBA;AACA;AACA;AAoBA;AACA;AACA;AAqBA;AACA;AACA;AAkBA;AACA;AACA;AAkBA;AACA;AACA;AAoBA;AACA;AACA;AAkBA;AACA;AACA;AAiBA;AACA;AACA;AAoBA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AACA;AACA;AAiDA;AACA;AACA;AACA;AAqCA;AACA;AACA;AACA;AA+CA;AACA;AACA;AACA;AAMA;AACA;AACA;AAaA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AA+CA;AACA;AACA;AACA;AACA;AAqDA;AACA;AACA;AACA;AACA;AA6NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IA6IYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["CONTENT_ENTRY_STATUS","exports"],"sources":["types.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\nimport { I18NContext, I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Context, GenericRecord } from \"@webiny/api/types\";\nimport { GraphQLFieldResolver, GraphQLRequestBody, Resolvers } from \"@webiny/handler-graphql/types\";\nimport { processRequestBody } from \"@webiny/handler-graphql\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\nimport { DbContext } from \"@webiny/handler-db/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection\";\nimport { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types\";\nimport { AccessControl } from \"~/crud/AccessControl/AccessControl\";\nimport { CmsModelToAstConverter } from \"~/utils/contentModelAst/CmsModelToAstConverter\";\nimport { CmsModelFieldToGraphQLPlugin } from \"./plugins\";\nimport { CmsEntryContext } from \"./context\";\nimport { CmsModelField, CmsModelFieldValidation, CmsModelUpdateInput } from \"./modelField\";\nimport { CmsModel, CmsModelCreateFromInput, CmsModelCreateInput } from \"./model\";\nimport { CmsGroup } from \"./modelGroup\";\nimport { CmsIdentity } from \"./identity\";\nimport { ISingletonModelManager } from \"~/modelManager\";\n\nexport interface CmsError {\n message: string;\n code: string;\n data: GenericRecord;\n stack?: string;\n}\n\nexport interface CmsError {\n message: string;\n code: string;\n data: GenericRecord;\n stack?: string;\n}\n\nexport type ApiEndpoint = \"manage\" | \"preview\" | \"read\";\n\nexport interface HeadlessCms\n extends CmsSystemContext,\n CmsGroupContext,\n CmsModelContext,\n CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\n /**\n * Requested locale\n */\n locale: string;\n /**\n * returns an instance of current locale\n */\n getLocale: () => I18NLocale;\n /**\n * Means this request is a READ API\n */\n READ: boolean;\n /**\n * Means this request is a MANAGE API\n */\n MANAGE: boolean;\n /**\n * Means this request is a PREVIEW API\n */\n PREVIEW: boolean;\n /**\n * The storage operations loaded for current context.\n */\n storageOperations: HeadlessCmsStorageOperations;\n\n /**\n * Use to ensure perform authorization and ensure identities have access to the groups, models and entries.\n */\n accessControl: AccessControl;\n\n /**\n * Export operations.\n */\n export: HeadlessCmsExport;\n importing: HeadlessCmsImport;\n getExecutableSchema: GetExecutableSchema;\n}\n\nexport type GetExecutableSchema = (\n type: ApiEndpoint\n) => Promise<\n <TData = Record<string, any>, TExtensions = Record<string, any>>(\n input: GraphQLRequestBody | GraphQLRequestBody[]\n ) => ReturnType<typeof processRequestBody<TData, TExtensions>>\n>;\n\n/**\n * @description This combines all contexts used in the CMS into a single one.\n *\n * @category Context\n */\nexport interface CmsContext extends Context, DbContext, I18NContext {\n cms: HeadlessCms;\n}\n\n/**\n * Used for our internal functionality.\n */\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\n/**\n * A definition for dateTime field to show possible type of the field in settings.\n */\nexport interface CmsModelDateTimeField extends CmsModelField {\n /**\n * Settings object for the field. Contains `type` property.\n */\n settings: {\n type: \"time\" | \"date\" | \"dateTimeWithoutTimezone\" | \"dateTimeWithTimezone\";\n };\n}\n\n/**\n * Arguments for the field validator validate method.\n *\n * @category ModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorValidateParams<T = any> {\n /**\n * A value to be validated.\n */\n value: T;\n /**\n * Options from the CmsModelField validations.\n *\n * @see CmsModelField.validation\n * @see CmsModelField.listValidation\n */\n validator: CmsModelFieldValidation;\n /**\n * An instance of the current context.\n */\n context: CmsContext;\n /**\n * Field being validated.\n */\n field: CmsModelField;\n /**\n * An instance of the content model being validated.\n */\n model: CmsModel;\n /**\n * If entry is sent it means it is an update operation.\n * First usage is for the unique field value.\n */\n entry?: CmsEntry;\n}\n\n/**\n * 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\nexport interface CmsModelFieldToGraphQLNormalizeInputParams<TField> {\n model: CmsModel;\n field: TField;\n input: GenericRecord<string> | Array<GenericRecord<string>>;\n}\n\ninterface CmsModelFieldToGraphQLCreateResolverParams<TField> {\n models: CmsModel[];\n model: CmsModel;\n graphQLType: string;\n field: TField;\n createFieldResolvers: any;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\nexport interface CmsModelFieldToGraphQLCreateResolver<TField = CmsModelField> {\n (params: CmsModelFieldToGraphQLCreateResolverParams<TField>):\n | GraphQLFieldResolver\n | {\n resolver: GraphQLFieldResolver | null;\n typeResolvers: Resolvers<CmsContext>;\n }\n | false;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams<\n TField extends CmsModelField = CmsModelField\n> {\n fields: TField[];\n originalFields: TField[];\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsValidate {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsValidateParams): void;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFieldsParams<\n TField extends CmsModelField = CmsModelField\n> {\n field: TField;\n originalField?: TField;\n validate: CmsModelFieldToGraphQLPluginValidateChildFieldsValidate;\n}\n\nexport interface CmsModelFieldToGraphQLPluginValidateChildFields<\n TField extends CmsModelField = CmsModelField\n> {\n (params: CmsModelFieldToGraphQLPluginValidateChildFieldsParams<TField>): void;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsFieldTypePlugins {\n [key: string]: CmsModelFieldToGraphQLPlugin;\n}\n\nexport interface OnSystemBeforeInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemAfterInstallTopicParams {\n tenant: string;\n locale: string;\n}\n\nexport interface OnSystemInstallErrorTopicParams {\n error: Error;\n tenant: string;\n locale: string;\n}\n\nexport type CmsSystemContext = {\n getSystemVersion: () => Promise<string | null>;\n setSystemVersion: (version: string) => Promise<void>;\n installSystem: () => Promise<void>;\n /**\n * Lifecycle Events\n */\n onSystemBeforeInstall: Topic<OnSystemBeforeInstallTopicParams>;\n onSystemAfterInstall: Topic<OnSystemAfterInstallTopicParams>;\n onSystemInstallError: Topic<OnSystemInstallErrorTopicParams>;\n};\n\n/**\n * A GraphQL `params.data` parameter received when creating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupCreateInput {\n id?: string;\n name: string;\n slug?: string;\n description?: string | null;\n icon: string;\n}\n\n/**\n * A GraphQL `params.data` parameter received when updating content model group.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupUpdateInput {\n name?: string;\n slug?: string;\n description?: string;\n icon?: string;\n}\n\n/**\n * A `data.where` parameter received when listing content model groups.\n *\n * @category CmsGroup\n * @category GraphQL params\n */\nexport interface CmsGroupListParams {\n where: {\n tenant: string;\n locale: string;\n };\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterCreateTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupCreateErrorTopicParams {\n input: CmsGroupCreateInput;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterUpdateTopicParams {\n original: CmsGroup;\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupUpdateErrorTopicParams {\n input: CmsGroupUpdateInput;\n original: CmsGroup;\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupBeforeDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupAfterDeleteTopicParams {\n group: CmsGroup;\n}\n\n/**\n * @category CmsGroup\n * @category Topic\n */\nexport interface OnGroupDeleteErrorTopicParams {\n group: CmsGroup;\n error: Error;\n}\n\n/**\n * Cms Group in context.\n *\n * @category Context\n * @category CmsGroup\n */\nexport interface CmsGroupContext {\n /**\n * Gets content model group by given id.\n */\n getGroup: (id: string) => Promise<CmsGroup>;\n /**\n * List all content model groups. Filterable via params.\n */\n listGroups: (params?: CmsGroupListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n createGroup: (data: CmsGroupCreateInput) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n updateGroup: (id: string, data: CmsGroupUpdateInput) => Promise<CmsGroup>;\n /**\n * Delete content model group by given id.\n */\n deleteGroup: (id: string) => Promise<boolean>;\n /**\n * Clear the cached groups.\n */\n clearGroupsCache: () => void;\n /**\n * Lifecycle Events\n */\n onGroupBeforeCreate: Topic<OnGroupBeforeCreateTopicParams>;\n onGroupAfterCreate: Topic<OnGroupAfterCreateTopicParams>;\n onGroupCreateError: Topic<OnGroupCreateErrorTopicParams>;\n onGroupBeforeUpdate: Topic<OnGroupBeforeUpdateTopicParams>;\n onGroupAfterUpdate: Topic<OnGroupAfterUpdateTopicParams>;\n onGroupUpdateError: Topic<OnGroupUpdateErrorTopicParams>;\n onGroupBeforeDelete: Topic<OnGroupBeforeDeleteTopicParams>;\n onGroupAfterDelete: Topic<OnGroupAfterDeleteTopicParams>;\n onGroupDeleteError: Topic<OnGroupDeleteErrorTopicParams>;\n}\n\n/**\n * 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<T = any>(context: CmsContext, model: CmsModel): Promise<CmsModelManager<T>>;\n}\n\n/**\n * A content entry values definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntryValues {\n [key: string]: any;\n}\n\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<T = CmsEntryValues> {\n /**\n * A version of the webiny this entry was created with.\n * This can be used when upgrading the system, so we know which entries to update.\n */\n webinyVersion: string;\n /**\n * Tenant id which is this entry for. Can be used in case of shared storage.\n */\n tenant: string;\n /**\n * Generated ID of the entry. It is shared across all the records in the database that represent a single entry.\n * So version 1, 2, ..., 2371 will have the same value in this field to link them together.\n */\n entryId: string;\n /**\n * Generated ID + version of the entry.\n */\n id: string;\n\n /**\n * Revision-level meta fields. 👇\n */\n\n /**\n * An ISO 8601 date/time string.\n */\n revisionCreatedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionSavedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n revisionModifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionDeletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionRestoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionFirstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n revisionLastPublishedOn: string | null;\n\n /**\n * Identity that last ionCreated the entry.\n */\n revisionCreatedBy: CmsIdentity;\n /**\n * Identity that last ionSaved the entry.\n */\n revisionSavedBy: CmsIdentity;\n /**\n * Identity that last ionModified the entry.\n */\n revisionModifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the revision.\n */\n revisionDeletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the revision.\n */\n revisionRestoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n revisionFirstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n revisionLastPublishedBy: CmsIdentity | null;\n\n /**\n * An ISO 8601 date/time string.\n */\n createdOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n savedOn: string;\n /**\n * An ISO 8601 date/time string.\n */\n modifiedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n deletedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n restoredOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n firstPublishedOn: string | null;\n /**\n * An ISO 8601 date/time string.\n */\n lastPublishedOn: string | null;\n\n /**\n * Identity that last created the entry.\n */\n createdBy: CmsIdentity;\n /**\n * Identity that last saved the entry.\n */\n savedBy: CmsIdentity;\n /**\n * Identity that last modified the entry.\n */\n modifiedBy: CmsIdentity | null;\n /**\n * Identity that last deleted the entry.\n */\n deletedBy: CmsIdentity | null;\n /**\n * Identity that last restored the entry.\n */\n restoredBy: CmsIdentity | null;\n /**\n * Identity that first published the entry.\n */\n firstPublishedBy: CmsIdentity | null;\n /**\n * Identity that last published the entry.\n */\n lastPublishedBy: CmsIdentity | null;\n\n /**\n * Deprecated fields. 👇\n */\n\n /**\n * @deprecated Will be removed with the 5.41.0 release. Use `createdBy` field instead.\n */\n ownedBy?: CmsIdentity | null;\n\n /**\n * @deprecated Will be removed with the 5.41.0 release. Use `firstPublishedOn` or `lastPublishedOn` field instead.\n */\n publishedOn?: string | null;\n\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 revision version of the entry.\n */\n version: number;\n /**\n * Is the entry locked?\n */\n locked: boolean;\n /**\n * Status type of the entry.\n */\n status: CmsEntryStatus;\n /**\n * A mapped storageId -> value object.\n *\n * @see CmsModelField\n */\n values: T;\n /**\n * Advanced Content Organization\n */\n location?: {\n folderId?: string | null;\n };\n /**\n * Settings for the given entry.\n *\n * Introduced with Advanced Publishing Workflow. Will always be inserted once this PR is merged.\n * Be aware that when accessing properties in it on old systems, it will break if not checked first.\n *\n * Available only on the Manage API in entry GraphQL type `meta.data` property.\n */\n meta?: {\n [key: string]: any;\n };\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean | null;\n /**\n * This field preserves the original folderId value, as the ROOT_FOLDER is set upon deletion.\n * The value is utilized when restoring the entry from the trash bin.\n */\n binOriginalFolderId?: string | null;\n}\n\nexport interface CmsStorageEntry extends CmsEntry {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\n}\n\n/**\n * A definition for content model manager to be used in the code.\n * The default one uses `CmsEntryContext` methods internally, but devs can change to what every they want.\n *\n * @see CmsEntryContext\n *\n * @category Context\n * @category CmsEntry\n * @category CmsModel\n */\nexport interface CmsModelManager<T = CmsEntryValues> {\n model: CmsModel;\n /**\n * List only published entries in the content model.\n */\n listPublished(params: CmsEntryListParams): Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * List latest entries in the content model. Used for administration.\n */\n listLatest(params: CmsEntryListParams): Promise<[CmsEntry<T>[], CmsEntryMeta]>;\n /**\n * Get a list of published entries by the ID list.\n */\n getPublishedByIds(ids: string[]): Promise<CmsEntry<T>[]>;\n /**\n * Get a list of the latest entries by the ID list.\n */\n getLatestByIds(ids: string[]): Promise<CmsEntry<T>[]>;\n /**\n * Get an entry filtered by given params. Will always get one.\n */\n get(id: string): Promise<CmsEntry<T>>;\n /**\n * Create an entry.\n */\n create<I>(\n data: CreateCmsEntryInput & I,\n options?: CreateCmsEntryOptionsInput\n ): Promise<CmsEntry<T>>;\n /**\n * Update an entry.\n */\n update(\n id: string,\n data: UpdateCmsEntryInput,\n options?: UpdateCmsEntryOptionsInput\n ): Promise<CmsEntry<T>>;\n /**\n * Delete an entry.\n */\n delete(id: string): Promise<void>;\n}\n\nexport type ICmsEntryManager<T = GenericRecord> = CmsModelManager<T>;\n\n/**\n * Create\n */\nexport interface OnModelBeforeCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\n\nexport interface OnModelAfterCreateTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n}\n\nexport interface OnModelCreateErrorTopicParams {\n input: CmsModelCreateInput;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Create From / Clone\n */\nexport interface OnModelBeforeCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelAfterCreateFromTopicParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelCreateFromErrorParams {\n input: CmsModelCreateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Update\n */\nexport interface OnModelBeforeUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelAfterUpdateTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n}\n\nexport interface OnModelUpdateErrorTopicParams {\n input: CmsModelUpdateInput;\n original: CmsModel;\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Delete\n */\nexport interface OnModelBeforeDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelAfterDeleteTopicParams {\n model: CmsModel;\n}\n\nexport interface OnModelDeleteErrorTopicParams {\n model: CmsModel;\n error: Error;\n}\n\n/**\n * Initialize\n */\nexport interface OnModelInitializeParams {\n model: CmsModel;\n data: Record<string, any>;\n}\n\n/**\n *\n */\nexport interface CmsModelUpdateDirectParams {\n model: CmsModel;\n original: CmsModel;\n}\n\nexport interface ICmsModelListParams {\n /**\n * Defaults to true.\n */\n includePrivate?: boolean;\n includePlugins?: boolean;\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 * @throws NotFoundError\n */\n getModel(modelId: string): Promise<CmsModel>;\n /**\n * Get model to AST converter.\n */\n getModelToAstConverter: () => CmsModelToAstConverter;\n /**\n * Get all content models.\n */\n listModels(params?: ICmsModelListParams): Promise<CmsModel[]>;\n /**\n * Create a content model.\n */\n createModel(data: CmsModelCreateInput): Promise<CmsModel>;\n /**\n * Create a content model from the given model - clone.\n */\n createModelFrom(modelId: string, data: CmsModelCreateFromInput): Promise<CmsModel>;\n /**\n * Update content model without data validation. Used internally.\n * @hidden\n */\n updateModelDirect(params: CmsModelUpdateDirectParams): Promise<CmsModel>;\n /**\n * Update content model.\n */\n updateModel(modelId: string, data: CmsModelUpdateInput): Promise<CmsModel>;\n /**\n * Delete content model. Should not allow deletion if there are entries connected to it.\n */\n deleteModel(modelId: string): Promise<void>;\n /**\n * Possibility for users to trigger the model initialization.\n * They can hook into it and do what ever they want to.\n *\n * Primary idea behind this is creating the index, for the code models, in the ES.\n */\n initializeModel(modelId: string, data: Record<string, any>): Promise<boolean>;\n /**\n * Get an instance of CmsModelManager for given content modelId.\n *\n * @see CmsModelManager\n */\n getEntryManager<T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel | string\n ): Promise<ICmsEntryManager<T>>;\n /**\n * A model manager for a model which has a single entry.\n */\n getSingletonEntryManager<T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel | string\n ): Promise<ISingletonModelManager<T>>;\n /**\n * Get all content model managers mapped by modelId.\n * @see CmsModelManager\n */\n getEntryManagers(): Map<string, ICmsEntryManager>;\n /**\n * Clear all the model caches.\n */\n clearModelsCache(): void;\n /**\n * Lifecycle Events\n */\n onModelBeforeCreate: Topic<OnModelBeforeCreateTopicParams>;\n onModelAfterCreate: Topic<OnModelAfterCreateTopicParams>;\n onModelCreateError: Topic<OnModelCreateErrorTopicParams>;\n onModelBeforeCreateFrom: Topic<OnModelBeforeCreateFromTopicParams>;\n onModelAfterCreateFrom: Topic<OnModelAfterCreateFromTopicParams>;\n onModelCreateFromError: Topic<OnModelCreateFromErrorParams>;\n onModelBeforeUpdate: Topic<OnModelBeforeUpdateTopicParams>;\n onModelAfterUpdate: Topic<OnModelAfterUpdateTopicParams>;\n onModelUpdateError: Topic<OnModelUpdateErrorTopicParams>;\n onModelBeforeDelete: Topic<OnModelBeforeDeleteTopicParams>;\n onModelAfterDelete: Topic<OnModelAfterDeleteTopicParams>;\n onModelDeleteError: Topic<OnModelDeleteErrorTopicParams>;\n onModelInitialize: Topic<OnModelInitializeParams>;\n}\n\n/**\n * Available statuses for content entry.\n *\n * @category CmsEntry\n */\nexport type CmsEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\nexport interface CmsEntryListWhereRef {\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n}\n\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Generated ID without the version.\n */\n entryId?: string;\n entryId_not?: string;\n entryId_in?: string[];\n entryId_not_in?: string[];\n /**\n * Status of the entry.\n */\n status?: CmsEntryStatus;\n status_not?: CmsEntryStatus;\n status_in?: CmsEntryStatus[];\n status_not_in?: CmsEntryStatus[];\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedBy?: string;\n revisionCreatedBy_not?: string;\n revisionCreatedBy_in?: string[];\n revisionCreatedBy_not_in?: string[];\n\n revisionModifiedBy?: string;\n revisionModifiedBy_not?: string;\n revisionModifiedBy_in?: string[];\n revisionModifiedBy_not_in?: string[];\n\n revisionSavedBy?: string;\n revisionSavedBy_not?: string;\n revisionSavedBy_in?: string[];\n revisionSavedBy_not_in?: string[];\n\n revisionFirstPublishedBy?: string;\n revisionFirstPublishedBy_not?: string;\n revisionFirstPublishedBy_in?: string[];\n revisionFirstPublishedBy_not_in?: string[];\n\n revisionLastPublishedBy?: string;\n revisionLastPublishedBy_not?: string;\n revisionLastPublishedBy_in?: string[];\n revisionLastPublishedBy_not_in?: string[];\n\n /**\n * Entry-level meta fields. 👇\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n\n modifiedBy?: string;\n modifiedBy_not?: string;\n modifiedBy_in?: string[];\n modifiedBy_not_in?: string[];\n\n savedBy?: string;\n savedBy_not?: string;\n savedBy_in?: string[];\n savedBy_not_in?: string[];\n\n firstPublishedBy?: string;\n firstPublishedBy_not?: string;\n firstPublishedBy_in?: string[];\n firstPublishedBy_not_in?: string[];\n\n lastPublishedBy?: string;\n lastPublishedBy_not?: string;\n lastPublishedBy_in?: string[];\n lastPublishedBy_not_in?: string[];\n\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n version?: number;\n version_lt?: number;\n version_gt?: number;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `published` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n published?: boolean;\n /**\n * Each storage operations implementation MUST determine how to use this field.\n * In SQL, it can be a `latest` field, and in DynamoDB it can be an SK.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n latest?: boolean;\n /**\n * ACO related parameters.\n */\n wbyAco_location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n AND?: CmsEntryListWhere[];\n OR?: CmsEntryListWhere[];\n };\n\n /**\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 | Date\n | undefined\n | string[]\n | number[]\n | null\n | CmsEntryListWhere[]\n | CmsEntryListWhere\n | CmsEntryListWhereRef;\n\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 CmsEntryListSortAsc = `${string}_ASC`;\nexport type CmsEntryListSortDesc = `${string}_DESC`;\nexport type CmsEntryListSort = (CmsEntryListSortAsc | CmsEntryListSortDesc)[];\n\n/**\n * Get entry GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n}\n\n/**\n * List entries GraphQL resolver params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\nexport interface CmsEntryListParams {\n where?: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit?: number;\n after?: string | null;\n}\n\n/**\n * Meta information for GraphQL output.\n *\n * @category CmsEntry\n * @category GraphQL output\n */\nexport interface CmsEntryMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\n/**\n * Create\n */\nexport interface OnEntryBeforeCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterCreateTopicParams {\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateErrorTopicParams {\n error: Error;\n input: CreateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Revision Create\n */\nexport interface OnEntryRevisionBeforeCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionAfterCreateTopicParams {\n input: CreateFromCmsEntryInput;\n entry: CmsEntry;\n original: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryCreateRevisionErrorTopicParams {\n error: Error;\n input: CreateFromCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Update\n */\nexport interface OnEntryBeforeUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterUpdateTopicParams {\n input: UpdateCmsEntryInput;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUpdateErrorTopicParams {\n error: Error;\n input: UpdateCmsEntryInput;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Move\n */\nexport interface OnEntryBeforeMoveTopicParams {\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterMoveTopicParams {\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryMoveErrorTopicParams {\n error: Error;\n folderId: string;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Publish\n */\nexport interface OnEntryBeforePublishTopicParams {\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterPublishTopicParams {\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryPublishErrorTopicParams {\n error: Error;\n original: CmsEntry;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Republish\n */\nexport interface OnEntryBeforeRepublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterRepublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryRepublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Unpublish\n */\nexport interface OnEntryBeforeUnpublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterUnpublishTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryUnpublishErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Delete\n */\nexport interface OnEntryBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n permanent: boolean;\n}\n\nexport interface OnEntryAfterDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n permanent: boolean;\n}\n\nexport interface OnEntryDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n permanent: boolean;\n model: CmsModel;\n}\n\n/**\n * Restore from bin\n */\nexport interface OnEntryBeforeRestoreFromBinTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryAfterRestoreFromBinTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n storageEntry: CmsEntry;\n}\n\nexport interface OnEntryRestoreFromBinErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Delete Revision\n */\nexport interface OnEntryRevisionBeforeDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionAfterDeleteTopicParams {\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport interface OnEntryRevisionDeleteErrorTopicParams {\n error: Error;\n entry: CmsEntry;\n model: CmsModel;\n}\n\n/**\n * Delete multiple\n */\nexport interface OnEntryBeforeDeleteMultipleTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n}\n\nexport interface OnEntryAfterDeleteMultipleTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n}\n\nexport interface OnEntryDeleteMultipleErrorTopicParams {\n model: CmsModel;\n entries: CmsEntry[];\n ids: string[];\n error: Error;\n}\n\n/**\n * Get\n */\nexport interface OnEntryBeforeGetTopicParams {\n model: CmsModel;\n where: CmsEntryListWhere;\n}\n\n/**\n * List\n */\nexport interface EntryBeforeListTopicParams {\n where: CmsEntryListWhere;\n model: CmsModel;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport type CreateCmsEntryInput<TValues = CmsEntryValues> = TValues & {\n id?: string;\n status?: CmsEntryStatus;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n createdBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n};\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date;\n revisionSavedOn?: Date;\n revisionModifiedOn?: Date;\n revisionCreatedBy?: CmsIdentity;\n revisionModifiedBy?: CmsIdentity;\n revisionSavedBy?: CmsIdentity;\n revisionFirstPublishedOn?: Date | string;\n revisionLastPublishedOn?: Date | string;\n revisionFirstPublishedBy?: CmsIdentity;\n revisionLastPublishedBy?: CmsIdentity;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date;\n savedOn?: Date;\n modifiedOn?: Date;\n createdBy?: CmsIdentity;\n modifiedBy?: CmsIdentity;\n savedBy?: CmsIdentity;\n firstPublishedOn?: Date | string;\n lastPublishedOn?: Date | string;\n firstPublishedBy?: CmsIdentity;\n lastPublishedBy?: CmsIdentity;\n\n [key: string]: any;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport type UpdateCmsEntryInput<TValues = CmsEntryValues> = TValues & {\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn?: Date | string | null;\n revisionModifiedOn?: Date | string | null;\n revisionSavedOn?: Date | string | null;\n revisionDeletedOn?: Date | string | null;\n revisionRestoredOn?: Date | string | null;\n revisionFirstPublishedOn?: Date | string | null;\n revisionLastPublishedOn?: Date | string | null;\n revisionModifiedBy?: CmsIdentity | null;\n revisionCreatedBy?: CmsIdentity | null;\n revisionSavedBy?: CmsIdentity | null;\n revisionDeletedBy?: CmsIdentity | null;\n revisionRestoredBy?: CmsIdentity | null;\n revisionFirstPublishedBy?: CmsIdentity | null;\n revisionLastPublishedBy?: CmsIdentity | null;\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn?: Date | string | null;\n modifiedOn?: Date | string | null;\n savedOn?: Date | string | null;\n deletedOn?: Date | string | null;\n restoredOn?: Date | string | null;\n firstPublishedOn?: Date | string | null;\n lastPublishedOn?: Date | string | null;\n createdBy?: CmsIdentity | null;\n modifiedBy?: CmsIdentity | null;\n savedBy?: CmsIdentity | null;\n deletedBy?: CmsIdentity | null;\n restoredBy?: CmsIdentity | null;\n firstPublishedBy?: CmsIdentity | null;\n lastPublishedBy?: CmsIdentity | null;\n\n wbyAco_location?: {\n folderId?: string | null;\n };\n};\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface GetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\n/**\n * @category CmsEntry\n */\nexport interface CmsDeleteEntryOptions {\n /**\n * Runs the delete commands even if the entry is not found in the DynamoDB.\n * This is to force clean the entry records that might have been left behind a failed delete.\n */\n force?: boolean;\n /**\n * Destroying the entry directly, without moving it to the bin.\n */\n permanently?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface DeleteMultipleEntriesParams {\n entries: string[];\n}\n\nexport type DeleteMultipleEntriesResponse = {\n id: string;\n}[];\n\nexport interface CmsEntryValidateResponse {\n [key: string]: any;\n}\n\n/**\n * Parameters for CmsEntryResolverFactory.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\ninterface CmsEntryResolverFactoryParams {\n model: CmsModel;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\n/**\n * A type for EntryResolvers. Used when creating get, list, update, publish, ...etc.\n *\n * @category GraphQL resolver\n * @category CmsEntry\n */\nexport type CmsEntryResolverFactory<TSource = any, TArgs = any, TContext = CmsContext> = {\n (params: CmsEntryResolverFactoryParams): GraphQLFieldResolver<TSource, TArgs, TContext>;\n};\n\n/**\n * A base security permission for CMS.\n *\n * @category SecurityPermission\n */\nexport interface BaseCmsSecurityPermission extends SecurityPermission {\n own?: boolean;\n rwd: string;\n}\n\n/**\n * A security permission for content model.\n *\n * @category SecurityPermission\n * @category CmsModel\n */\nexport interface CmsModelPermission extends BaseCmsSecurityPermission {\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content model groups.\n *\n * @category SecurityPermission\n * @category CmsGroup\n */\nexport interface CmsGroupPermission extends BaseCmsSecurityPermission {\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\n/**\n * The security permission for content entry.\n *\n * @category SecurityPermission\n * @category CmsEntry\n */\nexport interface CmsEntryPermission extends BaseCmsSecurityPermission {\n pw?: string;\n /**\n * An object representing `key: model.modelId` values where key is locale code.\n */\n models?: {\n [key: string]: string[];\n };\n /**\n * {locale: groupId[]} map, where key is a locale code.\n */\n groups?: {\n [key: string]: string[];\n };\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n locale: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n\n [key: string]: any;\n}\n\nexport interface CmsGroupStorageOperationsListParams {\n where: CmsGroupStorageOperationsListWhereParams;\n sort?: string[];\n}\n\nexport interface CmsGroupStorageOperationsCreateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsUpdateParams {\n group: CmsGroup;\n}\n\nexport interface CmsGroupStorageOperationsDeleteParams {\n group: CmsGroup;\n}\n\n/**\n * Description of the CmsGroup CRUD operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsGroupStorageOperations {\n /**\n * Gets content model group by given id.\n */\n get: (params: CmsGroupStorageOperationsGetParams) => Promise<CmsGroup | null>;\n /**\n * List all content model groups. Filterable via params.\n */\n list: (params: CmsGroupStorageOperationsListParams) => Promise<CmsGroup[]>;\n /**\n * Create a new content model group.\n */\n create: (params: CmsGroupStorageOperationsCreateParams) => Promise<CmsGroup>;\n /**\n * Update existing content model group.\n */\n update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<CmsGroup>;\n /**\n * Delete the content model group.\n */\n delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<CmsGroup>;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n locale: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n locale: string;\n\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: CmsModel;\n}\n\nexport interface CmsModelStorageOperationsDeleteParams {\n model: CmsModel;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n */\nexport interface CmsModelStorageOperations {\n /**\n * Gets content model by given id.\n */\n get: (params: CmsModelStorageOperationsGetParams) => Promise<CmsModel | null>;\n /**\n * List all content models. Filterable via params.\n */\n list: (params: CmsModelStorageOperationsListParams) => Promise<CmsModel[]>;\n /**\n * Create a new content model.\n */\n create: (params: CmsModelStorageOperationsCreateParams) => Promise<CmsModel>;\n /**\n * Update existing content model.\n */\n update: (params: CmsModelStorageOperationsUpdateParams) => Promise<CmsModel>;\n /**\n * Delete the content model.\n */\n delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<CmsModel>;\n}\n\nexport interface CmsEntryStorageOperationsGetParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n}\n\nexport interface CmsEntryStorageOperationsListParams {\n where: CmsEntryListWhere;\n sort?: CmsEntryListSort;\n search?: string;\n fields?: string[];\n limit: number;\n after?: string | null;\n}\n\nexport interface CmsEntryStorageOperationsCreateParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: T;\n /**\n * Entry that was set as latest.\n */\n latestEntry: CmsEntry | null;\n /**\n * Entry that was set as latest, directly from storage, with transformations.\n */\n latestStorageEntry: T | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams {\n entry: CmsEntry;\n}\n\nexport interface CmsEntryStorageOperationsMoveToBinParams<\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 CmsEntryStorageOperationsRestoreFromBinParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as restored.\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 CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: T;\n}\n\nexport interface CmsEntryStorageOperationsGetUniqueFieldValuesParams {\n where: CmsEntryListWhere;\n fieldId: string;\n}\n\nexport interface CmsEntryStorageOperationsGetByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetLatestByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedByIdsParams {\n ids: readonly string[];\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionsParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPublishedRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetLatestRevisionParams {\n id: string;\n}\n\nexport interface CmsEntryStorageOperationsGetPreviousRevisionParams {\n entryId: string;\n version: number;\n}\n\nexport interface CmsEntryStorageOperationsListResponse<\n T extends CmsStorageEntry = CmsStorageEntry\n> {\n /**\n * Has more items to load with the current filtering?\n */\n hasMoreItems: boolean;\n /**\n * Items loaded with current filtering.\n */\n items: T[];\n /**\n * Pointer for where to start the new item set.\n */\n cursor: string | null;\n /**\n * Total amount of items with the current filter.\n */\n totalCount: number;\n}\n\n/**\n * Description of the CmsModel storage operations.\n * If user wants to add another database to the application, this is how it is done.\n * This is just plain read, update, write, delete and list - no authentication or permission checks.\n *\n *\n * @category StorageOperations\n * @category CmsEntry\n */\nexport interface CmsEntryStorageOperations<T extends CmsStorageEntry = CmsStorageEntry> {\n /**\n * Get all the entries of the ids.\n */\n getByIds: (model: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams) => Promise<T[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<T[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<T[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<T | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<T | null>;\n /**\n * Gets entry by given params.\n */\n get: (model: CmsModel, params: CmsEntryStorageOperationsGetParams) => Promise<T | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: (\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<T>>;\n /**\n * Create a new entry.\n */\n create: (model: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>) => Promise<T>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: (\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<T>;\n /**\n * Update existing entry.\n */\n update: (model: CmsModel, params: CmsEntryStorageOperationsUpdateParams<T>) => Promise<T>;\n /**\n * Move entry and all its entries into a new folder.\n */\n move: (model: CmsModel, id: string, folderId: string) => Promise<void>;\n /**\n * Delete the entry revision.\n */\n deleteRevision: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ) => Promise<void>;\n /**\n * Delete the entry.\n */\n delete: (model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Move the entry to bin.\n */\n moveToBin: (model: CmsModel, params: CmsEntryStorageOperationsMoveToBinParams) => Promise<void>;\n /**\n * Restore the entry from the bin.\n */\n restoreFromBin: (\n model: CmsModel,\n params: CmsEntryStorageOperationsRestoreFromBinParams<T>\n ) => Promise<T>;\n /**\n * Delete multiple entries, with a limit on how much can be deleted in one call.\n */\n deleteMultipleEntries: (\n model: CmsModel,\n params: CmsEntryStorageOperationsDeleteEntriesParams\n ) => Promise<void>;\n /**\n * Publish the entry.\n */\n publish: (model: CmsModel, params: CmsEntryStorageOperationsPublishParams<T>) => Promise<T>;\n /**\n * Unpublish the entry.\n */\n unpublish: (model: CmsModel, params: CmsEntryStorageOperationsUnpublishParams<T>) => Promise<T>;\n /**\n * Method to list all the unique values for the given field id.\n * Simplest use case would be to aggregate tags for some content.\n * @internal\n */\n getUniqueFieldValues: (\n model: CmsModel,\n params: CmsEntryStorageOperationsGetUniqueFieldValuesParams\n ) => Promise<CmsEntryUniqueValue[]>;\n}\n\nexport enum CONTENT_ENTRY_STATUS {\n DRAFT = \"draft\",\n PUBLISHED = \"published\",\n UNPUBLISHED = \"unpublished\"\n}\n\nexport interface CmsSystem {\n version?: string;\n readAPIKey?: string;\n /**\n * System tenant.\n */\n tenant: string;\n}\n\nexport interface CmsSystemStorageOperationsGetParams {\n tenant: string;\n}\n\nexport interface CmsSystemStorageOperationsCreateParams {\n system: CmsSystem;\n}\n\nexport interface CmsSystemStorageOperationsUpdateParams {\n system: CmsSystem;\n}\n\nexport interface CmsSystemStorageOperations {\n /**\n * Get the system data.\n */\n get: (params: CmsSystemStorageOperationsGetParams) => Promise<CmsSystem | null>;\n /**\n * Create the system info in the storage.\n */\n create: (params: CmsSystemStorageOperationsCreateParams) => Promise<CmsSystem>;\n /**\n * Update the system info in the storage.\n */\n update: (params: CmsSystemStorageOperationsUpdateParams) => Promise<CmsSystem>;\n}\n\nexport interface HeadlessCmsStorageOperations<C = CmsContext> {\n name: string;\n system: CmsSystemStorageOperations;\n groups: CmsGroupStorageOperations;\n models: CmsModelStorageOperations;\n entries: CmsEntryStorageOperations;\n /**\n * Either attach something from the storage operations or run something in it.\n */\n beforeInit: (context: C) => Promise<void>;\n init?: (context: C) => Promise<void>;\n}\n"],"mappings":";;;;;;AA2FA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgCA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AAwDA;AACA;AACA;AAiCA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAwCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AA4NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA8CA;AACA;AACA;AAiBA;AACA;AACA;AAoBA;AACA;AACA;AAoBA;AACA;AACA;AAcA;AACA;AACA;AAMA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AAqFA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AA4IA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AAqBA;AACA;AACA;AAwBA;AACA;AACA;AAuBA;AACA;AACA;AAoBA;AACA;AACA;AAqBA;AACA;AACA;AAkBA;AACA;AACA;AAkBA;AACA;AACA;AAoBA;AACA;AACA;AAkBA;AACA;AACA;AAiBA;AACA;AACA;AAoBA;AACA;AACA;AAMA;AACA;AACA;AAMA;AACA;AACA;AACA;AAiDA;AACA;AACA;AACA;AAqCA;AACA;AACA;AACA;AA+CA;AACA;AACA;AACA;AAMA;AACA;AACA;AAaA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AA+CA;AACA;AACA;AACA;AACA;AAqDA;AACA;AACA;AACA;AACA;AA6NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IA6IYA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA","ignoreList":[]}
@@ -1,2 +1,5 @@
1
1
  import { ICache } from "./types";
2
- export declare const createMemoryCache: <T>() => ICache<T>;
2
+ export interface ICacheParams {
3
+ id?: string;
4
+ }
5
+ export declare const createMemoryCache: <T>(params?: ICacheParams) => ICache<T>;
@@ -6,11 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.createMemoryCache = void 0;
7
7
  class Cache {
8
8
  _cache = new Map();
9
- constructor() {
10
- // Prevent direct instantiation.
11
- }
12
- static create() {
13
- return new this();
9
+ constructor(params) {
10
+ this.id = params?.id;
14
11
  }
15
12
  get(cacheKey) {
16
13
  const key = cacheKey.get();
@@ -43,8 +40,8 @@ class Cache {
43
40
  this._cache.delete(cacheKey.get());
44
41
  }
45
42
  }
46
- const createMemoryCache = () => {
47
- return Cache.create();
43
+ const createMemoryCache = params => {
44
+ return new Cache(params);
48
45
  };
49
46
  exports.createMemoryCache = createMemoryCache;
50
47
 
@@ -1 +1 @@
1
- {"version":3,"names":["Cache","_cache","Map","constructor","create","get","cacheKey","key","value","set","getOrSet","cb","existing","clear","Array","isArray","delete","createMemoryCache","exports"],"sources":["Cache.ts"],"sourcesContent":["import { ICache, ICacheKey } from \"./types\";\n\nclass Cache<T> implements ICache {\n private _cache: Map<string, T> = new Map();\n\n protected constructor() {\n // Prevent direct instantiation.\n }\n\n public static create<R>() {\n return new this<R>();\n }\n\n public get(cacheKey: ICacheKey): T | null {\n const key = cacheKey.get();\n const value = this._cache.get(key);\n return value || null;\n }\n\n public set(cacheKey: ICacheKey, value: T): T {\n const key = cacheKey.get();\n this._cache.set(key, value);\n return value;\n }\n\n public getOrSet(cacheKey: ICacheKey, cb: () => T): T {\n const existing = this.get(cacheKey);\n if (existing) {\n return existing;\n }\n const value = cb();\n return this.set(cacheKey, value);\n }\n\n public clear(cacheKey?: ICacheKey | ICacheKey[]) {\n if (!cacheKey) {\n this._cache.clear();\n return;\n } else if (Array.isArray(cacheKey)) {\n for (const key of cacheKey) {\n this._cache.delete(key.get());\n }\n return;\n }\n\n this._cache.delete(cacheKey.get());\n }\n}\n\nexport const createMemoryCache = <T>(): ICache<T> => {\n return Cache.create<T>();\n};\n"],"mappings":";;;;;;AAEA,MAAMA,KAAK,CAAsB;EACrBC,MAAM,GAAmB,IAAIC,GAAG,CAAC,CAAC;EAEhCC,WAAWA,CAAA,EAAG;IACpB;EAAA;EAGJ,OAAcC,MAAMA,CAAA,EAAM;IACtB,OAAO,IAAI,IAAI,CAAI,CAAC;EACxB;EAEOC,GAAGA,CAACC,QAAmB,EAAY;IACtC,MAAMC,GAAG,GAAGD,QAAQ,CAACD,GAAG,CAAC,CAAC;IAC1B,MAAMG,KAAK,GAAG,IAAI,CAACP,MAAM,CAACI,GAAG,CAACE,GAAG,CAAC;IAClC,OAAOC,KAAK,IAAI,IAAI;EACxB;EAEOC,GAAGA,CAACH,QAAmB,EAAEE,KAAQ,EAAK;IACzC,MAAMD,GAAG,GAAGD,QAAQ,CAACD,GAAG,CAAC,CAAC;IAC1B,IAAI,CAACJ,MAAM,CAACQ,GAAG,CAACF,GAAG,EAAEC,KAAK,CAAC;IAC3B,OAAOA,KAAK;EAChB;EAEOE,QAAQA,CAACJ,QAAmB,EAAEK,EAAW,EAAK;IACjD,MAAMC,QAAQ,GAAG,IAAI,CAACP,GAAG,CAACC,QAAQ,CAAC;IACnC,IAAIM,QAAQ,EAAE;MACV,OAAOA,QAAQ;IACnB;IACA,MAAMJ,KAAK,GAAGG,EAAE,CAAC,CAAC;IAClB,OAAO,IAAI,CAACF,GAAG,CAACH,QAAQ,EAAEE,KAAK,CAAC;EACpC;EAEOK,KAAKA,CAACP,QAAkC,EAAE;IAC7C,IAAI,CAACA,QAAQ,EAAE;MACX,IAAI,CAACL,MAAM,CAACY,KAAK,CAAC,CAAC;MACnB;IACJ,CAAC,MAAM,IAAIC,KAAK,CAACC,OAAO,CAACT,QAAQ,CAAC,EAAE;MAChC,KAAK,MAAMC,GAAG,IAAID,QAAQ,EAAE;QACxB,IAAI,CAACL,MAAM,CAACe,MAAM,CAACT,GAAG,CAACF,GAAG,CAAC,CAAC,CAAC;MACjC;MACA;IACJ;IAEA,IAAI,CAACJ,MAAM,CAACe,MAAM,CAACV,QAAQ,CAACD,GAAG,CAAC,CAAC,CAAC;EACtC;AACJ;AAEO,MAAMY,iBAAiB,GAAGA,CAAA,KAAoB;EACjD,OAAOjB,KAAK,CAACI,MAAM,CAAI,CAAC;AAC5B,CAAC;AAACc,OAAA,CAAAD,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"names":["Cache","_cache","Map","constructor","params","id","get","cacheKey","key","value","set","getOrSet","cb","existing","clear","Array","isArray","delete","createMemoryCache","exports"],"sources":["Cache.ts"],"sourcesContent":["import { ICache, ICacheKey } from \"./types\";\n\nexport interface ICacheParams {\n id?: string;\n}\n\nclass Cache<T> implements ICache {\n public readonly id: string | undefined;\n private readonly _cache: Map<string, T> = new Map();\n\n public constructor(params?: ICacheParams) {\n this.id = params?.id;\n }\n\n public get(cacheKey: ICacheKey): T | null {\n const key = cacheKey.get();\n const value = this._cache.get(key);\n return value || null;\n }\n\n public set(cacheKey: ICacheKey, value: T): T {\n const key = cacheKey.get();\n this._cache.set(key, value);\n return value;\n }\n\n public getOrSet(cacheKey: ICacheKey, cb: () => T): T {\n const existing = this.get(cacheKey);\n if (existing) {\n return existing;\n }\n const value = cb();\n return this.set(cacheKey, value);\n }\n\n public clear(cacheKey?: ICacheKey | ICacheKey[]) {\n if (!cacheKey) {\n this._cache.clear();\n return;\n } else if (Array.isArray(cacheKey)) {\n for (const key of cacheKey) {\n this._cache.delete(key.get());\n }\n return;\n }\n\n this._cache.delete(cacheKey.get());\n }\n}\n\nexport const createMemoryCache = <T>(params?: ICacheParams): ICache<T> => {\n return new Cache<T>(params);\n};\n"],"mappings":";;;;;;AAMA,MAAMA,KAAK,CAAsB;EAEZC,MAAM,GAAmB,IAAIC,GAAG,CAAC,CAAC;EAE5CC,WAAWA,CAACC,MAAqB,EAAE;IACtC,IAAI,CAACC,EAAE,GAAGD,MAAM,EAAEC,EAAE;EACxB;EAEOC,GAAGA,CAACC,QAAmB,EAAY;IACtC,MAAMC,GAAG,GAAGD,QAAQ,CAACD,GAAG,CAAC,CAAC;IAC1B,MAAMG,KAAK,GAAG,IAAI,CAACR,MAAM,CAACK,GAAG,CAACE,GAAG,CAAC;IAClC,OAAOC,KAAK,IAAI,IAAI;EACxB;EAEOC,GAAGA,CAACH,QAAmB,EAAEE,KAAQ,EAAK;IACzC,MAAMD,GAAG,GAAGD,QAAQ,CAACD,GAAG,CAAC,CAAC;IAC1B,IAAI,CAACL,MAAM,CAACS,GAAG,CAACF,GAAG,EAAEC,KAAK,CAAC;IAC3B,OAAOA,KAAK;EAChB;EAEOE,QAAQA,CAACJ,QAAmB,EAAEK,EAAW,EAAK;IACjD,MAAMC,QAAQ,GAAG,IAAI,CAACP,GAAG,CAACC,QAAQ,CAAC;IACnC,IAAIM,QAAQ,EAAE;MACV,OAAOA,QAAQ;IACnB;IACA,MAAMJ,KAAK,GAAGG,EAAE,CAAC,CAAC;IAClB,OAAO,IAAI,CAACF,GAAG,CAACH,QAAQ,EAAEE,KAAK,CAAC;EACpC;EAEOK,KAAKA,CAACP,QAAkC,EAAE;IAC7C,IAAI,CAACA,QAAQ,EAAE;MACX,IAAI,CAACN,MAAM,CAACa,KAAK,CAAC,CAAC;MACnB;IACJ,CAAC,MAAM,IAAIC,KAAK,CAACC,OAAO,CAACT,QAAQ,CAAC,EAAE;MAChC,KAAK,MAAMC,GAAG,IAAID,QAAQ,EAAE;QACxB,IAAI,CAACN,MAAM,CAACgB,MAAM,CAACT,GAAG,CAACF,GAAG,CAAC,CAAC,CAAC;MACjC;MACA;IACJ;IAEA,IAAI,CAACL,MAAM,CAACgB,MAAM,CAACV,QAAQ,CAACD,GAAG,CAAC,CAAC,CAAC;EACtC;AACJ;AAEO,MAAMY,iBAAiB,GAAOd,MAAqB,IAAgB;EACtE,OAAO,IAAIJ,KAAK,CAAII,MAAM,CAAC;AAC/B,CAAC;AAACe,OAAA,CAAAD,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -5,6 +5,7 @@ export interface ICacheKey {
5
5
  keys: ICacheKeyKeys;
6
6
  }
7
7
  export interface ICache<T = any> {
8
+ id: string | undefined;
8
9
  get(cacheKey: ICacheKey): T | null;
9
10
  set(cacheKey: ICacheKey, value: T): T;
10
11
  getOrSet(cacheKey: ICacheKey, cb: () => T): T;
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require"],"sources":["types.ts"],"sourcesContent":["import { ICacheKeyKeys } from \"@webiny/utils\";\n\nexport { ICacheKeyKeys };\n\nexport interface ICacheKey {\n get(): string;\n keys: ICacheKeyKeys;\n}\n\nexport interface ICache<T = any> {\n get(cacheKey: ICacheKey): T | null;\n set(cacheKey: ICacheKey, value: T): T;\n getOrSet(cacheKey: ICacheKey, cb: () => T): T;\n clear(cacheKey?: ICacheKey | ICacheKey[]): void;\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_utils","require"],"sources":["types.ts"],"sourcesContent":["import { ICacheKeyKeys } from \"@webiny/utils\";\n\nexport { ICacheKeyKeys };\n\nexport interface ICacheKey {\n get(): string;\n keys: ICacheKeyKeys;\n}\n\nexport interface ICache<T = any> {\n id: string | undefined;\n get(cacheKey: ICacheKey): T | null;\n set(cacheKey: ICacheKey, value: T): T;\n getOrSet(cacheKey: ICacheKey, cb: () => T): T;\n clear(cacheKey?: ICacheKey | ICacheKey[]): void;\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","Converter","converters","undefined","constructor","config","type","plugin","setConverterCollection","WebinyError","getConverterCollection","getType","convertToStorage","params","field","value","converterCollection","convertFromStorage","exports"],"sources":["Converter.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryValues, CmsModelField } from \"~/types\";\nimport { CmsModelFieldConverterPlugin } from \"~/plugins\";\nimport { ConverterCollection } from \"./ConverterCollection\";\n\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\ninterface ConverterConvertParams {\n field: CmsModelFieldWithParent;\n value: any;\n parent?: CmsModelFieldWithParent | null;\n}\nexport interface ConverterConfig {\n type: string;\n plugin: CmsModelFieldConverterPlugin;\n}\nexport class Converter {\n private readonly type: string;\n private readonly plugin: CmsModelFieldConverterPlugin;\n\n private converters: ConverterCollection | undefined = undefined;\n\n public constructor(config: ConverterConfig) {\n this.type = config.type;\n this.plugin = config.plugin;\n }\n\n public setConverterCollection(converters: ConverterCollection): void {\n if (this.converters) {\n throw new WebinyError(\n `Cannot attach converters collection more than once to Converter with type \"${this.type}\".`,\n \"CONVERTER_COLLECTION_ERROR\",\n {\n type: this.type\n }\n );\n }\n this.converters = converters;\n }\n\n public getConverterCollection(): ConverterCollection {\n if (!this.converters) {\n throw new WebinyError(\n `There is no ConverterCollection defined in the converter with type \"${this.type}\".`\n );\n }\n return this.converters;\n }\n\n public getType(): string {\n return this.type;\n }\n\n public convertToStorage(params: ConverterConvertParams): CmsEntryValues {\n const { field, value } = params;\n\n return this.plugin.convertToStorage({\n field,\n value,\n converterCollection: this.getConverterCollection()\n });\n }\n\n public convertFromStorage(params: ConverterConvertParams): CmsEntryValues {\n const { field, value } = params;\n\n return this.plugin.convertFromStorage({\n field,\n value,\n converterCollection: this.getConverterCollection()\n });\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAkBO,MAAMC,SAAS,CAAC;EAIXC,UAAU,GAAoCC,SAAS;EAExDC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC/B;EAEOC,sBAAsBA,CAACN,UAA+B,EAAQ;IACjE,IAAI,IAAI,CAACA,UAAU,EAAE;MACjB,MAAM,IAAIO,cAAW,CAChB,8EAA6E,IAAI,CAACH,IAAK,IAAG,EAC3F,4BAA4B,EAC5B;QACIA,IAAI,EAAE,IAAI,CAACA;MACf,CACJ,CAAC;IACL;IACA,IAAI,CAACJ,UAAU,GAAGA,UAAU;EAChC;EAEOQ,sBAAsBA,CAAA,EAAwB;IACjD,IAAI,CAAC,IAAI,CAACR,UAAU,EAAE;MAClB,MAAM,IAAIO,cAAW,CAChB,uEAAsE,IAAI,CAACH,IAAK,IACrF,CAAC;IACL;IACA,OAAO,IAAI,CAACJ,UAAU;EAC1B;EAEOS,OAAOA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACL,IAAI;EACpB;EAEOM,gBAAgBA,CAACC,MAA8B,EAAkB;IACpE,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGF,MAAM;IAE/B,OAAO,IAAI,CAACN,MAAM,CAACK,gBAAgB,CAAC;MAChCE,KAAK;MACLC,KAAK;MACLC,mBAAmB,EAAE,IAAI,CAACN,sBAAsB,CAAC;IACrD,CAAC,CAAC;EACN;EAEOO,kBAAkBA,CAACJ,MAA8B,EAAkB;IACtE,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGF,MAAM;IAE/B,OAAO,IAAI,CAACN,MAAM,CAACU,kBAAkB,CAAC;MAClCH,KAAK;MACLC,KAAK;MACLC,mBAAmB,EAAE,IAAI,CAACN,sBAAsB,CAAC;IACrD,CAAC,CAAC;EACN;AACJ;AAACQ,OAAA,CAAAjB,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","Converter","converters","undefined","constructor","config","type","plugin","setConverterCollection","WebinyError","getConverterCollection","getType","convertToStorage","params","field","value","converterCollection","convertFromStorage","exports"],"sources":["Converter.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryValues, CmsModelField } from \"~/types\";\nimport { CmsModelFieldConverterPlugin } from \"~/plugins\";\nimport { ConverterCollection } from \"./ConverterCollection\";\n\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\ninterface ConverterConvertParams {\n field: CmsModelFieldWithParent;\n value: any;\n parent?: CmsModelFieldWithParent | null;\n}\nexport interface ConverterConfig {\n type: string;\n plugin: CmsModelFieldConverterPlugin;\n}\nexport class Converter {\n private readonly type: string;\n private readonly plugin: CmsModelFieldConverterPlugin;\n\n private converters: ConverterCollection | undefined = undefined;\n\n public constructor(config: ConverterConfig) {\n this.type = config.type;\n this.plugin = config.plugin;\n }\n\n public setConverterCollection(converters: ConverterCollection): void {\n if (this.converters) {\n throw new WebinyError(\n `Cannot attach converters collection more than once to Converter with type \"${this.type}\".`,\n \"CONVERTER_COLLECTION_ERROR\",\n {\n type: this.type\n }\n );\n }\n this.converters = converters;\n }\n\n public getConverterCollection(): ConverterCollection {\n if (!this.converters) {\n throw new WebinyError(\n `There is no ConverterCollection defined in the converter with type \"${this.type}\".`\n );\n }\n return this.converters;\n }\n\n public getType(): string {\n return this.type;\n }\n\n public convertToStorage(params: ConverterConvertParams): CmsEntryValues {\n const { field, value } = params;\n\n return this.plugin.convertToStorage({\n field,\n value,\n converterCollection: this.getConverterCollection()\n });\n }\n\n public convertFromStorage(params: ConverterConvertParams): CmsEntryValues {\n const { field, value } = params;\n\n return this.plugin.convertFromStorage({\n field,\n value,\n converterCollection: this.getConverterCollection()\n });\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAkBO,MAAMC,SAAS,CAAC;EAIXC,UAAU,GAAoCC,SAAS;EAExDC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC/B;EAEOC,sBAAsBA,CAACN,UAA+B,EAAQ;IACjE,IAAI,IAAI,CAACA,UAAU,EAAE;MACjB,MAAM,IAAIO,cAAW,CACjB,8EAA8E,IAAI,CAACH,IAAI,IAAI,EAC3F,4BAA4B,EAC5B;QACIA,IAAI,EAAE,IAAI,CAACA;MACf,CACJ,CAAC;IACL;IACA,IAAI,CAACJ,UAAU,GAAGA,UAAU;EAChC;EAEOQ,sBAAsBA,CAAA,EAAwB;IACjD,IAAI,CAAC,IAAI,CAACR,UAAU,EAAE;MAClB,MAAM,IAAIO,cAAW,CACjB,uEAAuE,IAAI,CAACH,IAAI,IACpF,CAAC;IACL;IACA,OAAO,IAAI,CAACJ,UAAU;EAC1B;EAEOS,OAAOA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACL,IAAI;EACpB;EAEOM,gBAAgBA,CAACC,MAA8B,EAAkB;IACpE,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGF,MAAM;IAE/B,OAAO,IAAI,CAACN,MAAM,CAACK,gBAAgB,CAAC;MAChCE,KAAK;MACLC,KAAK;MACLC,mBAAmB,EAAE,IAAI,CAACN,sBAAsB,CAAC;IACrD,CAAC,CAAC;EACN;EAEOO,kBAAkBA,CAACJ,MAA8B,EAAkB;IACtE,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGF,MAAM;IAE/B,OAAO,IAAI,CAACN,MAAM,CAACU,kBAAkB,CAAC;MAClCH,KAAK;MACLC,KAAK;MACLC,mBAAmB,EAAE,IAAI,CAACN,sBAAsB,CAAC;IACrD,CAAC,CAAC;EACN;AACJ;AAACQ,OAAA,CAAAjB,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_Converter","_plugins","_getBaseFieldType","ConverterCollection","converters","Map","constructor","params","plugins","fieldGraphQLPlugins","byType","fieldConverterPlugins","CmsModelFieldConverterPlugin","type","defaultFieldConverterPlugin","find","pl","getFieldType","undefined","WebinyError","fieldGraphQLPlugin","plugin","fieldType","converter","Converter","addConverter","setConverterCollection","set","getType","getConverter","get","convertToStorage","fields","values","inputValues","attachHasOwnProperty","reduce","output","field","baseType","getBaseFieldType","hasOwnProperty","fieldId","value","convertFromStorage","storageId","Array","isArray","Object","defineProperty","enumerable","writable","property","exports"],"sources":["ConverterCollection.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Converter } from \"./Converter\";\nimport { CmsEntryValues, CmsModelField, CmsModelFieldToGraphQLPlugin } from \"~/types\";\nimport { CmsModelFieldConverterPlugin } from \"~/plugins\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\nexport interface CmsModelFieldsWithParent extends CmsModelField {\n parent?: CmsModelField | null;\n}\n\nexport interface CmsModelConverterCallable {\n (params: ConverterCollectionConvertParams): CmsEntryValues;\n}\n\nexport interface ConverterCollectionConvertParams {\n fields: CmsModelFieldsWithParent[];\n values?: CmsEntryValues;\n}\n\nexport interface ConverterCollectionParams {\n plugins: PluginsContainer;\n}\n\nexport class ConverterCollection {\n private readonly converters: Map<string, Converter> = new Map();\n\n public constructor(params: ConverterCollectionParams) {\n const { plugins } = params;\n const fieldGraphQLPlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n const fieldConverterPlugins = plugins.byType<CmsModelFieldConverterPlugin>(\n CmsModelFieldConverterPlugin.type\n );\n const defaultFieldConverterPlugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === \"*\"\n );\n if (defaultFieldConverterPlugin === undefined) {\n throw new WebinyError(\n `Missing default field converter plugin.`,\n \"DEFAULT_FIELD_CONVERTER_ERROR\"\n );\n }\n for (const fieldGraphQLPlugin of fieldGraphQLPlugins) {\n const plugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === fieldGraphQLPlugin.fieldType\n );\n const converter = new Converter({\n type: fieldGraphQLPlugin.fieldType,\n plugin: plugin || defaultFieldConverterPlugin\n });\n\n this.addConverter(converter);\n }\n }\n\n public addConverter(converter: Converter): void {\n converter.setConverterCollection(this);\n this.converters.set(converter.getType(), converter);\n }\n\n public getConverter(type: string): Converter {\n const converter = this.converters.get(type);\n if (converter === undefined) {\n throw new WebinyError(\n `Missing converter for field type \"${type}\".`,\n \"CONVERTER_ERROR\",\n {\n type\n }\n );\n }\n return converter;\n }\n\n public convertToStorage(params: ConverterCollectionConvertParams): CmsEntryValues | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n this.attachHasOwnProperty(inputValues);\n\n return fields.reduce<CmsEntryValues>((output, field) => {\n const baseType = getBaseFieldType(field);\n const converter = this.getConverter(baseType);\n if (inputValues === null || inputValues.hasOwnProperty(field.fieldId) === false) {\n return output;\n }\n const values = converter.convertToStorage({\n field,\n value: inputValues[field.fieldId]\n });\n\n return {\n ...output,\n ...values\n };\n }, {});\n }\n\n public convertFromStorage(\n params: ConverterCollectionConvertParams\n ): CmsEntryValues | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n return fields.reduce((output, field) => {\n const baseType = getBaseFieldType(field);\n const converter = this.getConverter(baseType);\n if (inputValues === null || inputValues.hasOwnProperty(field.storageId) === false) {\n return output;\n }\n const values = converter.convertFromStorage({\n field,\n value: inputValues[field.storageId]\n });\n\n return {\n ...output,\n ...values\n };\n }, {});\n }\n\n /**\n * This method attaches hasOwnProperty when received object was created via Object.create(null) - no inheritance of Object.\n * At that point, hasOwnProperty does not exist, and we need to add it.\n *\n * TODO add more checks if required\n */\n private attachHasOwnProperty(values: CmsEntryValues) {\n if (\n // null or undefined?\n values === null ||\n values === undefined ||\n // not an object?\n typeof values !== \"object\" ||\n // maybe it's an array?\n Array.isArray(values) ||\n // and in the end, check if hasOwnProperty is a function already\n typeof values?.hasOwnProperty === \"function\"\n ) {\n return;\n }\n Object.defineProperty(values, \"hasOwnProperty\", {\n enumerable: false,\n writable: false,\n value: function (property: string) {\n return this[property] !== undefined;\n }\n });\n }\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_Converter","_plugins","_getBaseFieldType","ConverterCollection","converters","Map","constructor","params","plugins","fieldGraphQLPlugins","byType","fieldConverterPlugins","CmsModelFieldConverterPlugin","type","defaultFieldConverterPlugin","find","pl","getFieldType","undefined","WebinyError","fieldGraphQLPlugin","plugin","fieldType","converter","Converter","addConverter","setConverterCollection","set","getType","getConverter","get","convertToStorage","fields","values","inputValues","attachHasOwnProperty","reduce","output","field","baseType","getBaseFieldType","hasOwnProperty","fieldId","value","convertFromStorage","storageId","Array","isArray","Object","defineProperty","enumerable","writable","property","exports"],"sources":["ConverterCollection.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Converter } from \"./Converter\";\nimport { CmsEntryValues, CmsModelField, CmsModelFieldToGraphQLPlugin } from \"~/types\";\nimport { CmsModelFieldConverterPlugin } from \"~/plugins\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\nexport interface CmsModelFieldsWithParent extends CmsModelField {\n parent?: CmsModelField | null;\n}\n\nexport interface CmsModelConverterCallable {\n (params: ConverterCollectionConvertParams): CmsEntryValues;\n}\n\nexport interface ConverterCollectionConvertParams {\n fields: CmsModelFieldsWithParent[];\n values?: CmsEntryValues;\n}\n\nexport interface ConverterCollectionParams {\n plugins: PluginsContainer;\n}\n\nexport class ConverterCollection {\n private readonly converters: Map<string, Converter> = new Map();\n\n public constructor(params: ConverterCollectionParams) {\n const { plugins } = params;\n const fieldGraphQLPlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n const fieldConverterPlugins = plugins.byType<CmsModelFieldConverterPlugin>(\n CmsModelFieldConverterPlugin.type\n );\n const defaultFieldConverterPlugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === \"*\"\n );\n if (defaultFieldConverterPlugin === undefined) {\n throw new WebinyError(\n `Missing default field converter plugin.`,\n \"DEFAULT_FIELD_CONVERTER_ERROR\"\n );\n }\n for (const fieldGraphQLPlugin of fieldGraphQLPlugins) {\n const plugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === fieldGraphQLPlugin.fieldType\n );\n const converter = new Converter({\n type: fieldGraphQLPlugin.fieldType,\n plugin: plugin || defaultFieldConverterPlugin\n });\n\n this.addConverter(converter);\n }\n }\n\n public addConverter(converter: Converter): void {\n converter.setConverterCollection(this);\n this.converters.set(converter.getType(), converter);\n }\n\n public getConverter(type: string): Converter {\n const converter = this.converters.get(type);\n if (converter === undefined) {\n throw new WebinyError(\n `Missing converter for field type \"${type}\".`,\n \"CONVERTER_ERROR\",\n {\n type\n }\n );\n }\n return converter;\n }\n\n public convertToStorage(params: ConverterCollectionConvertParams): CmsEntryValues | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n this.attachHasOwnProperty(inputValues);\n\n return fields.reduce<CmsEntryValues>((output, field) => {\n const baseType = getBaseFieldType(field);\n const converter = this.getConverter(baseType);\n if (inputValues === null || inputValues.hasOwnProperty(field.fieldId) === false) {\n return output;\n }\n const values = converter.convertToStorage({\n field,\n value: inputValues[field.fieldId]\n });\n\n return {\n ...output,\n ...values\n };\n }, {});\n }\n\n public convertFromStorage(\n params: ConverterCollectionConvertParams\n ): CmsEntryValues | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n return fields.reduce((output, field) => {\n const baseType = getBaseFieldType(field);\n const converter = this.getConverter(baseType);\n if (inputValues === null || inputValues.hasOwnProperty(field.storageId) === false) {\n return output;\n }\n const values = converter.convertFromStorage({\n field,\n value: inputValues[field.storageId]\n });\n\n return {\n ...output,\n ...values\n };\n }, {});\n }\n\n /**\n * This method attaches hasOwnProperty when received object was created via Object.create(null) - no inheritance of Object.\n * At that point, hasOwnProperty does not exist, and we need to add it.\n *\n * TODO add more checks if required\n */\n private attachHasOwnProperty(values: CmsEntryValues) {\n if (\n // null or undefined?\n values === null ||\n values === undefined ||\n // not an object?\n typeof values !== \"object\" ||\n // maybe it's an array?\n Array.isArray(values) ||\n // and in the end, check if hasOwnProperty is a function already\n typeof values?.hasOwnProperty === \"function\"\n ) {\n return;\n }\n Object.defineProperty(values, \"hasOwnProperty\", {\n enumerable: false,\n writable: false,\n value: function (property: string) {\n return this[property] !== undefined;\n }\n });\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_ConverterCollection","require","_semver","_interopRequireDefault","featureVersion","semver","coerce","isBetaOrNext","model","webinyVersion","startsWith","match","isFeatureEnabled","disableConversion","process","env","WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE","nodeEnv","NODE_ENV","modelVersion","console","log","modelId","compare","createValueKeyToStorageConverter","params","plugins","values","converters","ConverterCollection","fields","result","convertToStorage","exports","createValueKeyFromStorageConverter","convertFromStorage","createCmsModelFieldConvertersAttachFactory","storageModel","convertValueKeyToStorage","convertValueKeyFromStorage"],"sources":["valueKeyStorageConverter.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport {\n CmsModelConverterCallable,\n ConverterCollection,\n ConverterCollectionConvertParams as BaseConverterCollectionConvertParams\n} from \"~/utils/converters/ConverterCollection\";\nimport { CmsModel, StorageOperationsCmsModel } from \"~/types\";\nimport semver, { SemVer } from \"semver\";\n\nconst featureVersion = semver.coerce(\"5.33.0\") as SemVer;\n\nconst isBetaOrNext = (model: CmsModel): boolean => {\n if (!model.webinyVersion) {\n return false;\n } else if (model.webinyVersion.startsWith(\"0.0.0\")) {\n return true;\n }\n return model.webinyVersion.match(/next|beta|unstable/) !== null;\n};\n\nconst isFeatureEnabled = (model: CmsModel): boolean => {\n /**\n * In case of disabled webinyVersion value, we disable this feature.\n * This is only for testing...\n */\n const disableConversion = !!process.env.WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE;\n if (model.webinyVersion === \"disable\" || disableConversion) {\n return false;\n }\n /**\n * If is a test environment, always have this turned on.\n */\n const nodeEnv = process.env.NODE_ENV as string;\n if (nodeEnv === \"test\" || nodeEnv === \"disable\" || isBetaOrNext(model)) {\n return true;\n }\n /**\n * Possibility that the version is not defined, this means it is a quite old system where models did not change.\n */\n if (!model.webinyVersion) {\n return false;\n }\n /**\n * In case feature version value is greater than the model version, feature is not enabled as it is an older model with no storageId.\n *\n * TODO change if necessary after the update to the system\n */\n const modelVersion = semver.coerce(model.webinyVersion);\n if (!modelVersion) {\n console.log(`Warning: Model \"${model.modelId}\" does not have valid Webiny version set.`);\n return true;\n } else if (semver.compare(modelVersion, featureVersion) === -1) {\n return false;\n }\n return true;\n};\n\ninterface Params {\n /**\n * We need a model to determine if the conversion feature is enabled.\n */\n model: CmsModel;\n plugins: PluginsContainer;\n}\n\n/**\n * In the first call of the converter we do not need the fields property as it will be taken directly from the model.\n */\ninterface ConverterCollectionConvertParams\n extends Omit<BaseConverterCollectionConvertParams, \"fields\"> {\n fields?: BaseConverterCollectionConvertParams[\"fields\"];\n}\n\nexport const createValueKeyToStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertToStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createValueKeyFromStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertFromStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createCmsModelFieldConvertersAttachFactory = (plugins: PluginsContainer) => {\n return (model: StorageOperationsCmsModel | CmsModel): StorageOperationsCmsModel => {\n const storageModel = model as Partial<StorageOperationsCmsModel>;\n if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) {\n return storageModel as StorageOperationsCmsModel;\n }\n return {\n ...model,\n convertValueKeyToStorage: createValueKeyToStorageConverter({\n model,\n plugins\n }),\n convertValueKeyFromStorage: createValueKeyFromStorageConverter({\n model,\n plugins\n })\n };\n };\n};\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"names":["_ConverterCollection","require","_semver","_interopRequireDefault","featureVersion","semver","coerce","isBetaOrNext","model","webinyVersion","startsWith","match","isFeatureEnabled","disableConversion","process","env","WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE","nodeEnv","NODE_ENV","modelVersion","console","log","modelId","compare","createValueKeyToStorageConverter","params","plugins","values","converters","ConverterCollection","fields","result","convertToStorage","exports","createValueKeyFromStorageConverter","convertFromStorage","createCmsModelFieldConvertersAttachFactory","storageModel","convertValueKeyToStorage","convertValueKeyFromStorage"],"sources":["valueKeyStorageConverter.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport {\n CmsModelConverterCallable,\n ConverterCollection,\n ConverterCollectionConvertParams as BaseConverterCollectionConvertParams\n} from \"~/utils/converters/ConverterCollection\";\nimport { CmsModel, StorageOperationsCmsModel } from \"~/types\";\nimport semver, { SemVer } from \"semver\";\n\nconst featureVersion = semver.coerce(\"5.33.0\") as SemVer;\n\nconst isBetaOrNext = (model: CmsModel): boolean => {\n if (!model.webinyVersion) {\n return false;\n } else if (model.webinyVersion.startsWith(\"0.0.0\")) {\n return true;\n }\n return model.webinyVersion.match(/next|beta|unstable/) !== null;\n};\n\nconst isFeatureEnabled = (model: CmsModel): boolean => {\n /**\n * In case of disabled webinyVersion value, we disable this feature.\n * This is only for testing...\n */\n const disableConversion = !!process.env.WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE;\n if (model.webinyVersion === \"disable\" || disableConversion) {\n return false;\n }\n /**\n * If is a test environment, always have this turned on.\n */\n const nodeEnv = process.env.NODE_ENV as string;\n if (nodeEnv === \"test\" || nodeEnv === \"disable\" || isBetaOrNext(model)) {\n return true;\n }\n /**\n * Possibility that the version is not defined, this means it is a quite old system where models did not change.\n */\n if (!model.webinyVersion) {\n return false;\n }\n /**\n * In case feature version value is greater than the model version, feature is not enabled as it is an older model with no storageId.\n *\n * TODO change if necessary after the update to the system\n */\n const modelVersion = semver.coerce(model.webinyVersion);\n if (!modelVersion) {\n console.log(`Warning: Model \"${model.modelId}\" does not have valid Webiny version set.`);\n return true;\n } else if (semver.compare(modelVersion, featureVersion) === -1) {\n return false;\n }\n return true;\n};\n\ninterface Params {\n /**\n * We need a model to determine if the conversion feature is enabled.\n */\n model: CmsModel;\n plugins: PluginsContainer;\n}\n\n/**\n * In the first call of the converter we do not need the fields property as it will be taken directly from the model.\n */\ninterface ConverterCollectionConvertParams\n extends Omit<BaseConverterCollectionConvertParams, \"fields\"> {\n fields?: BaseConverterCollectionConvertParams[\"fields\"];\n}\n\nexport const createValueKeyToStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertToStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createValueKeyFromStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertFromStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createCmsModelFieldConvertersAttachFactory = (plugins: PluginsContainer) => {\n return (model: StorageOperationsCmsModel | CmsModel): StorageOperationsCmsModel => {\n const storageModel = model as Partial<StorageOperationsCmsModel>;\n if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) {\n return storageModel as StorageOperationsCmsModel;\n }\n return {\n ...model,\n convertValueKeyToStorage: createValueKeyToStorageConverter({\n model,\n plugins\n }),\n convertValueKeyFromStorage: createValueKeyFromStorageConverter({\n model,\n plugins\n })\n };\n };\n};\n"],"mappings":"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","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","id","label","fieldId","initialFieldId","storageId","type","tags","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","helpText","placeholderText","renderer","camelCase","exports"],"sources":["createModelField.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport { CmsModelField } from \"~/types\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n id?: string;\n fieldId?: string;\n storageId?: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n // We are not just spreading `params` because we want to ensure\n // a default value is set for every property of the model field.\n const {\n id,\n label,\n fieldId: initialFieldId,\n storageId,\n type,\n tags,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n },\n helpText = null,\n placeholderText = null,\n renderer = null\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n\n return {\n id: id ?? fieldId,\n storageId: storageId ?? `${type}@${fieldId}`,\n fieldId,\n label,\n type,\n settings,\n tags,\n listValidation,\n validation,\n multipleValues,\n predefinedValues,\n helpText,\n placeholderText,\n renderer\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAUO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E;EACA;EACA,MAAM;IACFC,EAAE;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,SAAS;IACTC,IAAI;IACJC,IAAI;IACJC,QAAQ,GAAG,CAAC,CAAC;IACbC,cAAc,GAAG,EAAE;IACnBC,UAAU,GAAG,EAAE;IACfC,cAAc,GAAG,KAAK;IACtBC,gBAAgB,GAAG;MACfC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb,CAAC;IACDC,QAAQ,GAAG,IAAI;IACfC,eAAe,GAAG,IAAI;IACtBC,QAAQ,GAAG;EACf,CAAC,GAAGjB,MAAM;EAEV,MAAMG,OAAO,GAAGC,cAAc,GAAG,IAAAc,kBAAS,EAACd,cAAc,CAAC,GAAG,IAAAc,kBAAS,EAAChB,KAAK,CAAC;EAE7E,OAAO;IACHD,EAAE,EAAEA,EAAE,IAAIE,OAAO;IACjBE,SAAS,EAAEA,SAAS,IAAK,GAAEC,IAAK,IAAGH,OAAQ,EAAC;IAC5CA,OAAO;IACPD,KAAK;IACLI,IAAI;IACJE,QAAQ;IACRD,IAAI;IACJE,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC,gBAAgB;IAChBG,QAAQ;IACRC,eAAe;IACfC;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAApB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","id","label","fieldId","initialFieldId","storageId","type","tags","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","helpText","placeholderText","renderer","camelCase","exports"],"sources":["createModelField.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport { CmsModelField } from \"~/types\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n id?: string;\n fieldId?: string;\n storageId?: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n // We are not just spreading `params` because we want to ensure\n // a default value is set for every property of the model field.\n const {\n id,\n label,\n fieldId: initialFieldId,\n storageId,\n type,\n tags,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n },\n helpText = null,\n placeholderText = null,\n renderer = null\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n\n return {\n id: id ?? fieldId,\n storageId: storageId ?? `${type}@${fieldId}`,\n fieldId,\n label,\n type,\n settings,\n tags,\n listValidation,\n validation,\n multipleValues,\n predefinedValues,\n helpText,\n placeholderText,\n renderer\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAUO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E;EACA;EACA,MAAM;IACFC,EAAE;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,SAAS;IACTC,IAAI;IACJC,IAAI;IACJC,QAAQ,GAAG,CAAC,CAAC;IACbC,cAAc,GAAG,EAAE;IACnBC,UAAU,GAAG,EAAE;IACfC,cAAc,GAAG,KAAK;IACtBC,gBAAgB,GAAG;MACfC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb,CAAC;IACDC,QAAQ,GAAG,IAAI;IACfC,eAAe,GAAG,IAAI;IACtBC,QAAQ,GAAG;EACf,CAAC,GAAGjB,MAAM;EAEV,MAAMG,OAAO,GAAGC,cAAc,GAAG,IAAAc,kBAAS,EAACd,cAAc,CAAC,GAAG,IAAAc,kBAAS,EAAChB,KAAK,CAAC;EAE7E,OAAO;IACHD,EAAE,EAAEA,EAAE,IAAIE,OAAO;IACjBE,SAAS,EAAEA,SAAS,IAAI,GAAGC,IAAI,IAAIH,OAAO,EAAE;IAC5CA,OAAO;IACPD,KAAK;IACLI,IAAI;IACJE,QAAQ;IACRD,IAAI;IACJE,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC,gBAAgB;IAChBG,QAAQ;IACRC,eAAe;IACfC;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAApB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_renderFields","require","_renderInputFields","createTypeFromFields","params","typeOfType","model","models","type","typeNamePrefix","fields","fieldTypePlugins","typeSuffix","mTypeName","singularApiName","typeFields","nestedTypes","replace","RegExp","field","result","renderField","renderInputField","typeDefs","push","length","fieldType","join","exports"],"sources":["createTypeFromFields.ts"],"sourcesContent":["import { renderField } from \"~/utils/renderFields\";\nimport { renderInputField } from \"~/utils/renderInputFields\";\nimport { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\n\ninterface TypeFromFieldParams {\n typeOfType: \"type\" | \"input\";\n models: CmsModel[];\n model: CmsModel;\n type: ApiEndpoint;\n typeNamePrefix: string;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface TypeFromFieldResponse {\n fieldType: string;\n typeDefs: string;\n}\n\nexport const createTypeFromFields = (params: TypeFromFieldParams): TypeFromFieldResponse | null => {\n const { typeOfType, model, models, type, typeNamePrefix, fields, fieldTypePlugins } = params;\n const typeSuffix = typeOfType === \"input\" ? \"Input\" : \"\";\n const mTypeName = model.singularApiName;\n\n const typeFields: string[] = [];\n const nestedTypes: string[] = [];\n\n // Once the loop below starts, we'll be executing a recursive \"object\" type generation.\n // The main trick here is that nested objects don't know who the parent is, and will generate\n // type names using the \"model\", as if they're at the top level:\n // Every time the types are returned, we need to replace the model name in the generated type name\n // with the actual prefix which includes parent field name type.\n const replace = new RegExp(`${mTypeName}_`, \"g\");\n\n for (const field of fields) {\n const result =\n typeOfType === \"type\"\n ? renderField({ field, type, models, model, fieldTypePlugins })\n : renderInputField({ field, models, model, fieldTypePlugins });\n\n if (!result) {\n continue;\n }\n\n const { fields, typeDefs } = result;\n\n typeFields.push(fields.replace(replace, `${typeNamePrefix}_`));\n if (typeDefs) {\n nestedTypes.push(typeDefs.replace(replace, `${typeNamePrefix}_`));\n }\n }\n\n if (!typeFields.length) {\n typeFields.push(\"_empty: String\");\n }\n\n return {\n fieldType: `${typeNamePrefix}${typeSuffix}`,\n typeDefs: /* GraphQL */ `\n ${nestedTypes.join(\"\\n\")}\n\n ${typeOfType} ${typeNamePrefix}${typeSuffix} {\n ${typeFields.join(\"\\n\")}\n }\\n\n `\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAkBO,MAAME,oBAAoB,GAAIC,MAA2B,IAAmC;EAC/F,MAAM;IAAEC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,cAAc;IAAEC,MAAM;IAAEC;EAAiB,CAAC,GAAGP,MAAM;EAC5F,MAAMQ,UAAU,GAAGP,UAAU,KAAK,OAAO,GAAG,OAAO,GAAG,EAAE;EACxD,MAAMQ,SAAS,GAAGP,KAAK,CAACQ,eAAe;EAEvC,MAAMC,UAAoB,GAAG,EAAE;EAC/B,MAAMC,WAAqB,GAAG,EAAE;;EAEhC;EACA;EACA;EACA;EACA;EACA,MAAMC,OAAO,GAAG,IAAIC,MAAM,CAAE,GAAEL,SAAU,GAAE,EAAE,GAAG,CAAC;EAEhD,KAAK,MAAMM,KAAK,IAAIT,MAAM,EAAE;IACxB,MAAMU,MAAM,GACRf,UAAU,KAAK,MAAM,GACf,IAAAgB,yBAAW,EAAC;MAAEF,KAAK;MAAEX,IAAI;MAAED,MAAM;MAAED,KAAK;MAAEK;IAAiB,CAAC,CAAC,GAC7D,IAAAW,mCAAgB,EAAC;MAAEH,KAAK;MAAEZ,MAAM;MAAED,KAAK;MAAEK;IAAiB,CAAC,CAAC;IAEtE,IAAI,CAACS,MAAM,EAAE;MACT;IACJ;IAEA,MAAM;MAAEV,MAAM;MAAEa;IAAS,CAAC,GAAGH,MAAM;IAEnCL,UAAU,CAACS,IAAI,CAACd,MAAM,CAACO,OAAO,CAACA,OAAO,EAAG,GAAER,cAAe,GAAE,CAAC,CAAC;IAC9D,IAAIc,QAAQ,EAAE;MACVP,WAAW,CAACQ,IAAI,CAACD,QAAQ,CAACN,OAAO,CAACA,OAAO,EAAG,GAAER,cAAe,GAAE,CAAC,CAAC;IACrE;EACJ;EAEA,IAAI,CAACM,UAAU,CAACU,MAAM,EAAE;IACpBV,UAAU,CAACS,IAAI,CAAC,gBAAgB,CAAC;EACrC;EAEA,OAAO;IACHE,SAAS,EAAG,GAAEjB,cAAe,GAAEG,UAAW,EAAC;IAC3CW,QAAQ,EAAE,aAAe;AACjC,cAAcP,WAAW,CAACW,IAAI,CAAC,IAAI,CAAE;AACrC;AACA,cAActB,UAAW,IAAGI,cAAe,GAAEG,UAAW;AACxD,kBAAkBG,UAAU,CAACY,IAAI,CAAC,IAAI,CAAE;AACxC;AACA;EACI,CAAC;AACL,CAAC;AAACC,OAAA,CAAAzB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_renderFields","require","_renderInputFields","createTypeFromFields","params","typeOfType","model","models","type","typeNamePrefix","fields","fieldTypePlugins","typeSuffix","mTypeName","singularApiName","typeFields","nestedTypes","replace","RegExp","field","result","renderField","renderInputField","typeDefs","push","length","fieldType","join","exports"],"sources":["createTypeFromFields.ts"],"sourcesContent":["import { renderField } from \"~/utils/renderFields\";\nimport { renderInputField } from \"~/utils/renderInputFields\";\nimport { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\n\ninterface TypeFromFieldParams {\n typeOfType: \"type\" | \"input\";\n models: CmsModel[];\n model: CmsModel;\n type: ApiEndpoint;\n typeNamePrefix: string;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface TypeFromFieldResponse {\n fieldType: string;\n typeDefs: string;\n}\n\nexport const createTypeFromFields = (params: TypeFromFieldParams): TypeFromFieldResponse | null => {\n const { typeOfType, model, models, type, typeNamePrefix, fields, fieldTypePlugins } = params;\n const typeSuffix = typeOfType === \"input\" ? \"Input\" : \"\";\n const mTypeName = model.singularApiName;\n\n const typeFields: string[] = [];\n const nestedTypes: string[] = [];\n\n // Once the loop below starts, we'll be executing a recursive \"object\" type generation.\n // The main trick here is that nested objects don't know who the parent is, and will generate\n // type names using the \"model\", as if they're at the top level:\n // Every time the types are returned, we need to replace the model name in the generated type name\n // with the actual prefix which includes parent field name type.\n const replace = new RegExp(`${mTypeName}_`, \"g\");\n\n for (const field of fields) {\n const result =\n typeOfType === \"type\"\n ? renderField({ field, type, models, model, fieldTypePlugins })\n : renderInputField({ field, models, model, fieldTypePlugins });\n\n if (!result) {\n continue;\n }\n\n const { fields, typeDefs } = result;\n\n typeFields.push(fields.replace(replace, `${typeNamePrefix}_`));\n if (typeDefs) {\n nestedTypes.push(typeDefs.replace(replace, `${typeNamePrefix}_`));\n }\n }\n\n if (!typeFields.length) {\n typeFields.push(\"_empty: String\");\n }\n\n return {\n fieldType: `${typeNamePrefix}${typeSuffix}`,\n typeDefs: /* GraphQL */ `\n ${nestedTypes.join(\"\\n\")}\n\n ${typeOfType} ${typeNamePrefix}${typeSuffix} {\n ${typeFields.join(\"\\n\")}\n }\\n\n `\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAkBO,MAAME,oBAAoB,GAAIC,MAA2B,IAAmC;EAC/F,MAAM;IAAEC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,cAAc;IAAEC,MAAM;IAAEC;EAAiB,CAAC,GAAGP,MAAM;EAC5F,MAAMQ,UAAU,GAAGP,UAAU,KAAK,OAAO,GAAG,OAAO,GAAG,EAAE;EACxD,MAAMQ,SAAS,GAAGP,KAAK,CAACQ,eAAe;EAEvC,MAAMC,UAAoB,GAAG,EAAE;EAC/B,MAAMC,WAAqB,GAAG,EAAE;;EAEhC;EACA;EACA;EACA;EACA;EACA,MAAMC,OAAO,GAAG,IAAIC,MAAM,CAAC,GAAGL,SAAS,GAAG,EAAE,GAAG,CAAC;EAEhD,KAAK,MAAMM,KAAK,IAAIT,MAAM,EAAE;IACxB,MAAMU,MAAM,GACRf,UAAU,KAAK,MAAM,GACf,IAAAgB,yBAAW,EAAC;MAAEF,KAAK;MAAEX,IAAI;MAAED,MAAM;MAAED,KAAK;MAAEK;IAAiB,CAAC,CAAC,GAC7D,IAAAW,mCAAgB,EAAC;MAAEH,KAAK;MAAEZ,MAAM;MAAED,KAAK;MAAEK;IAAiB,CAAC,CAAC;IAEtE,IAAI,CAACS,MAAM,EAAE;MACT;IACJ;IAEA,MAAM;MAAEV,MAAM;MAAEa;IAAS,CAAC,GAAGH,MAAM;IAEnCL,UAAU,CAACS,IAAI,CAACd,MAAM,CAACO,OAAO,CAACA,OAAO,EAAE,GAAGR,cAAc,GAAG,CAAC,CAAC;IAC9D,IAAIc,QAAQ,EAAE;MACVP,WAAW,CAACQ,IAAI,CAACD,QAAQ,CAACN,OAAO,CAACA,OAAO,EAAE,GAAGR,cAAc,GAAG,CAAC,CAAC;IACrE;EACJ;EAEA,IAAI,CAACM,UAAU,CAACU,MAAM,EAAE;IACpBV,UAAU,CAACS,IAAI,CAAC,gBAAgB,CAAC;EACrC;EAEA,OAAO;IACHE,SAAS,EAAE,GAAGjB,cAAc,GAAGG,UAAU,EAAE;IAC3CW,QAAQ,EAAE,aAAc;AAChC,cAAcP,WAAW,CAACW,IAAI,CAAC,IAAI,CAAC;AACpC;AACA,cAActB,UAAU,IAAII,cAAc,GAAGG,UAAU;AACvD,kBAAkBG,UAAU,CAACY,IAAI,CAAC,IAAI,CAAC;AACvC;AACA;EACI,CAAC;AACL,CAAC;AAACC,OAAA,CAAAzB,oBAAA,GAAAA,oBAAA","ignoreList":[]}