@webiny/api-headless-cms 6.6.0-alpha.0 → 6.6.0-alpha.10

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 (549) hide show
  1. package/HeadlessCmsFeature.js +17 -38
  2. package/HeadlessCmsFeature.js.map +1 -1
  3. package/createCmsRoute.d.ts +13 -10
  4. package/createCmsRoute.js +40 -18
  5. package/createCmsRoute.js.map +1 -1
  6. package/crud/contentEntry/entryDataValidation.js +44 -11
  7. package/crud/contentEntry/entryDataValidation.js.map +1 -1
  8. package/crud/contentModel/defaultFields.js +3 -2
  9. package/crud/contentModel/defaultFields.js.map +1 -1
  10. package/crud/contentModel/validate/endingAllowed.js +1 -1
  11. package/crud/contentModel/validate/endingAllowed.js.map +1 -1
  12. package/crud/contentModel/validate/pluralApiName.js +1 -1
  13. package/crud/contentModel/validate/pluralApiName.js.map +1 -1
  14. package/crud/contentModel/validate/singularApiName.js +1 -1
  15. package/crud/contentModel/validate/singularApiName.js.map +1 -1
  16. package/crud/contentModel/validation.js +2 -2
  17. package/crud/contentModel/validation.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/endingAllowed.js +1 -1
  25. package/domain/contentModel/validation/endingAllowed.js.map +1 -1
  26. package/domain/contentModel/validation/modelFields.js +4 -2
  27. package/domain/contentModel/validation/modelFields.js.map +1 -1
  28. package/domain/contentModel/validation/pluralApiName.js +1 -1
  29. package/domain/contentModel/validation/pluralApiName.js.map +1 -1
  30. package/domain/contentModel/validation/singularApiName.js +1 -1
  31. package/domain/contentModel/validation/singularApiName.js.map +1 -1
  32. package/export/crud/exporting.js +2 -2
  33. package/export/crud/exporting.js.map +1 -1
  34. package/export/crud/imports/importGroups.js +1 -2
  35. package/export/crud/imports/importGroups.js.map +1 -1
  36. package/export/crud/imports/validateModels.js +1 -1
  37. package/export/crud/imports/validateModels.js.map +1 -1
  38. package/exports/api/cms/entry.d.ts +5 -0
  39. package/exports/api/cms/entry.js +5 -0
  40. package/exports/api/cms/model.d.ts +4 -1
  41. package/exports/api/cms/model.js +2 -0
  42. package/features/ai/DescribeContentModelTool.d.ts +60 -0
  43. package/features/ai/DescribeContentModelTool.js +69 -0
  44. package/features/ai/DescribeContentModelTool.js.map +1 -0
  45. package/features/ai/ListContentModelsTool.d.ts +46 -0
  46. package/features/ai/ListContentModelsTool.js +53 -0
  47. package/features/ai/ListContentModelsTool.js.map +1 -0
  48. package/features/ai/QueryEntriesTool.d.ts +80 -0
  49. package/features/ai/QueryEntriesTool.js +99 -0
  50. package/features/ai/QueryEntriesTool.js.map +1 -0
  51. package/features/ai/feature.d.ts +8 -0
  52. package/features/ai/feature.js +15 -0
  53. package/features/ai/feature.js.map +1 -0
  54. package/features/ai/index.d.ts +4 -0
  55. package/features/ai/index.js +4 -0
  56. package/features/contentEntry/ContentEntriesFeature.js +8 -0
  57. package/features/contentEntry/ContentEntriesFeature.js.map +1 -1
  58. package/features/contentEntry/CreateEntry/CreateEntryRepository.d.ts +4 -2
  59. package/features/contentEntry/CreateEntry/CreateEntryRepository.js +8 -3
  60. package/features/contentEntry/CreateEntry/CreateEntryRepository.js.map +1 -1
  61. package/features/contentEntry/CreateEntry/CreateEntryUseCase.d.ts +2 -2
  62. package/features/contentEntry/CreateEntry/CreateEntryUseCase.js +3 -4
  63. package/features/contentEntry/CreateEntry/CreateEntryUseCase.js.map +1 -1
  64. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.d.ts +4 -2
  65. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js +8 -3
  66. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromRepository.js.map +1 -1
  67. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.d.ts +2 -4
  68. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js +6 -14
  69. package/features/contentEntry/CreateEntryRevisionFrom/CreateEntryRevisionFromUseCase.js.map +1 -1
  70. package/features/contentEntry/CreateEntryRevisionFrom/abstractions.d.ts +2 -0
  71. package/features/contentEntry/CreateEntryRevisionFrom/abstractions.js.map +1 -1
  72. package/features/contentEntry/DeleteEntry/DeleteEntryRepository.d.ts +4 -2
  73. package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js +8 -3
  74. package/features/contentEntry/DeleteEntry/DeleteEntryRepository.js.map +1 -1
  75. package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.d.ts +2 -2
  76. package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js +2 -2
  77. package/features/contentEntry/DeleteEntry/DeleteEntryUseCase.js.map +1 -1
  78. package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.d.ts +3 -1
  79. package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js +7 -3
  80. package/features/contentEntry/DeleteEntry/MoveEntryToBinRepository.js.map +1 -1
  81. package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.d.ts +2 -2
  82. package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js +2 -2
  83. package/features/contentEntry/DeleteEntry/MoveEntryToBinUseCase.js.map +1 -1
  84. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.d.ts +3 -1
  85. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js +9 -3
  86. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionRepository.js.map +1 -1
  87. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.d.ts +2 -2
  88. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js +2 -2
  89. package/features/contentEntry/DeleteEntryRevision/DeleteEntryRevisionUseCase.js.map +1 -1
  90. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.d.ts +4 -2
  91. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js +7 -3
  92. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesRepository.js.map +1 -1
  93. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.d.ts +2 -2
  94. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js +11 -10
  95. package/features/contentEntry/DeleteMultipleEntries/DeleteMultipleEntriesUseCase.js.map +1 -1
  96. package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.d.ts +17 -0
  97. package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.js +83 -0
  98. package/features/contentEntry/DuplicateEntry/DuplicateEntryUseCase.js.map +1 -0
  99. package/features/contentEntry/DuplicateEntry/abstractions.d.ts +47 -0
  100. package/features/contentEntry/DuplicateEntry/abstractions.js +5 -0
  101. package/features/contentEntry/DuplicateEntry/abstractions.js.map +1 -0
  102. package/features/contentEntry/DuplicateEntry/events.d.ts +41 -0
  103. package/features/contentEntry/DuplicateEntry/events.js +32 -0
  104. package/features/contentEntry/DuplicateEntry/events.js.map +1 -0
  105. package/features/contentEntry/DuplicateEntry/feature.d.ts +4 -0
  106. package/features/contentEntry/DuplicateEntry/feature.js +11 -0
  107. package/features/contentEntry/DuplicateEntry/feature.js.map +1 -0
  108. package/features/contentEntry/DuplicateEntry/index.d.ts +2 -0
  109. package/features/contentEntry/DuplicateEntry/index.js +2 -0
  110. package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.d.ts +7 -0
  111. package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.js +12 -0
  112. package/features/contentEntry/DuplicateEntry/prepareDuplicateValues.js.map +1 -0
  113. package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.d.ts +10 -0
  114. package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.js +25 -0
  115. package/features/contentEntry/EntryEventPublisher/EntryEventPublisher.js.map +1 -0
  116. package/features/contentEntry/EntryEventPublisher/abstractions.d.ts +16 -0
  117. package/features/contentEntry/EntryEventPublisher/abstractions.js +5 -0
  118. package/features/contentEntry/EntryEventPublisher/abstractions.js.map +1 -0
  119. package/features/contentEntry/EntryEventPublisher/feature.d.ts +4 -0
  120. package/features/contentEntry/EntryEventPublisher/feature.js +11 -0
  121. package/features/contentEntry/EntryEventPublisher/feature.js.map +1 -0
  122. package/features/contentEntry/EntryEventPublisher/index.d.ts +2 -0
  123. package/features/contentEntry/EntryEventPublisher/index.js +2 -0
  124. package/features/contentEntry/EntrySystemField/abstractions.d.ts +14 -0
  125. package/features/contentEntry/EntrySystemField/abstractions.js +5 -0
  126. package/features/contentEntry/EntrySystemField/abstractions.js.map +1 -0
  127. package/features/contentEntry/EntrySystemField/index.d.ts +1 -0
  128. package/features/contentEntry/EntrySystemField/index.js +1 -0
  129. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.d.ts +4 -4
  130. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js +8 -11
  131. package/features/contentEntry/GetEntriesByIds/GetEntriesByIdsRepository.js.map +1 -1
  132. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.d.ts +4 -2
  133. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js +7 -3
  134. package/features/contentEntry/GetLatestEntriesByIds/GetLatestEntriesByIdsRepository.js.map +1 -1
  135. package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.d.ts +4 -2
  136. package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js +7 -3
  137. package/features/contentEntry/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdRepository.js.map +1 -1
  138. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.d.ts +4 -2
  139. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js +7 -3
  140. package/features/contentEntry/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdRepository.js.map +1 -1
  141. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.d.ts +4 -2
  142. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js +7 -3
  143. package/features/contentEntry/GetPublishedEntriesByIds/GetPublishedEntriesByIdsRepository.js.map +1 -1
  144. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.d.ts +4 -2
  145. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js +7 -3
  146. package/features/contentEntry/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdRepository.js.map +1 -1
  147. package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.d.ts +4 -2
  148. package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js +7 -3
  149. package/features/contentEntry/GetRevisionById/GetRevisionByIdRepository.js.map +1 -1
  150. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.d.ts +4 -2
  151. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js +7 -3
  152. package/features/contentEntry/GetRevisionsByEntryId/GetRevisionsByEntryIdRepository.js.map +1 -1
  153. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.d.ts +4 -2
  154. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js +7 -3
  155. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesRepository.js.map +1 -1
  156. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js +3 -0
  157. package/features/contentEntry/GetUniqueFieldValues/GetUniqueFieldValuesUseCase.js.map +1 -1
  158. package/features/contentEntry/ListEntries/ListEntriesRepository.d.ts +4 -2
  159. package/features/contentEntry/ListEntries/ListEntriesRepository.js +7 -3
  160. package/features/contentEntry/ListEntries/ListEntriesRepository.js.map +1 -1
  161. package/features/contentEntry/MoveEntry/MoveEntryRepository.d.ts +4 -2
  162. package/features/contentEntry/MoveEntry/MoveEntryRepository.js +7 -3
  163. package/features/contentEntry/MoveEntry/MoveEntryRepository.js.map +1 -1
  164. package/features/contentEntry/MoveEntry/MoveEntryUseCase.d.ts +2 -2
  165. package/features/contentEntry/MoveEntry/MoveEntryUseCase.js +11 -4
  166. package/features/contentEntry/MoveEntry/MoveEntryUseCase.js.map +1 -1
  167. package/features/contentEntry/PublishEntry/PublishEntryRepository.d.ts +4 -2
  168. package/features/contentEntry/PublishEntry/PublishEntryRepository.js +8 -3
  169. package/features/contentEntry/PublishEntry/PublishEntryRepository.js.map +1 -1
  170. package/features/contentEntry/PublishEntry/PublishEntryUseCase.d.ts +4 -6
  171. package/features/contentEntry/PublishEntry/PublishEntryUseCase.js +11 -13
  172. package/features/contentEntry/PublishEntry/PublishEntryUseCase.js.map +1 -1
  173. package/features/contentEntry/PublishEntry/abstractions.d.ts +8 -1
  174. package/features/contentEntry/PublishEntry/abstractions.js.map +1 -1
  175. package/features/contentEntry/RepublishEntry/RepublishEntryRepository.d.ts +4 -2
  176. package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js +8 -3
  177. package/features/contentEntry/RepublishEntry/RepublishEntryRepository.js.map +1 -1
  178. package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.d.ts +2 -2
  179. package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js +5 -3
  180. package/features/contentEntry/RepublishEntry/RepublishEntryUseCase.js.map +1 -1
  181. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.d.ts +4 -2
  182. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js +8 -3
  183. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinRepository.js.map +1 -1
  184. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.d.ts +2 -2
  185. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js +2 -2
  186. package/features/contentEntry/RestoreEntryFromBin/RestoreEntryFromBinUseCase.js.map +1 -1
  187. package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.d.ts +4 -2
  188. package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js +8 -3
  189. package/features/contentEntry/UnpublishEntry/UnpublishEntryRepository.js.map +1 -1
  190. package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.d.ts +2 -2
  191. package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js +5 -3
  192. package/features/contentEntry/UnpublishEntry/UnpublishEntryUseCase.js.map +1 -1
  193. package/features/contentEntry/UpdateEntry/UpdateEntryRepository.d.ts +4 -2
  194. package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js +8 -3
  195. package/features/contentEntry/UpdateEntry/UpdateEntryRepository.js.map +1 -1
  196. package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.d.ts +2 -2
  197. package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js +5 -3
  198. package/features/contentEntry/UpdateEntry/UpdateEntryUseCase.js.map +1 -1
  199. package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.d.ts +19 -0
  200. package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.js +70 -0
  201. package/features/contentEntry/UpdateEntrySystem/UpdateEntrySystemUseCase.js.map +1 -0
  202. package/features/contentEntry/UpdateEntrySystem/abstractions.d.ts +24 -0
  203. package/features/contentEntry/UpdateEntrySystem/abstractions.js +5 -0
  204. package/features/contentEntry/UpdateEntrySystem/abstractions.js.map +1 -0
  205. package/features/contentEntry/UpdateEntrySystem/events.d.ts +29 -0
  206. package/features/contentEntry/UpdateEntrySystem/events.js +23 -0
  207. package/features/contentEntry/UpdateEntrySystem/events.js.map +1 -0
  208. package/features/contentEntry/UpdateEntrySystem/feature.d.ts +4 -0
  209. package/features/contentEntry/UpdateEntrySystem/feature.js +11 -0
  210. package/features/contentEntry/UpdateEntrySystem/feature.js.map +1 -0
  211. package/features/contentEntry/UpdateEntrySystem/index.d.ts +2 -0
  212. package/features/contentEntry/UpdateEntrySystem/index.js +2 -0
  213. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.d.ts +2 -2
  214. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js +2 -2
  215. package/features/contentEntry/UpdateRevisionDescription/UpdateRevisionDescriptionUseCase.js.map +1 -1
  216. package/features/contentEntry/ensureItemIds.d.ts +13 -0
  217. package/features/contentEntry/ensureItemIds.js +22 -0
  218. package/features/contentEntry/ensureItemIds.js.map +1 -0
  219. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.d.ts +3 -1
  220. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js +8 -2
  221. package/features/contentEntry/entryDataFactories/CreateEntryDataFactory/CreateEntryDataFactory.js.map +1 -1
  222. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.d.ts +7 -3
  223. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js +46 -13
  224. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/CreateEntryRevisionFromDataFactory.js.map +1 -1
  225. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.d.ts +17 -1
  226. package/features/contentEntry/entryDataFactories/CreateEntryRevisionFromDataFactory/abstractions.js.map +1 -1
  227. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.d.ts +5 -3
  228. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js +22 -15
  229. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/CreatePublishEntryDataFactory.js.map +1 -1
  230. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.d.ts +15 -1
  231. package/features/contentEntry/entryDataFactories/CreatePublishEntryDataFactory/abstractions.js.map +1 -1
  232. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.d.ts +5 -3
  233. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js +17 -12
  234. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/CreateRepublishEntryDataFactory.js.map +1 -1
  235. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.d.ts +13 -1
  236. package/features/contentEntry/entryDataFactories/CreateRepublishEntryDataFactory/abstractions.js.map +1 -1
  237. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.d.ts +6 -6
  238. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js +17 -17
  239. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/CreateUnpublishEntryDataFactory.js.map +1 -1
  240. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.d.ts +14 -2
  241. package/features/contentEntry/entryDataFactories/CreateUnpublishEntryDataFactory/abstractions.js.map +1 -1
  242. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.d.ts +7 -3
  243. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js +72 -28
  244. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/UpdateEntryDataFactory.js.map +1 -1
  245. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.d.ts +15 -1
  246. package/features/contentEntry/entryDataFactories/UpdateEntryDataFactory/abstractions.js.map +1 -1
  247. package/features/contentEntry/entryDataFactories/expiresAt.js +2 -2
  248. package/features/contentEntry/entryDataFactories/expiresAt.js.map +1 -1
  249. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.d.ts +24 -0
  250. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js +13 -0
  251. package/features/contentEntry/entryDataFactories/hasEntryContentChanged.js.map +1 -0
  252. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.d.ts +14 -0
  253. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js +32 -0
  254. package/features/contentModel/ComponentMapGenerator/ComponentMapGenerator.js.map +1 -0
  255. package/features/contentModel/ComponentMapGenerator/abstractions.d.ts +8 -0
  256. package/features/contentModel/ComponentMapGenerator/abstractions.js +5 -0
  257. package/features/contentModel/ComponentMapGenerator/abstractions.js.map +1 -0
  258. package/features/contentModel/ComponentMapGenerator/feature.d.ts +4 -0
  259. package/features/contentModel/ComponentMapGenerator/feature.js +11 -0
  260. package/features/contentModel/ComponentMapGenerator/feature.js.map +1 -0
  261. package/features/contentModel/ComponentMapGenerator/index.d.ts +2 -0
  262. package/features/contentModel/ComponentMapGenerator/index.js +2 -0
  263. package/features/contentModel/ContentModelFeature.js +4 -0
  264. package/features/contentModel/ContentModelFeature.js.map +1 -1
  265. package/features/contentModel/CreateModel/CreateModelRepository.js +1 -2
  266. package/features/contentModel/CreateModel/CreateModelRepository.js.map +1 -1
  267. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js +1 -2
  268. package/features/contentModel/CreateModelFrom/CreateModelFromRepository.js.map +1 -1
  269. package/features/contentModel/DeleteModel/DeleteModelRepository.d.ts +4 -2
  270. package/features/contentModel/DeleteModel/DeleteModelRepository.js +7 -3
  271. package/features/contentModel/DeleteModel/DeleteModelRepository.js.map +1 -1
  272. package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.d.ts +9 -4
  273. package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js +36 -21
  274. package/features/contentModel/DeleteModel/DeleteModelWithEntryCleanup.js.map +1 -1
  275. package/features/contentModel/ModelToAstConverter/ModelToAstConverter.d.ts +1 -1
  276. package/features/contentModel/ModelToAstConverter/ModelToAstConverter.js.map +1 -1
  277. package/features/contentModel/ModelToAstConverter/abstractions.d.ts +1 -1
  278. package/features/contentModel/ModelToAstConverter/abstractions.js.map +1 -1
  279. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.d.ts +19 -0
  280. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js +56 -0
  281. package/features/contentModel/RefModelsGenerator/RefModelsGenerator.js.map +1 -0
  282. package/features/contentModel/RefModelsGenerator/abstractions.d.ts +11 -0
  283. package/features/contentModel/RefModelsGenerator/abstractions.js +5 -0
  284. package/features/contentModel/RefModelsGenerator/abstractions.js.map +1 -0
  285. package/features/contentModel/RefModelsGenerator/feature.d.ts +4 -0
  286. package/features/contentModel/RefModelsGenerator/feature.js +11 -0
  287. package/features/contentModel/RefModelsGenerator/feature.js.map +1 -0
  288. package/features/contentModel/RefModelsGenerator/index.d.ts +2 -0
  289. package/features/contentModel/RefModelsGenerator/index.js +2 -0
  290. package/features/contentModel/UpdateModel/UpdateModelRepository.d.ts +4 -2
  291. package/features/contentModel/UpdateModel/UpdateModelRepository.js +8 -4
  292. package/features/contentModel/UpdateModel/UpdateModelRepository.js.map +1 -1
  293. package/features/contentModel/UpdateModel/UpdateModelUseCase.js +2 -2
  294. package/features/contentModel/UpdateModel/UpdateModelUseCase.js.map +1 -1
  295. package/features/contentModel/UpdateModel/abstractions.d.ts +1 -1
  296. package/features/contentModel/UpdateModel/abstractions.js.map +1 -1
  297. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js +5 -2
  298. package/features/contentModel/ValuesSelectionGenerator/ValuesSelectionGenerator.js.map +1 -1
  299. package/features/contentModel/shared/ModelsFetcher.d.ts +6 -5
  300. package/features/contentModel/shared/ModelsFetcher.js.map +1 -1
  301. package/features/contentModel/shared/PluginModelsProvider.d.ts +6 -3
  302. package/features/contentModel/shared/PluginModelsProvider.js +2 -9
  303. package/features/contentModel/shared/PluginModelsProvider.js.map +1 -1
  304. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.d.ts +3 -1
  305. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js +6 -4
  306. package/features/contentModelGroup/CreateGroup/CreateGroupRepository.js.map +1 -1
  307. package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.d.ts +4 -2
  308. package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js +7 -3
  309. package/features/contentModelGroup/DeleteGroup/DeleteGroupRepository.js.map +1 -1
  310. package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.d.ts +4 -2
  311. package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js +8 -4
  312. package/features/contentModelGroup/UpdateGroup/UpdateGroupRepository.js.map +1 -1
  313. package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js +2 -2
  314. package/features/contentModelGroup/UpdateGroup/UpdateGroupUseCase.js.map +1 -1
  315. package/features/contentModelGroup/UpdateGroup/abstractions.d.ts +1 -1
  316. package/features/contentModelGroup/UpdateGroup/abstractions.js.map +1 -1
  317. package/features/graphql/feature.js +2 -0
  318. package/features/graphql/feature.js.map +1 -1
  319. package/features/graphql/fields/base/AssetToGraphQL.d.ts +26 -0
  320. package/features/graphql/fields/base/AssetToGraphQL.js +153 -0
  321. package/features/graphql/fields/base/AssetToGraphQL.js.map +1 -0
  322. package/features/graphql/fields/base/DynamicZoneToGraphQL.js +12 -2
  323. package/features/graphql/fields/base/DynamicZoneToGraphQL.js.map +1 -1
  324. package/features/graphql/fields/base/ObjectToGraphQL.js +8 -5
  325. package/features/graphql/fields/base/ObjectToGraphQL.js.map +1 -1
  326. package/features/graphql/fields/base/RefToGraphQL.js +24 -10
  327. package/features/graphql/fields/base/RefToGraphQL.js.map +1 -1
  328. package/features/modelBuilder/abstractions.d.ts +13 -0
  329. package/features/modelBuilder/abstractions.js.map +1 -1
  330. package/features/modelBuilder/feature.js +3 -8
  331. package/features/modelBuilder/feature.js.map +1 -1
  332. package/features/modelBuilder/fields/AssetFieldType.d.ts +20 -0
  333. package/features/modelBuilder/fields/AssetFieldType.js +46 -0
  334. package/features/modelBuilder/fields/AssetFieldType.js.map +1 -0
  335. package/features/modelBuilder/fields/BaseFieldBuilder.d.ts +3 -1
  336. package/features/modelBuilder/fields/BaseFieldBuilder.js +4 -0
  337. package/features/modelBuilder/fields/BaseFieldBuilder.js.map +1 -1
  338. package/features/modelBuilder/fields/DataFieldBuilder.d.ts +59 -0
  339. package/features/modelBuilder/fields/DataFieldBuilder.js +11 -1
  340. package/features/modelBuilder/fields/DataFieldBuilder.js.map +1 -1
  341. package/features/modelBuilder/fields/DateTimeFieldType.js +27 -12
  342. package/features/modelBuilder/fields/DateTimeFieldType.js.map +1 -1
  343. package/features/modelBuilder/fields/DynamicZoneFieldType.d.ts +1 -0
  344. package/features/modelBuilder/fields/DynamicZoneFieldType.js +10 -9
  345. package/features/modelBuilder/fields/DynamicZoneFieldType.js.map +1 -1
  346. package/features/modelBuilder/fields/UiAlertFieldType.js +2 -1
  347. package/features/modelBuilder/fields/UiAlertFieldType.js.map +1 -1
  348. package/features/modelBuilder/fields/UiSeparatorFieldType.js +2 -1
  349. package/features/modelBuilder/fields/UiSeparatorFieldType.js.map +1 -1
  350. package/features/modelBuilder/fields/UiTabsFieldType.d.ts +2 -1
  351. package/features/modelBuilder/fields/UiTabsFieldType.js +6 -3
  352. package/features/modelBuilder/fields/UiTabsFieldType.js.map +1 -1
  353. package/features/modelBuilder/fields/fieldTypeValidator.d.ts +5 -3
  354. package/features/modelBuilder/fields/resolveAssetUrl.d.ts +35 -0
  355. package/features/modelBuilder/fields/resolveAssetUrl.js +26 -0
  356. package/features/modelBuilder/fields/resolveAssetUrl.js.map +1 -0
  357. package/features/modelBuilder/index.d.ts +1 -1
  358. package/features/modelBuilder/models/BaseModelBuilder.d.ts +3 -1
  359. package/features/modelBuilder/models/BaseModelBuilder.js +7 -0
  360. package/features/modelBuilder/models/BaseModelBuilder.js.map +1 -1
  361. package/features/modelBuilder/models/ModelBuilder.d.ts +8 -0
  362. package/features/modelBuilder/models/ModelBuilder.js +1 -0
  363. package/features/modelBuilder/models/ModelBuilder.js.map +1 -1
  364. package/features/modelBuilder/models/ModelsProvider.d.ts +1 -3
  365. package/features/modelBuilder/models/ModelsProvider.js +2 -7
  366. package/features/modelBuilder/models/ModelsProvider.js.map +1 -1
  367. package/features/modelBuilder/models/PrivateModelBuilder.d.ts +5 -0
  368. package/features/modelBuilder/models/PrivateModelBuilder.js +13 -1
  369. package/features/modelBuilder/models/PrivateModelBuilder.js.map +1 -1
  370. package/features/modelBuilder/models/PublicModelBuilder.js +2 -1
  371. package/features/modelBuilder/models/PublicModelBuilder.js.map +1 -1
  372. package/features/modelStorageSync/ModelStorageSyncTask.d.ts +31 -0
  373. package/features/modelStorageSync/ModelStorageSyncTask.js +66 -0
  374. package/features/modelStorageSync/ModelStorageSyncTask.js.map +1 -0
  375. package/features/modelStorageSync/SyncStorageOnModelUpdate.d.ts +23 -0
  376. package/features/modelStorageSync/SyncStorageOnModelUpdate.js +51 -0
  377. package/features/modelStorageSync/SyncStorageOnModelUpdate.js.map +1 -0
  378. package/features/modelStorageSync/abstractions.d.ts +34 -0
  379. package/features/modelStorageSync/abstractions.js +6 -0
  380. package/features/modelStorageSync/abstractions.js.map +1 -0
  381. package/features/modelStorageSync/feature.d.ts +8 -0
  382. package/features/modelStorageSync/feature.js +13 -0
  383. package/features/modelStorageSync/feature.js.map +1 -0
  384. package/features/modelStorageSync/index.d.ts +2 -0
  385. package/features/modelStorageSync/index.js +2 -0
  386. package/features/runtimeTenant/RuntimeTenant.d.ts +13 -0
  387. package/features/runtimeTenant/RuntimeTenant.js +22 -0
  388. package/features/runtimeTenant/RuntimeTenant.js.map +1 -0
  389. package/features/runtimeTenant/abstractions.d.ts +11 -0
  390. package/features/runtimeTenant/abstractions.js +5 -0
  391. package/features/runtimeTenant/abstractions.js.map +1 -0
  392. package/features/runtimeTenant/index.d.ts +2 -0
  393. package/features/runtimeTenant/index.js +2 -0
  394. package/features/shared/abstractions.d.ts +1 -5
  395. package/features/shared/abstractions.js +1 -2
  396. package/features/shared/abstractions.js.map +1 -1
  397. package/features/sortMapper/SortMapper.js +2 -5
  398. package/features/sortMapper/SortMapper.js.map +1 -1
  399. package/features/storage/fields/CompressedTextStorageTransform.js +1 -1
  400. package/features/storage/fields/CompressedTextStorageTransform.js.map +1 -1
  401. package/features/storage/fields/DateStorageTransform.js +3 -4
  402. package/features/storage/fields/DateStorageTransform.js.map +1 -1
  403. package/features/storage/fields/DynamicZoneStorageTransform.js +2 -2
  404. package/features/storage/fields/DynamicZoneStorageTransform.js.map +1 -1
  405. package/features/storage/fields/JsonStorageTransform.js +1 -1
  406. package/features/storage/fields/JsonStorageTransform.js.map +1 -1
  407. package/features/storage/fields/LongTextStorageTransform.js +1 -1
  408. package/features/storage/fields/LongTextStorageTransform.js.map +1 -1
  409. package/features/storage/fields/ObjectStorageTransform.js +27 -7
  410. package/features/storage/fields/ObjectStorageTransform.js.map +1 -1
  411. package/features/storage/fields/RichTextStorageTransform.js +1 -1
  412. package/features/storage/fields/RichTextStorageTransform.js.map +1 -1
  413. package/features/validation/abstractions/CmsModelFieldValidator.d.ts +5 -0
  414. package/features/validation/abstractions/CmsModelFieldValidator.js.map +1 -1
  415. package/features/validation/validators/DateGteValidator.d.ts +2 -0
  416. package/features/validation/validators/DateGteValidator.js +12 -2
  417. package/features/validation/validators/DateGteValidator.js.map +1 -1
  418. package/features/validation/validators/DateLteValidator.d.ts +2 -0
  419. package/features/validation/validators/DateLteValidator.js +12 -2
  420. package/features/validation/validators/DateLteValidator.js.map +1 -1
  421. package/features/validation/validators/PatternValidator.js +1 -1
  422. package/features/validation/validators/PatternValidator.js.map +1 -1
  423. package/features/validation/validators/dateLimit.d.ts +9 -0
  424. package/features/validation/validators/dateLimit.js +18 -0
  425. package/features/validation/validators/dateLimit.js.map +1 -0
  426. package/features/whereMapper/WhereMapper.js +8 -8
  427. package/features/whereMapper/WhereMapper.js.map +1 -1
  428. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +15 -5
  429. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
  430. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +8 -2
  431. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
  432. package/graphql/checkEndpointAccess.d.ts +7 -2
  433. package/graphql/checkEndpointAccess.js +2 -4
  434. package/graphql/checkEndpointAccess.js.map +1 -1
  435. package/graphql/getSchema/generateCacheKey.js +1 -1
  436. package/graphql/getSchema/generateCacheKey.js.map +1 -1
  437. package/graphql/scalars/RevisionId.js +1 -1
  438. package/graphql/scalars/RevisionId.js.map +1 -1
  439. package/graphql/schema/cms/CmsBaseErrorTypeFactory.d.ts +1 -0
  440. package/graphql/schema/cms/CmsBaseErrorTypeFactory.js +4 -0
  441. package/graphql/schema/cms/CmsBaseErrorTypeFactory.js.map +1 -1
  442. package/graphql/schema/cms/getEntryResolver.js +3 -2
  443. package/graphql/schema/cms/getEntryResolver.js.map +1 -1
  444. package/graphql/schema/cms/getModelResolver.d.ts +35 -0
  445. package/graphql/schema/cms/getModelResolver.js +49 -0
  446. package/graphql/schema/cms/getModelResolver.js.map +1 -0
  447. package/graphql/schema/cms/helpers/buildFieldsSelection.js +9 -2
  448. package/graphql/schema/cms/helpers/buildFieldsSelection.js.map +1 -1
  449. package/graphql/schema/cms/helpers/expandFieldWildcards.d.ts +2 -0
  450. package/graphql/schema/cms/helpers/expandFieldWildcards.js +13 -0
  451. package/graphql/schema/cms/helpers/expandFieldWildcards.js.map +1 -0
  452. package/graphql/schema/cms/helpers/index.d.ts +1 -0
  453. package/graphql/schema/cms/helpers/index.js +1 -0
  454. package/graphql/schema/cms/helpers/transformWhereToNested.js +39 -17
  455. package/graphql/schema/cms/helpers/transformWhereToNested.js.map +1 -1
  456. package/graphql/schema/cms/helpers.d.ts +1 -0
  457. package/graphql/schema/cms/helpers.js +1 -0
  458. package/graphql/schema/cms/listEntriesResolver.js +3 -2
  459. package/graphql/schema/cms/listEntriesResolver.js.map +1 -1
  460. package/graphql/schema/cms/resolvers/createEntry.d.ts +1 -0
  461. package/graphql/schema/cms/resolvers/createEntry.js +4 -0
  462. package/graphql/schema/cms/resolvers/createEntry.js.map +1 -1
  463. package/graphql/schema/cms/resolvers/deleteEntryRevision.d.ts +1 -0
  464. package/graphql/schema/cms/resolvers/deleteEntryRevision.js +4 -0
  465. package/graphql/schema/cms/resolvers/deleteEntryRevision.js.map +1 -1
  466. package/graphql/schema/cms/resolvers/getEntry.d.ts +1 -0
  467. package/graphql/schema/cms/resolvers/getEntry.js +4 -0
  468. package/graphql/schema/cms/resolvers/getEntry.js.map +1 -1
  469. package/graphql/schema/cms/resolvers/getModel.d.ts +9 -0
  470. package/graphql/schema/cms/resolvers/getModel.js +22 -0
  471. package/graphql/schema/cms/resolvers/getModel.js.map +1 -0
  472. package/graphql/schema/cms/resolvers/index.d.ts +1 -0
  473. package/graphql/schema/cms/resolvers/index.js +1 -0
  474. package/graphql/schema/cms/resolvers/listEntries.d.ts +1 -0
  475. package/graphql/schema/cms/resolvers/listEntries.js +4 -0
  476. package/graphql/schema/cms/resolvers/listEntries.js.map +1 -1
  477. package/graphql/schema/cms/resolvers/mutationCms.d.ts +1 -0
  478. package/graphql/schema/cms/resolvers/mutationCms.js +4 -0
  479. package/graphql/schema/cms/resolvers/mutationCms.js.map +1 -1
  480. package/graphql/schema/cms/resolvers/publishEntryRevision.d.ts +1 -0
  481. package/graphql/schema/cms/resolvers/publishEntryRevision.js +4 -0
  482. package/graphql/schema/cms/resolvers/publishEntryRevision.js.map +1 -1
  483. package/graphql/schema/cms/resolvers/queryCms.d.ts +1 -0
  484. package/graphql/schema/cms/resolvers/queryCms.js +4 -0
  485. package/graphql/schema/cms/resolvers/queryCms.js.map +1 -1
  486. package/graphql/schema/cms/resolvers/unpublishEntryRevision.d.ts +1 -0
  487. package/graphql/schema/cms/resolvers/unpublishEntryRevision.js +4 -0
  488. package/graphql/schema/cms/resolvers/unpublishEntryRevision.js.map +1 -1
  489. package/graphql/schema/cms/resolvers/updateEntryRevision.d.ts +1 -0
  490. package/graphql/schema/cms/resolvers/updateEntryRevision.js +4 -0
  491. package/graphql/schema/cms/resolvers/updateEntryRevision.js.map +1 -1
  492. package/graphql/schema/cms/typeDefs/mutation.d.ts +1 -0
  493. package/graphql/schema/cms/typeDefs/mutation.js +4 -0
  494. package/graphql/schema/cms/typeDefs/mutation.js.map +1 -1
  495. package/graphql/schema/cms/typeDefs/query.d.ts +1 -0
  496. package/graphql/schema/cms/typeDefs/query.js +5 -0
  497. package/graphql/schema/cms/typeDefs/query.js.map +1 -1
  498. package/graphql/schema/cms/typeDefs/responses.d.ts +1 -0
  499. package/graphql/schema/cms/typeDefs/responses.js +9 -0
  500. package/graphql/schema/cms/typeDefs/responses.js.map +1 -1
  501. package/graphql/schema/contentEntries.js +19 -4
  502. package/graphql/schema/contentEntries.js.map +1 -1
  503. package/graphql/schema/contentModels.js +33 -0
  504. package/graphql/schema/contentModels.js.map +1 -1
  505. package/graphql/schema/createFieldResolvers.js +1 -1
  506. package/graphql/schema/createFieldResolvers.js.map +1 -1
  507. package/graphql/schema/createManageResolvers.js +3 -1
  508. package/graphql/schema/createManageResolvers.js.map +1 -1
  509. package/graphql/schema/createManageSDL.js +2 -0
  510. package/graphql/schema/createManageSDL.js.map +1 -1
  511. package/graphql/schema/resolvers/manage/resolveDuplicate.d.ts +7 -0
  512. package/graphql/schema/resolvers/manage/resolveDuplicate.js +11 -0
  513. package/graphql/schema/resolvers/manage/resolveDuplicate.js.map +1 -0
  514. package/package.json +24 -25
  515. package/plugins/CmsModelPlugin.js +11 -11
  516. package/plugins/CmsModelPlugin.js.map +1 -1
  517. package/types/fields/dynamicZoneField.d.ts +3 -2
  518. package/types/index.d.ts +0 -1
  519. package/types/model.d.ts +6 -0
  520. package/types/modelField.d.ts +14 -1
  521. package/types/types.d.ts +14 -109
  522. package/types/types.js.map +1 -1
  523. package/utils/caching/Cache.js +1 -1
  524. package/utils/caching/Cache.js.map +1 -1
  525. package/utils/createModelField.js +2 -1
  526. package/utils/createModelField.js.map +1 -1
  527. package/utils/createModelSchemaKey.d.ts +8 -0
  528. package/utils/createModelSchemaKey.js +18 -0
  529. package/utils/createModelSchemaKey.js.map +1 -0
  530. package/utils/date.js +1 -1
  531. package/utils/date.js.map +1 -1
  532. package/utils/entryStorage.js +1 -1
  533. package/utils/entryStorage.js.map +1 -1
  534. package/utils/renderFields.js +1 -1
  535. package/utils/renderFields.js.map +1 -1
  536. package/HeadlessCmsContextualSchema.d.ts +0 -16
  537. package/HeadlessCmsContextualSchema.js +0 -32
  538. package/HeadlessCmsContextualSchema.js.map +0 -1
  539. package/crud/contentEntry.crud.d.ts +0 -6
  540. package/crud/contentEntry.crud.js +0 -336
  541. package/crud/contentEntry.crud.js.map +0 -1
  542. package/crud/contentModel.crud.d.ts +0 -5
  543. package/crud/contentModel.crud.js +0 -79
  544. package/crud/contentModel.crud.js.map +0 -1
  545. package/crud/contentModelGroup.crud.d.ts +0 -5
  546. package/crud/contentModelGroup.crud.js +0 -76
  547. package/crud/contentModelGroup.crud.js.map +0 -1
  548. package/types/context.d.ts +0 -110
  549. package/types/context.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"domain/contentModel/validation/singularApiName.js","sources":["../../../../src/domain/contentModel/validation/singularApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsModel } from \"~/types/index.js\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateSingularApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n } else if (existingModel.pluralApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n }\n};\n"],"names":["validateSingularApiName","params","existingModel","model","WebinyError"],"mappings":";AAQO,MAAMA,0BAA0B,CAACC;IACpC,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IAEjC,IAAIC,cAAc,eAAe,KAAKC,MAAM,eAAe,EACvD,MAAM,IAAIC,MACN,CAAC,oCAAoC,EAAED,MAAM,eAAe,CAAC,iBAAiB,CAAC,EAC/E,kCACA;QACI,OAAOA,MAAM,eAAe;IAChC;IAED,IAAID,cAAc,aAAa,KAAKC,MAAM,eAAe,EAC5D,MAAM,IAAIC,MACN,CAAC,kCAAkC,EAAED,MAAM,eAAe,CAAC,iBAAiB,CAAC,EAC7E,gCACA;QACI,OAAOA,MAAM,eAAe;IAChC;AAGZ"}
