@webiny/api-headless-cms 6.4.12-beta.5 → 6.5.0-beta.1

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 (275) hide show
  1. package/crud/contentEntry/entryDataValidation.d.ts +1 -1
  2. package/crud/contentEntry/entryDataValidation.js +33 -18
  3. package/crud/contentEntry/entryDataValidation.js.map +1 -1
  4. package/crud/contentEntry.crud.js +12 -39
  5. package/crud/contentEntry.crud.js.map +1 -1
  6. package/crud/contentModel/defaultFields.js +3 -2
  7. package/crud/contentModel/defaultFields.js.map +1 -1
  8. package/crud/contentModel/validate/endingAllowed.js +1 -1
  9. package/crud/contentModel/validate/endingAllowed.js.map +1 -1
  10. package/crud/contentModel/validate/pluralApiName.js +1 -1
  11. package/crud/contentModel/validate/pluralApiName.js.map +1 -1
  12. package/crud/contentModel/validate/singularApiName.js +1 -1
  13. package/crud/contentModel/validate/singularApiName.js.map +1 -1
  14. package/crud/contentModel/validation.js +2 -2
  15. package/crud/contentModel/validation.js.map +1 -1
  16. package/domain/contentModel/schemas.d.ts +4 -0
  17. package/domain/contentModel/schemas.js +5 -2
  18. package/domain/contentModel/schemas.js.map +1 -1
  19. package/domain/contentModel/validation/endingAllowed.js +1 -1
  20. package/domain/contentModel/validation/endingAllowed.js.map +1 -1
  21. package/domain/contentModel/validation/pluralApiName.js +1 -1
  22. package/domain/contentModel/validation/pluralApiName.js.map +1 -1
  23. package/domain/contentModel/validation/singularApiName.js +1 -1
  24. package/domain/contentModel/validation/singularApiName.js.map +1 -1
  25. package/export/crud/exporting.js +2 -2
  26. package/export/crud/exporting.js.map +1 -1
  27. package/export/crud/imports/importGroups.js +2 -1
  28. package/export/crud/imports/importGroups.js.map +1 -1
  29. package/export/crud/imports/validateModels.js +1 -1
  30. package/export/crud/imports/validateModels.js.map +1 -1
  31. package/exports/api/cms/model.d.ts +4 -1
  32. package/exports/api/cms/model.js +2 -0
  33. package/extension.d.ts +3 -0
  34. package/extension.js +19 -0
  35. package/extension.js.map +1 -0
  36. package/features/contentEntry/ContentEntriesFeature.js +2 -0
  37. package/features/contentEntry/ContentEntriesFeature.js.map +1 -1
  38. package/features/contentEntry/CreateEntry/CreateEntryUseCase.js +1 -2
  39. package/features/contentEntry/CreateEntry/CreateEntryUseCase.js.map +1 -1
  40. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.d.ts +1 -3
  41. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js +4 -12
  42. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js.map +1 -1
  43. package/features/contentEntry/CreateEntryRevisionFrom/abstractions.d.ts +2 -0
  44. package/features/contentEntry/CreateEntryRevisionFrom/abstractions.js.map +1 -1
  45. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js +1 -0
  46. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js.map +1 -1
  47. package/features/contentEntry/GetSingletonEntry/GetSingletonEntryUseCase.js +1 -3
  48. package/features/contentEntry/GetSingletonEntry/GetSingletonEntryUseCase.js.map +1 -1
  49. package/features/contentEntry/PublishEntry/PublishEntryUseCase.d.ts +1 -3
  50. package/features/contentEntry/PublishEntry/PublishEntryUseCase.js +4 -10
  51. package/features/contentEntry/PublishEntry/PublishEntryUseCase.js.map +1 -1
  52. package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js +3 -1
  53. package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js.map +1 -1
  54. package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js +3 -1
  55. package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js.map +1 -1
  56. package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js +3 -1
  57. package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js.map +1 -1
  58. package/features/contentEntry/UpdateRevision/UpdateRevisionRepository.d.ts +14 -0
  59. package/features/contentEntry/UpdateRevision/UpdateRevisionRepository.js +34 -0
  60. package/features/contentEntry/UpdateRevision/UpdateRevisionRepository.js.map +1 -0
  61. package/features/contentEntry/UpdateRevision/abstractions.d.ts +10 -0
  62. package/features/contentEntry/UpdateRevision/abstractions.js +5 -0
  63. package/features/contentEntry/UpdateRevision/abstractions.js.map +1 -0
  64. package/features/contentEntry/UpdateRevision/feature.d.ts +4 -0
  65. package/features/contentEntry/UpdateRevision/feature.js +11 -0
  66. package/features/contentEntry/UpdateRevision/feature.js.map +1 -0
  67. package/features/contentEntry/UpdateRevision/index.d.ts +1 -0
  68. package/features/contentEntry/UpdateRevision/index.js +1 -0
  69. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.d.ts +2 -2
  70. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js +2 -2
  71. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js.map +1 -1
  72. package/features/contentEntry/ensureItemIds.d.ts +13 -0
  73. package/features/contentEntry/ensureItemIds.js +22 -0
  74. package/features/contentEntry/ensureItemIds.js.map +1 -0
  75. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.d.ts +3 -1
  76. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js +9 -3
  77. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js.map +1 -1
  78. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.d.ts +7 -5
  79. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js +48 -18
  80. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js.map +1 -1
  81. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.d.ts +17 -1
  82. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.js.map +1 -1
  83. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.d.ts +5 -3
  84. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js +22 -16
  85. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js.map +1 -1
  86. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.d.ts +15 -1
  87. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.js.map +1 -1
  88. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.d.ts +5 -3
  89. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js +17 -13
  90. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js.map +1 -1
  91. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.d.ts +13 -1
  92. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.js.map +1 -1
  93. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.d.ts +6 -6
  94. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js +17 -18
  95. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js.map +1 -1
  96. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.d.ts +14 -2
  97. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.js.map +1 -1
  98. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.d.ts +7 -3
  99. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js +73 -30
  100. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js.map +1 -1
  101. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.d.ts +15 -1
  102. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.js.map +1 -1
  103. package/features/contentEntry/entryDataFactories/expiresAt.js +2 -2
  104. package/features/contentEntry/entryDataFactories/expiresAt.js.map +1 -1
  105. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.d.ts +24 -0
  106. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js +13 -0
  107. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js.map +1 -0
  108. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.d.ts +14 -0
  109. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js +32 -0
  110. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js.map +1 -0
  111. package/features/contentModel/ComponentMapGenerator/abstractions.d.ts +8 -0
  112. package/features/contentModel/ComponentMapGenerator/abstractions.js +5 -0
  113. package/features/contentModel/ComponentMapGenerator/abstractions.js.map +1 -0
  114. package/features/contentModel/ComponentMapGenerator/feature.d.ts +4 -0
  115. package/features/contentModel/ComponentMapGenerator/feature.js +11 -0
  116. package/features/contentModel/ComponentMapGenerator/feature.js.map +1 -0
  117. package/features/contentModel/ComponentMapGenerator/index.d.ts +2 -0
  118. package/features/contentModel/ComponentMapGenerator/index.js +2 -0
  119. package/features/contentModel/ContentModelFeature.js +6 -0
  120. package/features/contentModel/ContentModelFeature.js.map +1 -1
  121. package/features/contentModel/CreateModel/CreateModelRepository.js +2 -1
  122. package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
  123. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +2 -1
  124. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
  125. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.d.ts +19 -0
  126. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js +56 -0
  127. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js.map +1 -0
  128. package/features/contentModel/RefModelsGenerator/abstractions.d.ts +11 -0
  129. package/features/contentModel/RefModelsGenerator/abstractions.js +5 -0
  130. package/features/contentModel/RefModelsGenerator/abstractions.js.map +1 -0
  131. package/features/contentModel/RefModelsGenerator/feature.d.ts +4 -0
  132. package/features/contentModel/RefModelsGenerator/feature.js +11 -0
  133. package/features/contentModel/RefModelsGenerator/feature.js.map +1 -0
  134. package/features/contentModel/RefModelsGenerator/index.d.ts +2 -0
  135. package/features/contentModel/RefModelsGenerator/index.js +2 -0
  136. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.d.ts +16 -0
  137. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +54 -0
  138. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js.map +1 -0
  139. package/features/contentModel/ValuesSelectionGenerator/abstractions.d.ts +8 -0
  140. package/features/contentModel/ValuesSelectionGenerator/abstractions.js +5 -0
  141. package/features/contentModel/ValuesSelectionGenerator/abstractions.js.map +1 -0
  142. package/features/contentModel/ValuesSelectionGenerator/feature.d.ts +4 -0
  143. package/features/contentModel/ValuesSelectionGenerator/feature.js +11 -0
  144. package/features/contentModel/ValuesSelectionGenerator/feature.js.map +1 -0
  145. package/features/contentModel/ValuesSelectionGenerator/index.d.ts +1 -0
  146. package/features/contentModel/ValuesSelectionGenerator/index.js +1 -0
  147. package/features/graphql/feature.js +2 -0
  148. package/features/graphql/feature.js.map +1 -1
  149. package/features/graphql/fields/base/AssetToGraphQL.d.ts +26 -0
  150. package/features/graphql/fields/base/AssetToGraphQL.js +153 -0
  151. package/features/graphql/fields/base/AssetToGraphQL.js.map +1 -0
  152. package/features/graphql/fields/base/DynamicZoneToGraphQL.js +12 -2
  153. package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
  154. package/features/graphql/fields/base/ObjectToGraphQL.js +8 -5
  155. package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -1
  156. package/features/modelBuilder/abstractions.d.ts +9 -0
  157. package/features/modelBuilder/abstractions.js.map +1 -1
  158. package/features/modelBuilder/feature.js +2 -0
  159. package/features/modelBuilder/feature.js.map +1 -1
  160. package/features/modelBuilder/fields/AssetFieldType.d.ts +20 -0
  161. package/features/modelBuilder/fields/AssetFieldType.js +46 -0
  162. package/features/modelBuilder/fields/AssetFieldType.js.map +1 -0
  163. package/features/modelBuilder/fields/DataFieldBuilder.d.ts +62 -18
  164. package/features/modelBuilder/fields/DataFieldBuilder.js +8 -0
  165. package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
  166. package/features/modelBuilder/fields/DynamicZoneFieldType.d.ts +1 -0
  167. package/features/modelBuilder/fields/DynamicZoneFieldType.js +2 -6
  168. package/features/modelBuilder/fields/DynamicZoneFieldType.js.map +1 -1
  169. package/features/modelBuilder/fields/resolveAssetUrl.d.ts +35 -0
  170. package/features/modelBuilder/fields/resolveAssetUrl.js +26 -0
  171. package/features/modelBuilder/fields/resolveAssetUrl.js.map +1 -0
  172. package/features/modelBuilder/index.d.ts +1 -1
  173. package/features/modelBuilder/models/BaseModelBuilder.d.ts +3 -1
  174. package/features/modelBuilder/models/BaseModelBuilder.js +7 -0
  175. package/features/modelBuilder/models/BaseModelBuilder.js.map +1 -1
  176. package/features/modelBuilder/models/PrivateModelBuilder.js +2 -1
  177. package/features/modelBuilder/models/PrivateModelBuilder.js.map +1 -1
  178. package/features/modelBuilder/models/PublicModelBuilder.js +2 -1
  179. package/features/modelBuilder/models/PublicModelBuilder.js.map +1 -1
  180. package/features/sortMapper/SortMapper.js +2 -5
  181. package/features/sortMapper/SortMapper.js.map +1 -1
  182. package/features/storage/fields/CompressedTextStorageTransform.js +1 -1
  183. package/features/storage/fields/CompressedTextStorageTransform.js.map +1 -1
  184. package/features/storage/fields/DateStorageTransform.js +4 -3
  185. package/features/storage/fields/DateStorageTransform.js.map +1 -1
  186. package/features/storage/fields/DynamicZoneStorageTransform.js +2 -2
  187. package/features/storage/fields/DynamicZoneStorageTransform.js.map +1 -1
  188. package/features/storage/fields/JsonStorageTransform.js +1 -1
  189. package/features/storage/fields/JsonStorageTransform.js.map +1 -1
  190. package/features/storage/fields/LongTextStorageTransform.js +1 -1
  191. package/features/storage/fields/LongTextStorageTransform.js.map +1 -1
  192. package/features/storage/fields/ObjectStorageTransform.js +27 -7
  193. package/features/storage/fields/ObjectStorageTransform.js.map +1 -1
  194. package/features/storage/fields/RichTextStorageTransform.js +1 -1
  195. package/features/storage/fields/RichTextStorageTransform.js.map +1 -1
  196. package/features/validation/validators/DateGteValidator.js +1 -1
  197. package/features/validation/validators/DateGteValidator.js.map +1 -1
  198. package/features/validation/validators/DateLteValidator.js +1 -1
  199. package/features/validation/validators/DateLteValidator.js.map +1 -1
  200. package/features/validation/validators/PatternValidator.js +1 -1
  201. package/features/validation/validators/PatternValidator.js.map +1 -1
  202. package/features/whereMapper/WhereMapper.js +10 -7
  203. package/features/whereMapper/WhereMapper.js.map +1 -1
  204. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +8 -2
  205. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
  206. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +8 -2
  207. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
  208. package/fieldConverters/index.d.ts +1 -1
  209. package/graphql/getSchema/generateCacheKey.js +1 -1
  210. package/graphql/getSchema/generateCacheKey.js.map +1 -1
  211. package/graphql/scalars/RevisionId.js +1 -1
  212. package/graphql/scalars/RevisionId.js.map +1 -1
  213. package/graphql/schema/baseSchema.js +5 -25
  214. package/graphql/schema/baseSchema.js.map +1 -1
  215. package/graphql/schema/cms/getEntryResolver.js +3 -2
  216. package/graphql/schema/cms/getEntryResolver.js.map +1 -1
  217. package/graphql/schema/cms/getModelResolver.d.ts +35 -0
  218. package/graphql/schema/cms/getModelResolver.js +49 -0
  219. package/graphql/schema/cms/getModelResolver.js.map +1 -0
  220. package/graphql/schema/cms/helpers/buildFieldsSelection.js +9 -2
  221. package/graphql/schema/cms/helpers/buildFieldsSelection.js.map +1 -1
  222. package/graphql/schema/cms/helpers/expandFieldWildcards.d.ts +2 -0
  223. package/graphql/schema/cms/helpers/expandFieldWildcards.js +13 -0
  224. package/graphql/schema/cms/helpers/expandFieldWildcards.js.map +1 -0
  225. package/graphql/schema/cms/helpers/index.d.ts +1 -0
  226. package/graphql/schema/cms/helpers/index.js +1 -0
  227. package/graphql/schema/cms/helpers.d.ts +1 -0
  228. package/graphql/schema/cms/helpers.js +1 -0
  229. package/graphql/schema/cms/index.js +2 -1
  230. package/graphql/schema/cms/index.js.map +1 -1
  231. package/graphql/schema/cms/listEntriesResolver.js +3 -2
  232. package/graphql/schema/cms/listEntriesResolver.js.map +1 -1
  233. package/graphql/schema/cms/resolvers/getModel.d.ts +8 -0
  234. package/graphql/schema/cms/resolvers/getModel.js +18 -0
  235. package/graphql/schema/cms/resolvers/getModel.js.map +1 -0
  236. package/graphql/schema/cms/resolvers/index.d.ts +1 -0
  237. package/graphql/schema/cms/resolvers/index.js +1 -0
  238. package/graphql/schema/cms/typeDefs/query.js +1 -0
  239. package/graphql/schema/cms/typeDefs/query.js.map +1 -1
  240. package/graphql/schema/cms/typeDefs/responses.js +5 -0
  241. package/graphql/schema/cms/typeDefs/responses.js.map +1 -1
  242. package/graphql/schema/contentModels.js +40 -1
  243. package/graphql/schema/contentModels.js.map +1 -1
  244. package/graphql/schema/createFieldResolvers.js +1 -1
  245. package/graphql/schema/createFieldResolvers.js.map +1 -1
  246. package/index.d.ts +2 -5
  247. package/index.js +1 -21
  248. package/package.json +27 -30
  249. package/plugins/CmsModelPlugin.js +12 -10
  250. package/plugins/CmsModelPlugin.js.map +1 -1
  251. package/types/fields/dynamicZoneField.d.ts +1 -0
  252. package/types/model.d.ts +6 -0
  253. package/types/modelField.d.ts +13 -0
  254. package/types/types.d.ts +8 -4
  255. package/types/types.js.map +1 -1
  256. package/utils/caching/Cache.js +1 -1
  257. package/utils/caching/Cache.js.map +1 -1
  258. package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.d.ts +28 -0
  259. package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js +324 -0
  260. package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js.map +1 -0
  261. package/utils/contentModelToJsonSchema/index.d.ts +2 -0
  262. package/utils/contentModelToJsonSchema/index.js +1 -0
  263. package/utils/contentModelToJsonSchema/types.d.ts +24 -0
  264. package/utils/contentModelToJsonSchema/types.js +0 -0
  265. package/utils/createModelField.js +2 -1
  266. package/utils/createModelField.js.map +1 -1
  267. package/utils/date.js +1 -1
  268. package/utils/date.js.map +1 -1
  269. package/utils/entryStorage.js +1 -1
  270. package/utils/entryStorage.js.map +1 -1
  271. package/utils/index.d.ts +1 -0
  272. package/utils/index.js +1 -0
  273. package/utils/renderFields.js +1 -1
  274. package/utils/renderFields.js.map +1 -1
  275. package/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types/types.js","sources":["../../src/types/types.ts"],"sourcesContent":["import type { Context, GenericRecord } from \"@webiny/api/types.js\";\nimport type { GraphQLFieldResolver, GraphQLRequestBody } from \"@webiny/handler-graphql/types.js\";\nimport type { processRequestBody } from \"@webiny/handler-graphql\";\nimport type { DbContext } from \"@webiny/handler-db/types.js\";\nimport type { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection.js\";\nimport type { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types.js\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl.js\";\nimport type { CmsModelToAstConverter } from \"~/utils/contentModelAst/CmsModelToAstConverter.js\";\nimport type { ICmsModelFieldToGraphQLRegistry } from \"~/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js\";\nimport type { CmsEntryContext } from \"./context.js\";\nimport type { CmsModelField, CmsModelFieldValidation, CmsModelUpdateInput } from \"./modelField.js\";\nimport type {\n CmsModel,\n CmsModelCreateFromInput,\n CmsModelCreateInput,\n StorageCmsModel\n} from \"./model.js\";\nimport type { CmsGroup } from \"./modelGroup.js\";\nimport type { CmsIdentity } from \"./identity.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\nimport type {\n DateStringInterfaceGenerator,\n IdentityInterfaceGenerator,\n IdInterfaceGenerator,\n IdMixedInterfaceGenerator,\n NumericInterfaceGenerator,\n TruthfulInterfaceGenerator\n} from \"@webiny/api\";\n\nexport type CmsIcon = {\n type: string;\n name: string;\n value?: 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 extends CmsGroupContext, CmsModelContext, CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\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, ApiCoreContext {\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 extends CmsEntryValues = CmsEntryValues> {\n /**\n * A value to be validated.\n */\n value: T[keyof 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<T>;\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<\n T extends CmsEntryValues = CmsEntryValues\n> extends CmsModel {\n convertValueKeyToStorage: CmsModelConverterCallable<T>;\n convertValueKeyFromStorage: CmsModelConverterCallable<T>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsModelFieldDefinition {\n fields: string;\n typeDefs?: string;\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?: CmsIcon | null;\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?: CmsIcon;\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 };\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\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\nexport interface ICmsEntryLocation {\n folderId?: string;\n}\n\nexport interface ICmsEntryLive {\n version: number;\n}\n\nexport interface ICmsEntrySystem {\n // to be extended\n}\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<TValues extends CmsEntryValues = CmsEntryValues> {\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 * Model ID of the definition for the entry.\n * @see CmsModel\n */\n modelId: 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: TValues;\n /**\n * Advanced Content Organization\n */\n location?: ICmsEntryLocation;\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 used when restoring the entry from the trash bin.\n */\n binOriginalFolderId?: string;\n\n system?: ICmsEntrySystem;\n /**\n * Is this CMS Entry live (no matter the revision).\n */\n live: ICmsEntryLive | null;\n /**\n * A revision description.\n */\n revisionDescription: string | undefined;\n /**\n * A timestamp of when the entry should be automatically deleted from the database.\n */\n expiresAt: number | null;\n}\n\nexport interface CmsStorageEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\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.\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 * Clear all the model caches.\n */\n clearModelsCache(): void;\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 extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"modelId\"> {}\n\nexport interface CmsEntryListWhereValues {\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 | CmsEntryListWhereValues[]\n | CmsEntryListWhereValues\n | CmsEntryListWhereRef;\n}\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\n\nexport interface CmsEntryListWhere\n extends\n IdMixedInterfaceGenerator<\"id\">,\n IdMixedInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"status\", CmsEntryStatus>,\n /**\n * Revision-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"revisionCreatedBy\">,\n IdentityInterfaceGenerator<\"revisionModifiedBy\">,\n IdentityInterfaceGenerator<\"revisionSavedBy\">,\n IdentityInterfaceGenerator<\"revisionFirstPublishedBy\">,\n IdentityInterfaceGenerator<\"revisionLastPublishedBy\">,\n /**\n * Entry-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"createdBy\">,\n IdentityInterfaceGenerator<\"modifiedBy\">,\n IdentityInterfaceGenerator<\"savedBy\">,\n IdentityInterfaceGenerator<\"firstPublishedBy\">,\n IdentityInterfaceGenerator<\"lastPublishedBy\">,\n DateStringInterfaceGenerator<\"createdOn\">,\n DateStringInterfaceGenerator<\"savedOn\">,\n DateStringInterfaceGenerator<\"deletedOn\">,\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n NumericInterfaceGenerator<\"version\">,\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 TruthfulInterfaceGenerator<\"published\">,\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 TruthfulInterfaceGenerator<\"latest\"> {\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 };\n location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n\n values?: CmsEntryListWhereValues;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean;\n wbyDeleted_not?: boolean;\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 * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\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 modifiedBy?: 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 // TODO remove wbyAco_location\n wbyAco_location?: {\n folderId?: string | null;\n };\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues | undefined;\n\n expiresAt?: Date | undefined;\n}\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\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 system?: Partial<ICmsEntrySystem>;\n\n values: TValues;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidators?: string[];\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\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 location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values?: Partial<TValues>;\n\n expiresAt?: Date | number | null | undefined;\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 fieldRegistry: ICmsModelFieldToGraphQLRegistry;\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 models?: string[];\n groups?: string[];\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 groups?: string[];\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 models?: string[];\n groups?: string[];\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: 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<void>;\n /**\n * Update existing content model group.\n */\n update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<void>;\n /**\n * Delete the content model group.\n */\n delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<void>;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: StorageCmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: StorageCmsModel;\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<StorageCmsModel | null>;\n /**\n * List all content models. Filterable via params.\n */\n list: (params: CmsModelStorageOperationsListParams) => Promise<StorageCmsModel[]>;\n /**\n * Create a new content model.\n */\n create: (params: CmsModelStorageOperationsCreateParams) => Promise<StorageCmsModel>;\n /**\n * Update existing content model.\n */\n update: (params: CmsModelStorageOperationsUpdateParams) => Promise<StorageCmsModel>;\n /**\n * Delete the content model.\n */\n delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<void>;\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<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry<T>;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: CmsStorageEntry<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: CmsStorageEntry<T> | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams<T extends CmsEntryValues = CmsEntryValues> {\n entry: CmsEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsMoveToBinParams<\n T extends CmsEntryValues = CmsEntryValues\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<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsRestoreFromBinParams<\n T extends CmsEntryValues = CmsEntryValues\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<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: CmsStorageEntry<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 {\n /**\n * Get all the entries of the ids.\n */\n getByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Gets entry by given params.\n */\n get: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<CmsEntry<T>>>;\n /**\n * Create a new entry.\n */\n create: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Update existing entry.\n */\n update: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUpdateParams<T>\n ) => Promise<CmsEntry<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: <T extends CmsEntryValues = CmsEntryValues>(\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: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsRestoreFromBinParams<T>\n ) => Promise<CmsEntry<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: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsPublishParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Unpublish the entry.\n */\n unpublish: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUnpublishParams<T>\n ) => Promise<CmsEntry<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 HeadlessCmsStorageOperations<C extends CmsContext = CmsContext> {\n name: string;\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"],"names":["CONTENT_ENTRY_STATUS"],"mappings":"AA24CO,IAAKA,6BAAoBA,WAAAA,GAAAA,SAApBA,oBAAoB;;;;WAApBA"}
