@webiny/api-headless-cms 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7

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 (873) hide show
  1. package/HeadlessCmsEndpointConfig.d.ts +10 -0
  2. package/HeadlessCmsEndpointConfig.js +5 -0
  3. package/HeadlessCmsEndpointConfig.js.map +1 -0
  4. package/HeadlessCmsFeature.d.ts +10 -0
  5. package/HeadlessCmsFeature.js +168 -0
  6. package/HeadlessCmsFeature.js.map +1 -0
  7. package/createCmsRoute.d.ts +24 -0
  8. package/createCmsRoute.js +47 -0
  9. package/createCmsRoute.js.map +1 -0
  10. package/crud/contentEntry/entryDataValidation.d.ts +1 -1
  11. package/crud/contentEntry/entryDataValidation.js +43 -22
  12. package/crud/contentEntry/entryDataValidation.js.map +1 -1
  13. package/crud/contentEntry/references/validateEntries.d.ts +1 -1
  14. package/crud/contentEntry/references/validateEntries.js +17 -7
  15. package/crud/contentEntry/references/validateEntries.js.map +1 -1
  16. package/crud/contentModel/defaultFields.js +3 -2
  17. package/crud/contentModel/defaultFields.js.map +1 -1
  18. package/domain/contentModel/schemas.d.ts +10 -6
  19. package/domain/contentModel/schemas.js +6 -3
  20. package/domain/contentModel/schemas.js.map +1 -1
  21. package/domain/contentModel/validation/dateExpressions.d.ts +6 -0
  22. package/domain/contentModel/validation/dateExpressions.js +27 -0
  23. package/domain/contentModel/validation/dateExpressions.js.map +1 -0
  24. package/domain/contentModel/validation/modelFields.js +23 -15
  25. package/domain/contentModel/validation/modelFields.js.map +1 -1
  26. package/export/abstractions.d.ts +9 -0
  27. package/export/abstractions.js +6 -0
  28. package/export/abstractions.js.map +1 -0
  29. package/export/crud/exporting.js +8 -2
  30. package/export/crud/exporting.js.map +1 -1
  31. package/export/crud/importing.js +13 -4
  32. package/export/crud/importing.js.map +1 -1
  33. package/export/crud/imports/importGroups.js +23 -23
  34. package/export/crud/imports/importGroups.js.map +1 -1
  35. package/export/crud/imports/importModels.js +25 -22
  36. package/export/crud/imports/importModels.js.map +1 -1
  37. package/export/graphql/index.d.ts +2 -3
  38. package/export/graphql/index.js +6 -10
  39. package/export/graphql/index.js.map +1 -1
  40. package/exports/api/cms/entry.d.ts +2 -0
  41. package/exports/api/cms/entry.js +2 -0
  42. package/exports/api/cms/model.d.ts +4 -1
  43. package/exports/api/cms/model.js +2 -0
  44. package/exports/api/cms/storage.d.ts +0 -1
  45. package/exports/api/cms/storage.js +0 -1
  46. package/features/ai/DescribeContentModelTool.d.ts +60 -0
  47. package/features/ai/DescribeContentModelTool.js +69 -0
  48. package/features/ai/DescribeContentModelTool.js.map +1 -0
  49. package/features/ai/ListContentModelsTool.d.ts +46 -0
  50. package/features/ai/ListContentModelsTool.js +53 -0
  51. package/features/ai/ListContentModelsTool.js.map +1 -0
  52. package/features/ai/QueryEntriesTool.d.ts +80 -0
  53. package/features/ai/QueryEntriesTool.js +99 -0
  54. package/features/ai/QueryEntriesTool.js.map +1 -0
  55. package/features/ai/feature.d.ts +8 -0
  56. package/features/ai/feature.js +15 -0
  57. package/features/ai/feature.js.map +1 -0
  58. package/features/ai/index.d.ts +4 -0
  59. package/features/ai/index.js +4 -0
  60. package/features/contentEntry/ContentEntriesFeature.js +6 -0
  61. package/features/contentEntry/ContentEntriesFeature.js.map +1 -1
  62. package/features/contentEntry/CreateEntry/CreateEntryRepository.d.ts +9 -5
  63. package/features/contentEntry/CreateEntry/CreateEntryRepository.js +13 -9
  64. package/features/contentEntry/CreateEntry/CreateEntryRepository.js.map +1 -1
  65. package/features/contentEntry/CreateEntry/CreateEntryUseCase.d.ts +5 -3
  66. package/features/contentEntry/CreateEntry/CreateEntryUseCase.js +5 -7
  67. package/features/contentEntry/CreateEntry/CreateEntryUseCase.js.map +1 -1
  68. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.d.ts +9 -5
  69. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js +13 -9
  70. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js.map +1 -1
  71. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.d.ts +5 -5
  72. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js +8 -17
  73. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js.map +1 -1
  74. package/features/contentEntry/CreateEntryRevisionFrom/abstractions.d.ts +2 -0
  75. package/features/contentEntry/CreateEntryRevisionFrom/abstractions.js.map +1 -1
  76. package/features/contentEntry/DeleteEntry/DeleteEntryRepository.d.ts +9 -5
  77. package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js +13 -9
  78. package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js.map +1 -1
  79. package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.d.ts +5 -3
  80. package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js +4 -5
  81. package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js.map +1 -1
  82. package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.d.ts +8 -4
  83. package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js +12 -9
  84. package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js.map +1 -1
  85. package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.d.ts +5 -3
  86. package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js +4 -5
  87. package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js.map +1 -1
  88. package/features/contentEntry/DeleteEntry/decorators/ForceDeleteDecorator.d.ts +3 -3
  89. package/features/contentEntry/DeleteEntry/decorators/ForceDeleteDecorator.js +5 -5
  90. package/features/contentEntry/DeleteEntry/decorators/ForceDeleteDecorator.js.map +1 -1
  91. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.d.ts +8 -4
  92. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js +14 -9
  93. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js.map +1 -1
  94. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.d.ts +5 -3
  95. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js +4 -5
  96. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js.map +1 -1
  97. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.d.ts +9 -5
  98. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js +12 -9
  99. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js.map +1 -1
  100. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.d.ts +5 -3
  101. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js +4 -5
  102. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js.map +1 -1
  103. package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.d.ts +17 -0
  104. package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.js +83 -0
  105. package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.js.map +1 -0
  106. package/features/contentEntry/DuplicateEntry/abstractions.d.ts +47 -0
  107. package/features/contentEntry/DuplicateEntry/abstractions.js +5 -0
  108. package/features/contentEntry/DuplicateEntry/abstractions.js.map +1 -0
  109. package/features/contentEntry/DuplicateEntry/events.d.ts +41 -0
  110. package/features/contentEntry/DuplicateEntry/events.js +32 -0
  111. package/features/contentEntry/DuplicateEntry/events.js.map +1 -0
  112. package/features/contentEntry/DuplicateEntry/feature.d.ts +4 -0
  113. package/features/contentEntry/DuplicateEntry/feature.js +11 -0
  114. package/features/contentEntry/DuplicateEntry/feature.js.map +1 -0
  115. package/features/contentEntry/DuplicateEntry/index.d.ts +2 -0
  116. package/features/contentEntry/DuplicateEntry/index.js +2 -0
  117. package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.d.ts +7 -0
  118. package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.js +12 -0
  119. package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.js.map +1 -0
  120. package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.d.ts +10 -0
  121. package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.js +25 -0
  122. package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.js.map +1 -0
  123. package/features/contentEntry/EntryEventPublisher/abstractions.d.ts +16 -0
  124. package/features/contentEntry/EntryEventPublisher/abstractions.js +5 -0
  125. package/features/contentEntry/EntryEventPublisher/abstractions.js.map +1 -0
  126. package/features/contentEntry/EntryEventPublisher/feature.d.ts +4 -0
  127. package/features/contentEntry/EntryEventPublisher/feature.js +11 -0
  128. package/features/contentEntry/EntryEventPublisher/feature.js.map +1 -0
  129. package/features/contentEntry/EntryEventPublisher/index.d.ts +2 -0
  130. package/features/contentEntry/EntryEventPublisher/index.js +2 -0
  131. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.d.ts +9 -7
  132. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js +12 -16
  133. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js.map +1 -1
  134. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsUseCase.d.ts +3 -1
  135. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsUseCase.js +2 -3
  136. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsUseCase.js.map +1 -1
  137. package/features/contentEntry/GetEntry/GetEntryUseCase.d.ts +3 -1
  138. package/features/contentEntry/GetEntry/GetEntryUseCase.js +2 -3
  139. package/features/contentEntry/GetEntry/GetEntryUseCase.js.map +1 -1
  140. package/features/contentEntry/GetEntryById/GetEntryByIdUseCase.d.ts +3 -1
  141. package/features/contentEntry/GetEntryById/GetEntryByIdUseCase.js +2 -3
  142. package/features/contentEntry/GetEntryById/GetEntryByIdUseCase.js.map +1 -1
  143. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.d.ts +9 -5
  144. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js +12 -9
  145. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js.map +1 -1
  146. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsUseCase.d.ts +3 -1
  147. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsUseCase.js +2 -3
  148. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsUseCase.js.map +1 -1
  149. package/features/contentEntry/GetLatestRevisionByEntryId/BaseUseCase.d.ts +3 -1
  150. package/features/contentEntry/GetLatestRevisionByEntryId/BaseUseCase.js +2 -3
  151. package/features/contentEntry/GetLatestRevisionByEntryId/BaseUseCase.js.map +1 -1
  152. package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.d.ts +9 -5
  153. package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js +12 -9
  154. package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js.map +1 -1
  155. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestDeletedRevisionByEntryIdUseCase.d.ts +3 -1
  156. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestDeletedRevisionByEntryIdUseCase.js +2 -3
  157. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestDeletedRevisionByEntryIdUseCase.js.map +1 -1
  158. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdIncludingDeletedUseCase.d.ts +3 -1
  159. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdIncludingDeletedUseCase.js +1 -3
  160. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdIncludingDeletedUseCase.js.map +1 -1
  161. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdUseCase.d.ts +3 -1
  162. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdUseCase.js +2 -3
  163. package/features/contentEntry/GetLatestRevisionByEntryId/variations/GetLatestRevisionByEntryIdUseCase.js.map +1 -1
  164. package/features/contentEntry/GetPreviousRevisionByEntryId/BaseUseCase.d.ts +3 -1
  165. package/features/contentEntry/GetPreviousRevisionByEntryId/BaseUseCase.js +2 -3
  166. package/features/contentEntry/GetPreviousRevisionByEntryId/BaseUseCase.js.map +1 -1
  167. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.d.ts +9 -5
  168. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js +12 -9
  169. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js.map +1 -1
  170. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdUseCase.d.ts +3 -1
  171. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdUseCase.js +2 -3
  172. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdUseCase.js.map +1 -1
  173. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.d.ts +9 -5
  174. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js +12 -9
  175. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js.map +1 -1
  176. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsUseCase.d.ts +3 -1
  177. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsUseCase.js +2 -3
  178. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsUseCase.js.map +1 -1
  179. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.d.ts +9 -5
  180. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js +12 -9
  181. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js.map +1 -1
  182. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdUseCase.d.ts +3 -1
  183. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdUseCase.js +2 -3
  184. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdUseCase.js.map +1 -1
  185. package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.d.ts +9 -5
  186. package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js +12 -9
  187. package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js.map +1 -1
  188. package/features/contentEntry/GetRevisionById/GetRevisionByIdUseCase.d.ts +3 -1
  189. package/features/contentEntry/GetRevisionById/GetRevisionByIdUseCase.js +1 -3
  190. package/features/contentEntry/GetRevisionById/GetRevisionByIdUseCase.js.map +1 -1
  191. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.d.ts +9 -5
  192. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js +12 -9
  193. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js.map +1 -1
  194. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdUseCase.d.ts +3 -1
  195. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdUseCase.js +2 -3
  196. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdUseCase.js.map +1 -1
  197. package/features/contentEntry/GetSingletonEntry/GetSingletonEntryUseCase.js +1 -3
  198. package/features/contentEntry/GetSingletonEntry/GetSingletonEntryUseCase.js.map +1 -1
  199. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.d.ts +9 -5
  200. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js +12 -9
  201. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js.map +1 -1
  202. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.d.ts +6 -2
  203. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js +8 -6
  204. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js.map +1 -1
  205. package/features/contentEntry/ListEntries/ListDeletedEntriesUseCase.d.ts +3 -1
  206. package/features/contentEntry/ListEntries/ListDeletedEntriesUseCase.js +1 -3
  207. package/features/contentEntry/ListEntries/ListDeletedEntriesUseCase.js.map +1 -1
  208. package/features/contentEntry/ListEntries/ListEntriesRepository.d.ts +9 -5
  209. package/features/contentEntry/ListEntries/ListEntriesRepository.js +12 -9
  210. package/features/contentEntry/ListEntries/ListEntriesRepository.js.map +1 -1
  211. package/features/contentEntry/ListEntries/ListEntriesUseCase.d.ts +3 -1
  212. package/features/contentEntry/ListEntries/ListEntriesUseCase.js +2 -3
  213. package/features/contentEntry/ListEntries/ListEntriesUseCase.js.map +1 -1
  214. package/features/contentEntry/ListEntries/ListLatestEntriesUseCase.d.ts +3 -1
  215. package/features/contentEntry/ListEntries/ListLatestEntriesUseCase.js +1 -3
  216. package/features/contentEntry/ListEntries/ListLatestEntriesUseCase.js.map +1 -1
  217. package/features/contentEntry/ListEntries/ListPublishedEntriesUseCase.d.ts +3 -1
  218. package/features/contentEntry/ListEntries/ListPublishedEntriesUseCase.js +1 -3
  219. package/features/contentEntry/ListEntries/ListPublishedEntriesUseCase.js.map +1 -1
  220. package/features/contentEntry/MoveEntry/MoveEntryRepository.d.ts +9 -5
  221. package/features/contentEntry/MoveEntry/MoveEntryRepository.js +12 -9
  222. package/features/contentEntry/MoveEntry/MoveEntryRepository.js.map +1 -1
  223. package/features/contentEntry/MoveEntry/MoveEntryUseCase.d.ts +5 -3
  224. package/features/contentEntry/MoveEntry/MoveEntryUseCase.js +4 -5
  225. package/features/contentEntry/MoveEntry/MoveEntryUseCase.js.map +1 -1
  226. package/features/contentEntry/PublishEntry/PublishEntryRepository.d.ts +9 -5
  227. package/features/contentEntry/PublishEntry/PublishEntryRepository.js +13 -9
  228. package/features/contentEntry/PublishEntry/PublishEntryRepository.js.map +1 -1
  229. package/features/contentEntry/PublishEntry/PublishEntryUseCase.d.ts +7 -7
  230. package/features/contentEntry/PublishEntry/PublishEntryUseCase.js +13 -16
  231. package/features/contentEntry/PublishEntry/PublishEntryUseCase.js.map +1 -1
  232. package/features/contentEntry/PublishEntry/abstractions.d.ts +8 -1
  233. package/features/contentEntry/PublishEntry/abstractions.js.map +1 -1
  234. package/features/contentEntry/RepublishEntry/RepublishEntryRepository.d.ts +11 -5
  235. package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js +17 -10
  236. package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js.map +1 -1
  237. package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.d.ts +5 -3
  238. package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js +7 -6
  239. package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js.map +1 -1
  240. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.d.ts +9 -5
  241. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js +13 -9
  242. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js.map +1 -1
  243. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.d.ts +5 -3
  244. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js +4 -5
  245. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js.map +1 -1
  246. package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.d.ts +9 -5
  247. package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js +13 -9
  248. package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js.map +1 -1
  249. package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.d.ts +5 -3
  250. package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js +7 -6
  251. package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js.map +1 -1
  252. package/features/contentEntry/UpdateEntry/UpdateEntryRepository.d.ts +9 -5
  253. package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js +13 -9
  254. package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js.map +1 -1
  255. package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.d.ts +5 -3
  256. package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js +7 -6
  257. package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js.map +1 -1
  258. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.d.ts +6 -9
  259. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js +7 -17
  260. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js.map +1 -1
  261. package/features/contentEntry/ValidateEntry/ValidateEntryUseCase.d.ts +3 -1
  262. package/features/contentEntry/ValidateEntry/ValidateEntryUseCase.js +2 -3
  263. package/features/contentEntry/ValidateEntry/ValidateEntryUseCase.js.map +1 -1
  264. package/features/contentEntry/ensureItemIds.d.ts +13 -0
  265. package/features/contentEntry/ensureItemIds.js +22 -0
  266. package/features/contentEntry/ensureItemIds.js.map +1 -0
  267. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.d.ts +6 -2
  268. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js +10 -6
  269. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js.map +1 -1
  270. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.d.ts +10 -6
  271. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js +49 -20
  272. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js.map +1 -1
  273. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.d.ts +17 -1
  274. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.js.map +1 -1
  275. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.d.ts +8 -4
  276. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js +23 -18
  277. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js.map +1 -1
  278. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.d.ts +15 -1
  279. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.js.map +1 -1
  280. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.d.ts +8 -4
  281. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js +18 -15
  282. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js.map +1 -1
  283. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.d.ts +13 -1
  284. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.js.map +1 -1
  285. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.d.ts +9 -7
  286. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js +18 -20
  287. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js.map +1 -1
  288. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.d.ts +14 -2
  289. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.js.map +1 -1
  290. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.d.ts +10 -4
  291. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js +74 -32
  292. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js.map +1 -1
  293. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.d.ts +15 -1
  294. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.js.map +1 -1
  295. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.d.ts +24 -0
  296. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js +13 -0
  297. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js.map +1 -0
  298. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.d.ts +14 -0
  299. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js +32 -0
  300. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js.map +1 -0
  301. package/features/contentModel/ComponentMapGenerator/abstractions.d.ts +8 -0
  302. package/features/contentModel/ComponentMapGenerator/abstractions.js +5 -0
  303. package/features/contentModel/ComponentMapGenerator/abstractions.js.map +1 -0
  304. package/features/contentModel/ComponentMapGenerator/feature.d.ts +4 -0
  305. package/features/contentModel/ComponentMapGenerator/feature.js +11 -0
  306. package/features/contentModel/ComponentMapGenerator/feature.js.map +1 -0
  307. package/features/contentModel/ComponentMapGenerator/index.d.ts +2 -0
  308. package/features/contentModel/ComponentMapGenerator/index.js +2 -0
  309. package/features/contentModel/ContentModelFeature.js +6 -0
  310. package/features/contentModel/ContentModelFeature.js.map +1 -1
  311. package/features/contentModel/CreateModel/CreateModelRepository.d.ts +4 -3
  312. package/features/contentModel/CreateModel/CreateModelRepository.js +6 -5
  313. package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
  314. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.d.ts +4 -3
  315. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +6 -5
  316. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
  317. package/features/contentModel/DeleteModel/DeleteModelRepository.d.ts +6 -4
  318. package/features/contentModel/DeleteModel/DeleteModelRepository.js +10 -6
  319. package/features/contentModel/DeleteModel/DeleteModelRepository.js.map +1 -1
  320. package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.d.ts +9 -3
  321. package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js +36 -18
  322. package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js.map +1 -1
  323. package/features/contentModel/ModelToAstConverter/ModelToAstConverter.d.ts +1 -1
  324. package/features/contentModel/ModelToAstConverter/ModelToAstConverter.js.map +1 -1
  325. package/features/contentModel/ModelToAstConverter/abstractions.d.ts +1 -1
  326. package/features/contentModel/ModelToAstConverter/abstractions.js.map +1 -1
  327. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.d.ts +19 -0
  328. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js +56 -0
  329. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js.map +1 -0
  330. package/features/contentModel/RefModelsGenerator/abstractions.d.ts +11 -0
  331. package/features/contentModel/RefModelsGenerator/abstractions.js +5 -0
  332. package/features/contentModel/RefModelsGenerator/abstractions.js.map +1 -0
  333. package/features/contentModel/RefModelsGenerator/feature.d.ts +4 -0
  334. package/features/contentModel/RefModelsGenerator/feature.js +11 -0
  335. package/features/contentModel/RefModelsGenerator/feature.js.map +1 -0
  336. package/features/contentModel/RefModelsGenerator/index.d.ts +2 -0
  337. package/features/contentModel/RefModelsGenerator/index.js +2 -0
  338. package/features/contentModel/UpdateModel/UpdateModelRepository.d.ts +9 -4
  339. package/features/contentModel/UpdateModel/UpdateModelRepository.js +17 -9
  340. package/features/contentModel/UpdateModel/UpdateModelRepository.js.map +1 -1
  341. package/features/contentModel/UpdateModel/UpdateModelUseCase.js +2 -2
  342. package/features/contentModel/UpdateModel/UpdateModelUseCase.js.map +1 -1
  343. package/features/contentModel/UpdateModel/abstractions.d.ts +1 -1
  344. package/features/contentModel/UpdateModel/abstractions.js.map +1 -1
  345. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.d.ts +16 -0
  346. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +54 -0
  347. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js.map +1 -0
  348. package/features/contentModel/ValuesSelectionGenerator/abstractions.d.ts +8 -0
  349. package/features/contentModel/ValuesSelectionGenerator/abstractions.js +5 -0
  350. package/features/contentModel/ValuesSelectionGenerator/abstractions.js.map +1 -0
  351. package/features/contentModel/ValuesSelectionGenerator/feature.d.ts +4 -0
  352. package/features/contentModel/ValuesSelectionGenerator/feature.js +11 -0
  353. package/features/contentModel/ValuesSelectionGenerator/feature.js.map +1 -0
  354. package/features/contentModel/ValuesSelectionGenerator/index.d.ts +1 -0
  355. package/features/contentModel/ValuesSelectionGenerator/index.js +1 -0
  356. package/features/contentModel/shared/ModelsFetcher.d.ts +9 -8
  357. package/features/contentModel/shared/ModelsFetcher.js +5 -5
  358. package/features/contentModel/shared/ModelsFetcher.js.map +1 -1
  359. package/features/contentModel/shared/PluginModelsProvider.d.ts +9 -5
  360. package/features/contentModel/shared/PluginModelsProvider.js +11 -15
  361. package/features/contentModel/shared/PluginModelsProvider.js.map +1 -1
  362. package/features/contentModel/shared/abstractions.d.ts +10 -0
  363. package/features/contentModel/shared/abstractions.js +2 -1
  364. package/features/contentModel/shared/abstractions.js.map +1 -1
  365. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.d.ts +10 -4
  366. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js +18 -14
  367. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js.map +1 -1
  368. package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.d.ts +3 -1
  369. package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.js +2 -3
  370. package/features/contentModelGroup/CreateGroup/CreateGroupUseCase.js.map +1 -1
  371. package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.d.ts +11 -5
  372. package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js +16 -10
  373. package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js.map +1 -1
  374. package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.d.ts +3 -1
  375. package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.js +2 -3
  376. package/features/contentModelGroup/DeleteGroup/DeleteGroupUseCase.js.map +1 -1
  377. package/features/contentModelGroup/GetGroup/GetGroupRepository.d.ts +6 -4
  378. package/features/contentModelGroup/GetGroup/GetGroupRepository.js +9 -9
  379. package/features/contentModelGroup/GetGroup/GetGroupRepository.js.map +1 -1
  380. package/features/contentModelGroup/GetGroup/GetGroupUseCase.d.ts +3 -1
  381. package/features/contentModelGroup/GetGroup/GetGroupUseCase.js +2 -3
  382. package/features/contentModelGroup/GetGroup/GetGroupUseCase.js.map +1 -1
  383. package/features/contentModelGroup/ListGroups/ListGroupsRepository.d.ts +6 -4
  384. package/features/contentModelGroup/ListGroups/ListGroupsRepository.js +9 -9
  385. package/features/contentModelGroup/ListGroups/ListGroupsRepository.js.map +1 -1
  386. package/features/contentModelGroup/ListGroups/ListGroupsUseCase.d.ts +3 -1
  387. package/features/contentModelGroup/ListGroups/ListGroupsUseCase.js +2 -3
  388. package/features/contentModelGroup/ListGroups/ListGroupsUseCase.js.map +1 -1
  389. package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.d.ts +9 -5
  390. package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js +13 -10
  391. package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js.map +1 -1
  392. package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.d.ts +3 -1
  393. package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js +4 -5
  394. package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js.map +1 -1
  395. package/features/contentModelGroup/UpdateGroup/abstractions.d.ts +1 -1
  396. package/features/contentModelGroup/UpdateGroup/abstractions.js.map +1 -1
  397. package/features/contentModelGroup/shared/PluginGroupsProvider.d.ts +6 -4
  398. package/features/contentModelGroup/shared/PluginGroupsProvider.js +13 -11
  399. package/features/contentModelGroup/shared/PluginGroupsProvider.js.map +1 -1
  400. package/features/contentModelGroup/shared/abstractions.d.ts +10 -0
  401. package/features/contentModelGroup/shared/abstractions.js +2 -1
  402. package/features/contentModelGroup/shared/abstractions.js.map +1 -1
  403. package/features/graphql/feature.js +2 -0
  404. package/features/graphql/feature.js.map +1 -1
  405. package/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.d.ts +2 -2
  406. package/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js.map +1 -1
  407. package/features/graphql/fields/base/AssetToGraphQL.d.ts +26 -0
  408. package/features/graphql/fields/base/AssetToGraphQL.js +153 -0
  409. package/features/graphql/fields/base/AssetToGraphQL.js.map +1 -0
  410. package/features/graphql/fields/base/DynamicZoneToGraphQL.js +12 -2
  411. package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
  412. package/features/graphql/fields/base/ObjectToGraphQL.js +8 -5
  413. package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -1
  414. package/features/graphql/fields/base/RefToGraphQL.d.ts +1 -1
  415. package/features/graphql/fields/base/RefToGraphQL.js +25 -9
  416. package/features/graphql/fields/base/RefToGraphQL.js.map +1 -1
  417. package/features/graphql/fields/base/richText/richTextResolver.d.ts +1 -1
  418. package/features/graphql/fields/base/richText/richTextResolver.js.map +1 -1
  419. package/features/modelBuilder/abstractions.d.ts +13 -0
  420. package/features/modelBuilder/abstractions.js.map +1 -1
  421. package/features/modelBuilder/feature.js +3 -8
  422. package/features/modelBuilder/feature.js.map +1 -1
  423. package/features/modelBuilder/fields/AssetFieldType.d.ts +20 -0
  424. package/features/modelBuilder/fields/AssetFieldType.js +46 -0
  425. package/features/modelBuilder/fields/AssetFieldType.js.map +1 -0
  426. package/features/modelBuilder/fields/BaseFieldBuilder.d.ts +3 -1
  427. package/features/modelBuilder/fields/BaseFieldBuilder.js +4 -0
  428. package/features/modelBuilder/fields/BaseFieldBuilder.js.map +1 -1
  429. package/features/modelBuilder/fields/DataFieldBuilder.d.ts +71 -18
  430. package/features/modelBuilder/fields/DataFieldBuilder.js +11 -1
  431. package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
  432. package/features/modelBuilder/fields/DateTimeFieldType.js +27 -12
  433. package/features/modelBuilder/fields/DateTimeFieldType.js.map +1 -1
  434. package/features/modelBuilder/fields/DynamicZoneFieldType.d.ts +1 -0
  435. package/features/modelBuilder/fields/DynamicZoneFieldType.js +10 -9
  436. package/features/modelBuilder/fields/DynamicZoneFieldType.js.map +1 -1
  437. package/features/modelBuilder/fields/TextFieldType.d.ts +3 -1
  438. package/features/modelBuilder/fields/TextFieldType.js +1 -3
  439. package/features/modelBuilder/fields/TextFieldType.js.map +1 -1
  440. package/features/modelBuilder/fields/UiAlertFieldType.js +2 -1
  441. package/features/modelBuilder/fields/UiAlertFieldType.js.map +1 -1
  442. package/features/modelBuilder/fields/UiSeparatorFieldType.js +2 -1
  443. package/features/modelBuilder/fields/UiSeparatorFieldType.js.map +1 -1
  444. package/features/modelBuilder/fields/UiTabsFieldType.d.ts +2 -1
  445. package/features/modelBuilder/fields/UiTabsFieldType.js +6 -3
  446. package/features/modelBuilder/fields/UiTabsFieldType.js.map +1 -1
  447. package/features/modelBuilder/fields/fieldTypeValidator.d.ts +5 -3
  448. package/features/modelBuilder/fields/resolveAssetUrl.d.ts +35 -0
  449. package/features/modelBuilder/fields/resolveAssetUrl.js +26 -0
  450. package/features/modelBuilder/fields/resolveAssetUrl.js.map +1 -0
  451. package/features/modelBuilder/index.d.ts +1 -1
  452. package/features/modelBuilder/models/BaseModelBuilder.d.ts +3 -1
  453. package/features/modelBuilder/models/BaseModelBuilder.js +7 -0
  454. package/features/modelBuilder/models/BaseModelBuilder.js.map +1 -1
  455. package/features/modelBuilder/models/ModelBuilder.d.ts +8 -0
  456. package/features/modelBuilder/models/ModelBuilder.js +1 -0
  457. package/features/modelBuilder/models/ModelBuilder.js.map +1 -1
  458. package/features/modelBuilder/models/ModelsProvider.d.ts +1 -3
  459. package/features/modelBuilder/models/ModelsProvider.js +2 -7
  460. package/features/modelBuilder/models/ModelsProvider.js.map +1 -1
  461. package/features/modelBuilder/models/PrivateModelBuilder.d.ts +5 -0
  462. package/features/modelBuilder/models/PrivateModelBuilder.js +13 -1
  463. package/features/modelBuilder/models/PrivateModelBuilder.js.map +1 -1
  464. package/features/modelBuilder/models/PublicModelBuilder.js +2 -1
  465. package/features/modelBuilder/models/PublicModelBuilder.js.map +1 -1
  466. package/features/runtimeTenant/RuntimeTenant.d.ts +13 -0
  467. package/features/runtimeTenant/RuntimeTenant.js +22 -0
  468. package/features/runtimeTenant/RuntimeTenant.js.map +1 -0
  469. package/features/runtimeTenant/abstractions.d.ts +11 -0
  470. package/features/runtimeTenant/abstractions.js +5 -0
  471. package/features/runtimeTenant/abstractions.js.map +1 -0
  472. package/features/runtimeTenant/index.d.ts +2 -0
  473. package/features/runtimeTenant/index.js +2 -0
  474. package/features/shared/abstractions.d.ts +8 -16
  475. package/features/shared/abstractions.js +2 -3
  476. package/features/shared/abstractions.js.map +1 -1
  477. package/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.d.ts +8 -0
  478. package/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js +5 -0
  479. package/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js.map +1 -0
  480. package/features/shared/storageOperations/entry/CreateEntryStorageOperation.d.ts +8 -0
  481. package/features/shared/storageOperations/entry/CreateEntryStorageOperation.js +5 -0
  482. package/features/shared/storageOperations/entry/CreateEntryStorageOperation.js.map +1 -0
  483. package/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.d.ts +8 -0
  484. package/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js +5 -0
  485. package/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js.map +1 -0
  486. package/features/shared/storageOperations/entry/DeleteEntryStorageOperation.d.ts +8 -0
  487. package/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js +5 -0
  488. package/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js.map +1 -0
  489. package/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.d.ts +8 -0
  490. package/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js +5 -0
  491. package/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js.map +1 -0
  492. package/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.d.ts +8 -0
  493. package/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js +5 -0
  494. package/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js.map +1 -0
  495. package/features/shared/storageOperations/entry/GetEntryStorageOperation.d.ts +8 -0
  496. package/features/shared/storageOperations/entry/GetEntryStorageOperation.js +5 -0
  497. package/features/shared/storageOperations/entry/GetEntryStorageOperation.js.map +1 -0
  498. package/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.d.ts +8 -0
  499. package/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js +5 -0
  500. package/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js.map +1 -0
  501. package/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.d.ts +8 -0
  502. package/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js +5 -0
  503. package/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js.map +1 -0
  504. package/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.d.ts +8 -0
  505. package/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js +5 -0
  506. package/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js.map +1 -0
  507. package/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.d.ts +8 -0
  508. package/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js +5 -0
  509. package/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js.map +1 -0
  510. package/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.d.ts +8 -0
  511. package/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js +5 -0
  512. package/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js.map +1 -0
  513. package/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.d.ts +8 -0
  514. package/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js +5 -0
  515. package/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js.map +1 -0
  516. package/features/shared/storageOperations/entry/GetRevisionsStorageOperation.d.ts +8 -0
  517. package/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js +5 -0
  518. package/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js.map +1 -0
  519. package/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.d.ts +8 -0
  520. package/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js +5 -0
  521. package/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js.map +1 -0
  522. package/features/shared/storageOperations/entry/ListEntriesStorageOperation.d.ts +8 -0
  523. package/features/shared/storageOperations/entry/ListEntriesStorageOperation.js +5 -0
  524. package/features/shared/storageOperations/entry/ListEntriesStorageOperation.js.map +1 -0
  525. package/features/shared/storageOperations/entry/MoveEntryStorageOperation.d.ts +8 -0
  526. package/features/shared/storageOperations/entry/MoveEntryStorageOperation.js +5 -0
  527. package/features/shared/storageOperations/entry/MoveEntryStorageOperation.js.map +1 -0
  528. package/features/shared/storageOperations/entry/MoveToBinStorageOperation.d.ts +8 -0
  529. package/features/shared/storageOperations/entry/MoveToBinStorageOperation.js +5 -0
  530. package/features/shared/storageOperations/entry/MoveToBinStorageOperation.js.map +1 -0
  531. package/features/shared/storageOperations/entry/PublishEntryStorageOperation.d.ts +8 -0
  532. package/features/shared/storageOperations/entry/PublishEntryStorageOperation.js +5 -0
  533. package/features/shared/storageOperations/entry/PublishEntryStorageOperation.js.map +1 -0
  534. package/features/shared/storageOperations/entry/RestoreFromBinStorageOperation.d.ts +8 -0
  535. package/features/shared/storageOperations/entry/RestoreFromBinStorageOperation.js +5 -0
  536. package/features/shared/storageOperations/entry/RestoreFromBinStorageOperation.js.map +1 -0
  537. package/features/shared/storageOperations/entry/UnpublishEntryStorageOperation.d.ts +8 -0
  538. package/features/shared/storageOperations/entry/UnpublishEntryStorageOperation.js +5 -0
  539. package/features/shared/storageOperations/entry/UnpublishEntryStorageOperation.js.map +1 -0
  540. package/features/shared/storageOperations/entry/UpdateEntryStorageOperation.d.ts +8 -0
  541. package/features/shared/storageOperations/entry/UpdateEntryStorageOperation.js +5 -0
  542. package/features/shared/storageOperations/entry/UpdateEntryStorageOperation.js.map +1 -0
  543. package/features/shared/storageOperations/group/CreateGroupStorageOperation.d.ts +8 -0
  544. package/features/shared/storageOperations/group/CreateGroupStorageOperation.js +5 -0
  545. package/features/shared/storageOperations/group/CreateGroupStorageOperation.js.map +1 -0
  546. package/features/shared/storageOperations/group/DeleteGroupStorageOperation.d.ts +8 -0
  547. package/features/shared/storageOperations/group/DeleteGroupStorageOperation.js +5 -0
  548. package/features/shared/storageOperations/group/DeleteGroupStorageOperation.js.map +1 -0
  549. package/features/shared/storageOperations/group/GetGroupStorageOperation.d.ts +8 -0
  550. package/features/shared/storageOperations/group/GetGroupStorageOperation.js +5 -0
  551. package/features/shared/storageOperations/group/GetGroupStorageOperation.js.map +1 -0
  552. package/features/shared/storageOperations/group/ListGroupsStorageOperation.d.ts +8 -0
  553. package/features/shared/storageOperations/group/ListGroupsStorageOperation.js +5 -0
  554. package/features/shared/storageOperations/group/ListGroupsStorageOperation.js.map +1 -0
  555. package/features/shared/storageOperations/group/UpdateGroupStorageOperation.d.ts +8 -0
  556. package/features/shared/storageOperations/group/UpdateGroupStorageOperation.js +5 -0
  557. package/features/shared/storageOperations/group/UpdateGroupStorageOperation.js.map +1 -0
  558. package/features/shared/storageOperations/index.d.ts +32 -0
  559. package/features/shared/storageOperations/index.js +32 -0
  560. package/features/shared/storageOperations/model/CreateModelStorageOperation.d.ts +8 -0
  561. package/features/shared/storageOperations/model/CreateModelStorageOperation.js +5 -0
  562. package/features/shared/storageOperations/model/CreateModelStorageOperation.js.map +1 -0
  563. package/features/shared/storageOperations/model/DeleteModelStorageOperation.d.ts +8 -0
  564. package/features/shared/storageOperations/model/DeleteModelStorageOperation.js +5 -0
  565. package/features/shared/storageOperations/model/DeleteModelStorageOperation.js.map +1 -0
  566. package/features/shared/storageOperations/model/GetModelStorageOperation.d.ts +8 -0
  567. package/features/shared/storageOperations/model/GetModelStorageOperation.js +5 -0
  568. package/features/shared/storageOperations/model/GetModelStorageOperation.js.map +1 -0
  569. package/features/shared/storageOperations/model/ListModelsStorageOperation.d.ts +8 -0
  570. package/features/shared/storageOperations/model/ListModelsStorageOperation.js +5 -0
  571. package/features/shared/storageOperations/model/ListModelsStorageOperation.js.map +1 -0
  572. package/features/shared/storageOperations/model/UpdateModelStorageOperation.d.ts +8 -0
  573. package/features/shared/storageOperations/model/UpdateModelStorageOperation.js +5 -0
  574. package/features/shared/storageOperations/model/UpdateModelStorageOperation.js.map +1 -0
  575. package/features/sortMapper/SortMapper.js +2 -5
  576. package/features/sortMapper/SortMapper.js.map +1 -1
  577. package/features/storage/fields/ObjectStorageTransform.js +27 -7
  578. package/features/storage/fields/ObjectStorageTransform.js.map +1 -1
  579. package/features/validation/abstractions/CmsModelFieldValidator.d.ts +5 -0
  580. package/features/validation/abstractions/CmsModelFieldValidator.js.map +1 -1
  581. package/features/validation/validators/DateGteValidator.d.ts +2 -0
  582. package/features/validation/validators/DateGteValidator.js +12 -2
  583. package/features/validation/validators/DateGteValidator.js.map +1 -1
  584. package/features/validation/validators/DateLteValidator.d.ts +2 -0
  585. package/features/validation/validators/DateLteValidator.js +12 -2
  586. package/features/validation/validators/DateLteValidator.js.map +1 -1
  587. package/features/validation/validators/PatternValidator.js +1 -1
  588. package/features/validation/validators/PatternValidator.js.map +1 -1
  589. package/features/validation/validators/dateLimit.d.ts +9 -0
  590. package/features/validation/validators/dateLimit.js +18 -0
  591. package/features/validation/validators/dateLimit.js.map +1 -0
  592. package/features/whereMapper/WhereMapper.js +7 -5
  593. package/features/whereMapper/WhereMapper.js.map +1 -1
  594. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +15 -5
  595. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
  596. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +8 -2
  597. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
  598. package/fieldConverters/abstractions.d.ts +14 -0
  599. package/fieldConverters/abstractions.js +13 -0
  600. package/fieldConverters/abstractions.js.map +1 -0
  601. package/fieldConverters/index.d.ts +1 -1
  602. package/graphql/CmsGraphQLSchemaFactory.d.ts +8 -0
  603. package/graphql/CmsGraphQLSchemaFactory.js +5 -0
  604. package/graphql/CmsGraphQLSchemaFactory.js.map +1 -0
  605. package/graphql/CmsSchemaExecutor.d.ts +10 -0
  606. package/graphql/CmsSchemaExecutor.js +5 -0
  607. package/graphql/CmsSchemaExecutor.js.map +1 -0
  608. package/graphql/buildSchemaPlugins.d.ts +2 -1
  609. package/graphql/buildSchemaPlugins.js +1 -3
  610. package/graphql/buildSchemaPlugins.js.map +1 -1
  611. package/graphql/checkEndpointAccess.js +5 -2
  612. package/graphql/checkEndpointAccess.js.map +1 -1
  613. package/graphql/createExecutableSchema.d.ts +1 -1
  614. package/graphql/createExecutableSchema.js +1 -1
  615. package/graphql/createExecutableSchema.js.map +1 -1
  616. package/graphql/generateSchema.d.ts +2 -1
  617. package/graphql/generateSchema.js +14 -5
  618. package/graphql/generateSchema.js.map +1 -1
  619. package/graphql/getSchema.js +7 -2
  620. package/graphql/getSchema.js.map +1 -1
  621. package/graphql/scalars/RevisionIdScalarPlugin.d.ts +1 -1
  622. package/graphql/scalars/RevisionIdScalarPlugin.js.map +1 -1
  623. package/graphql/schema/baseContentSchema.d.ts +1 -6
  624. package/graphql/schema/baseContentSchema.js +5 -8
  625. package/graphql/schema/baseContentSchema.js.map +1 -1
  626. package/graphql/schema/baseSchema.d.ts +2 -2
  627. package/graphql/schema/baseSchema.js +6 -41
  628. package/graphql/schema/baseSchema.js.map +1 -1
  629. package/graphql/schema/cms/CmsBaseErrorTypeFactory.d.ts +15 -0
  630. package/graphql/schema/cms/CmsBaseErrorTypeFactory.js +25 -0
  631. package/graphql/schema/cms/CmsBaseErrorTypeFactory.js.map +1 -0
  632. package/graphql/schema/cms/createEntryResolver.js +2 -2
  633. package/graphql/schema/cms/createEntryResolver.js.map +1 -1
  634. package/graphql/schema/cms/deleteEntryResolver.js +2 -2
  635. package/graphql/schema/cms/deleteEntryResolver.js.map +1 -1
  636. package/graphql/schema/cms/getEntryResolver.js +5 -4
  637. package/graphql/schema/cms/getEntryResolver.js.map +1 -1
  638. package/graphql/schema/cms/getModelResolver.d.ts +35 -0
  639. package/graphql/schema/cms/getModelResolver.js +49 -0
  640. package/graphql/schema/cms/getModelResolver.js.map +1 -0
  641. package/graphql/schema/cms/helpers/buildFieldsSelection.js +9 -2
  642. package/graphql/schema/cms/helpers/buildFieldsSelection.js.map +1 -1
  643. package/graphql/schema/cms/helpers/expandFieldWildcards.d.ts +2 -0
  644. package/graphql/schema/cms/helpers/expandFieldWildcards.js +13 -0
  645. package/graphql/schema/cms/helpers/expandFieldWildcards.js.map +1 -0
  646. package/graphql/schema/cms/helpers/getModel.d.ts +0 -3
  647. package/graphql/schema/cms/helpers/getModel.js +5 -3
  648. package/graphql/schema/cms/helpers/getModel.js.map +1 -1
  649. package/graphql/schema/cms/helpers/index.d.ts +1 -0
  650. package/graphql/schema/cms/helpers/index.js +1 -0
  651. package/graphql/schema/cms/helpers/transformWhereToNested.js +39 -17
  652. package/graphql/schema/cms/helpers/transformWhereToNested.js.map +1 -1
  653. package/graphql/schema/cms/helpers.d.ts +1 -0
  654. package/graphql/schema/cms/helpers.js +1 -0
  655. package/graphql/schema/cms/listEntriesResolver.js +5 -4
  656. package/graphql/schema/cms/listEntriesResolver.js.map +1 -1
  657. package/graphql/schema/cms/publishEntryResolver.js +2 -2
  658. package/graphql/schema/cms/publishEntryResolver.js.map +1 -1
  659. package/graphql/schema/cms/resolvers/createEntry.d.ts +3 -2
  660. package/graphql/schema/cms/resolvers/createEntry.js +5 -1
  661. package/graphql/schema/cms/resolvers/createEntry.js.map +1 -1
  662. package/graphql/schema/cms/resolvers/deleteEntryRevision.d.ts +3 -2
  663. package/graphql/schema/cms/resolvers/deleteEntryRevision.js +5 -1
  664. package/graphql/schema/cms/resolvers/deleteEntryRevision.js.map +1 -1
  665. package/graphql/schema/cms/resolvers/getEntry.d.ts +3 -2
  666. package/graphql/schema/cms/resolvers/getEntry.js +5 -1
  667. package/graphql/schema/cms/resolvers/getEntry.js.map +1 -1
  668. package/graphql/schema/cms/resolvers/getModel.d.ts +9 -0
  669. package/graphql/schema/cms/resolvers/getModel.js +22 -0
  670. package/graphql/schema/cms/resolvers/getModel.js.map +1 -0
  671. package/graphql/schema/cms/resolvers/index.d.ts +1 -0
  672. package/graphql/schema/cms/resolvers/index.js +1 -0
  673. package/graphql/schema/cms/resolvers/listEntries.d.ts +3 -2
  674. package/graphql/schema/cms/resolvers/listEntries.js +5 -1
  675. package/graphql/schema/cms/resolvers/listEntries.js.map +1 -1
  676. package/graphql/schema/cms/resolvers/mutationCms.d.ts +3 -2
  677. package/graphql/schema/cms/resolvers/mutationCms.js +5 -1
  678. package/graphql/schema/cms/resolvers/mutationCms.js.map +1 -1
  679. package/graphql/schema/cms/resolvers/publishEntryRevision.d.ts +3 -2
  680. package/graphql/schema/cms/resolvers/publishEntryRevision.js +5 -1
  681. package/graphql/schema/cms/resolvers/publishEntryRevision.js.map +1 -1
  682. package/graphql/schema/cms/resolvers/queryCms.d.ts +3 -2
  683. package/graphql/schema/cms/resolvers/queryCms.js +5 -1
  684. package/graphql/schema/cms/resolvers/queryCms.js.map +1 -1
  685. package/graphql/schema/cms/resolvers/unpublishEntryRevision.d.ts +3 -2
  686. package/graphql/schema/cms/resolvers/unpublishEntryRevision.js +5 -1
  687. package/graphql/schema/cms/resolvers/unpublishEntryRevision.js.map +1 -1
  688. package/graphql/schema/cms/resolvers/updateEntryRevision.d.ts +3 -2
  689. package/graphql/schema/cms/resolvers/updateEntryRevision.js +5 -1
  690. package/graphql/schema/cms/resolvers/updateEntryRevision.js.map +1 -1
  691. package/graphql/schema/cms/typeDefs/mutation.d.ts +3 -2
  692. package/graphql/schema/cms/typeDefs/mutation.js +5 -1
  693. package/graphql/schema/cms/typeDefs/mutation.js.map +1 -1
  694. package/graphql/schema/cms/typeDefs/query.d.ts +3 -2
  695. package/graphql/schema/cms/typeDefs/query.js +6 -1
  696. package/graphql/schema/cms/typeDefs/query.js.map +1 -1
  697. package/graphql/schema/cms/typeDefs/responses.d.ts +3 -2
  698. package/graphql/schema/cms/typeDefs/responses.js +10 -1
  699. package/graphql/schema/cms/typeDefs/responses.js.map +1 -1
  700. package/graphql/schema/cms/unpublishEntryResolver.js +2 -2
  701. package/graphql/schema/cms/unpublishEntryResolver.js.map +1 -1
  702. package/graphql/schema/cms/updateEntryResolver.js +2 -2
  703. package/graphql/schema/cms/updateEntryResolver.js.map +1 -1
  704. package/graphql/schema/contentEntries.js +60 -34
  705. package/graphql/schema/contentEntries.js.map +1 -1
  706. package/graphql/schema/contentModelGroups.js +39 -18
  707. package/graphql/schema/contentModelGroups.js.map +1 -1
  708. package/graphql/schema/contentModels.js +70 -16
  709. package/graphql/schema/contentModels.js.map +1 -1
  710. package/graphql/schema/createFieldResolvers.d.ts +1 -1
  711. package/graphql/schema/createFieldResolvers.js.map +1 -1
  712. package/graphql/schema/createManageResolvers.js +7 -3
  713. package/graphql/schema/createManageResolvers.js.map +1 -1
  714. package/graphql/schema/createManageSDL.js +2 -0
  715. package/graphql/schema/createManageSDL.js.map +1 -1
  716. package/graphql/schema/createSingularSDL.js +2 -0
  717. package/graphql/schema/createSingularSDL.js.map +1 -1
  718. package/graphql/schema/resolvers/manage/resolveCreate.js +5 -3
  719. package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
  720. package/graphql/schema/resolvers/manage/resolveCreateFrom.js +5 -3
  721. package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
  722. package/graphql/schema/resolvers/manage/resolveDelete.js +9 -4
  723. package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
  724. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js +5 -3
  725. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -1
  726. package/graphql/schema/resolvers/manage/resolveDuplicate.d.ts +7 -0
  727. package/graphql/schema/resolvers/manage/resolveDuplicate.js +11 -0
  728. package/graphql/schema/resolvers/manage/resolveDuplicate.js.map +1 -0
  729. package/graphql/schema/resolvers/manage/resolveGet.js +11 -6
  730. package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
  731. package/graphql/schema/resolvers/manage/resolveGetByIds.js +5 -3
  732. package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
  733. package/graphql/schema/resolvers/manage/resolveGetRevisions.js +5 -3
  734. package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
  735. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js +5 -3
  736. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -1
  737. package/graphql/schema/resolvers/manage/resolveList.js +5 -3
  738. package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
  739. package/graphql/schema/resolvers/manage/resolveListDeleted.js +5 -3
  740. package/graphql/schema/resolvers/manage/resolveListDeleted.js.map +1 -1
  741. package/graphql/schema/resolvers/manage/resolveMove.js +4 -2
  742. package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -1
  743. package/graphql/schema/resolvers/manage/resolvePublish.js +5 -3
  744. package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
  745. package/graphql/schema/resolvers/manage/resolveRepublish.js +5 -3
  746. package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
  747. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js +5 -3
  748. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js.map +1 -1
  749. package/graphql/schema/resolvers/manage/resolveUnpublish.js +5 -3
  750. package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
  751. package/graphql/schema/resolvers/manage/resolveUpdate.js +5 -3
  752. package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
  753. package/graphql/schema/resolvers/manage/resolveUpdateRevisionDescription.js +5 -3
  754. package/graphql/schema/resolvers/manage/resolveUpdateRevisionDescription.js.map +1 -1
  755. package/graphql/schema/resolvers/manage/resolveValidate.js +5 -3
  756. package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -1
  757. package/graphql/schema/resolvers/preview/resolveGet.js +6 -3
  758. package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
  759. package/graphql/schema/resolvers/preview/resolveList.js +5 -3
  760. package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
  761. package/graphql/schema/resolvers/read/resolveGet.js +5 -2
  762. package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
  763. package/graphql/schema/resolvers/read/resolveList.js +5 -3
  764. package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
  765. package/graphql/schema/resolvers/singular/resolveGet.js +1 -1
  766. package/graphql/schema/resolvers/singular/resolveGet.js.map +1 -1
  767. package/graphql/schema/resolvers/singular/resolveUpdate.js +1 -1
  768. package/graphql/schema/resolvers/singular/resolveUpdate.js.map +1 -1
  769. package/graphql/schema/schemaPlugins.d.ts +2 -1
  770. package/graphql/schema/schemaPlugins.js +2 -4
  771. package/graphql/schema/schemaPlugins.js.map +1 -1
  772. package/index.d.ts +7 -6
  773. package/index.js +4 -22
  774. package/legacy/abstractions.js.map +1 -1
  775. package/package.json +27 -33
  776. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.d.ts +2 -2
  777. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js +1 -1
  778. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js.map +1 -1
  779. package/plugins/CmsModelPlugin.js +2 -1
  780. package/plugins/CmsModelPlugin.js.map +1 -1
  781. package/plugins/index.d.ts +0 -1
  782. package/plugins/index.js +0 -1
  783. package/types/fields/dynamicZoneField.d.ts +3 -2
  784. package/types/index.d.ts +0 -1
  785. package/types/model.d.ts +6 -0
  786. package/types/modelField.d.ts +14 -1
  787. package/types/types.d.ts +11 -290
  788. package/types/types.js.map +1 -1
  789. package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.d.ts +28 -0
  790. package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js +324 -0
  791. package/utils/contentModelToJsonSchema/CmsModelToJsonSchemaConverter.js.map +1 -0
  792. package/utils/contentModelToJsonSchema/index.d.ts +2 -0
  793. package/utils/contentModelToJsonSchema/index.js +1 -0
  794. package/utils/contentModelToJsonSchema/types.d.ts +24 -0
  795. package/utils/converters/ConverterCollection.d.ts +2 -2
  796. package/utils/converters/ConverterCollection.js +1 -3
  797. package/utils/converters/ConverterCollection.js.map +1 -1
  798. package/utils/converters/valueKeyFromStorageConverter.d.ts +2 -2
  799. package/utils/converters/valueKeyFromStorageConverter.js +2 -2
  800. package/utils/converters/valueKeyFromStorageConverter.js.map +1 -1
  801. package/utils/converters/valueKeyStorageConverter.js +4 -2
  802. package/utils/converters/valueKeyStorageConverter.js.map +1 -1
  803. package/utils/converters/valueKeyToStorageConverter.d.ts +2 -2
  804. package/utils/converters/valueKeyToStorageConverter.js +2 -2
  805. package/utils/converters/valueKeyToStorageConverter.js.map +1 -1
  806. package/utils/createModelField.js +2 -1
  807. package/utils/createModelField.js.map +1 -1
  808. package/utils/createModelSchemaKey.d.ts +8 -0
  809. package/utils/createModelSchemaKey.js +18 -0
  810. package/utils/createModelSchemaKey.js.map +1 -0
  811. package/utils/getSchemaFromFieldPlugins.d.ts +2 -2
  812. package/utils/getSchemaFromFieldPlugins.js.map +1 -1
  813. package/utils/index.d.ts +1 -0
  814. package/utils/index.js +1 -0
  815. package/utils/isHeadlessCmsReady.d.ts +1 -1
  816. package/utils/isHeadlessCmsReady.js +3 -2
  817. package/utils/isHeadlessCmsReady.js.map +1 -1
  818. package/abstractions/entryHooks/OnEntryBeforeCreate.d.ts +0 -8
  819. package/abstractions/entryHooks/OnEntryBeforeCreate.js +0 -5
  820. package/abstractions/entryHooks/OnEntryBeforeCreate.js.map +0 -1
  821. package/abstractions/entryHooks/index.d.ts +0 -1
  822. package/abstractions/entryHooks/index.js +0 -1
  823. package/abstractions/index.d.ts +0 -1
  824. package/abstractions/index.js +0 -1
  825. package/context.d.ts +0 -3
  826. package/context.js +0 -131
  827. package/context.js.map +0 -1
  828. package/crud/contentEntry.crud.d.ts +0 -6
  829. package/crud/contentEntry.crud.js +0 -334
  830. package/crud/contentEntry.crud.js.map +0 -1
  831. package/crud/contentModel.crud.d.ts +0 -5
  832. package/crud/contentModel.crud.js +0 -77
  833. package/crud/contentModel.crud.js.map +0 -1
  834. package/crud/contentModelGroup.crud.d.ts +0 -5
  835. package/crud/contentModelGroup.crud.js +0 -74
  836. package/crud/contentModelGroup.crud.js.map +0 -1
  837. package/extensions/entryHooks/OnEntryBeforeCreate.d.ts +0 -4
  838. package/extensions/entryHooks/OnEntryBeforeCreate.js +0 -21
  839. package/extensions/entryHooks/OnEntryBeforeCreate.js.map +0 -1
  840. package/extensions/entryHooks/index.d.ts +0 -1
  841. package/extensions/entryHooks/index.js +0 -1
  842. package/extensions/index.d.ts +0 -5
  843. package/extensions/index.js +0 -7
  844. package/extensions/index.js.map +0 -1
  845. package/graphql/graphQLHandlerFactory.d.ts +0 -5
  846. package/graphql/graphQLHandlerFactory.js +0 -22
  847. package/graphql/graphQLHandlerFactory.js.map +0 -1
  848. package/graphql/handleRequest.d.ts +0 -11
  849. package/graphql/handleRequest.js +0 -62
  850. package/graphql/handleRequest.js.map +0 -1
  851. package/graphql/index.d.ts +0 -4
  852. package/graphql/index.js +0 -11
  853. package/graphql/index.js.map +0 -1
  854. package/graphql/schema/cms/index.d.ts +0 -2
  855. package/graphql/schema/cms/index.js +0 -24
  856. package/graphql/schema/cms/index.js.map +0 -1
  857. package/index.js.map +0 -1
  858. package/parameters/context.d.ts +0 -2
  859. package/parameters/context.js +0 -7
  860. package/parameters/context.js.map +0 -1
  861. package/parameters/header.d.ts +0 -2
  862. package/parameters/header.js +0 -13
  863. package/parameters/header.js.map +0 -1
  864. package/parameters/index.d.ts +0 -3
  865. package/parameters/index.js +0 -3
  866. package/parameters/path.d.ts +0 -2
  867. package/parameters/path.js +0 -12
  868. package/parameters/path.js.map +0 -1
  869. package/plugins/CmsParametersPlugin.d.ts +0 -18
  870. package/plugins/CmsParametersPlugin.js +0 -16
  871. package/plugins/CmsParametersPlugin.js.map +0 -1
  872. package/types/context.d.ts +0 -110
  873. /package/{types/context.js → utils/contentModelToJsonSchema/types.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"crud/contentEntry/references/validateEntries.js","sources":["../../../../src/crud/contentEntry/references/validateEntries.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport dotPropImmutable from \"dot-prop-immutable\";\nimport { WebinyError } from \"@webiny/error\";\n\ninterface ReferenceObject {\n id: string;\n modelId: string;\n}\n\ninterface ValidateReferencedEntriesParams {\n output: Record<string, any>;\n context: Pick<CmsContext, \"cms\" | \"security\">;\n referenceFieldPaths: string[];\n}\n\nconst getReferenceFieldValue = (\n ref: Partial<ReferenceObject> | null | undefined\n): ReferenceObject | null => {\n if (!ref?.id || !ref.modelId) {\n return null;\n }\n return ref as ReferenceObject;\n};\n\nexport const validateReferencedEntries = async ({\n output,\n context,\n referenceFieldPaths\n}: ValidateReferencedEntriesParams) => {\n const referencesByModel = new Map<string, string[]>();\n\n /**\n * Group references by modelId.\n */\n for (const path of referenceFieldPaths) {\n const ref = dotPropImmutable.get(output, path) as ReferenceObject | any;\n\n const result = getReferenceFieldValue(ref);\n\n if (!result) {\n continue;\n }\n\n const refs = referencesByModel.get(result.modelId) || [];\n refs.push(result.id);\n referencesByModel.set(result.modelId, refs);\n }\n\n if (referencesByModel.size === 0) {\n return;\n }\n\n /**\n * Load all models and use only those that are used in reference.\n */\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter(model => {\n const entries = referencesByModel.get(model.modelId) || [];\n if (entries.length === 0) {\n return false;\n }\n return true;\n });\n });\n\n if (!models.length) {\n return;\n }\n\n /**\n * Load all the entries by their IDs.\n */\n const promises = await context.security.withoutAuthorization(async () => {\n return models.map(model => {\n return context.cms.getEntriesByIds(model, referencesByModel.get(model.modelId) || []);\n });\n });\n\n const allEntries = await Promise.all(promises).then(res => res.flat());\n const entriesByModel = allEntries.reduce<Record<string, string[]>>((acc, entry) => {\n return { ...acc, [entry.modelId]: [...(acc[entry.modelId] || []), entry.id] };\n }, {});\n\n /**\n * Verify that all entries exist.\n */\n referencesByModel.forEach((ids, modelId) => {\n const modelEntriesInDb = entriesByModel[modelId];\n for (const id of ids) {\n if (!modelEntriesInDb || !modelEntriesInDb.includes(id)) {\n throw new WebinyError(\n `Missing referenced entry with id \"${id}\" in model \"${modelId}\".`,\n \"ENTRY_NOT_FOUND\",\n {\n id,\n model: modelId\n }\n );\n }\n }\n });\n};\n"],"names":["getReferenceFieldValue","ref","validateReferencedEntries","output","context","referenceFieldPaths","referencesByModel","Map","path","dotPropImmutable","result","refs","models","model","entries","promises","allEntries","Promise","res","entriesByMod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2B,CAACI,KAAKC,QAC9D;YAAE,GAAGD,GAAG;YAAE,CAACC,MAAM,OAAO,CAAC,EAAE;mBAAKD,GAAG,CAACC,MAAM,OAAO,CAAC,IAAI,EAAE;gBAAGA,MAAM,EAAE;aAAC;QAAC,IAC7E,CAAC;IAKJf,kBAAkB,OAAO,CAAC,CAACgB,KAAKC;QAC5B,MAAMC,mBAAmBL,cAAc,CAACI,QAAQ;QAChD,KAAK,MAAME,MAAMH,IACb,IAAI,CAACE,oBAAoB,CAACA,iBAAiB,QAAQ,CAACC,KAChD,MAAM,IAAIC,YACN,CAAC,kCAAkC,EAAED,GAAG,YAAY,EAAEF,QAAQ,EAAE,CAAC,EACjE,mBACA;YACIE;YACA,OAAOF;QACX;IAIhB;AACJ"}
1
+ {"version":3,"file":"crud/contentEntry/references/validateEntries.js","sources":["../../../../src/crud/contentEntry/references/validateEntries.ts"],"sourcesContent":["import { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport type { CmsContext } from \"~/types/index.js\";\nimport dotPropImmutable from \"dot-prop-immutable\";\nimport { WebinyError } from \"@webiny/error\";\nimport { ListModelsUseCase } from \"~/features/contentModel/ListModels/index.js\";\nimport { GetEntriesByIdsUseCase } from \"~/features/contentEntry/GetEntriesByIds/index.js\";\n\ninterface ReferenceObject {\n id: string;\n modelId: string;\n}\n\ninterface ValidateReferencedEntriesParams {\n output: Record<string, any>;\n context: Pick<CmsContext, \"container\">;\n referenceFieldPaths: string[];\n}\n\nconst getReferenceFieldValue = (\n ref: Partial<ReferenceObject> | null | undefined\n): ReferenceObject | null => {\n if (!ref?.id || !ref.modelId) {\n return null;\n }\n return ref as ReferenceObject;\n};\n\nexport const validateReferencedEntries = async ({\n output,\n context,\n referenceFieldPaths\n}: ValidateReferencedEntriesParams) => {\n const referencesByModel = new Map<string, string[]>();\n\n /**\n * Group references by modelId.\n */\n for (const path of referenceFieldPaths) {\n const ref = dotPropImmutable.get(output, path) as ReferenceObject | any;\n\n const result = getReferenceFieldValue(ref);\n\n if (!result) {\n continue;\n }\n\n const refs = referencesByModel.get(result.modelId) || [];\n refs.push(result.id);\n referencesByModel.set(result.modelId, refs);\n }\n\n if (referencesByModel.size === 0) {\n return;\n }\n\n /**\n * Load all models and use only those that are used in reference.\n */\n const modelsResult = await context.container\n .resolve(IdentityContext)\n .withoutAuthorization(async () => {\n return context.container.resolve(ListModelsUseCase).execute();\n });\n if (modelsResult.isFail()) {\n throw modelsResult.error;\n }\n const models = modelsResult.value.filter(model => {\n const entries = referencesByModel.get(model.modelId) || [];\n return entries.length > 0;\n });\n\n if (!models.length) {\n return;\n }\n\n /**\n * Load all the entries by their IDs.\n */\n const allEntries = await context.container\n .resolve(IdentityContext)\n .withoutAuthorization(async () => {\n const fetches = models.map(async model => {\n const result = await context.container\n .resolve(GetEntriesByIdsUseCase)\n .execute(model, referencesByModel.get(model.modelId) || []);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n return (await Promise.all(fetches)).flat();\n });\n const entriesByModel = allEntries.reduce<Record<string, string[]>>((acc, entry) => {\n return { ...acc, [entry.modelId]: [...(acc[entry.modelId] || []), entry.id] };\n }, {});\n\n /**\n * Verify that all entries exist.\n */\n referencesByModel.forEach((ids, modelId) => {\n const modelEntriesInDb = entriesByModel[modelId];\n for (const id of ids) {\n if (!modelEntriesInDb || !modelEntriesInDb.includes(id)) {\n throw new WebinyError(\n `Missing referenced entry with id \"${id}\" in model \"${modelId}\".`,\n \"ENTRY_NOT_FOUND\",\n {\n id,\n model: modelId\n }\n );\n }\n }\n });\n};\n"],"names":["getReferenceFieldValue","ref","validateReferencedEntries","output","context","referenceFieldPaths","referencesByModel","Map","path","dotPropImmutable","result","refs","modelsResult","IdentityContext","ListModelsUseCase","models","model","entries","allEntries","fetches","GetEntriesByIdsUseCase","Promise","entriesByModel","acc","entry","ids","modelId","modelEntriesInDb","id","WebinyError"],"mappings":";;;;;AAkBA,MAAMA,yBAAyB,CAC3BC;IAEA,IAAI,C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;QACvB;QACA,OAAQ,OAAMW,QAAQ,GAAG,CAACF,QAAO,EAAG,IAAI;IAC5C;IACJ,MAAMG,iBAAiBJ,WAAW,MAAM,CAA2B,CAACK,KAAKC,QAC9D;YAAE,GAAGD,GAAG;YAAE,CAACC,MAAM,OAAO,CAAC,EAAE;mBAAKD,GAAG,CAACC,MAAM,OAAO,CAAC,IAAI,EAAE;gBAAGA,MAAM,EAAE;aAAC;QAAC,IAC7E,CAAC;IAKJlB,kBAAkB,OAAO,CAAC,CAACmB,KAAKC;QAC5B,MAAMC,mBAAmBL,cAAc,CAACI,QAAQ;QAChD,KAAK,MAAME,MAAMH,IACb,IAAI,CAACE,oBAAoB,CAACA,iBAAiB,QAAQ,CAACC,KAChD,MAAM,IAAIC,YACN,CAAC,kCAAkC,EAAED,GAAG,YAAY,EAAEF,QAAQ,EAAE,CAAC,EACjE,mBACA;YACIE;YACA,OAAOF;QACX;IAIhB;AACJ"}
@@ -30,13 +30,14 @@ const createDefaultFields = ()=>[
30
30
  {
31
31
  id: generateAlphaNumericLowerCaseId(8),
32
32
  fieldId: "image",
33
- type: "file",
33
+ type: "asset",
34
34
  label: "Image",
35
35
  validation: [],
36
36
  listValidation: [],
37
37
  renderer: {
38
- name: "file-input"
38
+ name: "asset-input"
39
39
  },
40
+ tags: [],
40
41
  settings: {
41
42
  imagesOnly: true
42
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"crud/contentModel/defaultFields.js","sources":["../../../src/crud/contentModel/defaultFields.ts"],"sourcesContent":["import type { CmsModelCreateInput, CmsModelFieldInput } from \"~/types/index.js\";\nimport { generateAlphaNumericLowerCaseId } from \"@webiny/utils\";\n\nconst createDefaultFields = (): CmsModelFieldInput[] => {\n return [\n {\n id: generateAlphaNumericLowerCaseId(8),\n fieldId: \"title\",\n type: \"text\",\n label: \"Title\",\n validation: [\n {\n name: \"required\",\n message: \"Title is a required field.\"\n }\n ],\n listValidation: [],\n renderer: {\n name: \"text-input\"\n }\n },\n {\n id: generateAlphaNumericLowerCaseId(8),\n fieldId: \"description\",\n type: \"long-text\",\n label: \"Description\",\n validation: [],\n listValidation: [],\n renderer: {\n name: \"long-text-text-area\"\n }\n },\n {\n id: generateAlphaNumericLowerCaseId(8),\n fieldId: \"image\",\n type: \"file\",\n label: \"Image\",\n validation: [],\n listValidation: [],\n renderer: {\n name: \"file-input\"\n },\n settings: {\n imagesOnly: true\n }\n }\n ];\n};\n\n/**\n * We only assign default fields if there are no fields in the model already.\n */\nexport const assignModelDefaultFields = (model: CmsModelCreateInput): void => {\n if (model.fields && model.fields.length !== 0) {\n return;\n }\n\n model.fields = createDefaultFields();\n model.layout = [[model.fields[0].id], [model.fields[1].id, model.fields[2].id]];\n};\n"],"names":["createDefaultFields","generateAlphaNumericLowerCaseId","assignModelDefaultFields","model"],"mappings":";AAGA,MAAMA,sBAAsB,IACjB;QACH;YACI,IAAIC,gCAAgC;YACpC,SAAS;YACT,MAAM;YACN,OAAO;YACP,YAAY;gBACR;oBACI,MAAM;oBACN,SAAS;gBACb;aACH;YACD,gBAAgB,EAAE;YAClB,UAAU;gBACN,MAAM;YACV;QACJ;QACA;YACI,IAAIA,gCAAgC;YACpC,SAAS;YACT,MAAM;YACN,OAAO;YACP,YAAY,EAAE;YACd,gBAAgB,EAAE;YAClB,UAAU;gBACN,MAAM;YACV;QACJ;QACA;YACI,IAAIA,gCAAgC;YACpC,SAAS;YACT,MAAM;YACN,OAAO;YACP,YAAY,EAAE;YACd,gBAAgB,EAAE;YAClB,UAAU;gBACN,MAAM;YACV;YACA,UAAU;gBACN,YAAY;YAChB;QACJ;KACH;AAME,MAAMC,2BAA2B,CAACC;IACrC,IAAIA,MAAM,MAAM,IAAIA,AAAwB,MAAxBA,MAAM,MAAM,CAAC,MAAM,EACnC;IAGJA,MAAM,MAAM,GAAGH;IACfG,MAAM,MAAM,GAAG;QAAC;YAACA,MAAM,MAAM,CAAC,EAAE,CAAC,EAAE;SAAC;QAAE;YAACA,MAAM,MAAM,CAAC,EAAE,CAAC,EAAE;YAAEA,MAAM,MAAM,CAAC,EAAE,CAAC,EAAE;SAAC;KAAC;AACnF"}
1
+ {"version":3,"file":"crud/contentModel/defaultFields.js","sources":["../../../src/crud/contentModel/defaultFields.ts"],"sourcesContent":["import type { CmsModelCreateInput, CmsModelFieldInput } from \"~/types/index.js\";\nimport { generateAlphaNumericLowerCaseId } from \"@webiny/utils\";\n\nconst createDefaultFields = (): CmsModelFieldInput[] => {\n return [\n {\n id: generateAlphaNumericLowerCaseId(8),\n fieldId: \"title\",\n type: \"text\",\n label: \"Title\",\n validation: [\n {\n name: \"required\",\n message: \"Title is a required field.\"\n }\n ],\n listValidation: [],\n renderer: {\n name: \"text-input\"\n }\n },\n {\n id: generateAlphaNumericLowerCaseId(8),\n fieldId: \"description\",\n type: \"long-text\",\n label: \"Description\",\n validation: [],\n listValidation: [],\n renderer: {\n name: \"long-text-text-area\"\n }\n },\n {\n id: generateAlphaNumericLowerCaseId(8),\n fieldId: \"image\",\n type: \"asset\",\n label: \"Image\",\n validation: [],\n listValidation: [],\n renderer: {\n name: \"asset-input\"\n },\n tags: [],\n settings: {\n imagesOnly: true\n }\n }\n ];\n};\n\n/**\n * We only assign default fields if there are no fields in the model already.\n */\nexport const assignModelDefaultFields = (model: CmsModelCreateInput): void => {\n if (model.fields && model.fields.length !== 0) {\n return;\n }\n\n model.fields = createDefaultFields();\n model.layout = [[model.fields[0].id], [model.fields[1].id, model.fields[2].id]];\n};\n"],"names":["createDefaultFields","generateAlphaNumericLowerCaseId","assignModelDefaultFields","model"],"mappings":";AAGA,MAAMA,sBAAsB,IACjB;QACH;YACI,IAAIC,gCAAgC;YACpC,SAAS;YACT,MAAM;YACN,OAAO;YACP,YAAY;gBACR;oBACI,MAAM;oBACN,SAAS;gBACb;aACH;YACD,gBAAgB,EAAE;YAClB,UAAU;gBACN,MAAM;YACV;QACJ;QACA;YACI,IAAIA,gCAAgC;YACpC,SAAS;YACT,MAAM;YACN,OAAO;YACP,YAAY,EAAE;YACd,gBAAgB,EAAE;YAClB,UAAU;gBACN,MAAM;YACV;QACJ;QACA;YACI,IAAIA,gCAAgC;YACpC,SAAS;YACT,MAAM;YACN,OAAO;YACP,YAAY,EAAE;YACd,gBAAgB,EAAE;YAClB,UAAU;gBACN,MAAM;YACV;YACA,MAAM,EAAE;YACR,UAAU;gBACN,YAAY;YAChB;QACJ;KACH;AAME,MAAMC,2BAA2B,CAACC;IACrC,IAAIA,MAAM,MAAM,IAAIA,AAAwB,MAAxBA,MAAM,MAAM,CAAC,MAAM,EACnC;IAGJA,MAAM,MAAM,GAAGH;IACfG,MAAM,MAAM,GAAG;QAAC;YAACA,MAAM,MAAM,CAAC,EAAE,CAAC,EAAE;SAAC;QAAE;YAACA,MAAM,MAAM,CAAC,EAAE,CAAC,EAAE;YAAEA,MAAM,MAAM,CAAC,EAAE,CAAC,EAAE;SAAC;KAAC;AACnF"}
@@ -33,6 +33,7 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
33
33
  type: zod.ZodString;
34
34
  tags: zod.ZodDefault<zod.ZodOptional<zod.ZodArray<zod.ZodString>>>;
35
35
  list: zod.ZodDefault<zod.ZodPipe<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodBoolean>>>, zod.ZodTransform<boolean, boolean | null | undefined>>>;
36
+ disabled: zod.ZodDefault<zod.ZodPipe<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodBoolean>>>, zod.ZodTransform<boolean, boolean | null | undefined>>>;
36
37
  predefinedValues: zod.ZodPipe<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodDefault<zod.ZodObject<{
37
38
  enabled: zod.ZodBoolean;
38
39
  values: zod.ZodDefault<zod.ZodArray<zod.ZodObject<{
@@ -109,20 +110,20 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
109
110
  rules: zod.ZodPipe<zod.ZodDefault<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
110
111
  type: zod.ZodEnum<{
111
112
  accessControl: "accessControl";
112
- entryValue: "entryValue";
113
+ condition: "condition";
113
114
  }>;
114
115
  target: zod.ZodString;
115
116
  operator: zod.ZodString;
116
117
  value: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber, zod.ZodBoolean, zod.ZodNull]>;
117
118
  action: zod.ZodString;
118
119
  }, zod.core.$strip>>>>>>, zod.ZodTransform<{
119
- type: "accessControl" | "entryValue";
120
+ type: "accessControl" | "condition";
120
121
  target: string;
121
122
  operator: string;
122
123
  value: string | number | boolean | null;
123
124
  action: string;
124
125
  }[], {
125
- type: "accessControl" | "entryValue";
126
+ type: "accessControl" | "condition";
126
127
  target: string;
127
128
  operator: string;
128
129
  value: string | number | boolean | null;
@@ -135,6 +136,7 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
135
136
  descriptionFieldId: zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>;
136
137
  imageFieldId: zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>;
137
138
  defaultFields: zod.ZodOptional<zod.ZodNullable<zod.ZodBoolean>>;
139
+ settings: zod.ZodDefault<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodObject<{}, zod.core.$loose>>>>>;
138
140
  }, zod.core.$strip>;
139
141
  export declare const createModelUpdateValidation: () => zod.ZodObject<{
140
142
  name: zod.ZodOptional<zod.ZodString>;
@@ -169,6 +171,7 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
169
171
  type: zod.ZodString;
170
172
  tags: zod.ZodDefault<zod.ZodOptional<zod.ZodArray<zod.ZodString>>>;
171
173
  list: zod.ZodDefault<zod.ZodPipe<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodBoolean>>>, zod.ZodTransform<boolean, boolean | null | undefined>>>;
174
+ disabled: zod.ZodDefault<zod.ZodPipe<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodBoolean>>>, zod.ZodTransform<boolean, boolean | null | undefined>>>;
172
175
  predefinedValues: zod.ZodPipe<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodDefault<zod.ZodObject<{
173
176
  enabled: zod.ZodBoolean;
174
177
  values: zod.ZodDefault<zod.ZodArray<zod.ZodObject<{
@@ -245,20 +248,20 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
245
248
  rules: zod.ZodPipe<zod.ZodDefault<zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
246
249
  type: zod.ZodEnum<{
247
250
  accessControl: "accessControl";
248
- entryValue: "entryValue";
251
+ condition: "condition";
249
252
  }>;
250
253
  target: zod.ZodString;
251
254
  operator: zod.ZodString;
252
255
  value: zod.ZodUnion<readonly [zod.ZodString, zod.ZodNumber, zod.ZodBoolean, zod.ZodNull]>;
253
256
  action: zod.ZodString;
254
257
  }, zod.core.$strip>>>>>>, zod.ZodTransform<{
255
- type: "accessControl" | "entryValue";
258
+ type: "accessControl" | "condition";
256
259
  target: string;
257
260
  operator: string;
258
261
  value: string | number | boolean | null;
259
262
  action: string;
260
263
  }[], {
261
- type: "accessControl" | "entryValue";
264
+ type: "accessControl" | "condition";
262
265
  target: string;
263
266
  operator: string;
264
267
  value: string | number | boolean | null;
@@ -270,6 +273,7 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
270
273
  descriptionFieldId: zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>;
271
274
  imageFieldId: zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodString>>>;
272
275
  tags: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
276
+ settings: zod.ZodOptional<zod.ZodNullable<zod.ZodOptional<zod.ZodObject<{}, zod.core.$loose>>>>;
273
277
  }, zod.core.$strip>;
274
278
  export declare const createModelCreateFromValidation: () => zod.ZodObject<{
275
279
  name: zod.ZodString;
@@ -35,6 +35,7 @@ const fieldSchema = zod.object({
35
35
  type: shortString,
36
36
  tags: zod.array(shortString).optional().default([]),
37
37
  list: zod.boolean().optional().nullish().transform((value)=>!!value).default(false),
38
+ disabled: zod.boolean().optional().nullish().transform((value)=>!!value).default(false),
38
39
  predefinedValues: zod.object({
39
40
  enabled: zod.boolean(),
40
41
  values: zod.array(zod.object({
@@ -64,7 +65,7 @@ const fieldSchema = zod.object({
64
65
  rules: zod.array(zod.object({
65
66
  type: zod["enum"]([
66
67
  "accessControl",
67
- "entryValue"
68
+ "condition"
68
69
  ]),
69
70
  target: shortString,
70
71
  operator: shortString,
@@ -119,7 +120,8 @@ const createModelCreateValidation = ()=>zod.object({
119
120
  titleFieldId: optionalShortString.nullish(),
120
121
  descriptionFieldId: optionalShortString.nullish(),
121
122
  imageFieldId: optionalShortString.nullish(),
122
- defaultFields: zod.boolean().nullish()
123
+ defaultFields: zod.boolean().nullish(),
124
+ settings: zod.looseObject({}).optional().nullish().default({})
123
125
  });
124
126
  const createModelUpdateValidation = ()=>zod.object({
125
127
  name: optionalShortString,
@@ -137,7 +139,8 @@ const createModelUpdateValidation = ()=>zod.object({
137
139
  titleFieldId: optionalShortString.nullish(),
138
140
  descriptionFieldId: optionalShortString.nullish(),
139
141
  imageFieldId: optionalShortString.nullish(),
140
- tags: zod.array(shortString).optional()
142
+ tags: zod.array(shortString).optional(),
143
+ settings: zod.looseObject({}).optional().nullish()
141
144
  });
142
145
  const createModelCreateFromValidation = ()=>zod.object({
143
146
  name: shortString,
@@ -1 +1 @@
1
- {"version":3,"file":"domain/contentModel/schemas.js","sources":["../../../src/domain/contentModel/schemas.ts"],"sourcesContent":["import zod from \"zod\";\nimport upperFirst from \"lodash/upperFirst.js\";\nimport camelCase from \"lodash/camelCase.js\";\n\nconst str = zod.string().trim();\nconst shortString = str.max(255);\nconst longString = str;\nconst optionalShortString = shortString.optional();\nconst optionalLongString = longString.optional();\nconst optionalNullishShortString = optionalShortString.nullish().default(null);\nconst optionalNullishLongString = optionalLongString.nullish().default(null);\n\nconst icon = zod\n .looseObject({\n type: zod.string(),\n name: zod.string(),\n value: zod.string().optional()\n })\n .optional()\n .nullish()\n .default(null)\n .transform(value => {\n if (typeof value === \"string\") {\n return {\n type: \"icon\",\n name: value\n };\n }\n return value;\n });\n\nconst fieldSchema = zod.object({\n id: shortString,\n storageId: zod\n .string()\n .optional()\n .transform(() => {\n return \"\";\n }),\n fieldId: shortString\n .max(100)\n .regex(/^!?[a-zA-Z]/, {\n message: `Must not start with a number.`\n })\n .regex(/^(^[a-zA-Z0-9]+)$/, {\n message: `Must be alphanumeric string.`\n }),\n label: shortString,\n help: optionalNullishLongString,\n description: optionalNullishShortString,\n note: optionalNullishShortString,\n placeholder: optionalNullishShortString,\n type: shortString,\n tags: zod.array(shortString).optional().default([]),\n list: zod\n .boolean()\n .optional()\n .nullish()\n .transform(value => {\n return !!value;\n })\n .default(false),\n predefinedValues: zod\n .object({\n enabled: zod.boolean(),\n values: zod\n .array(\n zod.object({\n value: shortString,\n label: shortString,\n selected: zod.boolean().optional().default(false)\n })\n )\n .default([])\n })\n .default({\n enabled: false,\n values: []\n })\n .nullish()\n .optional()\n .transform(value => {\n return value || undefined;\n }),\n renderer: zod\n .object({\n name: shortString,\n settings: zod.looseObject({}).nullish().optional()\n })\n .optional()\n .nullable()\n .default(null),\n validation: zod\n .array(\n zod.object({\n name: shortString,\n message: optionalShortString.default(\"Value is required.\"),\n settings: zod\n .looseObject({})\n .optional()\n .nullish()\n .transform(value => {\n return value || {};\n })\n .default({})\n })\n )\n .nullish()\n .optional()\n .default([])\n .transform(value => value || []),\n listValidation: zod\n .array(\n zod.object({\n name: shortString,\n message: optionalShortString.default(\"Value is required.\"),\n settings: zod\n .looseObject({})\n .optional()\n .nullish()\n .transform(value => {\n return value || {};\n })\n .default({})\n })\n )\n .nullish()\n .optional()\n .default([])\n .transform(value => value || []),\n settings: zod\n .looseObject({})\n .optional()\n .nullish()\n .transform(value => {\n return value || {};\n })\n .default({}),\n rules: zod\n .array(\n zod.object({\n type: zod.enum([\"accessControl\", \"entryValue\"]),\n target: shortString,\n operator: shortString,\n value: zod.union([zod.string(), zod.number(), zod.boolean(), zod.null()]),\n action: shortString\n })\n )\n .optional()\n .nullish()\n .default([])\n .transform(value => value || [])\n});\n\nconst apiNameRefinementValidation = (value: string): boolean => {\n if (value.match(/^[A-Z]/) === null) {\n return false;\n }\n return value === upperFirst(camelCase(value));\n};\nconst refinementSingularValidationMessage = (value?: string) => {\n return {\n message: `The Singular API Name value \"${\n value || \"undefined\"\n }\" is not valid. It must in Upper First + Camel Cased form. For example: \"ArticleCategory\" or \"CarMake\".`\n };\n};\nconst refinementPluralValidationMessage = (value?: string) => {\n return {\n message: `The Plural API Name value \"${\n value || \"undefined\"\n }\" is not valid. It must in Upper First + Camel Cased form. For example: \"ArticleCategories\" or \"CarMakes\".`\n };\n};\n\nconst refineSingularApiName = (value: string, ctx: zod.RefinementCtx) => {\n if (!apiNameRefinementValidation(value)) {\n ctx.addIssue({\n code: zod.ZodIssueCode.custom,\n ...refinementSingularValidationMessage(value)\n });\n }\n};\n\nconst refinePluralApiName = (value: string, ctx: zod.RefinementCtx) => {\n if (!apiNameRefinementValidation(value)) {\n ctx.addIssue({\n code: zod.ZodIssueCode.custom,\n ...refinementPluralValidationMessage(value)\n });\n }\n};\n\nconst modelIdTransformation = (value?: string) => {\n if (!value) {\n return value;\n }\n const camelCasedValue = camelCase(value);\n if (camelCasedValue.toLowerCase() === value.toLowerCase()) {\n return value;\n }\n return camelCasedValue;\n};\n\nexport const createModelCreateValidation = () => {\n return zod.object({\n name: shortString,\n modelId: optionalShortString.transform(modelIdTransformation),\n singularApiName: shortString.min(1).superRefine(refineSingularApiName),\n pluralApiName: shortString.min(1).superRefine(refinePluralApiName),\n description: optionalNullishShortString.transform(value => {\n return value || \"\";\n }),\n group: shortString,\n icon,\n fields: zod.array(fieldSchema).default([]),\n layout: zod.array(zod.array(zod.any())).default([]),\n tags: zod.array(shortString).optional(),\n titleFieldId: optionalShortString.nullish(),\n descriptionFieldId: optionalShortString.nullish(),\n imageFieldId: optionalShortString.nullish(),\n defaultFields: zod.boolean().nullish()\n });\n};\n\nexport const createModelUpdateValidation = () => {\n return zod.object({\n name: optionalShortString,\n singularApiName: optionalShortString.superRefine((value, ctx) => {\n if (value) {\n refineSingularApiName(value, ctx);\n }\n }),\n pluralApiName: optionalShortString.superRefine((value, ctx) => {\n if (value) {\n refinePluralApiName(value, ctx);\n }\n }),\n description: optionalNullishShortString,\n group: optionalShortString,\n icon,\n fields: zod.array(fieldSchema),\n layout: zod.array(zod.array(zod.any())),\n titleFieldId: optionalShortString.nullish(),\n descriptionFieldId: optionalShortString.nullish(),\n imageFieldId: optionalShortString.nullish(),\n tags: zod.array(shortString).optional()\n });\n};\n\nexport const createModelCreateFromValidation = () => {\n return zod.object({\n name: shortString,\n modelId: optionalShortString.transform(modelIdTransformation),\n singularApiName: shortString.superRefine(refineSingularApiName),\n pluralApiName: shortString.superRefine(refinePluralApiName),\n description: optionalNullishShortString,\n group: shortString,\n icon\n });\n};\n"],"names":["str","zod","shortString","longString","optionalShortString","optionalLongString","optionalNullishShortString","optionalNullishLongString","icon","value","fieldSchema","undefined","apiNameRefinementValidation","upperFirst","camelCase","refinementSingularValidationMessage","refinementPluralValidationMessage","refineSingularApiName","ctx","refinePluralApiName","modelIdTransformation","camelCasedValue","createModelCreateValidation","createModelUpdateValidation","createModelCreateFromValidation"],"mappings":";;;AAIA,MAAMA,MAAMC,IAAI,MAAM,GAAG,IAAI;AAC7B,MAAMC,cAAcF,IAAI,GAAG,CAAC;AAC5B,MAAMG,aAAaH;AACnB,MAAMI,sBAAsBF,YAAY,QAAQ;AAChD,MAAMG,qBAAqBF,WAAW,QAAQ;AAC9C,MAAMG,6BAA6BF,oBAAoB,OAAO,GAAG,OAAO,CAAC;AACzE,MAAMG,4BAA4BF,mBAAmB,OAAO,GAAG,OAAO,CAAC;AAEvE,MAAMG,OAAOP,IAAAA,WACG,CAAC;IACT,MAAMA,IAAI,MAAM;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,OAAO;QACzC,eAAeH,IAAI,OAAO,GAAG,OAAO;IACxC;AAGG,MAAMsB,8BAA8B,IAChCtB,IAAI,MAAM,CAAC;QACd,MAAMG;QACN,iBAAiBA,oBAAoB,WAAW,CAAC,CAACK,OAAOS;YACrD,IAAIT,OACAQ,sBAAsBR,OAAOS;QAErC;QACA,eAAed,oBAAoB,WAAW,CAAC,CAACK,OAAOS;YACnD,IAAIT,OACAU,oBAAoBV,OAAOS;QAEnC;QACA,aAAaZ;QACb,OAAOF;QACPI,MAAAA;QACA,QAAQP,IAAI,KAAK,CAACS;QAClB,QAAQT,IAAI,KAAK,CAACA,IAAI,KAAK,CAACA,IAAI,GAAG;QACnC,cAAcG,oBAAoB,OAAO;QACzC,oBAAoBA,oBAAoB,OAAO;QAC/C,cAAcA,oBAAoB,OAAO;QACzC,MAAMH,IAAI,KAAK,CAACC,aAAa,QAAQ;IACzC;AAGG,MAAMsB,kCAAkC,IACpCvB,IAAI,MAAM,CAAC;QACd,MAAMC;QACN,SAASE,oBAAoB,SAAS,CAACgB;QACvC,iBAAiBlB,YAAY,WAAW,CAACe;QACzC,eAAef,YAAY,WAAW,CAACiB;QACvC,aAAab;QACb,OAAOJ;QACPM,MAAAA;IACJ"}
1
+ {"version":3,"file":"domain/contentModel/schemas.js","sources":["../../../src/domain/contentModel/schemas.ts"],"sourcesContent":["import zod from \"zod\";\nimport upperFirst from \"lodash/upperFirst.js\";\nimport camelCase from \"lodash/camelCase.js\";\n\nconst str = zod.string().trim();\nconst shortString = str.max(255);\nconst longString = str;\nconst optionalShortString = shortString.optional();\nconst optionalLongString = longString.optional();\nconst optionalNullishShortString = optionalShortString.nullish().default(null);\nconst optionalNullishLongString = optionalLongString.nullish().default(null);\n\nconst icon = zod\n .looseObject({\n type: zod.string(),\n name: zod.string(),\n value: zod.string().optional()\n })\n .optional()\n .nullish()\n .default(null)\n .transform(value => {\n if (typeof value === \"string\") {\n return {\n type: \"icon\",\n name: value\n };\n }\n return value;\n });\n\nconst fieldSchema = zod.object({\n id: shortString,\n storageId: zod\n .string()\n .optional()\n .transform(() => {\n return \"\";\n }),\n fieldId: shortString\n .max(100)\n .regex(/^!?[a-zA-Z]/, {\n message: `Must not start with a number.`\n })\n .regex(/^(^[a-zA-Z0-9]+)$/, {\n message: `Must be alphanumeric string.`\n }),\n label: shortString,\n help: optionalNullishLongString,\n description: optionalNullishShortString,\n note: optionalNullishShortString,\n placeholder: optionalNullishShortString,\n type: shortString,\n tags: zod.array(shortString).optional().default([]),\n list: zod\n .boolean()\n .optional()\n .nullish()\n .transform(value => {\n return !!value;\n })\n .default(false),\n disabled: zod\n .boolean()\n .optional()\n .nullish()\n .transform(value => {\n return !!value;\n })\n .default(false),\n predefinedValues: zod\n .object({\n enabled: zod.boolean(),\n values: zod\n .array(\n zod.object({\n value: shortString,\n label: shortString,\n selected: zod.boolean().optional().default(false)\n })\n )\n .default([])\n })\n .default({\n enabled: false,\n values: []\n })\n .nullish()\n .optional()\n .transform(value => {\n return value || undefined;\n }),\n renderer: zod\n .object({\n name: shortString,\n settings: zod.looseObject({}).nullish().optional()\n })\n .optional()\n .nullable()\n .default(null),\n validation: zod\n .array(\n zod.object({\n name: shortString,\n message: optionalShortString.default(\"Value is required.\"),\n settings: zod\n .looseObject({})\n .optional()\n .nullish()\n .transform(value => {\n return value || {};\n })\n .default({})\n })\n )\n .nullish()\n .optional()\n .default([])\n .transform(value => value || []),\n listValidation: zod\n .array(\n zod.object({\n name: shortString,\n message: optionalShortString.default(\"Value is required.\"),\n settings: zod\n .looseObject({})\n .optional()\n .nullish()\n .transform(value => {\n return value || {};\n })\n .default({})\n })\n )\n .nullish()\n .optional()\n .default([])\n .transform(value => value || []),\n settings: zod\n .looseObject({})\n .optional()\n .nullish()\n .transform(value => {\n return value || {};\n })\n .default({}),\n rules: zod\n .array(\n zod.object({\n type: zod.enum([\"accessControl\", \"condition\"]),\n target: shortString,\n operator: shortString,\n value: zod.union([zod.string(), zod.number(), zod.boolean(), zod.null()]),\n action: shortString\n })\n )\n .optional()\n .nullish()\n .default([])\n .transform(value => value || [])\n});\n\nconst apiNameRefinementValidation = (value: string): boolean => {\n if (value.match(/^[A-Z]/) === null) {\n return false;\n }\n return value === upperFirst(camelCase(value));\n};\nconst refinementSingularValidationMessage = (value?: string) => {\n return {\n message: `The Singular API Name value \"${\n value || \"undefined\"\n }\" is not valid. It must in Upper First + Camel Cased form. For example: \"ArticleCategory\" or \"CarMake\".`\n };\n};\nconst refinementPluralValidationMessage = (value?: string) => {\n return {\n message: `The Plural API Name value \"${\n value || \"undefined\"\n }\" is not valid. It must in Upper First + Camel Cased form. For example: \"ArticleCategories\" or \"CarMakes\".`\n };\n};\n\nconst refineSingularApiName = (value: string, ctx: zod.RefinementCtx) => {\n if (!apiNameRefinementValidation(value)) {\n ctx.addIssue({\n code: zod.ZodIssueCode.custom,\n ...refinementSingularValidationMessage(value)\n });\n }\n};\n\nconst refinePluralApiName = (value: string, ctx: zod.RefinementCtx) => {\n if (!apiNameRefinementValidation(value)) {\n ctx.addIssue({\n code: zod.ZodIssueCode.custom,\n ...refinementPluralValidationMessage(value)\n });\n }\n};\n\nconst modelIdTransformation = (value?: string) => {\n if (!value) {\n return value;\n }\n const camelCasedValue = camelCase(value);\n if (camelCasedValue.toLowerCase() === value.toLowerCase()) {\n return value;\n }\n return camelCasedValue;\n};\n\nexport const createModelCreateValidation = () => {\n return zod.object({\n name: shortString,\n modelId: optionalShortString.transform(modelIdTransformation),\n singularApiName: shortString.min(1).superRefine(refineSingularApiName),\n pluralApiName: shortString.min(1).superRefine(refinePluralApiName),\n description: optionalNullishShortString.transform(value => {\n return value || \"\";\n }),\n group: shortString,\n icon,\n fields: zod.array(fieldSchema).default([]),\n layout: zod.array(zod.array(zod.any())).default([]),\n tags: zod.array(shortString).optional(),\n titleFieldId: optionalShortString.nullish(),\n descriptionFieldId: optionalShortString.nullish(),\n imageFieldId: optionalShortString.nullish(),\n defaultFields: zod.boolean().nullish(),\n settings: zod.looseObject({}).optional().nullish().default({})\n });\n};\n\nexport const createModelUpdateValidation = () => {\n return zod.object({\n name: optionalShortString,\n singularApiName: optionalShortString.superRefine((value, ctx) => {\n if (value) {\n refineSingularApiName(value, ctx);\n }\n }),\n pluralApiName: optionalShortString.superRefine((value, ctx) => {\n if (value) {\n refinePluralApiName(value, ctx);\n }\n }),\n description: optionalNullishShortString,\n group: optionalShortString,\n icon,\n fields: zod.array(fieldSchema),\n layout: zod.array(zod.array(zod.any())),\n titleFieldId: optionalShortString.nullish(),\n descriptionFieldId: optionalShortString.nullish(),\n imageFieldId: optionalShortString.nullish(),\n tags: zod.array(shortString).optional(),\n settings: zod.looseObject({}).optional().nullish()\n });\n};\n\nexport const createModelCreateFromValidation = () => {\n return zod.object({\n name: shortString,\n modelId: optionalShortString.transform(modelIdTransformation),\n singularApiName: shortString.superRefine(refineSingularApiName),\n pluralApiName: shortString.superRefine(refinePluralApiName),\n description: optionalNullishShortString,\n group: shortString,\n icon\n });\n};\n"],"names":["str","zod","shortString","longString","optionalShortString","optionalLongString","optionalNullishShortString","optionalNullishLongString","icon","value","fieldSchema","undefined","apiNameRefinementValidation","upperFirst","camelCase","refinementSingularValidationMessage","refinementPluralValidationMessage","refineSingularApiName","ctx","refinePluralApiName","modelIdTransformation","camelCasedValue","createModelCreateValidation","createModelUpdateValidation","createModelCreateFromValidation"],"mappings":";;;AAIA,MAAMA,MAAMC,IAAI,MAAM,GAAG,IAAI;AAC7B,MAAMC,cAAcF,IAAI,GAAG,CAAC;AAC5B,MAAMG,aAAaH;AACnB,MAAMI,sBAAsBF,YAAY,QAAQ;AAChD,MAAMG,qBAAqBF,WAAW,QAAQ;AAC9C,MAAMG,6BAA6BF,oBAAoB,OAAO,GAAG,OAAO,CAAC;AACzE,MAAMG,4BAA4BF,mBAAmB,OAAO,GAAG,OAAO,CAAC;AAEvE,MAAMG,OAAOP,IAAAA,WACG,CAAC;IACT,MAAMA,IAAI,MAAM;IAChB,MAAMA,IAAI,MAAM;IAChB,O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C,cAAcE,oBAAoB,OAAO;QACzC,oBAAoBA,oBAAoB,OAAO;QAC/C,cAAcA,oBAAoB,OAAO;QACzC,eAAeH,IAAI,OAAO,GAAG,OAAO;QACpC,UAAUA,IAAI,WAAW,CAAC,CAAC,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;IAChE;AAGG,MAAMsB,8BAA8B,IAChCtB,IAAI,MAAM,CAAC;QACd,MAAMG;QACN,iBAAiBA,oBAAoB,WAAW,CAAC,CAACK,OAAOS;YACrD,IAAIT,OACAQ,sBAAsBR,OAAOS;QAErC;QACA,eAAed,oBAAoB,WAAW,CAAC,CAACK,OAAOS;YACnD,IAAIT,OACAU,oBAAoBV,OAAOS;QAEnC;QACA,aAAaZ;QACb,OAAOF;QACPI,MAAAA;QACA,QAAQP,IAAI,KAAK,CAACS;QAClB,QAAQT,IAAI,KAAK,CAACA,IAAI,KAAK,CAACA,IAAI,GAAG;QACnC,cAAcG,oBAAoB,OAAO;QACzC,oBAAoBA,oBAAoB,OAAO;QAC/C,cAAcA,oBAAoB,OAAO;QACzC,MAAMH,IAAI,KAAK,CAACC,aAAa,QAAQ;QACrC,UAAUD,IAAI,WAAW,CAAC,CAAC,GAAG,QAAQ,GAAG,OAAO;IACpD;AAGG,MAAMuB,kCAAkC,IACpCvB,IAAI,MAAM,CAAC;QACd,MAAMC;QACN,SAASE,oBAAoB,SAAS,CAACgB;QACvC,iBAAiBlB,YAAY,WAAW,CAACe;QACzC,eAAef,YAAY,WAAW,CAACiB;QACvC,aAAab;QACb,OAAOJ;QACPM,MAAAA;IACJ"}
@@ -0,0 +1,6 @@
1
+ import type { CmsModelField } from "../../../types/index.js";
2
+ /**
3
+ * A `dateGte`/`dateLte` limit given as `{ expression }` must parse, and is allowed only on a
4
+ * date-only field: on a time or datetime field, "today" has no single meaning.
5
+ */
6
+ export declare const validateDateExpressions: (field: Pick<CmsModelField, "fieldId" | "type" | "settings" | "validation">) => void;
@@ -0,0 +1,27 @@
1
+ import error from "@webiny/error";
2
+ import { isDateExpression } from "@webiny/utils";
3
+ const DATE_LIMIT_VALIDATORS = [
4
+ "dateGte",
5
+ "dateLte"
6
+ ];
7
+ const validateDateExpressions = (field)=>{
8
+ for (const validator of field.validation || []){
9
+ if (!DATE_LIMIT_VALIDATORS.includes(validator.name)) continue;
10
+ const expression = validator.settings?.expression;
11
+ if (null != expression) {
12
+ if ("string" != typeof expression || !isDateExpression(expression)) throw new error(`Field "${field.fieldId}" has an invalid date expression "${expression}" in its "${validator.name}" validator. Use "today", or "today" plus or minus a number of days, months or years, like "today-18y".`, "INVALID_DATE_EXPRESSION", {
13
+ fieldId: field.fieldId,
14
+ validator: validator.name,
15
+ expression
16
+ });
17
+ if ("datetime" !== field.type || field.settings?.type !== "date") throw new error(`Field "${field.fieldId}" uses a date expression in its "${validator.name}" validator, but expressions are only allowed on date-only fields.`, "DATE_EXPRESSION_NOT_ALLOWED", {
18
+ fieldId: field.fieldId,
19
+ validator: validator.name,
20
+ expression
21
+ });
22
+ }
23
+ }
24
+ };
25
+ export { validateDateExpressions };
26
+
27
+ //# sourceMappingURL=dateExpressions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain/contentModel/validation/dateExpressions.js","sources":["../../../../src/domain/contentModel/validation/dateExpressions.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { isDateExpression } from \"@webiny/utils\";\nimport type { CmsModelField } from \"~/types/index.js\";\n\nconst DATE_LIMIT_VALIDATORS = [\"dateGte\", \"dateLte\"];\n\n/**\n * A `dateGte`/`dateLte` limit given as `{ expression }` must parse, and is allowed only on a\n * date-only field: on a time or datetime field, \"today\" has no single meaning.\n */\nexport const validateDateExpressions = (\n field: Pick<CmsModelField, \"fieldId\" | \"type\" | \"settings\" | \"validation\">\n): void => {\n for (const validator of field.validation || []) {\n if (!DATE_LIMIT_VALIDATORS.includes(validator.name)) {\n continue;\n }\n const expression = validator.settings?.expression;\n if (expression === undefined || expression === null) {\n continue;\n }\n if (typeof expression !== \"string\" || !isDateExpression(expression)) {\n throw new WebinyError(\n `Field \"${field.fieldId}\" has an invalid date expression \"${expression}\" in its \"${validator.name}\" validator. Use \"today\", or \"today\" plus or minus a number of days, months or years, like \"today-18y\".`,\n \"INVALID_DATE_EXPRESSION\",\n { fieldId: field.fieldId, validator: validator.name, expression }\n );\n }\n if (field.type !== \"datetime\" || field.settings?.type !== \"date\") {\n throw new WebinyError(\n `Field \"${field.fieldId}\" uses a date expression in its \"${validator.name}\" validator, but expressions are only allowed on date-only fields.`,\n \"DATE_EXPRESSION_NOT_ALLOWED\",\n { fieldId: field.fieldId, validator: validator.name, expression }\n );\n }\n }\n};\n"],"names":["DATE_LIMIT_VALIDATORS","validateDateExpressions","field","validator","expression","isDateExpression","WebinyError"],"mappings":";;AAIA,MAAMA,wBAAwB;IAAC;IAAW;CAAU;AAM7C,MAAMC,0BAA0B,CACnCC;IAEA,KAAK,MAAMC,aAAaD,MAAM,UAAU,IAAI,EAAE,CAAE;QAC5C,IAAI,CAACF,sBAAsB,QAAQ,CAACG,UAAU,IAAI,GAC9C;QAEJ,MAAMC,aAAaD,UAAU,QAAQ,EAAE;QACvC,IAAIC,QAAAA;YAGJ,IAAI,AAAsB,YAAtB,OAAOA,cAA2B,CAACC,iBAAiBD,aACpD,MAAM,IAAIE,MACN,CAAC,OAAO,EAAEJ,MAAM,OAAO,CAAC,kCAAkC,EAAEE,WAAW,UAAU,EAAED,UAAU,IAAI,CAAC,uGAAuG,CAAC,EAC1M,2BACA;gBAAE,SAASD,MAAM,OAAO;gBAAE,WAAWC,UAAU,IAAI;gBAAEC;YAAW;YAGxE,IAAIF,AAAe,eAAfA,MAAM,IAAI,IAAmBA,MAAM,QAAQ,EAAE,SAAS,QACtD,MAAM,IAAII,MACN,CAAC,OAAO,EAAEJ,MAAM,OAAO,CAAC,iCAAiC,EAAEC,UAAU,IAAI,CAAC,kEAAkE,CAAC,EAC7I,+BACA;gBAAE,SAASD,MAAM,OAAO;gBAAE,WAAWC,UAAU,IAAI;gBAAEC;YAAW;;IAG5E;AACJ"}
@@ -1,14 +1,17 @@
1
1
  import graphql_tag from "graphql-tag";
2
- import { generateAlphaNumericId } from "@webiny/utils";
3
2
  import _webiny_error from "@webiny/error";
3
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
4
+ import { ListModelsUseCase } from "../../../features/contentModel/ListModels/index.js";
4
5
  import { createManageSDL } from "../../../graphql/schema/createManageSDL.js";
5
6
  import { createFieldStorageId } from "../createFieldStorageId.js";
6
7
  import { getBaseFieldType } from "../../../utils/getBaseFieldType.js";
7
8
  import { getContentModelTitleFieldId } from "./fields/titleField.js";
8
9
  import { getContentModelDescriptionFieldId } from "./fields/descriptionField.js";
9
10
  import { getContentModelImageFieldId } from "./fields/imageField.js";
10
- import { CmsGraphQLSchemaPlugin } from "../../../plugins/index.js";
11
+ import { validateDateExpressions } from "./dateExpressions.js";
11
12
  import { buildSchemaPlugins } from "../../../graphql/buildSchemaPlugins.js";
13
+ import { HeadlessCmsEndpointConfig } from "../../../HeadlessCmsEndpointConfig.js";
14
+ import { CmsGraphQLSchemaFactory } from "../../../graphql/CmsGraphQLSchemaFactory.js";
12
15
  import { createExecutableSchema } from "../../../graphql/createExecutableSchema.js";
13
16
  import { CmsGraphQLSchemaSorter, CmsModelFieldToGraphQLRegistry } from "../../../features/graphql/index.js";
14
17
  const extractInvalidField = (model, err)=>{
@@ -76,6 +79,7 @@ const validateFields = (params)=>{
76
79
  fieldIdList.push(field.fieldId);
77
80
  if (storageIdList.includes(field.storageId)) throw new _webiny_error(`Cannot update content model because field "${field.label}" has storageId "${field.storageId}", which is already used.`);
78
81
  storageIdList.push(field.storageId);
82
+ validateDateExpressions(field);
79
83
  if (!fieldImpl.validateChildFields) continue;
80
84
  const validateChildFields = createValidateChildFields(registry);
81
85
  fieldImpl.validateChildFields({
@@ -87,24 +91,28 @@ const validateFields = (params)=>{
87
91
  };
88
92
  const createGraphQLSchema = async (params)=>{
89
93
  const { context, model } = params;
90
- const models = await context.security.withoutAuthorization(async ()=>(await context.cms.listModels()).filter((model)=>true !== model.isPrivate));
91
- const modelPlugins = await buildSchemaPlugins({
94
+ const modelsResult = await context.container.resolve(IdentityContext).withoutAuthorization(async ()=>context.container.resolve(ListModelsUseCase).execute());
95
+ if (modelsResult.isFail()) throw modelsResult.error;
96
+ const models = modelsResult.value.filter((model)=>true !== model.isPrivate);
97
+ const generatedSchemaPlugins = await buildSchemaPlugins({
92
98
  context,
93
99
  models: models.filter((m)=>m.modelId !== model.modelId).concat([
94
100
  model
95
- ])
101
+ ]),
102
+ type: context.container.resolve(HeadlessCmsEndpointConfig).type
103
+ });
104
+ const staticFactories = context.container.resolveAll(CmsGraphQLSchemaFactory);
105
+ const staticPlugins = [];
106
+ for (const factory of staticFactories)staticPlugins.push(...await factory.execute());
107
+ const schemaPlugins = [
108
+ ...staticPlugins,
109
+ ...generatedSchemaPlugins
110
+ ].filter((pl)=>{
111
+ if ("function" == typeof pl.isApplicable) return pl.isApplicable(context);
112
+ return true;
96
113
  });
97
- const plugins = context.plugins.byType(CmsGraphQLSchemaPlugin.type).filter((plugin)=>plugin.isApplicable(context)).reduce((collection, plugin)=>{
98
- const name = plugin.name || `${CmsGraphQLSchemaPlugin.type}-${generateAlphaNumericId(16)}`;
99
- collection[name] = plugin;
100
- return collection;
101
- }, {});
102
- for (const plugin of modelPlugins){
103
- const name = plugin.name || `${plugin.type}-${generateAlphaNumericId(16)}`;
104
- plugins[name] = plugin;
105
- }
106
114
  return createExecutableSchema({
107
- plugins: Object.values(plugins)
115
+ plugins: schemaPlugins
108
116
  });
109
117
  };
110
118
  const extractErrorObject = (error)=>[
@@ -1 +1 @@
1
- {"version":3,"file":"domain/contentModel/validation/modelFields.js","sources":["../../../../src/domain/contentModel/validation/modelFields.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\nimport WebinyError from \"@webiny/error\";\nimport type { CmsContext, CmsModel, CmsModelField } from \"~/types/index.js\";\nimport type { ValidateChildFieldsValidate } from \"~/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js\";\nimport { createManageSDL } from \"~/graphql/schema/createManageSDL.js\";\nimport { createFieldStorageId } from \"../createFieldStorageId.js\";\nimport type { GraphQLError } from \"graphql\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType.js\";\nimport { getContentModelTitleFieldId } from \"./fields/titleField.js\";\nimport { getContentModelDescriptionFieldId } from \"./fields/descriptionField.js\";\nimport { getContentModelImageFieldId } from \"./fields/imageField.js\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport { CmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport { buildSchemaPlugins } from \"~/graphql/buildSchemaPlugins.js\";\nimport { createExecutableSchema } from \"~/graphql/createExecutableSchema.js\";\nimport {\n CmsGraphQLSchemaSorter,\n CmsModelFieldToGraphQLRegistry\n} from \"~/features/graphql/index.js\";\n\nconst extractInvalidField = (model: CmsModel, err: GraphQLError) => {\n const sdl = err.source?.body || \"\";\n\n /**\n * Find the invalid type\n */\n const { line: lineNumber } = err.locations\n ? err.locations[0]\n : {\n line: 0\n };\n const sdlLines = sdl.split(\"\\n\");\n let sdlLine;\n let gqlType;\n for (let i = lineNumber; i > 0; i--) {\n if (sdlLine && sdlLine.includes(\"type \")) {\n gqlType = sdlLine.match(/type\\s+(.*?)\\s+{/);\n break;\n }\n\n sdlLine = sdlLines[i];\n }\n\n let invalidField: string | undefined = undefined;\n if (Array.isArray(gqlType)) {\n const fieldRegex = new RegExp(`([^\\\\s+].*?):\\\\s+\\\\[?${gqlType[1]}!?\\\\]?`);\n\n const matched = sdl.match(fieldRegex);\n if (matched) {\n invalidField = matched[1];\n }\n }\n\n let message = `See more details in the browser console.`;\n if (invalidField) {\n message = `Please review the definition of \"${invalidField}\" field.`;\n }\n\n return {\n data: {\n modelId: model.modelId,\n sdl,\n invalidField\n },\n code: \"INVALID_MODEL_DEFINITION\",\n message: [`Model \"${model.modelId}\" was not saved!`, message].join(\"\\n\")\n };\n};\n\nconst createValidateChildFields = (\n registry: CmsModelFieldToGraphQLRegistry.Interface\n): ValidateChildFieldsValidate => {\n return ({ fields, originalFields }) => {\n if (fields.length === 0 && originalFields.length === 0) {\n return;\n }\n validateFields({\n fields,\n originalFields,\n registry\n });\n };\n};\n\ninterface ValidateFieldsParams {\n registry: CmsModelFieldToGraphQLRegistry.Interface;\n fields: CmsModelField[];\n originalFields: CmsModelField[];\n}\n\nconst validateFields = (params: ValidateFieldsParams) => {\n const { registry, fields, originalFields } = params;\n\n const idList: string[] = [];\n const fieldIdList: string[] = [];\n const storageIdList: string[] = [];\n\n for (const field of fields) {\n const baseType = getBaseFieldType(field);\n const fieldImpl = registry.get(baseType);\n\n if (!fieldImpl) {\n throw new Error(\n `Cannot update content model because of the unknown \"${baseType}\" field.`\n );\n }\n /**\n * Check the field's id against existing ones.\n * There cannot be two fields with the same id.\n */\n if (idList.includes(field.id)) {\n throw new WebinyError(\n `Cannot update content model because field \"${\n field.storageId || field.fieldId\n }\" has id \"${field.id}\", which is already used.`\n );\n }\n idList.push(field.id);\n\n const originalField = originalFields.find(f => f.id === field.id);\n /**\n * Field MUST have an fieldId defined.\n */\n if (!field.fieldId) {\n throw new WebinyError(`Field does not have an \"fieldId\" defined.`, \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.\n * This is to avoid errors in the already installed systems.\n *\n * Why are we using the @?\n *\n * It is not part of special characters for the query syntax in the Lucene.\n *\n * Relevant links:\n * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html\n * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3\n * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2\n */\n if (!field.storageId) {\n /**\n * When having an original field, set the storageId to value from the originalField\n */\n if (originalField) {\n field.storageId = originalField.storageId;\n } else {\n field.storageId = createFieldStorageId(field);\n }\n }\n /**\n * Check the field's fieldId against existing ones.\n * There cannot be two fields with the same fieldId - outside world identifier.\n */\n if (fieldIdList.includes(field.fieldId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.storageId}\" has fieldId \"${field.fieldId}\", which is already used.`\n );\n }\n fieldIdList.push(field.fieldId);\n /**\n * Check the field's storageId against the existing ones.\n * There cannot be two fields with the same storageId.\n */\n if (storageIdList.includes(field.storageId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.label}\" has storageId \"${field.storageId}\", which is already used.`\n );\n }\n storageIdList.push(field.storageId);\n /**\n * There might be some plugins which allow child fields.\n * We use this method to validate them as well.\n */\n if (!fieldImpl.validateChildFields) {\n continue;\n }\n const validateChildFields = createValidateChildFields(registry);\n fieldImpl.validateChildFields({\n field,\n originalField,\n validate: validateChildFields\n });\n }\n};\n\ninterface CreateGraphQLSchemaParams {\n context: CmsContext;\n model: CmsModel;\n}\n\nconst createGraphQLSchema = async (params: CreateGraphQLSchemaParams): Promise<any> => {\n const { context, model } = params;\n\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter((model): model is CmsModel => {\n return model.isPrivate !== true;\n });\n });\n\n const modelPlugins = await buildSchemaPlugins({\n context,\n /**\n * Must remove the current model from the list, as we are possibly updating it - there would be two if we didn't.\n */\n models: models.filter(m => m.modelId !== model.modelId).concat([model])\n });\n\n const plugins = context.plugins\n .byType<ICmsGraphQLSchemaPlugin>(CmsGraphQLSchemaPlugin.type)\n .filter(plugin => plugin.isApplicable(context))\n .reduce<Record<string, ICmsGraphQLSchemaPlugin>>((collection, plugin) => {\n const name =\n plugin.name || `${CmsGraphQLSchemaPlugin.type}-${generateAlphaNumericId(16)}`;\n collection[name] = plugin;\n return collection;\n }, {});\n for (const plugin of modelPlugins) {\n const name = plugin.name || `${plugin.type}-${generateAlphaNumericId(16)}`;\n plugins[name] = plugin;\n }\n\n return createExecutableSchema({\n plugins: Object.values(plugins)\n });\n};\n\nconst extractErrorObject = (error: any) => {\n return [\"message\", \"code\", \"data\", \"stack\"].reduce<Record<string, any>>((output, key) => {\n if (!error[key]) {\n return output;\n }\n output[key] = error[key];\n return output;\n }, {});\n};\n\ninterface ValidateModelFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModelFields = async (params: ValidateModelFieldsParams): Promise<void> => {\n const { models, model, original, context } = params;\n const { titleFieldId, descriptionFieldId, imageFieldId } = model;\n\n /**\n * There should be fields/locked fields in either model or data to be updated.\n */\n const { fields = [] } = model;\n\n /**\n * Let's inspect the fields of the received content model. We prevent saving of a content model if it\n * contains a field for which a \"cms-model-field-to-graphql\" plugin does not exist on the backend.\n */\n const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);\n const sorters = context.container.resolveAll(CmsGraphQLSchemaSorter);\n\n validateFields({\n fields,\n originalFields: original?.fields || [],\n registry: fieldRegistry\n });\n\n if (fields.length) {\n /**\n * Make sure that this model can be safely converted to a GraphQL SDL\n */\n const schema = createManageSDL({\n models,\n model,\n fieldRegistry,\n sorters\n });\n\n try {\n gql(schema);\n } catch (err) {\n throw new WebinyError(extractInvalidField(model, err));\n }\n /**\n *\n */\n try {\n await createGraphQLSchema({\n context,\n model\n });\n } catch (err) {\n throw new WebinyError({\n message:\n \"Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.\",\n code: \"GRAPHQL_SCHEMA_ERROR\",\n data: {\n modelId: model.modelId,\n error: extractErrorObject(err)\n }\n });\n }\n }\n\n model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);\n model.descriptionFieldId = getContentModelDescriptionFieldId(fields, descriptionFieldId);\n model.imageFieldId = getContentModelImageFieldId(fields, imageFieldId);\n};\n"],"names":["extractInvalidField","model","err","sdl","lineNumber","sdlLines","sdlLine","gqlType","i","invalidField","Array","fieldRegex","RegExp","matched","message","createValidateChildFields","registry","fields","originalFields","validateFields","params","idList","fieldIdList","storageIdList","field","baseType","getBaseFieldType","fieldImpl","Error","WebinyError","originalField","f","createFieldStorageId","validateChildFields","createGraphQLSchema","context","models","modelPlugins","buildSchemaPlugins","m","plugins","CmsGraphQLSchemaPlugin","plugin","collection","name","generateAlphaNumericId","createExecutableSchema","Object","extractErrorObject","error","output","key","validateModelFields","original","titleFieldId","descriptionFieldId","imageFieldId","fieldRegistry","CmsModelFieldToGraphQLRegistry","sorters","CmsGraphQLSchemaSorter","schema","createManageSDL","gql","getContentModelTitleFieldId","getContentModelDescriptionFieldId","getContentModelImageFieldId"],"mappings":";;;;;;;;;;;;;AAqBA,MAAMA,sBAAsB,CAACC,OAAiBC;IAC1C,MAAMC,MAAMD,IAAI,MAAM,EAAE,QAAQ;IAKhC,MAAM,EAAE,MAAME,UAAU,EAAE,GAAGF,IAAI,SAAS,GACpCA,IAAI,SAAS,CAAC,EAAE,GAChB;QACI,MAAM;IACV;IACN,MAAMG,WAAWF,IAAI,KAAK,CAAC;IAC3B,IAAIG;IACJ,IAAIC;IACJ,IAAK,IAAIC,IAAIJ,YAAYI,IAAI,GAAGA,IAAK;QACjC,IAAIF,WAAWA,QAAQ,QAAQ,CAAC,UAAU;YACtCC,UAAUD,QAAQ,KAAK,CAAC;YACxB;QACJ;QAEAA,UAAUD,QAAQ,CAACG,EAAE;IACzB;IAEA,IAAIC;IACJ,IAAIC,MAAM,OAAO,CAACH,UAAU;QACxB,MAAMI,aAAa,IAAIC,OAAO,CAAC,qBAAqB,EAAEL,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC;QAExE,MAAMM,UAAUV,IAAI,KAAK,CAACQ;QAC1B,IAAIE,SACAJ,eAAeI,OAAO,CAAC,EAAE;IAEjC;IAEA,IAAIC,UAAU;IACd,IAAIL,cACAK,UAAU,CAAC,iCAAiC,EAAEL,aAAa,QAAQ,CAAC;IAGxE,OAAO;QACH,MAAM;YACF,SAASR,MAAM,OAAO;YACtBE;YACAM;QACJ;QACA,MAAM;QACN,SAAS;YAAC,CAAC,OAAO,E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B;YACJ;QACJ;IACJ;IAEAD,MAAM,YAAY,GAAG+D,4BAA4B/C,QAAQqC;IACzDrD,MAAM,kBAAkB,GAAGgE,kCAAkChD,QAAQsC;IACrEtD,MAAM,YAAY,GAAGiE,4BAA4BjD,QAAQuC;AAC7D"}
1
+ {"version":3,"file":"domain/contentModel/validation/modelFields.js","sources":["../../../../src/domain/contentModel/validation/modelFields.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport WebinyError from \"@webiny/error\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { ListModelsUseCase } from \"~/features/contentModel/ListModels/index.js\";\nimport type { CmsContext, CmsModel, CmsModelField } from \"~/types/index.js\";\nimport type { ValidateChildFieldsValidate } from \"~/features/graphql/fields/abstractions/CmsModelFieldToGraphQL.js\";\nimport { createManageSDL } from \"~/graphql/schema/createManageSDL.js\";\nimport { createFieldStorageId } from \"../createFieldStorageId.js\";\nimport type { GraphQLError } from \"graphql\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType.js\";\nimport { getContentModelTitleFieldId } from \"./fields/titleField.js\";\nimport { getContentModelDescriptionFieldId } from \"./fields/descriptionField.js\";\nimport { getContentModelImageFieldId } from \"./fields/imageField.js\";\nimport { validateDateExpressions } from \"./dateExpressions.js\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins/index.js\";\nimport { buildSchemaPlugins } from \"~/graphql/buildSchemaPlugins.js\";\nimport { HeadlessCmsEndpointConfig } from \"~/HeadlessCmsEndpointConfig.js\";\nimport { CmsGraphQLSchemaFactory } from \"~/graphql/CmsGraphQLSchemaFactory.js\";\nimport { createExecutableSchema } from \"~/graphql/createExecutableSchema.js\";\nimport {\n CmsGraphQLSchemaSorter,\n CmsModelFieldToGraphQLRegistry\n} from \"~/features/graphql/index.js\";\n\nconst extractInvalidField = (model: CmsModel, err: GraphQLError) => {\n const sdl = err.source?.body || \"\";\n\n /**\n * Find the invalid type\n */\n const { line: lineNumber } = err.locations\n ? err.locations[0]\n : {\n line: 0\n };\n const sdlLines = sdl.split(\"\\n\");\n let sdlLine;\n let gqlType;\n for (let i = lineNumber; i > 0; i--) {\n if (sdlLine && sdlLine.includes(\"type \")) {\n gqlType = sdlLine.match(/type\\s+(.*?)\\s+{/);\n break;\n }\n\n sdlLine = sdlLines[i];\n }\n\n let invalidField: string | undefined = undefined;\n if (Array.isArray(gqlType)) {\n const fieldRegex = new RegExp(`([^\\\\s+].*?):\\\\s+\\\\[?${gqlType[1]}!?\\\\]?`);\n\n const matched = sdl.match(fieldRegex);\n if (matched) {\n invalidField = matched[1];\n }\n }\n\n let message = `See more details in the browser console.`;\n if (invalidField) {\n message = `Please review the definition of \"${invalidField}\" field.`;\n }\n\n return {\n data: {\n modelId: model.modelId,\n sdl,\n invalidField\n },\n code: \"INVALID_MODEL_DEFINITION\",\n message: [`Model \"${model.modelId}\" was not saved!`, message].join(\"\\n\")\n };\n};\n\nconst createValidateChildFields = (\n registry: CmsModelFieldToGraphQLRegistry.Interface\n): ValidateChildFieldsValidate => {\n return ({ fields, originalFields }) => {\n if (fields.length === 0 && originalFields.length === 0) {\n return;\n }\n validateFields({\n fields,\n originalFields,\n registry\n });\n };\n};\n\ninterface ValidateFieldsParams {\n registry: CmsModelFieldToGraphQLRegistry.Interface;\n fields: CmsModelField[];\n originalFields: CmsModelField[];\n}\n\nconst validateFields = (params: ValidateFieldsParams) => {\n const { registry, fields, originalFields } = params;\n\n const idList: string[] = [];\n const fieldIdList: string[] = [];\n const storageIdList: string[] = [];\n\n for (const field of fields) {\n const baseType = getBaseFieldType(field);\n const fieldImpl = registry.get(baseType);\n\n if (!fieldImpl) {\n throw new Error(\n `Cannot update content model because of the unknown \"${baseType}\" field.`\n );\n }\n /**\n * Check the field's id against existing ones.\n * There cannot be two fields with the same id.\n */\n if (idList.includes(field.id)) {\n throw new WebinyError(\n `Cannot update content model because field \"${\n field.storageId || field.fieldId\n }\" has id \"${field.id}\", which is already used.`\n );\n }\n idList.push(field.id);\n\n const originalField = originalFields.find(f => f.id === field.id);\n /**\n * Field MUST have an fieldId defined.\n */\n if (!field.fieldId) {\n throw new WebinyError(`Field does not have an \"fieldId\" defined.`, \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.\n * This is to avoid errors in the already installed systems.\n *\n * Why are we using the @?\n *\n * It is not part of special characters for the query syntax in the Lucene.\n *\n * Relevant links:\n * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html\n * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3\n * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2\n */\n if (!field.storageId) {\n /**\n * When having an original field, set the storageId to value from the originalField\n */\n if (originalField) {\n field.storageId = originalField.storageId;\n } else {\n field.storageId = createFieldStorageId(field);\n }\n }\n /**\n * Check the field's fieldId against existing ones.\n * There cannot be two fields with the same fieldId - outside world identifier.\n */\n if (fieldIdList.includes(field.fieldId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.storageId}\" has fieldId \"${field.fieldId}\", which is already used.`\n );\n }\n fieldIdList.push(field.fieldId);\n /**\n * Check the field's storageId against the existing ones.\n * There cannot be two fields with the same storageId.\n */\n if (storageIdList.includes(field.storageId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.label}\" has storageId \"${field.storageId}\", which is already used.`\n );\n }\n storageIdList.push(field.storageId);\n\n validateDateExpressions(field);\n /**\n * There might be some plugins which allow child fields.\n * We use this method to validate them as well.\n */\n if (!fieldImpl.validateChildFields) {\n continue;\n }\n const validateChildFields = createValidateChildFields(registry);\n fieldImpl.validateChildFields({\n field,\n originalField,\n validate: validateChildFields\n });\n }\n};\n\ninterface CreateGraphQLSchemaParams {\n context: CmsContext;\n model: CmsModel;\n}\n\nconst createGraphQLSchema = async (params: CreateGraphQLSchemaParams): Promise<any> => {\n const { context, model } = params;\n\n const modelsResult = await context.container\n .resolve(IdentityContext)\n .withoutAuthorization(async () => {\n return context.container.resolve(ListModelsUseCase).execute();\n });\n if (modelsResult.isFail()) {\n throw modelsResult.error;\n }\n const models = modelsResult.value.filter(\n (model): model is CmsModel => model.isPrivate !== true\n );\n\n const generatedSchemaPlugins = await buildSchemaPlugins({\n context,\n /**\n * Must remove the current model from the list, as we are possibly updating it - there would be two if we didn't.\n */\n models: models.filter(m => m.modelId !== model.modelId).concat([model]),\n type: context.container.resolve(HeadlessCmsEndpointConfig).type\n });\n\n /**\n * The base CMS GraphQL types (CmsError, CmsIdentity, entry options, etc.) are provided\n * by the CmsGraphQLSchemaFactory implementations registered in the DI container — mirror\n * generateSchema() so model validation builds against the same complete type set.\n */\n const staticFactories = context.container.resolveAll(CmsGraphQLSchemaFactory);\n const staticPlugins: ICmsGraphQLSchemaPlugin[] = [];\n for (const factory of staticFactories) {\n staticPlugins.push(...(await factory.execute()));\n }\n\n const schemaPlugins = [...staticPlugins, ...generatedSchemaPlugins].filter(pl => {\n if (typeof pl.isApplicable === \"function\") {\n return pl.isApplicable(context);\n }\n return true;\n });\n\n return createExecutableSchema({ plugins: schemaPlugins });\n};\n\nconst extractErrorObject = (error: any) => {\n return [\"message\", \"code\", \"data\", \"stack\"].reduce<Record<string, any>>((output, key) => {\n if (!error[key]) {\n return output;\n }\n output[key] = error[key];\n return output;\n }, {});\n};\n\ninterface ValidateModelFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModelFields = async (params: ValidateModelFieldsParams): Promise<void> => {\n const { models, model, original, context } = params;\n const { titleFieldId, descriptionFieldId, imageFieldId } = model;\n\n /**\n * There should be fields/locked fields in either model or data to be updated.\n */\n const { fields = [] } = model;\n\n /**\n * Let's inspect the fields of the received content model. We prevent saving of a content model if it\n * contains a field for which a \"cms-model-field-to-graphql\" plugin does not exist on the backend.\n */\n const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);\n const sorters = context.container.resolveAll(CmsGraphQLSchemaSorter);\n\n validateFields({\n fields,\n originalFields: original?.fields || [],\n registry: fieldRegistry\n });\n\n if (fields.length) {\n /**\n * Make sure that this model can be safely converted to a GraphQL SDL\n */\n const schema = createManageSDL({\n models,\n model,\n fieldRegistry,\n sorters\n });\n\n try {\n gql(schema);\n } catch (err) {\n throw new WebinyError(extractInvalidField(model, err));\n }\n /**\n *\n */\n try {\n await createGraphQLSchema({\n context,\n model\n });\n } catch (err) {\n throw new WebinyError({\n message:\n \"Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.\",\n code: \"GRAPHQL_SCHEMA_ERROR\",\n data: {\n modelId: model.modelId,\n error: extractErrorObject(err)\n }\n });\n }\n }\n\n model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);\n model.descriptionFieldId = getContentModelDescriptionFieldId(fields, descriptionFieldId);\n model.imageFieldId = getContentModelImageFieldId(fields, imageFieldId);\n};\n"],"names":["extractInvalidField","model","err","sdl","lineNumber","sdlLines","sdlLine","gqlType","i","invalidField","Array","fieldRegex","RegExp","matched","message","createValidateChildFields","registry","fields","originalFields","validateFields","params","idList","fieldIdList","storageIdList","field","baseType","getBaseFieldType","fieldImpl","Error","WebinyError","originalField","f","createFieldStorageId","validateDateExpressions","validateChildFields","createGraphQLSchema","context","modelsResult","IdentityContext","ListModelsUseCase","models","generatedSchemaPlugins","buildSchemaPlugins","m","HeadlessCmsEndpointConfig","staticFactories","CmsGraphQLSchemaFactory","staticPlugins","factory","schemaPlugins","pl","createExecutableSchema","extractErrorObject","error","output","key","validateModelFields","original","titleFieldId","descriptionFieldId","imageFieldId","fieldRegistry","CmsModelFieldToGraphQLRegistry","sorters","CmsGraphQLSchemaSorter","schema","createManageSDL","gql","getContentModelTitleFieldId","getContentModelDescriptionFieldId","getContentModelImageFieldId"],"mappings":";;;;;;;;;;;;;;;;AAwBA,MAAMA,sBAAsB,CAACC,OAAiBC;IAC1C,MAAMC,MAAMD,IAAI,MAAM,EAAE,QAAQ;IAKhC,MAAM,EAAE,MAAME,U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EoB,MAAM,EAAEvC,KAAK,EAAEwD,QAAQ,EAAErB,OAAO,EAAE,GAAGhB;IAC7C,MAAM,EAAEsC,YAAY,EAAEC,kBAAkB,EAAEC,YAAY,EAAE,GAAG3D;IAK3D,MAAM,EAAEgB,SAAS,EAAE,EAAE,GAAGhB;IAMxB,MAAM4D,gBAAgBzB,QAAQ,SAAS,CAAC,OAAO,CAAC0B;IAChD,MAAMC,UAAU3B,QAAQ,SAAS,CAAC,UAAU,CAAC4B;IAE7C7C,eAAe;QACXF;QACA,gBAAgBwC,UAAU,UAAU,EAAE;QACtC,UAAUI;IACd;IAEA,IAAI5C,OAAO,MAAM,EAAE;QAIf,MAAMgD,SAASC,gBAAgB;YAC3B1B;YACAvC;YACA4D;YACAE;QACJ;QAEA,IAAI;YACAI,YAAIF;QACR,EAAE,OAAO/D,KAAK;YACV,MAAM,IAAI2B,cAAY7B,oBAAoBC,OAAOC;QACrD;QAIA,IAAI;YACA,MAAMiC,oBAAoB;gBACtBC;gBACAnC;YACJ;QACJ,EAAE,OAAOC,KAAK;YACV,MAAM,IAAI2B,cAAY;gBAClB,SACI;gBACJ,MAAM;gBACN,MAAM;oBACF,SAAS5B,MAAM,OAAO;oBACtB,OAAOmD,mBAAmBlD;gBAC9B;YACJ;QACJ;IACJ;IAEAD,MAAM,YAAY,GAAGmE,4BAA4BnD,QAAQyC;IACzDzD,MAAM,kBAAkB,GAAGoE,kCAAkCpD,QAAQ0C;IACrE1D,MAAM,YAAY,GAAGqE,4BAA4BrD,QAAQ2C;AAC7D"}
@@ -0,0 +1,9 @@
1
+ import type { HeadlessCmsExport, HeadlessCmsImport } from "./types.js";
2
+ export declare const CmsExport: import("@webiny/di").Abstraction<HeadlessCmsExport>;
3
+ export declare namespace CmsExport {
4
+ type Interface = HeadlessCmsExport;
5
+ }
6
+ export declare const CmsImport: import("@webiny/di").Abstraction<HeadlessCmsImport>;
7
+ export declare namespace CmsImport {
8
+ type Interface = HeadlessCmsImport;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const CmsExport = createAbstraction("CmsExport");
3
+ const CmsImport = createAbstraction("CmsImport");
4
+ export { CmsExport, CmsImport };
5
+
6
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export/abstractions.js","sources":["../../src/export/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { HeadlessCmsExport, HeadlessCmsImport } from \"./types.js\";\n\nexport const CmsExport = createAbstraction<HeadlessCmsExport>(\"CmsExport\");\n\nexport namespace CmsExport {\n export type Interface = HeadlessCmsExport;\n}\n\nexport const CmsImport = createAbstraction<HeadlessCmsImport>(\"CmsImport\");\n\nexport namespace CmsImport {\n export type Interface = HeadlessCmsImport;\n}\n"],"names":["CmsExport","createAbstraction","CmsImport"],"mappings":";AAGO,MAAMA,YAAYC,kBAAqC;AAMvD,MAAMC,YAAYD,kBAAqC"}
@@ -1,8 +1,14 @@
1
1
  import { sanitizeGroup, sanitizeModel } from "./sanitize.js";
2
+ import { ListGroupsUseCase } from "../../features/contentModelGroup/ListGroups/index.js";
3
+ import { ListModelsUseCase } from "../../features/contentModel/ListModels/index.js";
2
4
  const createExportStructureContext = (context)=>async (params)=>{
3
5
  const { models: modelIdList } = params;
4
- const groups = (await context.cms.listGroups()).map(sanitizeGroup);
5
- const models = (await context.cms.listModels()).filter((model)=>{
6
+ const groupsResult = await context.container.resolve(ListGroupsUseCase).execute();
7
+ if (groupsResult.isFail()) throw groupsResult.error;
8
+ const groups = groupsResult.value.map(sanitizeGroup);
9
+ const modelsResult = await context.container.resolve(ListModelsUseCase).execute();
10
+ if (modelsResult.isFail()) throw modelsResult.error;
11
+ const models = modelsResult.value.filter((model)=>{
6
12
  if (model.isPrivate) return false;
7
13
  if (!model.fields?.length) return false;
8
14
  if (!modelIdList?.length) return true;
@@ -1 +1 @@
1
- {"version":3,"file":"export/crud/exporting.js","sources":["../../../src/export/crud/exporting.ts"],"sourcesContent":["import type { HeadlessCmsExportStructure, SanitizedCmsModel } from \"~/export/types.js\";\nimport type { CmsContext } from \"~/types/index.js\";\nimport { sanitizeGroup, sanitizeModel } from \"./sanitize.js\";\n\nexport const createExportStructureContext = (context: CmsContext): HeadlessCmsExportStructure => {\n return async params => {\n const { models: modelIdList } = params;\n const groups = (await context.cms.listGroups()).map(sanitizeGroup);\n /**\n * We need all the models which:\n * * are accessible by current user\n * * are not private\n * * are included (if targets are provided)\n * * are part of one of the groups we already fetched\n */\n const models = (await context.cms.listModels())\n .filter(model => {\n if (model.isPrivate) {\n return false;\n } else if (!model.fields?.length) {\n return false;\n } else if (!modelIdList?.length) {\n return true;\n }\n return modelIdList.includes(model.modelId);\n })\n .map(model => {\n const group = groups.find(group => group.slug === model.group);\n if (!group) {\n return null;\n }\n return sanitizeModel(group, model);\n })\n .filter((model): model is SanitizedCmsModel => {\n return !!model;\n });\n\n return {\n groups: groups.filter(group => {\n return models.some(model => model.group === group.slug);\n }),\n models\n };\n };\n};\n"],"names":["createExportStructureContext","context","params","modelIdList","groups","sanitizeGroup","models","model","group","sanitizeModel"],"mappings":";AAIO,MAAMA,+BAA+B,CAACC,UAClC,OAAMC;QACT,MAAM,EAAE,QAAQC,WAAW,EAAE,GAAGD;QAChC,MAAME,SAAU,OAAMH,QAAQ,GAAG,CAAC,UAAU,EAAC,EAAG,GAAG,CAACI;QAQpD,MAAMC,SAAU,OAAML,QAAQ,GAAG,CAAC,UAAU,EAAC,EACxC,MAAM,CAACM,CAAAA;YACJ,IAAIA,MAAM,SAAS,EACf,OAAO;YACJ,IAAI,CAACA,MAAM,MAAM,EAAE,QACtB,OAAO;YACJ,IAAI,CAACJ,aAAa,QACrB,OAAO;YAEX,OAAOA,YAAY,QAAQ,CAACI,MAAM,OAAO;QAC7C,GACC,GAAG,CAACA,CAAAA;YACD,MAAMC,QAAQJ,OAAO,IAAI,CAACI,CAAAA,QAASA,MAAM,IAAI,KAAKD,MAAM,KAAK;YAC7D,IAAI,CAACC,OACD,OAAO;YAEX,OAAOC,cAAcD,OAAOD;QAChC,GACC,MAAM,CAAC,CAACA,QACE,CAAC,CAACA;QAGjB,OAAO;YACH,QAAQH,OAAO,MAAM,CAACI,CAAAA,QACXF,OAAO,IAAI,CAACC,CAAAA,QAASA,MAAM,KAAK,KAAKC,MAAM,IAAI;YAE1DF;QACJ;IACJ"}
1
+ {"version":3,"file":"export/crud/exporting.js","sources":["../../../src/export/crud/exporting.ts"],"sourcesContent":["import type { HeadlessCmsExportStructure, SanitizedCmsModel } from \"~/export/types.js\";\nimport type { CmsContext } from \"~/types/index.js\";\nimport { sanitizeGroup, sanitizeModel } from \"./sanitize.js\";\nimport { ListGroupsUseCase } from \"~/features/contentModelGroup/ListGroups/index.js\";\nimport { ListModelsUseCase } from \"~/features/contentModel/ListModels/index.js\";\n\nexport const createExportStructureContext = (context: CmsContext): HeadlessCmsExportStructure => {\n return async params => {\n const { models: modelIdList } = params;\n\n const groupsResult = await context.container.resolve(ListGroupsUseCase).execute();\n if (groupsResult.isFail()) {\n throw groupsResult.error;\n }\n const groups = groupsResult.value.map(sanitizeGroup);\n\n /**\n * We need all the models which:\n * * are accessible by current user\n * * are not private\n * * are included (if targets are provided)\n * * are part of one of the groups we already fetched\n */\n const modelsResult = await context.container.resolve(ListModelsUseCase).execute();\n if (modelsResult.isFail()) {\n throw modelsResult.error;\n }\n const models = modelsResult.value\n .filter(model => {\n if (model.isPrivate) {\n return false;\n } else if (!model.fields?.length) {\n return false;\n } else if (!modelIdList?.length) {\n return true;\n }\n return modelIdList.includes(model.modelId);\n })\n .map(model => {\n const group = groups.find(group => group.slug === model.group);\n if (!group) {\n return null;\n }\n return sanitizeModel(group, model);\n })\n .filter((model): model is SanitizedCmsModel => {\n return !!model;\n });\n\n return {\n groups: groups.filter(group => {\n return models.some(model => model.group === group.slug);\n }),\n models\n };\n };\n};\n"],"names":["createExportStructureContext","context","params","modelIdList","groupsResult","ListGroupsUseCase","groups","sanitizeGroup","modelsResult","ListModelsUseCase","models","model","group","sanitizeModel"],"mappings":";;;AAMO,MAAMA,+BAA+B,CAACC,UAClC,OAAMC;QACT,MAAM,EAAE,QAAQC,WAAW,EAAE,GAAGD;QAEhC,MAAME,eAAe,MAAMH,QAAQ,SAAS,CAAC,OAAO,CAACI,mBAAmB,OAAO;QAC/E,IAAID,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAE5B,MAAME,SAASF,aAAa,KAAK,CAAC,GAAG,CAACG;QAStC,MAAMC,eAAe,MAAMP,QAAQ,SAAS,CAAC,OAAO,CAACQ,mBAAmB,OAAO;QAC/E,IAAID,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAE5B,MAAME,SAASF,aAAa,KAAK,CAC5B,MAAM,CAACG,CAAAA;YACJ,IAAIA,MAAM,SAAS,EACf,OAAO;YACJ,IAAI,CAACA,MAAM,MAAM,EAAE,QACtB,OAAO;YACJ,IAAI,CAACR,aAAa,QACrB,OAAO;YAEX,OAAOA,YAAY,QAAQ,CAACQ,MAAM,OAAO;QAC7C,GACC,GAAG,CAACA,CAAAA;YACD,MAAMC,QAAQN,OAAO,IAAI,CAACM,CAAAA,QAASA,MAAM,IAAI,KAAKD,MAAM,KAAK;YAC7D,IAAI,CAACC,OACD,OAAO;YAEX,OAAOC,cAAcD,OAAOD;QAChC,GACC,MAAM,CAAC,CAACA,QACE,CAAC,CAACA;QAGjB,OAAO;YACH,QAAQL,OAAO,MAAM,CAACM,CAAAA,QACXF,OAAO,IAAI,CAACC,CAAAA,QAASA,MAAM,KAAK,KAAKC,MAAM,IAAI;YAE1DF;QACJ;IACJ"}
@@ -1,10 +1,19 @@
1
1
  import _webiny_error from "@webiny/error";
2
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
2
3
  import { importData } from "./imports/importData.js";
3
4
  import { validateInput } from "./imports/validateInput.js";
4
- const fetchGroupsAndModels = async (context)=>await context.security.withoutAuthorization(async ()=>({
5
- groups: await context.cms.listGroups(),
6
- models: await context.cms.listModels()
7
- }));
5
+ import { ListGroupsUseCase } from "../../features/contentModelGroup/ListGroups/index.js";
6
+ import { ListModelsUseCase } from "../../features/contentModel/ListModels/index.js";
7
+ const fetchGroupsAndModels = async (context)=>await context.container.resolve(IdentityContext).withoutAuthorization(async ()=>{
8
+ const groupsResult = await context.container.resolve(ListGroupsUseCase).execute();
9
+ if (groupsResult.isFail()) throw groupsResult.error;
10
+ const modelsResult = await context.container.resolve(ListModelsUseCase).execute();
11
+ if (modelsResult.isFail()) throw modelsResult.error;
12
+ return {
13
+ groups: groupsResult.value,
14
+ models: modelsResult.value
15
+ };
16
+ });
8
17
  const createImportCrud = (context)=>({
9
18
  validate: async (params)=>{
10
19
  const { data } = params;
@@ -1 +1 @@
1
- {"version":3,"file":"export/crud/importing.js","sources":["../../../src/export/crud/importing.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n HeadlessCmsImport,\n ValidCmsGroupResult,\n ValidCmsModelResult\n} from \"~/export/types.js\";\nimport type { CmsContext } from \"~/types/index.js\";\nimport { importData } from \"./imports/importData.js\";\nimport { validateInput } from \"./imports/validateInput.js\";\n\nconst fetchGroupsAndModels = async (context: CmsContext) => {\n return await context.security.withoutAuthorization(async () => {\n return {\n groups: await context.cms.listGroups(),\n models: await context.cms.listModels()\n };\n });\n};\n\nexport const createImportCrud = (context: CmsContext): HeadlessCmsImport => {\n return {\n validate: async params => {\n const { data } = params;\n\n const { groups, models } = await fetchGroupsAndModels(context);\n\n const validated = await validateInput({\n groups,\n models,\n data\n });\n if (validated.error) {\n return {\n groups: validated.groups,\n models: validated.models,\n message: validated.error\n };\n }\n\n return {\n groups: validated.groups,\n models: validated.models,\n message: \"Validation done.\"\n };\n },\n structure: async params => {\n const { data } = params;\n\n const { groups, models } = await fetchGroupsAndModels(context);\n\n const validated = await validateInput({\n groups,\n models,\n data\n });\n if (validated.error) {\n throw new WebinyError(validated.error, \"VALIDATION_ERROR\");\n }\n\n const imported = await importData({\n context,\n groups: validated.groups as ValidCmsGroupResult[],\n models: validated.models as ValidCmsModelResult[]\n });\n\n const modelError = imported.models.find(model => !!model.error);\n const error = imported.error || modelError;\n\n return {\n ...imported,\n message: error ? null : \"Import done.\"\n };\n }\n };\n};\n"],"names":["fetchGroupsAndModels","context","createImportCrud","params","data","groups","models","validated","validateInput","WebinyError","imported","importData","modelError","model","error"],"mappings":";;;AAUA,MAAMA,uBAAuB,OAAOC,UACzB,MAAMA,QAAQ,QAAQ,CAAC,oBAAoB,CAAC,UACxC;YACH,QAAQ,MAAMA,QAAQ,GAAG,CAAC,UAAU;YACpC,QAAQ,MAAMA,QAAQ,GAAG,CAAC,UAAU;QACxC;AAID,MAAMC,mBAAmB,CAACD,UACtB;QACH,UAAU,OAAME;YACZ,MAAM,EAAEC,IAAI,EAAE,GAAGD;YAEjB,MAAM,EAAEE,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAMN,qBAAqBC;YAEtD,MAAMM,YAAY,MAAMC,cAAc;gBAClCH;gBACAC;gBACAF;YACJ;YACA,IAAIG,UAAU,KAAK,EACf,OAAO;gBACH,QAAQA,UAAU,MAAM;gBACxB,QAAQA,UAAU,MAAM;gBACxB,SAASA,UAAU,KAAK;YAC5B;YAGJ,OAAO;gBACH,QAAQA,UAAU,MAAM;gBACxB,QAAQA,UAAU,MAAM;gBACxB,SAAS;YACb;QACJ;QACA,WAAW,OAAMJ;YACb,MAAM,EAAEC,IAAI,EAAE,GAAGD;YAEjB,MAAM,EAAEE,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAMN,qBAAqBC;YAEtD,MAAMM,YAAY,MAAMC,cAAc;gBAClCH;gBACAC;gBACAF;YACJ;YACA,IAAIG,UAAU,KAAK,EACf,MAAM,IAAIE,cAAYF,UAAU,KAAK,EAAE;YAG3C,MAAMG,WAAW,MAAMC,WAAW;gBAC9BV;gBACA,QAAQM,UAAU,MAAM;gBACxB,QAAQA,UAAU,MAAM;YAC5B;YAEA,MAAMK,aAAaF,SAAS,MAAM,CAAC,IAAI,CAACG,CAAAA,QAAS,CAAC,CAACA,MAAM,KAAK;YAC9D,MAAMC,QAAQJ,SAAS,KAAK,IAAIE;YAEhC,OAAO;gBACH,GAAGF,QAAQ;gBACX,SAASI,QAAQ,OAAO;YAC5B;QACJ;IACJ"}
1
+ {"version":3,"file":"export/crud/importing.js","sources":["../../../src/export/crud/importing.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport type {\n HeadlessCmsImport,\n ValidCmsGroupResult,\n ValidCmsModelResult\n} from \"~/export/types.js\";\nimport type { CmsContext } from \"~/types/index.js\";\nimport { importData } from \"./imports/importData.js\";\nimport { validateInput } from \"./imports/validateInput.js\";\nimport { ListGroupsUseCase } from \"~/features/contentModelGroup/ListGroups/index.js\";\nimport { ListModelsUseCase } from \"~/features/contentModel/ListModels/index.js\";\n\nconst fetchGroupsAndModels = async (context: CmsContext) => {\n return await context.container.resolve(IdentityContext).withoutAuthorization(async () => {\n const groupsResult = await context.container.resolve(ListGroupsUseCase).execute();\n if (groupsResult.isFail()) {\n throw groupsResult.error;\n }\n const modelsResult = await context.container.resolve(ListModelsUseCase).execute();\n if (modelsResult.isFail()) {\n throw modelsResult.error;\n }\n return {\n groups: groupsResult.value,\n models: modelsResult.value\n };\n });\n};\n\nexport const createImportCrud = (context: CmsContext): HeadlessCmsImport => {\n return {\n validate: async params => {\n const { data } = params;\n\n const { groups, models } = await fetchGroupsAndModels(context);\n\n const validated = await validateInput({\n groups,\n models,\n data\n });\n if (validated.error) {\n return {\n groups: validated.groups,\n models: validated.models,\n message: validated.error\n };\n }\n\n return {\n groups: validated.groups,\n models: validated.models,\n message: \"Validation done.\"\n };\n },\n structure: async params => {\n const { data } = params;\n\n const { groups, models } = await fetchGroupsAndModels(context);\n\n const validated = await validateInput({\n groups,\n models,\n data\n });\n if (validated.error) {\n throw new WebinyError(validated.error, \"VALIDATION_ERROR\");\n }\n\n const imported = await importData({\n context,\n groups: validated.groups as ValidCmsGroupResult[],\n models: validated.models as ValidCmsModelResult[]\n });\n\n const modelError = imported.models.find(model => !!model.error);\n const error = imported.error || modelError;\n\n return {\n ...imported,\n message: error ? null : \"Import done.\"\n };\n }\n };\n};\n"],"names":["fetchGroupsAndModels","context","IdentityContext","groupsResult","ListGroupsUseCase","modelsResult","ListModelsUseCase","createImportCrud","params","data","groups","models","validated","validateInput","WebinyError","imported","importData","modelError","model","error"],"mappings":";;;;;;AAaA,MAAMA,uBAAuB,OAAOC,UACzB,MAAMA,QAAQ,SAAS,CAAC,OAAO,CAACC,iBAAiB,oBAAoB,CAAC;QACzE,MAAMC,eAAe,MAAMF,QAAQ,SAAS,CAAC,OAAO,CAACG,mBAAmB,OAAO;QAC/E,IAAID,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAE5B,MAAME,eAAe,MAAMJ,QAAQ,SAAS,CAAC,OAAO,CAACK,mBAAmB,OAAO;QAC/E,IAAID,aAAa,MAAM,IACnB,MAAMA,aAAa,KAAK;QAE5B,OAAO;YACH,QAAQF,aAAa,KAAK;YAC1B,QAAQE,aAAa,KAAK;QAC9B;IACJ;AAGG,MAAME,mBAAmB,CAACN,UACtB;QACH,UAAU,OAAMO;YACZ,MAAM,EAAEC,IAAI,EAAE,GAAGD;YAEjB,MAAM,EAAEE,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAMX,qBAAqBC;YAEtD,MAAMW,YAAY,MAAMC,cAAc;gBAClCH;gBACAC;gBACAF;YACJ;YACA,IAAIG,UAAU,KAAK,EACf,OAAO;gBACH,QAAQA,UAAU,MAAM;gBACxB,QAAQA,UAAU,MAAM;gBACxB,SAASA,UAAU,KAAK;YAC5B;YAGJ,OAAO;gBACH,QAAQA,UAAU,MAAM;gBACxB,QAAQA,UAAU,MAAM;gBACxB,SAAS;YACb;QACJ;QACA,WAAW,OAAMJ;YACb,MAAM,EAAEC,IAAI,EAA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