1
+ {"version":3,"file":"domain/contentModel/validation/singularApiName.js","sources":["../../../../src/domain/contentModel/validation/singularApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsModel } from \"~/types/index.js\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateSingularApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n } else if (existingModel.pluralApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n }\n};\n"],"names":["validateSingularApiName","params","existingModel","model","WebinyError"],"mappings":";AAQO,MAAMA,0BAA0B,CAACC;IACpC,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IAEjC,IAAIC,cAAc,eAAe,KAAKC,MAAM,eAAe,EACvD,MAAM,IAAIC,MACN,CAAC,oCAAoC,EAAED,MAAM,eAAe,CAAC,iBAAiB,CAAC,EAC/E,kCACA;QACI,OAAOA,MAAM,eAAe;IAChC;SAED,IAAID,cAAc,aAAa,KAAKC,MAAM,eAAe,EAC5D,MAAM,IAAIC,MACN,CAAC,kCAAkC,EAAED,MAAM,eAAe,CAAC,iBAAiB,CAAC,EAC7E,gCACA;QACI,OAAOA,MAAM,eAAe;IAChC;AAGZ"}
@@ -10,8 +10,8 @@ const createExportStructureContext = (context)=>async (params)=>{
10
10
  if (modelsResult.isFail()) throw modelsResult.error;
11
11
  const models = modelsResult.value.filter((model)=>{
12
12
  if (model.isPrivate) return false;
13
- if (!model.fields?.length) return false;
14
- if (!modelIdList?.length) return true;
13
+ else if (!model.fields?.length) return false;
14
+ else if (!modelIdList?.length) return true;
15
15
  return modelIdList.includes(model.modelId);
16
16
  }).map((model)=>{
17
17
  const group = groups.find((group)=>group.slug === model.group);
@@ -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\";\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
+ {"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;iBACJ,IAAI,CAACA,MAAM,MAAM,EAAE,QACtB,OAAO;iBACJ,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"}
@@ -21,8 +21,7 @@ const importGroups = async (params)=>{
21
21
  imported: true
22
22
  });
23
23
  continue;
24
- }
25
- if (group.action === CmsImportAction.UPDATE) {
24
+ } else if (group.action === CmsImportAction.UPDATE) {
26
25
  const updateResult = await context.container.resolve(UpdateGroupUseCase).execute(group.group.id, {
27
26
  ...group.group,
28
27
  icon: group.group.icon ?? void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"export/crud/imports/importGroups.js","sources":["../../../../src/export/crud/imports/importGroups.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport type { CmsGroupImportResult, ValidCmsGroupResult } from \"~/export/types.js\";\nimport { CmsImportAction } from \"~/export/types.js\";\nimport { CreateGroupUseCase } from \"~/features/contentModelGroup/CreateGroup/index.js\";\nimport { UpdateGroupUseCase } from \"~/features/contentModelGroup/UpdateGroup/index.js\";\n\ninterface Params {\n context: CmsContext;\n groups: ValidCmsGroupResult[];\n}\n\nexport const importGroups = async (params: Params) => {\n const { context, groups } = params;\n\n const results: CmsGroupImportResult[] = [];\n for (const group of groups) {\n if (group.action === CmsImportAction.NONE || group.error) {\n results.push({\n action: group.action,\n group: group.group,\n imported: false,\n error: group.error || {\n message: \"No action to be ran on the group.\",\n code: \"NO_ACTION\"\n }\n });\n }\n /**\n * Cannot update if the group is created via plugin.\n */\n if (group.action === CmsImportAction.CODE) {\n results.push({\n action: group.action,\n group: group.group,\n imported: true\n });\n continue;\n }\n /**\n * Update the group.\n */\n //\n else if (group.action === CmsImportAction.UPDATE) {\n const updateResult = await context.container\n .resolve(UpdateGroupUseCase)\n .execute(group.group.id, {\n ...group.group,\n icon: group.group.icon ?? undefined,\n description: group.group.description || undefined\n });\n if (updateResult.isFail()) {\n const ex = updateResult.error;\n results.push({\n action: group.action,\n group: group.group,\n imported: false,\n error: {\n message: ex.message,\n code: (ex as any).code || \"UPDATE_GROUP_ERROR\",\n data: { ...(ex as any).data, group }\n }\n });\n } else {\n results.push({\n action: group.action,\n group: { ...updateResult.value },\n imported: true\n });\n }\n continue;\n }\n /**\n * Create the group\n */\n const createResult = await context.container\n .resolve(CreateGroupUseCase)\n .execute(group.group);\n if (createResult.isFail()) {\n const ex = createResult.error;\n results.push({\n action: group.action,\n group: group.group,\n imported: false,\n error: {\n message: ex.message,\n code: (ex as any).code || \"CREATE_GROUP_ERROR\",\n data: { ...(ex as any).data, group }\n }\n });\n } else {\n results.push({\n action: group.action,\n group: { ...createResult.value },\n imported: true\n });\n }\n }\n\n return results;\n};\n"],"names":["importGroups","params","context","groups","results","group","CmsImportAction","updateResult","UpdateGroupUseCase","undefined","ex","createResult","CreateGroupUseCase"],"mappings":";;;AAWO,MAAMA,eAAe,OAAOC;IAC/B,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGF;IAE5B,MAAMG,UAAkC,EAAE;IAC1C,KAAK,MAAMC,SAASF,OAAQ;QACxB,IAAIE,MAAM,MAAM,KAAKC,gBAAgB,IAAI,IAAID,MAAM,KAAK,EACpDD,QAAQ,IAAI,CAAC;YACT,QAAQC,MAAM,MAAM;YACpB,OAAOA,MAAM,KAAK;YAClB,UAAU;YACV,OAAOA,MAAM,KAAK,IAAI;gBAClB,SAAS;gBACT,MAAM;YACV;QACJ;QAKJ,IAAIA,MAAM,MAAM,KAAKC,gBAAgB,IAAI,EAAE;YACvCF,QAAQ,IAAI,CAAC;gBACT,QAAQC,MAAM,MAAM;gBACpB,OAAOA,MAAM,KAAK;gBAClB,UAAU;YACd;YACA;QACJ;QAKK,IAAIA,MAAM,MAAM,KAAKC,gBAAgB,MAAM,EAAE;YAC9C,MAAMC,eAAe,MAAML,QAAQ,SAAS,CACvC,OAAO,CAACM,oBACR,OAAO,CAACH,MAAM,KAAK,CAAC,EAAE,EAAE;gBACrB,GAAGA,MAAM,KAAK;gBACd,MAAMA,MAAM,KAAK,CAAC,IAAI,IAAII;gBAC1B,aAAaJ,MAAM,KAAK,CAAC,WAAW,IAAII;YAC5C;YACJ,IAAIF,aAAa,MAAM,IAAI;gBACvB,MAAMG,KAAKH,aAAa,KAAK;gBAC7BH,QAAQ,IAAI,CAAC;oBACT,QAAQC,MAAM,MAAM;oBACpB,OAAOA,MAAM,KAAK;oBAClB,UAAU;oBACV,OAAO;wBACH,SAASK,GAAG,OAAO;wBACnB,MAAOA,GAAW,IAAI,IAAI;wBAC1B,MAAM;4BAAE,GAAIA,GAAW,IAAI;4BAAEL;wBAAM;oBACvC;gBACJ;YACJ,OACID,QAAQ,IAAI,CAAC;gBACT,QAAQC,MAAM,MAAM;gBACpB,OAAO;oBAAE,GAAGE,aAAa,KAAK;gBAAC;gBAC/B,UAAU;YACd;YAEJ;QACJ;QAIA,MAAMI,eAAe,MAAMT,QAAQ,SAAS,CACvC,OAAO,CAACU,oBACR,OAAO,CAACP,MAAM,KAAK;QACxB,IAAIM,aAAa,MAAM,IAAI;YACvB,MAAMD,KAAKC,aAAa,KAAK;YAC7BP,QAAQ,IAAI,CAAC;gBACT,QAAQC,MAAM,MAAM;gBACpB,OAAOA,MAAM,KAAK;gBAClB,UAAU;gBACV,OAAO;oBACH,SAASK,GAAG,OAAO;oBACnB,MAAOA,GAAW,IAAI,IAAI;oBAC1B,MAAM;wBAAE,GAAIA,GAAW,IAAI;wBAAEL;oBAAM;gBACvC;YACJ;QACJ,OACID,QAAQ,IAAI,CAAC;YACT,QAAQC,MAAM,MAAM;YACpB,OAAO;gBAAE,GAAGM,aAAa,KAAK;YAAC;YAC/B,UAAU;QACd;IAER;IAEA,OAAOP;AACX"}
1
+ {"version":3,"file":"export/crud/imports/importGroups.js","sources":["../../../../src/export/crud/imports/importGroups.ts"],"sourcesContent":["import type { CmsContext } from \"~/types/index.js\";\nimport type { CmsGroupImportResult, ValidCmsGroupResult } from \"~/export/types.js\";\nimport { CmsImportAction } from \"~/export/types.js\";\nimport { CreateGroupUseCase } from \"~/features/contentModelGroup/CreateGroup/index.js\";\nimport { UpdateGroupUseCase } from \"~/features/contentModelGroup/UpdateGroup/index.js\";\n\ninterface Params {\n context: CmsContext;\n groups: ValidCmsGroupResult[];\n}\n\nexport const importGroups = async (params: Params) => {\n const { context, groups } = params;\n\n const results: CmsGroupImportResult[] = [];\n for (const group of groups) {\n if (group.action === CmsImportAction.NONE || group.error) {\n results.push({\n action: group.action,\n group: group.group,\n imported: false,\n error: group.error || {\n message: \"No action to be ran on the group.\",\n code: \"NO_ACTION\"\n }\n });\n }\n /**\n * Cannot update if the group is created via plugin.\n */\n if (group.action === CmsImportAction.CODE) {\n results.push({\n action: group.action,\n group: group.group,\n imported: true\n });\n continue;\n }\n /**\n * Update the group.\n */\n //\n else if (group.action === CmsImportAction.UPDATE) {\n const updateResult = await context.container\n .resolve(UpdateGroupUseCase)\n .execute(group.group.id, {\n ...group.group,\n icon: group.group.icon ?? undefined,\n description: group.group.description || undefined\n });\n if (updateResult.isFail()) {\n const ex = updateResult.error;\n results.push({\n action: group.action,\n group: group.group,\n imported: false,\n error: {\n message: ex.message,\n code: (ex as any).code || \"UPDATE_GROUP_ERROR\",\n data: { ...(ex as any).data, group }\n }\n });\n } else {\n results.push({\n action: group.action,\n group: { ...updateResult.value },\n imported: true\n });\n }\n continue;\n }\n /**\n * Create the group\n */\n const createResult = await context.container\n .resolve(CreateGroupUseCase)\n .execute(group.group);\n if (createResult.isFail()) {\n const ex = createResult.error;\n results.push({\n action: group.action,\n group: group.group,\n imported: false,\n error: {\n message: ex.message,\n code: (ex as any).code || \"CREATE_GROUP_ERROR\",\n data: { ...(ex as any).data, group }\n }\n });\n } else {\n results.push({\n action: group.action,\n group: { ...createResult.value },\n imported: true\n });\n }\n }\n\n return results;\n};\n"],"names":["importGroups","params","context","groups","results","group","CmsImportAction","updateResult","UpdateGroupUseCase","undefined","ex","createResult","CreateGroupUseCase"],"mappings":";;;AAWO,MAAMA,eAAe,OAAOC;IAC/B,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGF;IAE5B,MAAMG,UAAkC,EAAE;IAC1C,KAAK,MAAMC,SAASF,OAAQ;QACxB,IAAIE,MAAM,MAAM,KAAKC,gBAAgB,IAAI,IAAID,MAAM,KAAK,EACpDD,QAAQ,IAAI,CAAC;YACT,QAAQC,MAAM,MAAM;YACpB,OAAOA,MAAM,KAAK;YAClB,UAAU;YACV,OAAOA,MAAM,KAAK,IAAI;gBAClB,SAAS;gBACT,MAAM;YACV;QACJ;QAKJ,IAAIA,MAAM,MAAM,KAAKC,gBAAgB,IAAI,EAAE;YACvCF,QAAQ,IAAI,CAAC;gBACT,QAAQC,MAAM,MAAM;gBACpB,OAAOA,MAAM,KAAK;gBAClB,UAAU;YACd;YACA;QACJ,OAKK,IAAIA,MAAM,MAAM,KAAKC,gBAAgB,MAAM,EAAE;YAC9C,MAAMC,eAAe,MAAML,QAAQ,SAAS,CACvC,OAAO,CAACM,oBACR,OAAO,CAACH,MAAM,KAAK,CAAC,EAAE,EAAE;gBACrB,GAAGA,MAAM,KAAK;gBACd,MAAMA,MAAM,KAAK,CAAC,IAAI,IAAII;gBAC1B,aAAaJ,MAAM,KAAK,CAAC,WAAW,IAAII;YAC5C;YACJ,IAAIF,aAAa,MAAM,IAAI;gBACvB,MAAMG,KAAKH,aAAa,KAAK;gBAC7BH,QAAQ,IAAI,CAAC;oBACT,QAAQC,MAAM,MAAM;oBACpB,OAAOA,MAAM,KAAK;oBAClB,UAAU;oBACV,OAAO;wBACH,SAASK,GAAG,OAAO;wBACnB,MAAOA,GAAW,IAAI,IAAI;wBAC1B,MAAM;4BAAE,GAAIA,GAAW,IAAI;4BAAEL;wBAAM;oBACvC;gBACJ;YACJ,OACID,QAAQ,IAAI,CAAC;gBACT,QAAQC,MAAM,MAAM;gBACpB,OAAO;oBAAE,GAAGE,aAAa,KAAK;gBAAC;gBAC/B,UAAU;YACd;YAEJ;QACJ;QAIA,MAAMI,eAAe,MAAMT,QAAQ,SAAS,CACvC,OAAO,CAACU,oBACR,OAAO,CAACP,MAAM,KAAK;QACxB,IAAIM,aAAa,MAAM,IAAI;YACvB,MAAMD,KAAKC,aAAa,KAAK;YAC7BP,QAAQ,IAAI,CAAC;gBACT,QAAQC,MAAM,MAAM;gBACpB,OAAOA,MAAM,KAAK;gBAClB,UAAU;gBACV,OAAO;oBACH,SAASK,GAAG,OAAO;oBACnB,MAAOA,GAAW,IAAI,IAAI;oBAC1B,MAAM;wBAAE,GAAIA,GAAW,IAAI;wBAAEL;oBAAM;gBACvC;YACJ;QACJ,OACID,QAAQ,IAAI,CAAC;YACT,QAAQC,MAAM,MAAM;YACpB,OAAO;gBAAE,GAAGM,aAAa,KAAK;YAAC;YAC/B,UAAU;QACd;IAER;IAEA,OAAOP;AACX"}
@@ -102,7 +102,7 @@ const validateModels = async (params)=>{
102
102
  code: "MODEL_GROUP_NOT_FOUND"
103
103
  }
104
104
  };
105
- if (!model.fields?.length) return {
105
+ else if (!model.fields?.length) return {
106
106
  model: data,
107
107
  action: CmsImportAction.NONE,
108
108
  error: {
@@ -1 +1 @@
1
- {"version":3,"file":"export/crud/imports/validateModels.js","sources":["../../../../src/export/crud/imports/validateModels.ts"],"sourcesContent":["import { createModelImportValidation } from \"~/crud/contentModel/validation.js\";\nimport type {\n CmsImportError,\n HeadlessCmsImportStructureParamsDataModel,\n ValidatedCmsModel,\n ValidatedCmsModelResult\n} from \"~/export/types.js\";\nimport { CmsImportAction } from \"~/export/types.js\";\nimport type { CmsDynamicZoneTemplate, CmsGroup, CmsModel, CmsModelField } from \"~/types/index.js\";\nimport { createZodError } from \"@webiny/utils\";\n\ninterface CreateModelValidationParams {\n model: ValidatedCmsModel;\n models: CmsModel[];\n}\n\ninterface AddCodeMessageParams {\n action: CmsImportAction;\n}\n\nconst addCodeMessage = (params: AddCodeMessageParams) => {\n if (params.action !== CmsImportAction.CODE) {\n return params;\n }\n return {\n ...params,\n errors: [\n {\n message: `The model is defined via plugin and it cannot be updated.`,\n code: \"MODEL_IS_A_PLUGIN\"\n }\n ]\n };\n};\n\ninterface ValidationResult {\n errors?: CmsImportError[];\n action: CmsImportAction;\n}\n\nconst validateModel = (params: CreateModelValidationParams): ValidationResult => {\n const { model, models } = params;\n /**\n * Let's check if model values that must be unique, already exist.\n */\n const existingModelId = models.find(\n m => m.modelId.toLowerCase() === model.modelId.toLowerCase()\n );\n const existingSingularApiName = models.find(\n m =>\n m.singularApiName.toLowerCase() === model.singularApiName.toLowerCase() ||\n m.singularApiName.toLowerCase() === model.pluralApiName.toString()\n );\n const existingPluralApiName = models.find(\n m =>\n m.pluralApiName.toLowerCase() === model.pluralApiName.toLowerCase() ||\n m.pluralApiName.toLowerCase() === model.singularApiName.toString()\n );\n\n const UPDATE_KEYWORD = existingModelId?.isPlugin\n ? CmsImportAction.CODE\n : CmsImportAction.UPDATE;\n /**\n * There are few cases that we must address:\n *\n * 1. modelId, singular and plural names do not exist in any of the models\n * - this is OK, we can create the model\n */\n if (!existingModelId && !existingSingularApiName && !existingPluralApiName) {\n return {\n action: CmsImportAction.CREATE\n };\n }\n /**\n * 2. modelId, singular and plural names are a part of a single model\n * - this is OK, we can update the model\n */\n if (\n existingModelId &&\n existingSingularApiName &&\n existingPluralApiName &&\n existingModelId.modelId === existingSingularApiName.modelId &&\n existingModelId.modelId === existingPluralApiName.modelId\n ) {\n return addCodeMessage({\n action: UPDATE_KEYWORD\n });\n }\n /**\n * 3. modelId already exists, but singular and plural names do not\n * - this is OK, we can update the model\n */\n if (existingModelId && !existingSingularApiName && !existingPluralApiName) {\n return addCodeMessage({\n action: UPDATE_KEYWORD\n });\n }\n /**\n * 4. modelId already exists, but only the singular name exists.\n * - this is OK, we can update the model\n */\n if (\n existingModelId &&\n existingSingularApiName?.modelId === existingModelId.modelId &&\n !existingPluralApiName\n ) {\n return addCodeMessage({\n action: UPDATE_KEYWORD\n });\n }\n /**\n * 5. modelId already exists, but only the plural name exists.\n * - this is OK, we can update the model\n */\n if (\n existingModelId &&\n existingPluralApiName?.modelId === existingModelId.modelId &&\n !existingSingularApiName\n ) {\n return addCodeMessage({\n action: UPDATE_KEYWORD\n });\n }\n /**\n * 6. modelId already exists, but singular and plural names are in different models.\n */\n if (\n existingModelId &&\n (existingSingularApiName?.modelId !== existingModelId.modelId ||\n existingPluralApiName?.modelId !== existingModelId.modelId)\n ) {\n return {\n action: CmsImportAction.NONE,\n errors: [\n {\n message: `The model has singular or plural API names same as some other model.`,\n code: \"MODEL_API_NAMES_ERROR\"\n }\n ]\n };\n }\n\n return {\n action: CmsImportAction.NONE,\n errors: [\n {\n message: `The model cannot be imported.`,\n code: \"MODEL_IMPORT_ERROR\",\n data: {\n modelId: existingModelId?.modelId,\n singularApiName: existingSingularApiName?.modelId,\n pluralApiName: existingPluralApiName?.modelId\n }\n }\n ]\n };\n};\n\ninterface InputGroup extends Pick<CmsGroup, \"id\" | \"slug\"> {\n target: string;\n}\n\ninterface Params {\n groups: InputGroup[];\n models: CmsModel[];\n input: HeadlessCmsImportStructureParamsDataModel[];\n}\n\ninterface GetRelatedModelsParams {\n fields: CmsModelField[];\n models: CmsModel[];\n}\n\nconst getRelatedModels = (params: GetRelatedModelsParams): string[] => {\n const { fields, models } = params;\n\n const result: string[] = [];\n for (const field of fields) {\n if (field.type === \"ref\") {\n for (const model of field.settings?.models || []) {\n result.push(model.modelId);\n }\n } else if (field.type === \"object\") {\n result.push(...getRelatedModels({ fields: field.settings?.fields || [], models }));\n } else if (field.type === \"dynamicZone\") {\n const templates = (field.settings?.templates || []) as CmsDynamicZoneTemplate[];\n for (const tpl of templates) {\n result.push(\n ...getRelatedModels({\n fields: tpl.fields || [],\n models\n })\n );\n }\n }\n }\n\n return Array.from(new Set(result));\n};\n\nexport const validateModels = async (params: Params): Promise<ValidatedCmsModelResult[]> => {\n const { groups, models, input } = params;\n\n const validation = createModelImportValidation();\n\n return await Promise.all(\n input.map(async (model): Promise<ValidatedCmsModelResult> => {\n const result = await validation.safeParseAsync(model);\n if (!result.success) {\n const error = createZodError(result.error);\n return {\n model: model as ValidatedCmsModel,\n action: CmsImportAction.NONE,\n error: {\n message: error.message,\n code: error.code,\n data: error.data\n }\n };\n }\n const data = result.data as unknown as ValidatedCmsModel;\n const group = groups.find(g => g.slug === data.group || g.target === data.group);\n if (!group) {\n return {\n model: data,\n action: CmsImportAction.NONE,\n error: {\n message: `The model group \"${data.group}\" does not exist.`,\n code: \"MODEL_GROUP_NOT_FOUND\"\n }\n };\n } else if (!model.fields?.length) {\n return {\n model: data,\n action: CmsImportAction.NONE,\n error: {\n message: `Model is missing fields.`,\n code: \"MODEL_FIELDS_MISSING\"\n }\n };\n }\n\n const targetModel: ValidatedCmsModel = {\n ...data,\n group: group.slug\n };\n\n const modelValidationResult = validateModel({\n model: targetModel,\n models\n });\n\n if (!modelValidationResult.errors?.length) {\n return {\n model: targetModel,\n related: getRelatedModels({\n fields: targetModel.fields,\n models\n }),\n action: modelValidationResult.action\n };\n }\n return {\n model: targetModel,\n action: modelValidationResult.action,\n error: modelValidationResult.errors[0]\n };\n })\n );\n};\n"],"names":["addCodeMessage","params","CmsImportAction","validateModel","model","models","existingModelId","m","existingSingularApiName","existingPluralApiName","UPDATE_KEYWORD","getRelatedModels","fields","result","field","templates","tpl","Array","Set","validateModels","groups","input","validation","createModelImportValidation","Promise","error","createZodError","data","group","g","targetModel","modelValidationResult"],"mappings":"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"}
1
+ {"version":3,"file":"export/crud/imports/validateModels.js","sources":["../../../../src/export/crud/imports/validateModels.ts"],"sourcesContent":["import { createModelImportValidation } from \"~/crud/contentModel/validation.js\";\nimport type {\n CmsImportError,\n HeadlessCmsImportStructureParamsDataModel,\n ValidatedCmsModel,\n ValidatedCmsModelResult\n} from \"~/export/types.js\";\nimport { CmsImportAction } from \"~/export/types.js\";\nimport type { CmsDynamicZoneTemplate, CmsGroup, CmsModel, CmsModelField } from \"~/types/index.js\";\nimport { createZodError } from \"@webiny/utils\";\n\ninterface CreateModelValidationParams {\n model: ValidatedCmsModel;\n models: CmsModel[];\n}\n\ninterface AddCodeMessageParams {\n action: CmsImportAction;\n}\n\nconst addCodeMessage = (params: AddCodeMessageParams) => {\n if (params.action !== CmsImportAction.CODE) {\n return params;\n }\n return {\n ...params,\n errors: [\n {\n message: `The model is defined via plugin and it cannot be updated.`,\n code: \"MODEL_IS_A_PLUGIN\"\n }\n ]\n };\n};\n\ninterface ValidationResult {\n errors?: CmsImportError[];\n action: CmsImportAction;\n}\n\nconst validateModel = (params: CreateModelValidationParams): ValidationResult => {\n const { model, models } = params;\n /**\n * Let's check if model values that must be unique, already exist.\n */\n const existingModelId = models.find(\n m => m.modelId.toLowerCase() === model.modelId.toLowerCase()\n );\n const existingSingularApiName = models.find(\n m =>\n m.singularApiName.toLowerCase() === model.singularApiName.toLowerCase() ||\n m.singularApiName.toLowerCase() === model.pluralApiName.toString()\n );\n const existingPluralApiName = models.find(\n m =>\n m.pluralApiName.toLowerCase() === model.pluralApiName.toLowerCase() ||\n m.pluralApiName.toLowerCase() === model.singularApiName.toString()\n );\n\n const UPDATE_KEYWORD = existingModelId?.isPlugin\n ? CmsImportAction.CODE\n : CmsImportAction.UPDATE;\n /**\n * There are few cases that we must address:\n *\n * 1. modelId, singular and plural names do not exist in any of the models\n * - this is OK, we can create the model\n */\n if (!existingModelId && !existingSingularApiName && !existingPluralApiName) {\n return {\n action: CmsImportAction.CREATE\n };\n }\n /**\n * 2. modelId, singular and plural names are a part of a single model\n * - this is OK, we can update the model\n */\n if (\n existingModelId &&\n existingSingularApiName &&\n existingPluralApiName &&\n existingModelId.modelId === existingSingularApiName.modelId &&\n existingModelId.modelId === existingPluralApiName.modelId\n ) {\n return addCodeMessage({\n action: UPDATE_KEYWORD\n });\n }\n /**\n * 3. modelId already exists, but singular and plural names do not\n * - this is OK, we can update the model\n */\n if (existingModelId && !existingSingularApiName && !existingPluralApiName) {\n return addCodeMessage({\n action: UPDATE_KEYWORD\n });\n }\n /**\n * 4. modelId already exists, but only the singular name exists.\n * - this is OK, we can update the model\n */\n if (\n existingModelId &&\n existingSingularApiName?.modelId === existingModelId.modelId &&\n !existingPluralApiName\n ) {\n return addCodeMessage({\n action: UPDATE_KEYWORD\n });\n }\n /**\n * 5. modelId already exists, but only the plural name exists.\n * - this is OK, we can update the model\n */\n if (\n existingModelId &&\n existingPluralApiName?.modelId === existingModelId.modelId &&\n !existingSingularApiName\n ) {\n return addCodeMessage({\n action: UPDATE_KEYWORD\n });\n }\n /**\n * 6. modelId already exists, but singular and plural names are in different models.\n */\n if (\n existingModelId &&\n (existingSingularApiName?.modelId !== existingModelId.modelId ||\n existingPluralApiName?.modelId !== existingModelId.modelId)\n ) {\n return {\n action: CmsImportAction.NONE,\n errors: [\n {\n message: `The model has singular or plural API names same as some other model.`,\n code: \"MODEL_API_NAMES_ERROR\"\n }\n ]\n };\n }\n\n return {\n action: CmsImportAction.NONE,\n errors: [\n {\n message: `The model cannot be imported.`,\n code: \"MODEL_IMPORT_ERROR\",\n data: {\n modelId: existingModelId?.modelId,\n singularApiName: existingSingularApiName?.modelId,\n pluralApiName: existingPluralApiName?.modelId\n }\n }\n ]\n };\n};\n\ninterface InputGroup extends Pick<CmsGroup, \"id\" | \"slug\"> {\n target: string;\n}\n\ninterface Params {\n groups: InputGroup[];\n models: CmsModel[];\n input: HeadlessCmsImportStructureParamsDataModel[];\n}\n\ninterface GetRelatedModelsParams {\n fields: CmsModelField[];\n models: CmsModel[];\n}\n\nconst getRelatedModels = (params: GetRelatedModelsParams): string[] => {\n const { fields, models } = params;\n\n const result: string[] = [];\n for (const field of fields) {\n if (field.type === \"ref\") {\n for (const model of field.settings?.models || []) {\n result.push(model.modelId);\n }\n } else if (field.type === \"object\") {\n result.push(...getRelatedModels({ fields: field.settings?.fields || [], models }));\n } else if (field.type === \"dynamicZone\") {\n const templates = (field.settings?.templates || []) as CmsDynamicZoneTemplate[];\n for (const tpl of templates) {\n result.push(\n ...getRelatedModels({\n fields: tpl.fields || [],\n models\n })\n );\n }\n }\n }\n\n return Array.from(new Set(result));\n};\n\nexport const validateModels = async (params: Params): Promise<ValidatedCmsModelResult[]> => {\n const { groups, models, input } = params;\n\n const validation = createModelImportValidation();\n\n return await Promise.all(\n input.map(async (model): Promise<ValidatedCmsModelResult> => {\n const result = await validation.safeParseAsync(model);\n if (!result.success) {\n const error = createZodError(result.error);\n return {\n model: model as ValidatedCmsModel,\n action: CmsImportAction.NONE,\n error: {\n message: error.message,\n code: error.code,\n data: error.data\n }\n };\n }\n const data = result.data as unknown as ValidatedCmsModel;\n const group = groups.find(g => g.slug === data.group || g.target === data.group);\n if (!group) {\n return {\n model: data,\n action: CmsImportAction.NONE,\n error: {\n message: `The model group \"${data.group}\" does not exist.`,\n code: \"MODEL_GROUP_NOT_FOUND\"\n }\n };\n } else if (!model.fields?.length) {\n return {\n model: data,\n action: CmsImportAction.NONE,\n error: {\n message: `Model is missing fields.`,\n code: \"MODEL_FIELDS_MISSING\"\n }\n };\n }\n\n const targetModel: ValidatedCmsModel = {\n ...data,\n group: group.slug\n };\n\n const modelValidationResult = validateModel({\n model: targetModel,\n models\n });\n\n if (!modelValidationResult.errors?.length) {\n return {\n model: targetModel,\n related: getRelatedModels({\n fields: targetModel.fields,\n models\n }),\n action: modelValidationResult.action\n };\n }\n return {\n model: targetModel,\n action: modelValidationResult.action,\n error: modelValidationResult.errors[0]\n };\n })\n );\n};\n"],"names":["addCodeMessage","params","CmsImportAction","validateModel","model","models","existingModelId","m","existingSingularApiName","existingPluralApiName","UPDATE_KEYWORD","getRelatedModels","fields","result","field","templates","tpl","Array","Set","validateModels","groups","input","validation","createModelImportValidation","Promise","error","createZodError","data","group","g","targetModel","modelValidationResult"],"mappings":"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"}
@@ -4,6 +4,8 @@ export { CreateEntryUseCase } from "../../../features/contentEntry/CreateEntry/a
4
4
  export { EntryBeforeCreateEventHandler, EntryAfterCreateEventHandler } from "../../../features/contentEntry/CreateEntry/events.js";
5
5
  export { CreateEntryRevisionFromUseCase } from "../../../features/contentEntry/CreateEntryRevisionFrom/abstractions.js";
6
6
  export { EntryRevisionBeforeCreateEventHandler, EntryRevisionAfterCreateEventHandler } from "../../../features/contentEntry/CreateEntryRevisionFrom/events.js";
7
+ export { DuplicateEntryUseCase } from "../../../features/contentEntry/DuplicateEntry/abstractions.js";
8
+ export { EntryBeforeDuplicateEventHandler, EntryAfterDuplicateEventHandler } from "../../../features/contentEntry/DuplicateEntry/events.js";
7
9
  export { DeleteEntryUseCase, MoveEntryToBinUseCase } from "../../../features/contentEntry/DeleteEntry/abstractions.js";
8
10
  export { EntryBeforeDeleteEventHandler, EntryAfterDeleteEventHandler } from "../../../features/contentEntry/DeleteEntry/events.js";
9
11
  export { DeleteEntryRevisionUseCase } from "../../../features/contentEntry/DeleteEntryRevision/abstractions.js";
@@ -24,6 +26,9 @@ export { UpdateEntryUseCase } from "../../../features/contentEntry/UpdateEntry/a
24
26
  export { EntryBeforeUpdateEventHandler, EntryAfterUpdateEventHandler } from "../../../features/contentEntry/UpdateEntry/events.js";
25
27
  export { UpdateRevisionDescriptionUseCase } from "../../../features/contentEntry/UpdateRevisionDescription/abstractions.js";
26
28
  export { EntryBeforeUpdateRevisionDescriptionEventHandler, EntryAfterUpdateRevisionDescriptionEventHandler } from "../../../features/contentEntry/UpdateRevisionDescription/events.js";
29
+ export { UpdateEntrySystemUseCase } from "../../../features/contentEntry/UpdateEntrySystem/abstractions.js";
30
+ export { EntryBeforeUpdateSystemEventHandler, EntryAfterUpdateSystemEventHandler } from "../../../features/contentEntry/UpdateEntrySystem/events.js";
31
+ export { CmsEntrySystemField } from "../../../features/contentEntry/EntrySystemField/abstractions.js";
27
32
  export { UpdateSingletonEntryUseCase } from "../../../features/contentEntry/UpdateSingletonEntry/abstractions.js";
28
33
  export { GetEntriesByIdsUseCase } from "../../../features/contentEntry/GetEntriesByIds/abstractions.js";
29
34
  export { GetEntryUseCase } from "../../../features/contentEntry/GetEntry/abstractions.js";
@@ -3,6 +3,8 @@ export { CreateEntryUseCase } from "../../../features/contentEntry/CreateEntry/a
3
3
  export { EntryAfterCreateEventHandler, EntryBeforeCreateEventHandler } from "../../../features/contentEntry/CreateEntry/events.js";
4
4
  export { CreateEntryRevisionFromUseCase } from "../../../features/contentEntry/CreateEntryRevisionFrom/abstractions.js";
5
5
  export { EntryRevisionAfterCreateEventHandler, EntryRevisionBeforeCreateEventHandler } from "../../../features/contentEntry/CreateEntryRevisionFrom/events.js";
6
+ export { DuplicateEntryUseCase } from "../../../features/contentEntry/DuplicateEntry/abstractions.js";
7
+ export { EntryAfterDuplicateEventHandler, EntryBeforeDuplicateEventHandler } from "../../../features/contentEntry/DuplicateEntry/events.js";
6
8
  export { DeleteEntryUseCase, MoveEntryToBinUseCase } from "../../../features/contentEntry/DeleteEntry/abstractions.js";
7
9
  export { EntryAfterDeleteEventHandler, EntryBeforeDeleteEventHandler } from "../../../features/contentEntry/DeleteEntry/events.js";
8
10
  export { DeleteEntryRevisionUseCase } from "../../../features/contentEntry/DeleteEntryRevision/abstractions.js";
@@ -23,6 +25,9 @@ export { UpdateEntryUseCase } from "../../../features/contentEntry/UpdateEntry/a
23
25
  export { EntryAfterUpdateEventHandler, EntryBeforeUpdateEventHandler } from "../../../features/contentEntry/UpdateEntry/events.js";
24
26
  export { UpdateRevisionDescriptionUseCase } from "../../../features/contentEntry/UpdateRevisionDescription/abstractions.js";
25
27
  export { EntryAfterUpdateRevisionDescriptionEventHandler, EntryBeforeUpdateRevisionDescriptionEventHandler } from "../../../features/contentEntry/UpdateRevisionDescription/events.js";
28
+ export { UpdateEntrySystemUseCase } from "../../../features/contentEntry/UpdateEntrySystem/abstractions.js";
29
+ export { EntryAfterUpdateSystemEventHandler, EntryBeforeUpdateSystemEventHandler } from "../../../features/contentEntry/UpdateEntrySystem/events.js";
30
+ export { CmsEntrySystemField } from "../../../features/contentEntry/EntrySystemField/abstractions.js";
26
31
  export { UpdateSingletonEntryUseCase } from "../../../features/contentEntry/UpdateSingletonEntry/abstractions.js";
27
32
  export { GetEntriesByIdsUseCase } from "../../../features/contentEntry/GetEntriesByIds/abstractions.js";
28
33
  export { GetEntryUseCase } from "../../../features/contentEntry/GetEntry/abstractions.js";
@@ -3,8 +3,9 @@ export { ModelBuilder } from "../../../features/modelBuilder/models/ModelBuilder
3
3
  export { DataFieldBuilder } from "../../../features/modelBuilder/fields/FieldBuilder.js";
4
4
  export { LayoutFieldBuilder } from "../../../features/modelBuilder/fields/FieldBuilder.js";
5
5
  export { FieldType } from "../../../features/modelBuilder/fields/abstractions.js";
6
+ export { type IAssetFieldBuilder } from "../../../features/modelBuilder/fields/AssetFieldType.js";
6
7
  export type { IFieldRendererRegistry } from "../../../features/modelBuilder/fields/DataFieldBuilder.js";
7
- export type { IFieldBuilderRegistry } from "../../../features/modelBuilder/abstractions.js";
8
+ export type { IFieldBuilderRegistry, IModelSettings } from "../../../features/modelBuilder/abstractions.js";
8
9
  export { LayoutBuilder } from "../../../features/modelBuilder/LayoutBuilder.js";
9
10
  export type { FieldTypeValidator } from "../../../features/modelBuilder/fields/fieldTypeValidator.js";
10
11
  export type { CmsModel } from "../../../types/model.js";
@@ -19,3 +20,5 @@ export { DeleteModelUseCase } from "../../../features/contentModel/DeleteModel/a
19
20
  export { ModelBeforeDeleteEventHandler, ModelAfterDeleteEventHandler } from "../../../features/contentModel/DeleteModel/events.js";
20
21
  export { GetModelUseCase } from "../../../features/contentModel/GetModel/abstractions.js";
21
22
  export { ListModelsUseCase } from "../../../features/contentModel/ListModels/abstractions.js";
23
+ export { ModelToAstConverter } from "../../../features/contentModel/ModelToAstConverter/index.js";
24
+ export { CmsModelToJsonSchemaConverter } from "../../../utils/index.js";
@@ -13,3 +13,5 @@ export { DeleteModelUseCase } from "../../../features/contentModel/DeleteModel/a
13
13
  export { ModelAfterDeleteEventHandler, ModelBeforeDeleteEventHandler } from "../../../features/contentModel/DeleteModel/events.js";
14
14
  export { GetModelUseCase } from "../../../features/contentModel/GetModel/abstractions.js";
15
15
  export { ListModelsUseCase } from "../../../features/contentModel/ListModels/abstractions.js";
16
+ export { ModelToAstConverter } from "../../../features/contentModel/ModelToAstConverter/index.js";
17
+ export { CmsModelToJsonSchemaConverter } from "../../../utils/index.js";
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
+ import { GetModelUseCase } from "../../features/contentModel/GetModel/index.js";
4
+ declare const inputSchema: z.ZodObject<{
5
+ modelId: z.ZodString;
6
+ }, z.core.$strip>;
7
+ type Input = z.infer<typeof inputSchema>;
8
+ interface FieldDescription {
9
+ fieldId: string;
10
+ type: string;
11
+ label: string;
12
+ /** True when the field holds an array of values — affects which `where` operators apply. */
13
+ list: boolean;
14
+ required: boolean;
15
+ description?: string;
16
+ /** Allowed values for enum-like fields, so a filter can be built without guessing. */
17
+ predefinedValues?: string[];
18
+ /** For `ref` fields: which models this field can point at. */
19
+ refModels?: string[];
20
+ /** For `object` fields: the nested field set. */
21
+ fields?: FieldDescription[];
22
+ }
23
+ interface ModelDescription {
24
+ modelId: string;
25
+ name: string;
26
+ description: string | null;
27
+ singularApiName: string;
28
+ pluralApiName: string;
29
+ titleFieldId: string;
30
+ fields: FieldDescription[];
31
+ }
32
+ declare class DescribeContentModelToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
33
+ private getModel;
34
+ constructor(getModel: GetModelUseCase.Interface);
35
+ execute(input: Input): Promise<ModelDescription>;
36
+ }
37
+ /**
38
+ * Supplies the field detail needed to build a valid `queryEntries` filter. Deliberately a separate
39
+ * call from `listContentModels`: returning full field sets for every model would be large and mostly
40
+ * unread, so the model pays for detail only on the model it actually cares about.
41
+ */
42
+ declare class DescribeContentModelToolImpl implements AiSdkToolDefinition.Interface<Input> {
43
+ readonly name = "describeContentModel";
44
+ readonly title = "Describe content model";
45
+ readonly description = "Returns the fields of one content model \u2014 field IDs, types, whether each is a list, required flags, allowed values, and referenced models. Call this before queryEntries so filters use real field IDs.";
46
+ readonly inputSchema: z.ZodObject<{
47
+ modelId: z.ZodString;
48
+ }, z.core.$strip>;
49
+ readonly annotations: {
50
+ readOnlyHint: boolean;
51
+ idempotentHint: boolean;
52
+ };
53
+ readonly handler: typeof DescribeContentModelToolHandlerImpl & {
54
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
55
+ };
56
+ }
57
+ export declare const DescribeContentModelTool: typeof DescribeContentModelToolImpl & {
58
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
59
+ };
60
+ export {};
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
+ import { GetModelUseCase } from "../contentModel/GetModel/index.js";
4
+ const inputSchema = z.object({
5
+ modelId: z.string().describe("Model ID as returned by listContentModels (e.g. 'product', not 'Products').")
6
+ });
7
+ const isRequired = (field)=>field.validation.some((validator)=>"required" === validator.name);
8
+ const describeField = (field)=>{
9
+ const described = {
10
+ fieldId: field.fieldId,
11
+ type: field.type,
12
+ label: field.label,
13
+ list: Boolean(field.list),
14
+ required: isRequired(field)
15
+ };
16
+ if (field.description) described.description = field.description;
17
+ const values = field.predefinedValues;
18
+ if (values?.enabled && values.values?.length) described.predefinedValues = values.values.map((entry)=>entry.value);
19
+ const refModels = field.settings?.models;
20
+ if (refModels?.length) described.refModels = refModels.map((model)=>model.modelId);
21
+ const nested = field.settings?.fields;
22
+ if (nested?.length) described.fields = nested.map(describeField);
23
+ return described;
24
+ };
25
+ class DescribeContentModelToolHandlerImpl {
26
+ constructor(getModel){
27
+ this.getModel = getModel;
28
+ }
29
+ async execute(input) {
30
+ const result = await this.getModel.execute(input.modelId);
31
+ if (result.isFail()) throw new Error(`Could not describe model "${input.modelId}": ${result.error.message}. Call listContentModels for valid model IDs.`);
32
+ const model = result.value;
33
+ return {
34
+ modelId: model.modelId,
35
+ name: model.name,
36
+ description: model.description,
37
+ singularApiName: model.singularApiName,
38
+ pluralApiName: model.pluralApiName,
39
+ titleFieldId: model.titleFieldId,
40
+ fields: model.fields.map(describeField)
41
+ };
42
+ }
43
+ }
44
+ const DescribeContentModelToolHandler = AiSdkToolHandler.createImplementation({
45
+ implementation: DescribeContentModelToolHandlerImpl,
46
+ dependencies: [
47
+ GetModelUseCase
48
+ ]
49
+ });
50
+ class DescribeContentModelToolImpl {
51
+ constructor(){
52
+ this.name = "describeContentModel";
53
+ this.title = "Describe content model";
54
+ this.description = "Returns the fields of one content model — field IDs, types, whether each is a list, required flags, allowed values, and referenced models. Call this before queryEntries so filters use real field IDs.";
55
+ this.inputSchema = inputSchema;
56
+ this.annotations = {
57
+ readOnlyHint: true,
58
+ idempotentHint: true
59
+ };
60
+ this.handler = DescribeContentModelToolHandler;
61
+ }
62
+ }
63
+ const DescribeContentModelTool = AiSdkToolDefinition.createImplementation({
64
+ implementation: DescribeContentModelToolImpl,
65
+ dependencies: []
66
+ });
67
+ export { DescribeContentModelTool };
68
+
69
+ //# sourceMappingURL=DescribeContentModelTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/DescribeContentModelTool.js","sources":["../../../src/features/ai/DescribeContentModelTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { GetModelUseCase } from \"~/features/contentModel/GetModel/index.js\";\nimport type { CmsModelField } from \"~/types/index.js\";\n\nconst inputSchema = z.object({\n modelId: z\n .string()\n .describe(\"Model ID as returned by listContentModels (e.g. 'product', not 'Products').\")\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface FieldDescription {\n fieldId: string;\n type: string;\n label: string;\n /** True when the field holds an array of values — affects which `where` operators apply. */\n list: boolean;\n required: boolean;\n description?: string;\n /** Allowed values for enum-like fields, so a filter can be built without guessing. */\n predefinedValues?: string[];\n /** For `ref` fields: which models this field can point at. */\n refModels?: string[];\n /** For `object` fields: the nested field set. */\n fields?: FieldDescription[];\n}\n\ninterface ModelDescription {\n modelId: string;\n name: string;\n description: string | null;\n singularApiName: string;\n pluralApiName: string;\n titleFieldId: string;\n fields: FieldDescription[];\n}\n\nconst isRequired = (field: CmsModelField): boolean =>\n field.validation.some(validator => validator.name === \"required\");\n\nconst describeField = (field: CmsModelField): FieldDescription => {\n const described: FieldDescription = {\n fieldId: field.fieldId,\n type: field.type,\n label: field.label,\n list: Boolean(field.list),\n required: isRequired(field)\n };\n\n if (field.description) {\n described.description = field.description;\n }\n\n const values = field.predefinedValues;\n if (values?.enabled && values.values?.length) {\n described.predefinedValues = values.values.map(entry => entry.value);\n }\n\n const refModels = field.settings?.models;\n if (refModels?.length) {\n described.refModels = refModels.map(model => model.modelId);\n }\n\n const nested = field.settings?.fields;\n if (nested?.length) {\n described.fields = nested.map(describeField);\n }\n\n return described;\n};\n\nclass DescribeContentModelToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private getModel: GetModelUseCase.Interface) {}\n\n async execute(input: Input): Promise<ModelDescription> {\n const result = await this.getModel.execute(input.modelId);\n\n if (result.isFail()) {\n throw new Error(\n `Could not describe model \"${input.modelId}\": ${result.error.message}. Call listContentModels for valid model IDs.`\n );\n }\n\n const model = result.value;\n\n return {\n modelId: model.modelId,\n name: model.name,\n description: model.description,\n singularApiName: model.singularApiName,\n pluralApiName: model.pluralApiName,\n titleFieldId: model.titleFieldId,\n fields: model.fields.map(describeField)\n };\n }\n}\n\nconst DescribeContentModelToolHandler = AiSdkToolHandler.createImplementation({\n implementation: DescribeContentModelToolHandlerImpl,\n dependencies: [GetModelUseCase]\n});\n\n/**\n * Supplies the field detail needed to build a valid `queryEntries` filter. Deliberately a separate\n * call from `listContentModels`: returning full field sets for every model would be large and mostly\n * unread, so the model pays for detail only on the model it actually cares about.\n */\nclass DescribeContentModelToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"describeContentModel\";\n readonly title = \"Describe content model\";\n readonly description =\n \"Returns the fields of one content model — field IDs, types, whether each is a list, required flags, allowed values, and referenced models. Call this before queryEntries so filters use real field IDs.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = DescribeContentModelToolHandler;\n}\n\nexport const DescribeContentModelTool = AiSdkToolDefinition.createImplementation({\n implementation: DescribeContentModelToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","isRequired","field","validator","describeField","described","Boolean","values","entry","refModels","model","nested","DescribeContentModelToolHandlerImpl","getModel","input","result","Error","DescribeContentModelToolHandler","AiSdkToolHandler","GetModelUseCase","DescribeContentModelToolImpl","DescribeContentModelTool","AiSdkToolDefinition"],"mappings":";;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,SAASA,EAAAA,MACE,GACN,QAAQ,CAAC;AAClB;AA8BA,MAAMC,aAAa,CAACC,QAChBA,MAAM,UAAU,CAAC,IAAI,CAACC,CAAAA,YAAaA,AAAmB,eAAnBA,UAAU,IAAI;AAErD,MAAMC,gBAAgB,CAACF;IACnB,MAAMG,YAA8B;QAChC,SAASH,MAAM,OAAO;QACtB,MAAMA,MAAM,IAAI;QAChB,OAAOA,MAAM,KAAK;QAClB,MAAMI,QAAQJ,MAAM,IAAI;QACxB,UAAUD,WAAWC;IACzB;IAEA,IAAIA,MAAM,WAAW,EACjBG,UAAU,WAAW,GAAGH,MAAM,WAAW;IAG7C,MAAMK,SAASL,MAAM,gBAAgB;IACrC,IAAIK,QAAQ,WAAWA,OAAO,MAAM,EAAE,QAClCF,UAAU,gBAAgB,GAAGE,OAAO,MAAM,CAAC,GAAG,CAACC,CAAAA,QAASA,MAAM,KAAK;IAGvE,MAAMC,YAAYP,MAAM,QAAQ,EAAE;IAClC,IAAIO,WAAW,QACXJ,UAAU,SAAS,GAAGI,UAAU,GAAG,CAACC,CAAAA,QAASA,MAAM,OAAO;IAG9D,MAAMC,SAAST,MAAM,QAAQ,EAAE;IAC/B,IAAIS,QAAQ,QACRN,UAAU,MAAM,GAAGM,OAAO,GAAG,CAACP;IAGlC,OAAOC;AACX;AAEA,MAAMO;IACF,YAAoBC,QAAmC,CAAE;aAArCA,QAAQ,GAARA;IAAsC;IAE1D,MAAM,QAAQC,KAAY,EAA6B;QACnD,MAAMC,SAAS,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACD,MAAM,OAAO;QAExD,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MACN,CAAC,0BAA0B,EAAEF,MAAM,OAAO,CAAC,GAAG,EAAEC,OAAO,KAAK,CAAC,OAAO,CAAC,6CAA6C,CAAC;QAI3H,MAAML,QAAQK,OAAO,KAAK;QAE1B,OAAO;YACH,SAASL,MAAM,OAAO;YACtB,MAAMA,MAAM,IAAI;YAChB,aAAaA,MAAM,WAAW;YAC9B,iBAAiBA,MAAM,eAAe;YACtC,eAAeA,MAAM,aAAa;YAClC,cAAcA,MAAM,YAAY;YAChC,QAAQA,MAAM,MAAM,CAAC,GAAG,CAACN;QAC7B;IACJ;AACJ;AAEA,MAAMa,kCAAkCC,iBAAiB,oBAAoB,CAAC;IAC1E,gBAAgBN;IAChB,cAAc;QAACO;KAAgB;AACnC;AAOA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGrB;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;aACzD,OAAO,GAAGkB;;AACvB;AAEO,MAAMI,2BAA2BC,oBAAoB,oBAAoB,CAAC;IAC7E,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
+ import { ListModelsUseCase } from "../../features/contentModel/ListModels/index.js";
4
+ declare const inputSchema: z.ZodObject<{
5
+ includeSystem: z.ZodOptional<z.ZodBoolean>;
6
+ }, z.core.$strip>;
7
+ type Input = z.infer<typeof inputSchema>;
8
+ interface ModelSummary {
9
+ modelId: string;
10
+ name: string;
11
+ description: string | null;
12
+ group: string;
13
+ singularApiName: string;
14
+ pluralApiName: string;
15
+ titleFieldId: string;
16
+ fieldCount: number;
17
+ }
18
+ declare class ListContentModelsToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
19
+ private listModels;
20
+ constructor(listModels: ListModelsUseCase.Interface);
21
+ execute(input: Input): Promise<ModelSummary[]>;
22
+ }
23
+ /**
24
+ * Entry point for any content question. The CMS schema is defined per project (and per tenant), so a
25
+ * model list cannot be baked into a system prompt — it has to be discovered at call time. Returns a
26
+ * summary only; `describeContentModel` supplies the field detail needed to actually build a query.
27
+ */
28
+ declare class ListContentModelsToolImpl implements AiSdkToolDefinition.Interface<Input> {
29
+ readonly name = "listContentModels";
30
+ readonly title = "List content models";
31
+ readonly description = "Lists the content models available in this project. Call this first when you need to find content \u2014 model IDs are project-specific and cannot be guessed. Returns a summary per model; use describeContentModel for field details.";
32
+ readonly inputSchema: z.ZodObject<{
33
+ includeSystem: z.ZodOptional<z.ZodBoolean>;
34
+ }, z.core.$strip>;
35
+ readonly annotations: {
36
+ readOnlyHint: boolean;
37
+ idempotentHint: boolean;
38
+ };
39
+ readonly handler: typeof ListContentModelsToolHandlerImpl & {
40
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
41
+ };
42
+ }
43
+ export declare const ListContentModelsTool: typeof ListContentModelsToolImpl & {
44
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
45
+ };
46
+ export {};
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
+ import { ListModelsUseCase } from "../contentModel/ListModels/index.js";
4
+ const HIDDEN_MODEL_GROUP = "hidden";
5
+ const inputSchema = z.object({
6
+ includeSystem: z.boolean().optional().describe("Include system models that back Webiny itself (languages, tenants, task settings) and internal models belonging to other apps. Off by default — these are never what a user means by 'content'.")
7
+ });
8
+ const isSystemModel = (model)=>Boolean(model.isPrivate) || model.group === HIDDEN_MODEL_GROUP;
9
+ class ListContentModelsToolHandlerImpl {
10
+ constructor(listModels){
11
+ this.listModels = listModels;
12
+ }
13
+ async execute(input) {
14
+ const result = await this.listModels.execute();
15
+ if (result.isFail()) throw new Error(`Could not list content models: ${result.error.message}`);
16
+ return result.value.filter((model)=>input.includeSystem ? true : !isSystemModel(model)).map((model)=>({
17
+ modelId: model.modelId,
18
+ name: model.name,
19
+ description: model.description,
20
+ group: model.group,
21
+ singularApiName: model.singularApiName,
22
+ pluralApiName: model.pluralApiName,
23
+ titleFieldId: model.titleFieldId,
24
+ fieldCount: model.fields.length
25
+ }));
26
+ }
27
+ }
28
+ const ListContentModelsToolHandler = AiSdkToolHandler.createImplementation({
29
+ implementation: ListContentModelsToolHandlerImpl,
30
+ dependencies: [
31
+ ListModelsUseCase
32
+ ]
33
+ });
34
+ class ListContentModelsToolImpl {
35
+ constructor(){
36
+ this.name = "listContentModels";
37
+ this.title = "List content models";
38
+ this.description = "Lists the content models available in this project. Call this first when you need to find content — model IDs are project-specific and cannot be guessed. Returns a summary per model; use describeContentModel for field details.";
39
+ this.inputSchema = inputSchema;
40
+ this.annotations = {
41
+ readOnlyHint: true,
42
+ idempotentHint: true
43
+ };
44
+ this.handler = ListContentModelsToolHandler;
45
+ }
46
+ }
47
+ const ListContentModelsTool = AiSdkToolDefinition.createImplementation({
48
+ implementation: ListContentModelsToolImpl,
49
+ dependencies: []
50
+ });
51
+ export { ListContentModelsTool };
52
+
53
+ //# sourceMappingURL=ListContentModelsTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/ai/ListContentModelsTool.js","sources":["../../../src/features/ai/ListContentModelsTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListModelsUseCase } from \"~/features/contentModel/ListModels/index.js\";\nimport type { CmsModel } from \"~/types/index.js\";\n\nconst HIDDEN_MODEL_GROUP = \"hidden\";\n\nconst inputSchema = z.object({\n includeSystem: z\n .boolean()\n .optional()\n .describe(\n \"Include system models that back Webiny itself (languages, tenants, task settings) and internal models belonging to other apps. Off by default — these are never what a user means by 'content'.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface ModelSummary {\n modelId: string;\n name: string;\n description: string | null;\n group: string;\n singularApiName: string;\n pluralApiName: string;\n titleFieldId: string;\n fieldCount: number;\n}\n\n/**\n * Models Webiny itself owns. Two separate markers, both needed:\n * - `group: \"hidden\"` — the convention system models use (languages, tenants, background-task\n * settings). The admin UI filters the same way, see app-headless-cms useCmsData.\n * - `isPrivate` — models another app owns and manages through its own UI (e.g. Website Builder).\n */\nconst isSystemModel = (model: CmsModel): boolean =>\n Boolean(model.isPrivate) || model.group === HIDDEN_MODEL_GROUP;\n\nclass ListContentModelsToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private listModels: ListModelsUseCase.Interface) {}\n\n async execute(input: Input): Promise<ModelSummary[]> {\n const result = await this.listModels.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list content models: ${result.error.message}`);\n }\n\n return result.value\n .filter(model => (input.includeSystem ? true : !isSystemModel(model)))\n .map(model => ({\n modelId: model.modelId,\n name: model.name,\n description: model.description,\n group: model.group,\n singularApiName: model.singularApiName,\n pluralApiName: model.pluralApiName,\n titleFieldId: model.titleFieldId,\n fieldCount: model.fields.length\n }));\n }\n}\n\nconst ListContentModelsToolHandler = AiSdkToolHandler.createImplementation({\n implementation: ListContentModelsToolHandlerImpl,\n dependencies: [ListModelsUseCase]\n});\n\n/**\n * Entry point for any content question. The CMS schema is defined per project (and per tenant), so a\n * model list cannot be baked into a system prompt — it has to be discovered at call time. Returns a\n * summary only; `describeContentModel` supplies the field detail needed to actually build a query.\n */\nclass ListContentModelsToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"listContentModels\";\n readonly title = \"List content models\";\n readonly description =\n \"Lists the content models available in this project. Call this first when you need to find content — model IDs are project-specific and cannot be guessed. Returns a summary per model; use describeContentModel for field details.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = ListContentModelsToolHandler;\n}\n\nexport const ListContentModelsTool = AiSdkToolDefinition.createImplementation({\n implementation: ListContentModelsToolImpl,\n dependencies: []\n});\n"],"names":["HIDDEN_MODEL_GROUP","inputSchema","z","isSystemModel","model","Boolean","ListContentModelsToolHandlerImpl","listModels","input","result","Error","ListContentModelsToolHandler","AiSdkToolHandler","ListModelsUseCase","ListContentModelsToolImpl","ListContentModelsTool","AiSdkToolDefinition"],"mappings":";;;AAKA,MAAMA,qBAAqB;AAE3B,MAAMC,cAAcC,EAAE,MAAM,CAAC;IACzB,eAAeA,EAAAA,OACH,GACP,QAAQ,GACR,QAAQ,CACL;AAEZ;AAqBA,MAAMC,gBAAgB,CAACC,QACnBC,QAAQD,MAAM,SAAS,KAAKA,MAAM,KAAK,KAAKJ;AAEhD,MAAMM;IACF,YAAoBC,UAAuC,CAAE;aAAzCA,UAAU,GAAVA;IAA0C;IAE9D,MAAM,QAAQC,KAAY,EAA2B;QACjD,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;QAE5C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,+BAA+B,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAG5E,OAAOA,OAAO,KAAK,CACd,MAAM,CAACL,CAAAA,QAAUI,MAAM,aAAa,GAAG,OAAO,CAACL,cAAcC,QAC7D,GAAG,CAACA,CAAAA,QAAU;gBACX,SAASA,MAAM,OAAO;gBACtB,MAAMA,MAAM,IAAI;gBAChB,aAAaA,MAAM,WAAW;gBAC9B,OAAOA,MAAM,KAAK;gBAClB,iBAAiBA,MAAM,eAAe;gBACtC,eAAeA,MAAM,aAAa;gBAClC,cAAcA,MAAM,YAAY;gBAChC,YAAYA,MAAM,MAAM,CAAC,MAAM;YACnC;IACR;AACJ;AAEA,MAAMO,+BAA+BC,iBAAiB,oBAAoB,CAAC;IACvE,gBAAgBN;IAChB,cAAc;QAACO;KAAkB;AACrC;AAOA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGb;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;aACzD,OAAO,GAAGU;;AACvB;AAEO,MAAMI,wBAAwBC,oBAAoB,oBAAoB,CAAC;IAC1E,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,80 @@
1
+ import { z } from "zod";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
+ import { GetModelUseCase } from "../../features/contentModel/GetModel/index.js";
4
+ import { ListLatestEntriesUseCase } from "../../features/contentEntry/ListEntries/index.js";
5
+ import { CmsWhereMapper } from "../../features/whereMapper/abstractions.js";
6
+ import { CmsSortMapper } from "../../features/sortMapper/abstractions.js";
7
+ declare const inputSchema: z.ZodObject<{
8
+ modelId: z.ZodString;
9
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
+ sort: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ search: z.ZodOptional<z.ZodString>;
12
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ limit: z.ZodOptional<z.ZodNumber>;
14
+ after: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>;
16
+ type Input = z.infer<typeof inputSchema>;
17
+ interface EntrySummary {
18
+ id: string;
19
+ entryId: string;
20
+ status: string;
21
+ createdOn: string;
22
+ savedOn: string;
23
+ values: Record<string, unknown>;
24
+ }
25
+ interface QueryEntriesResult {
26
+ modelId: string;
27
+ entries: EntrySummary[];
28
+ meta: {
29
+ totalCount: number;
30
+ hasMoreItems: boolean;
31
+ cursor: string | null;
32
+ };
33
+ }
34
+ declare class QueryEntriesToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
35
+ private getModel;
36
+ private listLatestEntries;
37
+ private whereMapper;
38
+ private sortMapper;
39
+ constructor(getModel: GetModelUseCase.Interface, listLatestEntries: ListLatestEntriesUseCase.Interface, whereMapper: CmsWhereMapper.Interface, sortMapper: CmsSortMapper.Interface);
40
+ execute(input: Input): Promise<QueryEntriesResult>;
41
+ }
42
+ /**
43
+ * Reads entries for one model.
44
+ *
45
+ * Uses the LATEST revisions (the manage-API view), not published ones — an editor asking "which
46
+ * products are discounted" means the content as it currently stands in the admin app, including
47
+ * unpublished edits. Filter on `status` for a published-only view.
48
+ *
49
+ * `where` is passed through to the CMS rather than re-modelled as a Zod schema: the valid keys depend
50
+ * entirely on the model's fields, which are only known at runtime. An invalid filter surfaces as a
51
+ * tool error the model can correct, which is why `describeContentModel` is named in the description.
52
+ *
53
+ * `where` and `sort` arrive FLAT and go through `CmsWhereMapper`/`CmsSortMapper`, which nest the
54
+ * model's own fields under `values` and leave entry meta at the top. The flat form is what a model
55
+ * writes, because `describeContentModel` hands it a flat list of fieldIds.
56
+ */
57
+ declare class QueryEntriesToolImpl implements AiSdkToolDefinition.Interface<Input> {
58
+ readonly name = "queryEntries";
59
+ readonly title = "Query content entries";
60
+ readonly description = "Queries content entries for a model, with filtering, sorting, search and pagination. Returns the latest revision of each entry (including unpublished changes). Call describeContentModel first to learn the field IDs used in `where` and `sort`.";
61
+ readonly inputSchema: z.ZodObject<{
62
+ modelId: z.ZodString;
63
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
64
+ sort: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
+ search: z.ZodOptional<z.ZodString>;
66
+ fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
67
+ limit: z.ZodOptional<z.ZodNumber>;
68
+ after: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strip>;
70
+ readonly annotations: {
71
+ readOnlyHint: boolean;
72
+ };
73
+ readonly handler: typeof QueryEntriesToolHandlerImpl & {
74
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
75
+ };
76
+ }
77
+ export declare const QueryEntriesTool: typeof QueryEntriesToolImpl & {
78
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
79
+ };
80
+ export {};