1
+ {"version":3,"file":"types/types.js","sources":["../../src/types/types.ts"],"sourcesContent":["import type { Context, GenericRecord } from \"@webiny/api/types.js\";\nimport type { GraphQLFieldResolver, GraphQLRequestBody } from \"@webiny/handler-graphql/types.js\";\nimport type { processRequestBody } from \"@webiny/handler-graphql\";\nimport type { DbContext } from \"@webiny/handler-db/types.js\";\nimport type { CmsModelConverterCallable } from \"~/utils/converters/ConverterCollection.js\";\nimport type { HeadlessCmsExport, HeadlessCmsImport } from \"~/export/types.js\";\nimport type { AccessControl } from \"~/crud/AccessControl/AccessControl.js\";\nimport type { CmsModelToAstConverter } from \"~/utils/contentModelAst/CmsModelToAstConverter.js\";\nimport type { ICmsModelFieldToGraphQLRegistry } from \"~/features/graphql/fields/abstractions/CmsModelFieldToGraphQLRegistry.js\";\nimport type { CmsEntryContext } from \"./context.js\";\nimport type { CmsModelField, CmsModelFieldValidation, CmsModelUpdateInput } from \"./modelField.js\";\nimport type {\n CmsModel,\n CmsModelCreateFromInput,\n CmsModelCreateInput,\n StorageCmsModel\n} from \"./model.js\";\nimport type { CmsGroup } from \"./modelGroup.js\";\nimport type { CmsIdentity } from \"./identity.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\nimport type {\n DateStringInterfaceGenerator,\n IdentityInterfaceGenerator,\n IdInterfaceGenerator,\n IdMixedInterfaceGenerator,\n NumericInterfaceGenerator,\n TruthfulInterfaceGenerator\n} from \"@webiny/api\";\n\nexport type CmsIcon = {\n type: string;\n name: string;\n value?: 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 extends CmsGroupContext, CmsModelContext, CmsEntryContext {\n /**\n * API type\n */\n type: ApiEndpoint | null;\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, ApiCoreContext {\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 extends CmsEntryValues = CmsEntryValues> {\n /**\n * A value to be validated.\n */\n value: T[keyof 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<T>;\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<\n T extends CmsEntryValues = CmsEntryValues\n> extends CmsModel {\n convertValueKeyToStorage: CmsModelConverterCallable<T>;\n convertValueKeyFromStorage: CmsModelConverterCallable<T>;\n}\n\n/**\n * @category ModelField\n */\nexport interface CmsModelFieldDefinition {\n fields: string;\n typeDefs?: string;\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?: CmsIcon | null;\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?: CmsIcon;\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 };\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\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\nexport interface ICmsEntryLocation {\n folderId?: string;\n}\n\nexport interface ICmsEntryLive {\n version: number;\n}\n\nexport interface ICmsEntrySystem {\n // to be extended\n}\n/**\n * A content entry definition for and from the database.\n *\n * @category Database model\n * @category CmsEntry\n */\nexport interface CmsEntry<TValues extends CmsEntryValues = CmsEntryValues> {\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 * Model ID of the definition for the entry.\n * @see CmsModel\n */\n modelId: 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: TValues;\n /**\n * Advanced Content Organization\n */\n location?: ICmsEntryLocation;\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 used when restoring the entry from the trash bin.\n */\n binOriginalFolderId?: string;\n\n system?: ICmsEntrySystem;\n /**\n * Is this CMS Entry live (no matter the revision).\n */\n live: ICmsEntryLive | null;\n /**\n * A revision description.\n */\n revisionDescription: string | undefined;\n /**\n * A timestamp of when the entry should be automatically deleted from the database.\n */\n expiresAt: number | null;\n}\n\nexport interface CmsStorageEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n [key: string]: any;\n}\n\nexport interface CmsEntryUniqueValue {\n value: string;\n count: number;\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.\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 * Clear all the model caches.\n */\n clearModelsCache(): void;\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 extends\n IdInterfaceGenerator<\"id\">,\n IdInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"modelId\"> {}\n\nexport interface CmsEntryListWhereValues {\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 | CmsEntryListWhereValues[]\n | CmsEntryListWhereValues\n | CmsEntryListWhereRef;\n}\n/**\n * Entry listing where params.\n *\n * @category CmsEntry\n * @category GraphQL params\n */\n\nexport interface CmsEntryListWhere\n extends\n IdMixedInterfaceGenerator<\"id\">,\n IdMixedInterfaceGenerator<\"entryId\">,\n IdInterfaceGenerator<\"status\", CmsEntryStatus>,\n /**\n * Revision-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"revisionCreatedBy\">,\n IdentityInterfaceGenerator<\"revisionModifiedBy\">,\n IdentityInterfaceGenerator<\"revisionSavedBy\">,\n IdentityInterfaceGenerator<\"revisionFirstPublishedBy\">,\n IdentityInterfaceGenerator<\"revisionLastPublishedBy\">,\n /**\n * Entry-level meta fields. 👇\n */\n IdentityInterfaceGenerator<\"createdBy\">,\n IdentityInterfaceGenerator<\"modifiedBy\">,\n IdentityInterfaceGenerator<\"savedBy\">,\n IdentityInterfaceGenerator<\"firstPublishedBy\">,\n IdentityInterfaceGenerator<\"lastPublishedBy\">,\n DateStringInterfaceGenerator<\"createdOn\">,\n DateStringInterfaceGenerator<\"savedOn\">,\n DateStringInterfaceGenerator<\"deletedOn\">,\n /**\n * Version of the entry.\n *\n * It is not meant to be used via the API.\n * @internal\n */\n NumericInterfaceGenerator<\"version\">,\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 TruthfulInterfaceGenerator<\"published\">,\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 TruthfulInterfaceGenerator<\"latest\"> {\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 };\n location?: {\n folderId?: string;\n folderId_not?: string;\n folderId_in?: string[];\n folderId_not_in?: string[];\n };\n\n values?: CmsEntryListWhereValues;\n /**\n * Is the entry in the bin?\n */\n wbyDeleted?: boolean;\n wbyDeleted_not?: boolean;\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 * @category Context\n * @category CmsEntry\n */\nexport interface CreateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\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 modifiedBy?: 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 // TODO remove wbyAco_location\n wbyAco_location?: {\n folderId?: string | null;\n };\n location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values: TValues | undefined;\n\n expiresAt?: Date | undefined;\n}\n\nexport interface CreateCmsEntryOptionsInput {\n skipValidation?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface CreateFromCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\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 system?: Partial<ICmsEntrySystem>;\n\n values: TValues;\n}\n\nexport interface CreateRevisionCmsEntryOptionsInput {\n skipValidation?: boolean;\n}\n\n/**\n * @category Context\n * @category CmsEntry\n */\nexport interface UpdateCmsEntryInput<TValues extends CmsEntryValues = CmsEntryValues> {\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 location?: {\n folderId?: string | null;\n };\n\n system?: Partial<ICmsEntrySystem>;\n\n values?: Partial<TValues>;\n\n expiresAt?: Date | number | null | undefined;\n}\n\nexport interface UpdateCmsEntryOptionsInput {\n skipValidation?: boolean;\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 fieldRegistry: ICmsModelFieldToGraphQLRegistry;\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 models?: string[];\n groups?: string[];\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 groups?: string[];\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 models?: string[];\n groups?: string[];\n}\n\nexport interface CmsGroupStorageOperationsGetParams {\n id: string;\n tenant: string;\n}\n\nexport interface CmsGroupStorageOperationsListWhereParams {\n tenant: 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<void>;\n /**\n * Update existing content model group.\n */\n update: (params: CmsGroupStorageOperationsUpdateParams) => Promise<void>;\n /**\n * Delete the content model group.\n */\n delete: (params: CmsGroupStorageOperationsDeleteParams) => Promise<void>;\n}\n\nexport interface CmsModelStorageOperationsGetParams {\n tenant: string;\n modelId: string;\n}\n\nexport interface CmsModelStorageOperationsListWhereParams {\n tenant: string;\n\n [key: string]: string;\n}\n\nexport interface CmsModelStorageOperationsListParams {\n where: CmsModelStorageOperationsListWhereParams;\n}\n\nexport interface CmsModelStorageOperationsCreateParams {\n model: StorageCmsModel;\n}\n\nexport interface CmsModelStorageOperationsUpdateParams {\n model: StorageCmsModel;\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<StorageCmsModel | null>;\n /**\n * List all content models. Filterable via params.\n */\n list: (params: CmsModelStorageOperationsListParams) => Promise<StorageCmsModel[]>;\n /**\n * Create a new content model.\n */\n create: (params: CmsModelStorageOperationsCreateParams) => Promise<StorageCmsModel>;\n /**\n * Update existing content model.\n */\n update: (params: CmsModelStorageOperationsUpdateParams) => Promise<StorageCmsModel>;\n /**\n * Delete the content model.\n */\n delete: (params: CmsModelStorageOperationsDeleteParams) => Promise<void>;\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<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsCreateRevisionFromParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUpdateParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * Real entry, with no transformations on it.\n */\n entry: CmsEntry<T>;\n /**\n * Entry prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteRevisionParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * Entry that was deleted.\n */\n entry: CmsEntry<T>;\n /**\n * Entry that was deleted, directly from storage, with transformations.\n */\n storageEntry: CmsStorageEntry<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: CmsStorageEntry<T> | null;\n}\n\nexport interface CmsEntryStorageOperationsDeleteParams<T extends CmsEntryValues = CmsEntryValues> {\n entry: CmsEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsMoveToBinParams<\n T extends CmsEntryValues = CmsEntryValues\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<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsRestoreFromBinParams<\n T extends CmsEntryValues = CmsEntryValues\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<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsDeleteEntriesParams {\n entries: string[];\n}\n\nexport interface CmsEntryStorageOperationsPublishParams<T extends CmsEntryValues = CmsEntryValues> {\n /**\n * The modified entry that is going to be saved as published.\n * Entry is in its original form.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry and prepared for the storage.\n */\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport interface CmsEntryStorageOperationsUnpublishParams<\n T extends CmsEntryValues = CmsEntryValues\n> {\n /**\n * The modified entry that is going to be saved as unpublished.\n */\n entry: CmsEntry<T>;\n /**\n * The modified entry that is going to be saved as unpublished, with transformations on it.\n */\n storageEntry: CmsStorageEntry<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 {\n /**\n * Get all the entries of the ids.\n */\n getByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all the published entries of the ids.\n */\n getPublishedByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all the latest entries of the ids.\n */\n getLatestByIds: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestByIdsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get all revisions of the given entry id.\n */\n getRevisions: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) => Promise<CmsEntry<T>[]>;\n /**\n * Get the entry by the given revision id.\n */\n getRevisionById: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the published entry by given entryId.\n */\n getPublishedRevisionByEntryId: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the latest entry by given entryId.\n */\n getLatestRevisionByEntryId: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Get the revision of the entry before given one.\n */\n getPreviousRevision: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * Gets entry by given params.\n */\n get: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) => Promise<CmsEntry<T> | null>;\n /**\n * List all entries. Filterable via params.\n */\n list: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) => Promise<CmsEntryStorageOperationsListResponse<CmsEntry<T>>>;\n /**\n * Create a new entry.\n */\n create: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Create a new entry from existing one.\n */\n createRevisionFrom: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Update existing entry.\n */\n update: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUpdateParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Update a single revision record without touching the latest or published records.\n */\n updateRevision: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUpdateParams<T>\n ) => Promise<CmsEntry<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: <T extends CmsEntryValues = CmsEntryValues>(\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: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsRestoreFromBinParams<T>\n ) => Promise<CmsEntry<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: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsPublishParams<T>\n ) => Promise<CmsEntry<T>>;\n /**\n * Unpublish the entry.\n */\n unpublish: <T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsUnpublishParams<T>\n ) => Promise<CmsEntry<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 HeadlessCmsStorageOperations<C extends CmsContext = CmsContext> {\n name: string;\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"],"names":["CONTENT_ENTRY_STATUS"],"mappings":"AAk5CO,IAAKA,6BAAoBA,WAAAA,GAAAA,SAApBA,oBAAoB;;;;WAApBA"}
@@ -21,7 +21,7 @@ class Cache {
21
21
  }
22
22
  clear(cacheKey) {
23
23
  if (!cacheKey) return void this._cache.clear();
24
- else if (Array.isArray(cacheKey)) {
24
+ if (Array.isArray(cacheKey)) {
25
25
  for (const key of cacheKey)this._cache.delete(key.get());
26
26
  return;
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils/caching/Cache.js","sources":["../../../src/utils/caching/Cache.ts"],"sourcesContent":["import type { ICache, ICacheKey } from \"./types.js\";\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"],"names":["Cache","params","Map","cacheKey","key","value","cb","existing","Array","createMemoryCache"],"mappings":"AAMA,MAAMA;IAIF,YAAmBC,MAAqB,CAAE;aAFzB,MAAM,GAAmB,IAAIC;QAG1C,IAAI,CAAC,EAAE,GAAGD,QAAQ;IACtB;IAEO,IAAIE,QAAmB,EAAY;QACtC,MAAMC,MAAMD,SAAS,GAAG;QACxB,MAAME,QAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,CAACD;QAC9B,OAAOC,SAAS;IACpB;IAEO,IAAIF,QAAmB,EAAEE,KAAQ,EAAK;QACzC,MAAMD,MAAMD,SAAS,GAAG;QACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAACC,KAAKC;QACrB,OAAOA;IACX;IAEO,SAASF,QAAmB,EAAEG,EAAW,EAAK;QACjD,MAAMC,WAAW,IAAI,CAAC,GAAG,CAACJ;QAC1B,IAAII,UACA,OAAOA;QAEX,MAAMF,QAAQC;QACd,OAAO,IAAI,CAAC,GAAG,CAACH,UAAUE;IAC9B;IAEO,MAAMF,QAAkC,EAAE;QAC7C,IAAI,CAACA,UAAU,YACX,IAAI,CAAC,MAAM,CAAC,KAAK;aAEd,IAAIK,MAAM,OAAO,CAACL,WAAW;YAChC,KAAK,MAAMC,OAAOD,SACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAACC,IAAI,GAAG;YAE9B;QACJ;QAEA,IAAI,CAAC,MAAM,CAAC,MAAM,CAACD,SAAS,GAAG;IACnC;AACJ;AAEO,MAAMM,oBAAoB,CAAIR,SAC1B,IAAID,MAASC"}
1
+ {"version":3,"file":"utils/caching/Cache.js","sources":["../../../src/utils/caching/Cache.ts"],"sourcesContent":["import type { ICache, ICacheKey } from \"./types.js\";\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"],"names":["Cache","params","Map","cacheKey","key","value","cb","existing","Array","createMemoryCache"],"mappings":"AAMA,MAAMA;IAIF,YAAmBC,MAAqB,CAAE;aAFzB,MAAM,GAAmB,IAAIC;QAG1C,IAAI,CAAC,EAAE,GAAGD,QAAQ;IACtB;IAEO,IAAIE,QAAmB,EAAY;QACtC,MAAMC,MAAMD,SAAS,GAAG;QACxB,MAAME,QAAQ,IAAI,CAAC,MAAM,CAAC,GAAG,CAACD;QAC9B,OAAOC,SAAS;IACpB;IAEO,IAAIF,QAAmB,EAAEE,KAAQ,EAAK;QACzC,MAAMD,MAAMD,SAAS,GAAG;QACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAACC,KAAKC;QACrB,OAAOA;IACX;IAEO,SAASF,QAAmB,EAAEG,EAAW,EAAK;QACjD,MAAMC,WAAW,IAAI,CAAC,GAAG,CAACJ;QAC1B,IAAII,UACA,OAAOA;QAEX,MAAMF,QAAQC;QACd,OAAO,IAAI,CAAC,GAAG,CAACH,UAAUE;IAC9B;IAEO,MAAMF,QAAkC,EAAE;QAC7C,IAAI,CAACA,UAAU,YACX,IAAI,CAAC,MAAM,CAAC,KAAK;QAEd,IAAIK,MAAM,OAAO,CAACL,WAAW;YAChC,KAAK,MAAMC,OAAOD,SACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAACC,IAAI,GAAG;YAE9B;QACJ;QAEA,IAAI,CAAC,MAAM,CAAC,MAAM,CAACD,SAAS,GAAG;IACnC;AACJ;AAEO,MAAMM,oBAAoB,CAAIR,SAC1B,IAAID,MAASC"}
@@ -0,0 +1,28 @@
1
+ import type { CmsModel, CmsModelAst } from "../../types/index.js";
2
+ import type { JsonSchema, CmsModelToJsonSchemaOptions } from "./types.js";
3
+ export declare class CmsModelToJsonSchemaConverter {
4
+ private readonly options;
5
+ constructor(options?: CmsModelToJsonSchemaOptions);
6
+ convert(ast: CmsModelAst, model: Pick<CmsModel, "name" | "description">): JsonSchema;
7
+ private convertNode;
8
+ private convertChildren;
9
+ private convertFieldByType;
10
+ private convertTextField;
11
+ private convertLongTextField;
12
+ private convertRichTextField;
13
+ private convertNumberField;
14
+ private convertBooleanField;
15
+ private convertDateTimeField;
16
+ private convertFileField;
17
+ private convertRefField;
18
+ private convertDynamicZone;
19
+ private convertCollection;
20
+ private buildFieldDescription;
21
+ private buildModelDescription;
22
+ private extractValidationConstraints;
23
+ private applyValidationConstraints;
24
+ private applyPredefinedValues;
25
+ private wrapAsList;
26
+ private isHidden;
27
+ private childrenAreCollections;
28
+ }
@@ -0,0 +1,324 @@
1
+ class CmsModelToJsonSchemaConverter {
2
+ constructor(options){
3
+ this.options = {
4
+ includeHiddenFields: false,
5
+ ...options
6
+ };
7
+ }
8
+ convert(ast, model) {
9
+ const { properties, required } = this.convertChildren(ast.children);
10
+ const schema = {
11
+ type: "object",
12
+ properties
13
+ };
14
+ if (required.length > 0) schema.required = required;
15
+ const description = this.buildModelDescription(model);
16
+ if (description) schema.description = description;
17
+ return schema;
18
+ }
19
+ convertNode(node) {
20
+ if ("collection" === node.type) return null;
21
+ const field = node.field;
22
+ if (this.isHidden(field)) return null;
23
+ let schema;
24
+ if (this.childrenAreCollections(node)) schema = this.convertDynamicZone(node);
25
+ else if (node.children.length > 0) {
26
+ const { properties, required } = this.convertChildren(node.children);
27
+ schema = {
28
+ type: "object",
29
+ properties
30
+ };
31
+ if (required.length > 0) schema.required = required;
32
+ } else schema = this.convertFieldByType(field);
33
+ const description = this.buildFieldDescription(field);
34
+ if (description) schema.description = schema.description ? `${description}. ${schema.description}` : description;
35
+ if (field.list) return this.wrapAsList(schema, field);
36
+ return schema;
37
+ }
38
+ convertChildren(children) {
39
+ const properties = {};
40
+ const required = [];
41
+ for (const child of children){
42
+ if ("collection" === child.type) continue;
43
+ const schema = this.convertNode(child);
44
+ if (null === schema) continue;
45
+ properties[child.field.fieldId] = schema;
46
+ const constraints = this.extractValidationConstraints(child.field.validation || []);
47
+ if (constraints.required) required.push(child.field.fieldId);
48
+ }
49
+ return {
50
+ properties,
51
+ required
52
+ };
53
+ }
54
+ convertFieldByType(field) {
55
+ switch(field.type){
56
+ case "text":
57
+ return this.convertTextField(field);
58
+ case "long-text":
59
+ return this.convertLongTextField(field);
60
+ case "rich-text":
61
+ return this.convertRichTextField(field);
62
+ case "number":
63
+ return this.convertNumberField(field);
64
+ case "boolean":
65
+ return this.convertBooleanField();
66
+ case "datetime":
67
+ return this.convertDateTimeField(field);
68
+ case "file":
69
+ return this.convertFileField(field);
70
+ case "ref":
71
+ return this.convertRefField(field);
72
+ case "json":
73
+ return {
74
+ type: "object",
75
+ additionalProperties: true
76
+ };
77
+ default:
78
+ return {
79
+ type: "object",
80
+ additionalProperties: true
81
+ };
82
+ }
83
+ }
84
+ convertTextField(field) {
85
+ const schema = {
86
+ type: "string"
87
+ };
88
+ this.applyPredefinedValues(schema, field);
89
+ this.applyValidationConstraints(schema, field.validation);
90
+ return schema;
91
+ }
92
+ convertLongTextField(field) {
93
+ const schema = {
94
+ type: "string"
95
+ };
96
+ this.applyValidationConstraints(schema, field.validation);
97
+ return schema;
98
+ }
99
+ convertRichTextField(_field) {
100
+ return {
101
+ type: "object",
102
+ properties: {
103
+ tool: {
104
+ const: "textToLexical"
105
+ },
106
+ params: {
107
+ type: "object",
108
+ properties: {
109
+ text: {
110
+ type: "string",
111
+ description: "Rich text content as HTML markup. Use semantic HTML tags: <h1>-<h6>, <p>, <strong>, <em>, <ul>, <ol>, <li>, <a>, <blockquote>."
112
+ }
113
+ },
114
+ required: [
115
+ "text"
116
+ ]
117
+ }
118
+ },
119
+ required: [
120
+ "tool",
121
+ "params"
122
+ ]
123
+ };
124
+ }
125
+ convertNumberField(field) {
126
+ const schema = {
127
+ type: "number"
128
+ };
129
+ this.applyPredefinedValues(schema, field, true);
130
+ this.applyValidationConstraints(schema, field.validation);
131
+ return schema;
132
+ }
133
+ convertBooleanField() {
134
+ return {
135
+ type: "boolean"
136
+ };
137
+ }
138
+ convertDateTimeField(field) {
139
+ const schema = {
140
+ type: "string"
141
+ };
142
+ const dateType = field.settings?.type;
143
+ switch(dateType){
144
+ case "date":
145
+ schema.format = "date";
146
+ break;
147
+ case "time":
148
+ schema.format = "time";
149
+ break;
150
+ case "dateTimeWithTimezone":
151
+ schema.format = "date-time";
152
+ break;
153
+ case "dateTimeWithoutTimezone":
154
+ schema.format = "date-time";
155
+ schema.description = "Date and time without timezone (ISO 8601 format).";
156
+ break;
157
+ default:
158
+ schema.format = "date-time";
159
+ break;
160
+ }
161
+ return schema;
162
+ }
163
+ convertFileField(field) {
164
+ const imagesOnly = field.settings?.imagesOnly === true;
165
+ return {
166
+ type: "object",
167
+ properties: {
168
+ tool: {
169
+ const: "cmsResolveImage"
170
+ },
171
+ params: {
172
+ type: "object",
173
+ properties: {
174
+ id: {
175
+ type: "string",
176
+ description: imagesOnly ? "Image file ID obtained from listImagesByTag." : "File ID obtained from listImagesByTag."
177
+ }
178
+ },
179
+ required: [
180
+ "id"
181
+ ]
182
+ }
183
+ },
184
+ required: [
185
+ "tool",
186
+ "params"
187
+ ]
188
+ };
189
+ }
190
+ convertRefField(field) {
191
+ const models = field.settings?.models;
192
+ const modelIds = Array.isArray(models) && models.length > 0 ? models.map((m)=>m.modelId) : [];
193
+ const schema = {
194
+ type: "object",
195
+ properties: {
196
+ entryId: {
197
+ type: "string",
198
+ description: "ID of the referenced entry."
199
+ },
200
+ modelId: {
201
+ type: "string",
202
+ description: "Model ID of the referenced entry."
203
+ }
204
+ },
205
+ required: [
206
+ "entryId",
207
+ "modelId"
208
+ ]
209
+ };
210
+ if (modelIds.length > 0) {
211
+ const modelIdProp = schema.properties["modelId"];
212
+ modelIdProp.enum = modelIds;
213
+ }
214
+ return schema;
215
+ }
216
+ convertDynamicZone(node) {
217
+ const collections = node.children.filter((child)=>"collection" === child.type);
218
+ const oneOf = collections.map((collection)=>this.convertCollection(collection));
219
+ const schema = {
220
+ oneOf
221
+ };
222
+ if (collections.length > 0) schema.discriminator = {
223
+ propertyName: collections[0].collection.discriminator
224
+ };
225
+ return schema;
226
+ }
227
+ convertCollection(collection) {
228
+ const { properties, required } = this.convertChildren(collection.children);
229
+ properties[collection.collection.discriminator] = {
230
+ const: collection.collection.id
231
+ };
232
+ const allRequired = [
233
+ collection.collection.discriminator,
234
+ ...required
235
+ ];
236
+ const schema = {
237
+ type: "object",
238
+ properties,
239
+ required: allRequired
240
+ };
241
+ if (collection.collection.name) schema.description = collection.collection.name;
242
+ return schema;
243
+ }
244
+ buildFieldDescription(field) {
245
+ const parts = [];
246
+ if (field.label) parts.push(field.label);
247
+ if (field.description) parts.push(field.description);
248
+ if (field.help) parts.push(field.help);
249
+ if (0 === parts.length) return;
250
+ return parts.join(". ");
251
+ }
252
+ buildModelDescription(model) {
253
+ const parts = [];
254
+ if (model.name) parts.push(model.name);
255
+ if (model.description) parts.push(model.description);
256
+ if (0 === parts.length) return;
257
+ return parts.join(". ");
258
+ }
259
+ extractValidationConstraints(validations) {
260
+ const constraints = {
261
+ required: false
262
+ };
263
+ if (!validations) return constraints;
264
+ for (const v of validations)switch(v.name){
265
+ case "required":
266
+ constraints.required = true;
267
+ break;
268
+ case "minLength":
269
+ if (v.settings?.value !== void 0) constraints.minLength = Number(v.settings.value);
270
+ break;
271
+ case "maxLength":
272
+ if (v.settings?.value !== void 0) constraints.maxLength = Number(v.settings.value);
273
+ break;
274
+ case "gte":
275
+ if (v.settings?.value !== void 0) constraints.minimum = Number(v.settings.value);
276
+ break;
277
+ case "lte":
278
+ if (v.settings?.value !== void 0) constraints.maximum = Number(v.settings.value);
279
+ break;
280
+ case "pattern":
281
+ if (v.settings?.preset === "email") constraints.format = "email";
282
+ else if (v.settings?.preset === "url") constraints.format = "uri";
283
+ else if (v.settings?.value !== void 0) constraints.pattern = String(v.settings.value);
284
+ break;
285
+ }
286
+ return constraints;
287
+ }
288
+ applyValidationConstraints(schema, validations) {
289
+ const constraints = this.extractValidationConstraints(validations);
290
+ if (void 0 !== constraints.minLength) schema.minLength = constraints.minLength;
291
+ if (void 0 !== constraints.maxLength) schema.maxLength = constraints.maxLength;
292
+ if (void 0 !== constraints.minimum) schema.minimum = constraints.minimum;
293
+ if (void 0 !== constraints.maximum) schema.maximum = constraints.maximum;
294
+ if (void 0 !== constraints.pattern) schema.pattern = constraints.pattern;
295
+ if (void 0 !== constraints.format) schema.format = constraints.format;
296
+ }
297
+ applyPredefinedValues(schema, field, parseAsNumber = false) {
298
+ if (field.predefinedValues?.enabled !== true) return;
299
+ const values = field.predefinedValues.values;
300
+ if (!Array.isArray(values) || 0 === values.length) return;
301
+ schema.enum = values.map((v)=>parseAsNumber ? Number(v.value) : v.value);
302
+ }
303
+ wrapAsList(schema, field) {
304
+ const listSchema = {
305
+ type: "array",
306
+ items: schema
307
+ };
308
+ for (const v of field.listValidation || []){
309
+ if ("minLength" === v.name && v.settings?.value !== void 0) listSchema.minLength = Number(v.settings.value);
310
+ if ("maxLength" === v.name && v.settings?.value !== void 0) listSchema.maxLength = Number(v.settings.value);
311
+ }
312
+ return listSchema;
313
+ }
314
+ isHidden(field) {
315
+ if (this.options.includeHiddenFields) return false;
316
+ return field.renderer?.name === "hidden";
317
+ }
318
+ childrenAreCollections(node) {
319
+ return node.children.length > 0 && node.children.every((c)=>"collection" === c.type);
320
+ }
321
+ }
322
+ export { CmsModelToJsonSchemaConverter };
323
+
324
+ //# sourceMappingURL=CmsModelToJsonSchemaConverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js","sources":["../../../src/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsModelAst,\n CmsModelField,\n CmsModelFieldAstNode,\n CmsModelFieldAstNodeCollection,\n CmsModelFieldAstNodeField,\n CmsModelFieldValidation\n} from \"~/types/index.js\";\nimport type { JsonSchema, CmsModelToJsonSchemaOptions } from \"./types.js\";\n\ninterface ValidationConstraints {\n required: boolean;\n minLength?: number;\n maxLength?: number;\n minimum?: number;\n maximum?: number;\n pattern?: string;\n format?: string;\n}\n\ninterface ConvertedChildren {\n properties: Record<string, JsonSchema>;\n required: string[];\n}\n\nexport class CmsModelToJsonSchemaConverter {\n private readonly options: Required<CmsModelToJsonSchemaOptions>;\n\n constructor(options?: CmsModelToJsonSchemaOptions) {\n this.options = {\n includeHiddenFields: false,\n ...options\n };\n }\n\n convert(ast: CmsModelAst, model: Pick<CmsModel, \"name\" | \"description\">): JsonSchema {\n const { properties, required } = this.convertChildren(ast.children);\n\n const schema: JsonSchema = {\n type: \"object\",\n properties\n };\n\n if (required.length > 0) {\n schema.required = required;\n }\n\n const description = this.buildModelDescription(model);\n if (description) {\n schema.description = description;\n }\n\n return schema;\n }\n\n private convertNode(node: CmsModelFieldAstNode): JsonSchema | null {\n if (node.type === \"collection\") {\n return null;\n }\n\n const field = node.field;\n\n if (this.isHidden(field)) {\n return null;\n }\n\n let schema: JsonSchema;\n\n if (this.childrenAreCollections(node)) {\n schema = this.convertDynamicZone(node);\n } else if (node.children.length > 0) {\n const { properties, required } = this.convertChildren(node.children);\n schema = { type: \"object\", properties };\n if (required.length > 0) {\n schema.required = required;\n }\n } else {\n schema = this.convertFieldByType(field);\n }\n\n const description = this.buildFieldDescription(field);\n if (description) {\n schema.description = schema.description\n ? `${description}. ${schema.description}`\n : description;\n }\n\n if (field.list) {\n return this.wrapAsList(schema, field);\n }\n\n return schema;\n }\n\n private convertChildren(children: CmsModelFieldAstNode[]): ConvertedChildren {\n const properties: Record<string, JsonSchema> = {};\n const required: string[] = [];\n\n for (const child of children) {\n if (child.type === \"collection\") {\n continue;\n }\n\n const schema = this.convertNode(child);\n if (schema === null) {\n continue;\n }\n\n properties[child.field.fieldId] = schema;\n\n const constraints = this.extractValidationConstraints(child.field.validation || []);\n if (constraints.required) {\n required.push(child.field.fieldId);\n }\n }\n\n return { properties, required };\n }\n\n private convertFieldByType(field: CmsModelField): JsonSchema {\n switch (field.type) {\n case \"text\":\n return this.convertTextField(field);\n case \"long-text\":\n return this.convertLongTextField(field);\n case \"rich-text\":\n return this.convertRichTextField(field);\n case \"number\":\n return this.convertNumberField(field);\n case \"boolean\":\n return this.convertBooleanField();\n case \"datetime\":\n return this.convertDateTimeField(field);\n case \"file\":\n return this.convertFileField(field);\n case \"ref\":\n return this.convertRefField(field);\n case \"json\":\n return { type: \"object\", additionalProperties: true };\n default:\n return { type: \"object\", additionalProperties: true };\n }\n }\n\n private convertTextField(field: CmsModelField): JsonSchema {\n const schema: JsonSchema = { type: \"string\" };\n this.applyPredefinedValues(schema, field);\n this.applyValidationConstraints(schema, field.validation);\n return schema;\n }\n\n private convertLongTextField(field: CmsModelField): JsonSchema {\n const schema: JsonSchema = { type: \"string\" };\n this.applyValidationConstraints(schema, field.validation);\n return schema;\n }\n\n private convertRichTextField(_field: CmsModelField): JsonSchema {\n return {\n type: \"object\",\n properties: {\n tool: { const: \"textToLexical\" },\n params: {\n type: \"object\",\n properties: {\n text: {\n type: \"string\",\n description:\n \"Rich text content as HTML markup. Use semantic HTML tags: <h1>-<h6>, <p>, <strong>, <em>, <ul>, <ol>, <li>, <a>, <blockquote>.\"\n }\n },\n required: [\"text\"]\n }\n },\n required: [\"tool\", \"params\"]\n };\n }\n\n private convertNumberField(field: CmsModelField): JsonSchema {\n const schema: JsonSchema = { type: \"number\" };\n this.applyPredefinedValues(schema, field, true);\n this.applyValidationConstraints(schema, field.validation);\n return schema;\n }\n\n private convertBooleanField(): JsonSchema {\n return { type: \"boolean\" };\n }\n\n private convertDateTimeField(field: CmsModelField): JsonSchema {\n const schema: JsonSchema = { type: \"string\" };\n\n const dateType = field.settings?.type;\n switch (dateType) {\n case \"date\":\n schema.format = \"date\";\n break;\n case \"time\":\n schema.format = \"time\";\n break;\n case \"dateTimeWithTimezone\":\n schema.format = \"date-time\";\n break;\n case \"dateTimeWithoutTimezone\":\n schema.format = \"date-time\";\n schema.description = \"Date and time without timezone (ISO 8601 format).\";\n break;\n default:\n schema.format = \"date-time\";\n break;\n }\n\n return schema;\n }\n\n private convertFileField(field: CmsModelField): JsonSchema {\n const imagesOnly = field.settings?.imagesOnly === true;\n return {\n type: \"object\",\n properties: {\n tool: { const: \"cmsResolveImage\" },\n params: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n description: imagesOnly\n ? \"Image file ID obtained from listImagesByTag.\"\n : \"File ID obtained from listImagesByTag.\"\n }\n },\n required: [\"id\"]\n }\n },\n required: [\"tool\", \"params\"]\n };\n }\n\n private convertRefField(field: CmsModelField): JsonSchema {\n const models = field.settings?.models;\n const modelIds =\n Array.isArray(models) && models.length > 0\n ? models.map((m: { modelId: string }) => m.modelId)\n : [];\n\n const schema: JsonSchema = {\n type: \"object\",\n properties: {\n entryId: { type: \"string\", description: \"ID of the referenced entry.\" },\n modelId: {\n type: \"string\",\n description: \"Model ID of the referenced entry.\"\n }\n },\n required: [\"entryId\", \"modelId\"]\n };\n\n if (modelIds.length > 0) {\n const modelIdProp = schema.properties![\"modelId\"];\n modelIdProp.enum = modelIds;\n }\n\n return schema;\n }\n\n private convertDynamicZone(node: CmsModelFieldAstNodeField): JsonSchema {\n const collections = node.children.filter(\n (child): child is CmsModelFieldAstNodeCollection => child.type === \"collection\"\n );\n\n const oneOf = collections.map(collection => this.convertCollection(collection));\n\n const schema: JsonSchema = { oneOf };\n\n if (collections.length > 0) {\n schema.discriminator = { propertyName: collections[0].collection.discriminator };\n }\n\n return schema;\n }\n\n private convertCollection(collection: CmsModelFieldAstNodeCollection): JsonSchema {\n const { properties, required } = this.convertChildren(collection.children);\n\n properties[collection.collection.discriminator] = {\n const: collection.collection.id\n };\n\n const allRequired = [collection.collection.discriminator, ...required];\n\n const schema: JsonSchema = {\n type: \"object\",\n properties,\n required: allRequired\n };\n\n if (collection.collection.name) {\n schema.description = collection.collection.name;\n }\n\n return schema;\n }\n\n private buildFieldDescription(field: CmsModelField): string | undefined {\n const parts: string[] = [];\n\n if (field.label) {\n parts.push(field.label);\n }\n\n if (field.description) {\n parts.push(field.description);\n }\n\n if (field.help) {\n parts.push(field.help);\n }\n\n if (parts.length === 0) {\n return undefined;\n }\n\n return parts.join(\". \");\n }\n\n private buildModelDescription(\n model: Pick<CmsModel, \"name\" | \"description\">\n ): string | undefined {\n const parts: string[] = [];\n\n if (model.name) {\n parts.push(model.name);\n }\n\n if (model.description) {\n parts.push(model.description);\n }\n\n if (parts.length === 0) {\n return undefined;\n }\n\n return parts.join(\". \");\n }\n\n private extractValidationConstraints(\n validations: CmsModelFieldValidation[] | undefined\n ): ValidationConstraints {\n const constraints: ValidationConstraints = { required: false };\n\n if (!validations) {\n return constraints;\n }\n\n for (const v of validations) {\n switch (v.name) {\n case \"required\":\n constraints.required = true;\n break;\n case \"minLength\":\n if (v.settings?.value !== undefined) {\n constraints.minLength = Number(v.settings.value);\n }\n break;\n case \"maxLength\":\n if (v.settings?.value !== undefined) {\n constraints.maxLength = Number(v.settings.value);\n }\n break;\n case \"gte\":\n if (v.settings?.value !== undefined) {\n constraints.minimum = Number(v.settings.value);\n }\n break;\n case \"lte\":\n if (v.settings?.value !== undefined) {\n constraints.maximum = Number(v.settings.value);\n }\n break;\n case \"pattern\":\n if (v.settings?.preset === \"email\") {\n constraints.format = \"email\";\n } else if (v.settings?.preset === \"url\") {\n constraints.format = \"uri\";\n } else if (v.settings?.value !== undefined) {\n constraints.pattern = String(v.settings.value);\n }\n break;\n }\n }\n\n return constraints;\n }\n\n private applyValidationConstraints(\n schema: JsonSchema,\n validations: CmsModelFieldValidation[]\n ): void {\n const constraints = this.extractValidationConstraints(validations);\n\n if (constraints.minLength !== undefined) {\n schema.minLength = constraints.minLength;\n }\n if (constraints.maxLength !== undefined) {\n schema.maxLength = constraints.maxLength;\n }\n if (constraints.minimum !== undefined) {\n schema.minimum = constraints.minimum;\n }\n if (constraints.maximum !== undefined) {\n schema.maximum = constraints.maximum;\n }\n if (constraints.pattern !== undefined) {\n schema.pattern = constraints.pattern;\n }\n if (constraints.format !== undefined) {\n schema.format = constraints.format;\n }\n }\n\n private applyPredefinedValues(\n schema: JsonSchema,\n field: CmsModelField,\n parseAsNumber = false\n ): void {\n if (field.predefinedValues?.enabled !== true) {\n return;\n }\n\n const values = field.predefinedValues.values;\n if (!Array.isArray(values) || values.length === 0) {\n return;\n }\n\n schema.enum = values.map(v => (parseAsNumber ? Number(v.value) : v.value));\n }\n\n private wrapAsList(schema: JsonSchema, field: CmsModelField): JsonSchema {\n const listSchema: JsonSchema = {\n type: \"array\",\n items: schema\n };\n\n for (const v of field.listValidation || []) {\n if (v.name === \"minLength\" && v.settings?.value !== undefined) {\n listSchema.minLength = Number(v.settings.value);\n }\n if (v.name === \"maxLength\" && v.settings?.value !== undefined) {\n listSchema.maxLength = Number(v.settings.value);\n }\n }\n\n return listSchema;\n }\n\n private isHidden(field: CmsModelField): boolean {\n if (this.options.includeHiddenFields) {\n return false;\n }\n\n return field.renderer?.name === \"hidden\";\n }\n\n private childrenAreCollections(\n node: CmsModelFieldAstNodeField\n ): node is CmsModelFieldAstNodeField & { children: CmsModelFieldAstNodeCollection[] } {\n return node.children.length > 0 && node.children.every(c => c.type === \"collection\");\n }\n}\n"],"names":["CmsModelToJsonSchemaConverter","options","ast","model","properties","required","schema","description","node","field","children","child","constraints","_field","dateType","imagesOnly","models","modelIds","Array","m","modelIdProp","collections","oneOf","collection","allRequired","parts","validations","v","undefined","Number","String","parseAsNumber","values","listSchema","c"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export { CmsModelToJsonSchemaConverter } from "./CmsModelToJsonSchemaConverter.js";
2
+ export type { JsonSchema, CmsModelToJsonSchemaOptions } from "./types.js";
@@ -0,0 +1 @@
1
+ export { CmsModelToJsonSchemaConverter } from "./CmsModelToJsonSchemaConverter.js";