@webiny/api-headless-cms-ddb-es 0.0.0-unstable.e6f0dc8ca7 → 0.0.0-unstable.eb81deee7e

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 (429) hide show
  1. package/abstractions/CmsDdbEsDataLoaders.d.ts +5 -0
  2. package/abstractions/CmsDdbEsDataLoaders.js +5 -0
  3. package/abstractions/CmsDdbEsDataLoaders.js.map +1 -0
  4. package/abstractions/CmsDdbEsEntriesEsEntity.d.ts +5 -0
  5. package/abstractions/CmsDdbEsEntriesEsEntity.js +5 -0
  6. package/abstractions/CmsDdbEsEntriesEsEntity.js.map +1 -0
  7. package/abstractions/CmsDdbEsEntryEntity.d.ts +5 -0
  8. package/abstractions/CmsDdbEsEntryEntity.js +5 -0
  9. package/abstractions/CmsDdbEsEntryEntity.js.map +1 -0
  10. package/abstractions/CmsDdbEsGroupEntity.d.ts +5 -0
  11. package/abstractions/CmsDdbEsGroupEntity.js +5 -0
  12. package/abstractions/CmsDdbEsGroupEntity.js.map +1 -0
  13. package/abstractions/CmsDdbEsModelEntity.d.ts +5 -0
  14. package/abstractions/CmsDdbEsModelEntity.js +5 -0
  15. package/abstractions/CmsDdbEsModelEntity.js.map +1 -0
  16. package/abstractions/CmsDdbEsOsTable.d.ts +5 -0
  17. package/abstractions/CmsDdbEsOsTable.js +5 -0
  18. package/abstractions/CmsDdbEsOsTable.js.map +1 -0
  19. package/abstractions/CmsDdbEsTable.d.ts +5 -0
  20. package/abstractions/CmsDdbEsTable.js +5 -0
  21. package/abstractions/CmsDdbEsTable.js.map +1 -0
  22. package/definitions/entry.js +7 -9
  23. package/definitions/entry.js.map +1 -1
  24. package/definitions/group.js +7 -9
  25. package/definitions/group.js.map +1 -1
  26. package/definitions/model.js +7 -9
  27. package/definitions/model.js.map +1 -1
  28. package/definitions/types.d.ts +4 -0
  29. package/definitions/types.js +0 -3
  30. package/feature.d.ts +9 -1
  31. package/feature.js +46 -179
  32. package/feature.js.map +1 -1
  33. package/index.d.ts +2 -1
  34. package/index.js +2 -3
  35. package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
  36. package/operations/entry/DdbEsCreateEntry.js +134 -0
  37. package/operations/entry/DdbEsCreateEntry.js.map +1 -0
  38. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
  39. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -0
  40. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
  41. package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
  42. package/operations/entry/DdbEsDeleteEntry.js +79 -0
  43. package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
  44. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +24 -0
  45. package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
  46. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
  47. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
  48. package/operations/entry/DdbEsDeleteMultipleEntries.js +80 -0
  49. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
  50. package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
  51. package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
  52. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
  53. package/operations/entry/DdbEsGetEntry.d.ts +14 -0
  54. package/operations/entry/DdbEsGetEntry.js +27 -0
  55. package/operations/entry/DdbEsGetEntry.js.map +1 -0
  56. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
  57. package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
  58. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
  59. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
  60. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
  61. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
  62. package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
  63. package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
  64. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
  65. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
  66. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
  67. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
  68. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
  69. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
  70. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
  71. package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
  72. package/operations/entry/DdbEsGetRevisionById.js +34 -0
  73. package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
  74. package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
  75. package/operations/entry/DdbEsGetRevisions.js +33 -0
  76. package/operations/entry/DdbEsGetRevisions.js.map +1 -0
  77. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +18 -0
  78. package/operations/entry/DdbEsGetUniqueFieldValues.js +76 -0
  79. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
  80. package/operations/entry/DdbEsListEntries.d.ts +25 -0
  81. package/operations/entry/DdbEsListEntries.js +91 -0
  82. package/operations/entry/DdbEsListEntries.js.map +1 -0
  83. package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
  84. package/operations/entry/DdbEsMoveEntry.js +113 -0
  85. package/operations/entry/DdbEsMoveEntry.js.map +1 -0
  86. package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
  87. package/operations/entry/DdbEsMoveToBin.js +137 -0
  88. package/operations/entry/DdbEsMoveToBin.js.map +1 -0
  89. package/operations/entry/DdbEsPublishEntry.d.ts +24 -0
  90. package/operations/entry/DdbEsPublishEntry.js +231 -0
  91. package/operations/entry/DdbEsPublishEntry.js.map +1 -0
  92. package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
  93. package/operations/entry/DdbEsRestoreFromBin.js +137 -0
  94. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
  95. package/operations/entry/DdbEsUnpublishEntry.d.ts +24 -0
  96. package/operations/entry/DdbEsUnpublishEntry.js +127 -0
  97. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
  98. package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
  99. package/operations/entry/DdbEsUpdateEntry.js +175 -0
  100. package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
  101. package/operations/entry/dataLoader/DataLoaderCache.js +22 -26
  102. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  103. package/operations/entry/dataLoader/constants.js +2 -1
  104. package/operations/entry/dataLoader/constants.js.map +1 -1
  105. package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
  106. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  107. package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -29
  108. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  109. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +27 -37
  110. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  111. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +27 -37
  112. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  113. package/operations/entry/dataLoader/getRevisionById.js +32 -46
  114. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  115. package/operations/entry/dataLoader/index.js +8 -9
  116. package/operations/entry/dataLoader/index.js.map +1 -1
  117. package/operations/entry/dataLoader/types.js +0 -3
  118. package/operations/entry/dataLoaders.d.ts +5 -5
  119. package/operations/entry/dataLoaders.js +89 -99
  120. package/operations/entry/dataLoaders.js.map +1 -1
  121. package/{features/CmsEntryOpenSearchIndex → operations/entry}/feature.d.ts +1 -1
  122. package/operations/entry/feature.js +53 -0
  123. package/operations/entry/feature.js.map +1 -0
  124. package/operations/entry/keys.js +43 -63
  125. package/operations/entry/keys.js.map +1 -1
  126. package/operations/entry/recordType.js +4 -9
  127. package/operations/entry/recordType.js.map +1 -1
  128. package/operations/entry/storageEntryUtils.d.ts +7 -0
  129. package/operations/entry/storageEntryUtils.js +14 -0
  130. package/operations/entry/storageEntryUtils.js.map +1 -0
  131. package/operations/entry/transformations/convertEntryKeys.js +21 -26
  132. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  133. package/operations/entry/transformations/index.d.ts +2 -5
  134. package/operations/entry/transformations/index.js +85 -115
  135. package/operations/entry/transformations/index.js.map +1 -1
  136. package/operations/entry/transformations/modifyEntryValues.d.ts +3 -3
  137. package/operations/entry/transformations/modifyEntryValues.js +12 -17
  138. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  139. package/operations/entry/transformations/transformEntryKeys.js +13 -16
  140. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  141. package/operations/group/DdbEsCreateGroup.d.ts +12 -0
  142. package/operations/group/DdbEsCreateGroup.js +35 -0
  143. package/operations/group/DdbEsCreateGroup.js.map +1 -0
  144. package/operations/group/DdbEsDeleteGroup.d.ts +12 -0
  145. package/operations/group/DdbEsDeleteGroup.js +31 -0
  146. package/operations/group/DdbEsDeleteGroup.js.map +1 -0
  147. package/operations/group/DdbEsGetGroup.d.ts +12 -0
  148. package/operations/group/DdbEsGetGroup.js +31 -0
  149. package/operations/group/DdbEsGetGroup.js.map +1 -0
  150. package/operations/group/DdbEsListGroups.d.ts +14 -0
  151. package/operations/group/DdbEsListGroups.js +52 -0
  152. package/operations/group/DdbEsListGroups.js.map +1 -0
  153. package/operations/group/DdbEsUpdateGroup.d.ts +12 -0
  154. package/operations/group/DdbEsUpdateGroup.js +35 -0
  155. package/operations/group/DdbEsUpdateGroup.js.map +1 -0
  156. package/{features/CmsEntryOpenSearchFilter → operations/group}/feature.d.ts +1 -1
  157. package/operations/group/feature.js +19 -0
  158. package/operations/group/feature.js.map +1 -0
  159. package/operations/group/keys.d.ts +15 -0
  160. package/operations/group/keys.js +17 -0
  161. package/operations/group/keys.js.map +1 -0
  162. package/operations/model/DdbEsCreateModel.d.ts +16 -0
  163. package/operations/model/DdbEsCreateModel.js +56 -0
  164. package/operations/model/DdbEsCreateModel.js.map +1 -0
  165. package/operations/model/DdbEsDeleteModel.d.ts +12 -0
  166. package/operations/model/DdbEsDeleteModel.js +31 -0
  167. package/operations/model/DdbEsDeleteModel.js.map +1 -0
  168. package/operations/model/DdbEsGetModel.d.ts +12 -0
  169. package/operations/model/DdbEsGetModel.js +30 -0
  170. package/operations/model/DdbEsGetModel.js.map +1 -0
  171. package/operations/model/DdbEsListModels.d.ts +12 -0
  172. package/operations/model/DdbEsListModels.js +36 -0
  173. package/operations/model/DdbEsListModels.js.map +1 -0
  174. package/operations/model/DdbEsUpdateModel.d.ts +12 -0
  175. package/operations/model/DdbEsUpdateModel.js +36 -0
  176. package/operations/model/DdbEsUpdateModel.js.map +1 -0
  177. package/{features/CmsEntryOpenSearchFieldIndex → operations/model}/feature.d.ts +1 -1
  178. package/operations/model/feature.js +19 -0
  179. package/operations/model/feature.js.map +1 -0
  180. package/operations/model/keys.d.ts +15 -0
  181. package/operations/model/keys.js +17 -0
  182. package/operations/model/keys.js.map +1 -0
  183. package/package.json +33 -27
  184. package/requestFeature.d.ts +20 -0
  185. package/requestFeature.js +54 -0
  186. package/requestFeature.js.map +1 -0
  187. package/tasks/CreateElasticsearchIndexTask.d.ts +13 -0
  188. package/tasks/CreateElasticsearchIndexTask.js +40 -0
  189. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  190. package/types.d.ts +11 -50
  191. package/types.js +7 -13
  192. package/types.js.map +1 -1
  193. package/configurations.d.ts +0 -19
  194. package/configurations.js +0 -39
  195. package/configurations.js.map +0 -1
  196. package/definitions/types.js.map +0 -1
  197. package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
  198. package/elasticsearch/createElasticsearchIndex.js +0 -74
  199. package/elasticsearch/createElasticsearchIndex.js.map +0 -1
  200. package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
  201. package/elasticsearch/deleteElasticsearchIndex.js +0 -31
  202. package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
  203. package/exports/api/cms/opensearch.d.ts +0 -9
  204. package/exports/api/cms/opensearch.js +0 -11
  205. package/exports/api/cms/opensearch.js.map +0 -1
  206. package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +0 -16
  207. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +0 -4
  208. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +0 -1
  209. package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +0 -1
  210. package/features/CmsEntryOpenSearchBodyModifier/index.js +0 -3
  211. package/features/CmsEntryOpenSearchBodyModifier/index.js.map +0 -1
  212. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +0 -13
  213. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +0 -36
  214. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +0 -1
  215. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +0 -35
  216. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +0 -4
  217. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +0 -1
  218. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +0 -11
  219. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +0 -4
  220. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +0 -1
  221. package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +0 -1
  222. package/features/CmsEntryOpenSearchFieldIndex/constants.js +0 -3
  223. package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +0 -1
  224. package/features/CmsEntryOpenSearchFieldIndex/feature.js +0 -24
  225. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +0 -1
  226. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +0 -11
  227. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +0 -77
  228. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +0 -1
  229. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +0 -10
  230. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +0 -39
  231. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +0 -1
  232. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +0 -10
  233. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +0 -22
  234. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +0 -1
  235. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +0 -10
  236. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +0 -25
  237. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +0 -1
  238. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +0 -11
  239. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +0 -37
  240. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +0 -1
  241. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +0 -10
  242. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +0 -158
  243. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +0 -1
  244. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +0 -10
  245. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +0 -22
  246. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +0 -1
  247. package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +0 -3
  248. package/features/CmsEntryOpenSearchFieldIndex/index.js +0 -5
  249. package/features/CmsEntryOpenSearchFieldIndex/index.js.map +0 -1
  250. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +0 -11
  251. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +0 -38
  252. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +0 -1
  253. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +0 -37
  254. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +0 -4
  255. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +0 -1
  256. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +0 -9
  257. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +0 -4
  258. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +0 -1
  259. package/features/CmsEntryOpenSearchFilter/constants.d.ts +0 -1
  260. package/features/CmsEntryOpenSearchFilter/constants.js +0 -3
  261. package/features/CmsEntryOpenSearchFilter/constants.js.map +0 -1
  262. package/features/CmsEntryOpenSearchFilter/feature.js +0 -16
  263. package/features/CmsEntryOpenSearchFilter/feature.js.map +0 -1
  264. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +0 -9
  265. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +0 -23
  266. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +0 -1
  267. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +0 -9
  268. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +0 -61
  269. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +0 -1
  270. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +0 -9
  271. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +0 -49
  272. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +0 -1
  273. package/features/CmsEntryOpenSearchFilter/index.d.ts +0 -3
  274. package/features/CmsEntryOpenSearchFilter/index.js +0 -5
  275. package/features/CmsEntryOpenSearchFilter/index.js.map +0 -1
  276. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +0 -20
  277. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +0 -4
  278. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +0 -1
  279. package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +0 -1
  280. package/features/CmsEntryOpenSearchFullTextSearch/index.js +0 -3
  281. package/features/CmsEntryOpenSearchFullTextSearch/index.js.map +0 -1
  282. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +0 -11
  283. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +0 -16
  284. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +0 -1
  285. package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +0 -14
  286. package/features/CmsEntryOpenSearchIndex/abstractions.js +0 -4
  287. package/features/CmsEntryOpenSearchIndex/abstractions.js.map +0 -1
  288. package/features/CmsEntryOpenSearchIndex/feature.js +0 -10
  289. package/features/CmsEntryOpenSearchIndex/feature.js.map +0 -1
  290. package/features/CmsEntryOpenSearchIndex/index.d.ts +0 -3
  291. package/features/CmsEntryOpenSearchIndex/index.js +0 -5
  292. package/features/CmsEntryOpenSearchIndex/index.js.map +0 -1
  293. package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +0 -16
  294. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +0 -4
  295. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +0 -1
  296. package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +0 -1
  297. package/features/CmsEntryOpenSearchQueryModifier/index.js +0 -3
  298. package/features/CmsEntryOpenSearchQueryModifier/index.js.map +0 -1
  299. package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +0 -15
  300. package/features/CmsEntryOpenSearchSortModifier/abstractions.js +0 -4
  301. package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +0 -1
  302. package/features/CmsEntryOpenSearchSortModifier/index.d.ts +0 -1
  303. package/features/CmsEntryOpenSearchSortModifier/index.js +0 -3
  304. package/features/CmsEntryOpenSearchSortModifier/index.js.map +0 -1
  305. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +0 -12
  306. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +0 -27
  307. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +0 -1
  308. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +0 -22
  309. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +0 -4
  310. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +0 -1
  311. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +0 -10
  312. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +0 -4
  313. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +0 -1
  314. package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +0 -4
  315. package/features/CmsEntryOpenSearchValueSearch/feature.js +0 -16
  316. package/features/CmsEntryOpenSearchValueSearch/feature.js.map +0 -1
  317. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +0 -10
  318. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +0 -23
  319. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +0 -1
  320. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +0 -10
  321. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +0 -55
  322. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +0 -1
  323. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +0 -10
  324. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +0 -24
  325. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +0 -1
  326. package/features/CmsEntryOpenSearchValueSearch/index.d.ts +0 -3
  327. package/features/CmsEntryOpenSearchValueSearch/index.js +0 -5
  328. package/features/CmsEntryOpenSearchValueSearch/index.js.map +0 -1
  329. package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +0 -23
  330. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +0 -4
  331. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +0 -1
  332. package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +0 -1
  333. package/features/CmsEntryOpenSearchValuesModifier/index.js +0 -3
  334. package/features/CmsEntryOpenSearchValuesModifier/index.js.map +0 -1
  335. package/helpers/entryIndexHelpers.d.ts +0 -20
  336. package/helpers/entryIndexHelpers.js +0 -134
  337. package/helpers/entryIndexHelpers.js.map +0 -1
  338. package/helpers/fieldIdentifier.d.ts +0 -6
  339. package/helpers/fieldIdentifier.js +0 -35
  340. package/helpers/fieldIdentifier.js.map +0 -1
  341. package/helpers/index.d.ts +0 -2
  342. package/helpers/index.js +0 -4
  343. package/helpers/index.js.map +0 -1
  344. package/index.js.map +0 -1
  345. package/operations/entry/dataLoader/types.js.map +0 -1
  346. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
  347. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -27
  348. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
  349. package/operations/entry/elasticsearch/body.d.ts +0 -29
  350. package/operations/entry/elasticsearch/body.js +0 -138
  351. package/operations/entry/elasticsearch/body.js.map +0 -1
  352. package/operations/entry/elasticsearch/fields/createSystemField.d.ts +0 -4
  353. package/operations/entry/elasticsearch/fields/createSystemField.js +0 -10
  354. package/operations/entry/elasticsearch/fields/createSystemField.js.map +0 -1
  355. package/operations/entry/elasticsearch/fields/live.d.ts +0 -2
  356. package/operations/entry/elasticsearch/fields/live.js +0 -45
  357. package/operations/entry/elasticsearch/fields/live.js.map +0 -1
  358. package/operations/entry/elasticsearch/fields/location.d.ts +0 -2
  359. package/operations/entry/elasticsearch/fields/location.js +0 -45
  360. package/operations/entry/elasticsearch/fields/location.js.map +0 -1
  361. package/operations/entry/elasticsearch/fields/state.d.ts +0 -2
  362. package/operations/entry/elasticsearch/fields/state.js +0 -93
  363. package/operations/entry/elasticsearch/fields/state.js.map +0 -1
  364. package/operations/entry/elasticsearch/fields.d.ts +0 -12
  365. package/operations/entry/elasticsearch/fields.js +0 -231
  366. package/operations/entry/elasticsearch/fields.js.map +0 -1
  367. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -9
  368. package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -52
  369. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
  370. package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -22
  371. package/operations/entry/elasticsearch/filtering/exec.js +0 -125
  372. package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
  373. package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
  374. package/operations/entry/elasticsearch/filtering/index.js +0 -3
  375. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  376. package/operations/entry/elasticsearch/filtering/path.d.ts +0 -17
  377. package/operations/entry/elasticsearch/filtering/path.js +0 -36
  378. package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
  379. package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
  380. package/operations/entry/elasticsearch/filtering/populated.js +0 -18
  381. package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
  382. package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
  383. package/operations/entry/elasticsearch/filtering/values.js +0 -16
  384. package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
  385. package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -13
  386. package/operations/entry/elasticsearch/fullTextSearch.js +0 -88
  387. package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
  388. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
  389. package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -20
  390. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
  391. package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
  392. package/operations/entry/elasticsearch/initialQuery.js +0 -88
  393. package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
  394. package/operations/entry/elasticsearch/keyword.d.ts +0 -2
  395. package/operations/entry/elasticsearch/keyword.js +0 -31
  396. package/operations/entry/elasticsearch/keyword.js.map +0 -1
  397. package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -7
  398. package/operations/entry/elasticsearch/plugins/operator.js +0 -24
  399. package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
  400. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +0 -2
  401. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +0 -6
  402. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +0 -1
  403. package/operations/entry/elasticsearch/sort.d.ts +0 -12
  404. package/operations/entry/elasticsearch/sort.js +0 -103
  405. package/operations/entry/elasticsearch/sort.js.map +0 -1
  406. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -9
  407. package/operations/entry/elasticsearch/transformValueForSearch.js +0 -17
  408. package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
  409. package/operations/entry/elasticsearch/types.d.ts +0 -34
  410. package/operations/entry/elasticsearch/types.js +0 -3
  411. package/operations/entry/elasticsearch/types.js.map +0 -1
  412. package/operations/entry/index.d.ts +0 -32
  413. package/operations/entry/index.js +0 -1761
  414. package/operations/entry/index.js.map +0 -1
  415. package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -12
  416. package/operations/entry/transformations/transformEntryToIndex.js +0 -26
  417. package/operations/entry/transformations/transformEntryToIndex.js.map +0 -1
  418. package/operations/group/index.d.ts +0 -9
  419. package/operations/group/index.js +0 -142
  420. package/operations/group/index.js.map +0 -1
  421. package/operations/model/index.d.ts +0 -8
  422. package/operations/model/index.js +0 -163
  423. package/operations/model/index.js.map +0 -1
  424. package/tasks/createIndexTaskPlugin.d.ts +0 -2
  425. package/tasks/createIndexTaskPlugin.js +0 -48
  426. package/tasks/createIndexTaskPlugin.js.map +0 -1
  427. package/values/NoValueContainer.d.ts +0 -5
  428. package/values/NoValueContainer.js +0 -13
  429. package/values/NoValueContainer.js.map +0 -1
@@ -0,0 +1,14 @@
1
+ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetRevisionsParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetRevisionsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js";
3
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
4
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
5
+ declare class DdbEsGetRevisionsImpl implements GetRevisionsStorageOperation.Interface {
6
+ private dataLoaders;
7
+ private storageModelProvider;
8
+ constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
9
+ execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetRevisionsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
10
+ }
11
+ export declare const DdbEsGetRevisions: typeof DdbEsGetRevisionsImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js").IGetRevisionsStorageOperation>;
13
+ };
14
+ export {};
@@ -0,0 +1,33 @@
1
+ import { GetRevisionsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js";
2
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
3
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
4
+ import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
5
+ class DdbEsGetRevisionsImpl {
6
+ constructor(dataLoaders, storageModelProvider){
7
+ this.dataLoaders = dataLoaders;
8
+ this.storageModelProvider = storageModelProvider;
9
+ }
10
+ async execute(initialModel, params) {
11
+ const model = this.storageModelProvider.getModel(initialModel);
12
+ const entries = await this.dataLoaders.getAllEntryRevisions({
13
+ model,
14
+ ids: [
15
+ params.id
16
+ ]
17
+ });
18
+ return entries.map((entry)=>convertEntryKeysFromStorage({
19
+ model,
20
+ entry
21
+ }));
22
+ }
23
+ }
24
+ const DdbEsGetRevisions = GetRevisionsStorageOperation.createImplementation({
25
+ implementation: DdbEsGetRevisionsImpl,
26
+ dependencies: [
27
+ CmsDdbEsDataLoaders,
28
+ CmsStorageModelProvider
29
+ ]
30
+ });
31
+ export { DdbEsGetRevisions };
32
+
33
+ //# sourceMappingURL=DdbEsGetRevisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsGetRevisions.js","sources":["../../../src/operations/entry/DdbEsGetRevisions.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetRevisionsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetRevisionsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetRevisionsImpl implements GetRevisionsStorageOperation.Interface {\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getAllEntryRevisions<T>({\n model,\n ids: [params.id]\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetRevisions = GetRevisionsStorageOperation.createImplementation({\n implementation: DdbEsGetRevisionsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n});\n"],"names":["DdbEsGetRevisionsImpl","dataLoaders","storageModelProvider","initialModel","params","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetRevisions","GetRevisionsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;AAUA,MAAMA;IACF,YACYC,WAA0C,EAC1CC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAmD,EACrD;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAMG,UAAU,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAI;YAC3DD;YACA,KAAK;gBAACD,OAAO,EAAE;aAAC;QACpB;QAEA,OAAOE,QAAQ,GAAG,CAACC,CAAAA,QACRC,4BAA+B;gBAClCH;gBACAE;YACJ;IAER;AACJ;AAEO,MAAME,oBAAoBC,6BAA6B,oBAAoB,CAAC;IAC/E,gBAAgBV;IAChB,cAAc;QAACW;QAAqBC;KAAwB;AAChE"}
@@ -0,0 +1,18 @@
1
+ import type { CmsModel, CmsEntryStorageOperationsGetUniqueFieldValuesParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetUniqueFieldValuesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js";
3
+ import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
4
+ import { CmsEntryOpenSearchBodyBuilder, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
5
+ declare class DdbEsGetUniqueFieldValuesImpl implements GetUniqueFieldValuesStorageOperation.Interface {
6
+ private bodyBuilder;
7
+ private indexProvider;
8
+ private elasticsearch;
9
+ constructor(bodyBuilder: CmsEntryOpenSearchBodyBuilder.Interface, openSearchClient: OpenSearchClient.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface);
10
+ execute(model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams): Promise<{
11
+ value: string;
12
+ count: number;
13
+ }[]>;
14
+ }
15
+ export declare const DdbEsGetUniqueFieldValues: typeof DdbEsGetUniqueFieldValuesImpl & {
16
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js").IGetUniqueFieldValuesStorageOperation>;
17
+ };
18
+ export {};
@@ -0,0 +1,76 @@
1
+ import _webiny_error from "@webiny/error";
2
+ import { GetUniqueFieldValuesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js";
3
+ import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
4
+ import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
5
+ import { shouldIgnoreEsResponseError } from "@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js";
6
+ import { CmsEntryOpenSearchBodyBuilder, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
7
+ class DdbEsGetUniqueFieldValuesImpl {
8
+ constructor(bodyBuilder, openSearchClient, indexProvider){
9
+ this.bodyBuilder = bodyBuilder;
10
+ this.indexProvider = indexProvider;
11
+ this.elasticsearch = openSearchClient.use();
12
+ }
13
+ async execute(model, params) {
14
+ const { where, fieldId } = params;
15
+ const configurations = createConfigurations(this.indexProvider);
16
+ const { index } = await configurations.es({
17
+ model
18
+ });
19
+ const initialBody = this.bodyBuilder.build({
20
+ model,
21
+ params: {
22
+ limit: 1,
23
+ where
24
+ }
25
+ });
26
+ const field = model.fields.find((f)=>f.fieldId === fieldId);
27
+ if (!field) throw new _webiny_error('Could not find field with given "fieldId" value.', "FIELD_NOT_FOUND", {
28
+ fieldId
29
+ });
30
+ const body = {
31
+ ...initialBody,
32
+ size: 0,
33
+ aggregations: {
34
+ getUniqueFieldValues: {
35
+ terms: {
36
+ field: `values.${field.storageId}.keyword`,
37
+ size: 1000000
38
+ }
39
+ }
40
+ }
41
+ };
42
+ let response;
43
+ try {
44
+ response = await this.elasticsearch.search({
45
+ index,
46
+ body
47
+ });
48
+ } catch (error) {
49
+ if (shouldIgnoreEsResponseError(error)) return [];
50
+ throw new _webiny_error(error.message || "Error in the Elasticsearch query.", error.code || "OPENSEARCH_ERROR", {
51
+ error,
52
+ index,
53
+ model,
54
+ body
55
+ });
56
+ }
57
+ const aggregations = response.body.aggregations || {};
58
+ const agg = aggregations["getUniqueFieldValues"];
59
+ const buckets = agg && "buckets" in agg && Array.isArray(agg.buckets) ? agg.buckets : [];
60
+ return buckets.map((bucket)=>({
61
+ value: bucket.key,
62
+ count: bucket.doc_count
63
+ }));
64
+ }
65
+ }
66
+ const DdbEsGetUniqueFieldValues = GetUniqueFieldValuesStorageOperation.createImplementation({
67
+ implementation: DdbEsGetUniqueFieldValuesImpl,
68
+ dependencies: [
69
+ CmsEntryOpenSearchBodyBuilder,
70
+ OpenSearchClient,
71
+ CmsModelOpenSearchIndexProvider
72
+ ]
73
+ });
74
+ export { DdbEsGetUniqueFieldValues };
75
+
76
+ //# sourceMappingURL=DdbEsGetUniqueFieldValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsGetUniqueFieldValues.js","sources":["../../../src/operations/entry/DdbEsGetUniqueFieldValues.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryStorageOperationsGetUniqueFieldValuesParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetUniqueFieldValuesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js\";\nimport { OpenSearchClient } from \"@webiny/api-opensearch/exports/api/opensearch.js\";\nimport type { Client } from \"@webiny/api-opensearch\";\nimport type {\n OpenSearchSearchResponse,\n SearchBody as OpenSearchSearchBody\n} from \"@webiny/api-opensearch/types.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { shouldIgnoreEsResponseError } from \"@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js\";\nimport {\n CmsEntryOpenSearchBodyBuilder,\n CmsModelOpenSearchIndexProvider\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\n\nclass DdbEsGetUniqueFieldValuesImpl implements GetUniqueFieldValuesStorageOperation.Interface {\n private elasticsearch: Client;\n\n constructor(\n private bodyBuilder: CmsEntryOpenSearchBodyBuilder.Interface,\n openSearchClient: OpenSearchClient.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface\n ) {\n this.elasticsearch = openSearchClient.use();\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams) {\n const { where, fieldId } = params;\n\n const configurations = createConfigurations(this.indexProvider);\n const { index } = await configurations.es({\n model\n });\n\n const initialBody = this.bodyBuilder.build({\n model,\n params: {\n limit: 1,\n where\n }\n });\n\n const field = model.fields.find(f => f.fieldId === fieldId);\n if (!field) {\n throw new WebinyError(\n `Could not find field with given \"fieldId\" value.`,\n \"FIELD_NOT_FOUND\",\n {\n fieldId\n }\n );\n }\n\n const body: OpenSearchSearchBody = {\n ...initialBody,\n /**\n * We do not need any hits returned, we only need the aggregations.\n */\n size: 0,\n aggregations: {\n getUniqueFieldValues: {\n terms: {\n field: `values.${field.storageId}.keyword`,\n size: 1000000\n }\n }\n }\n };\n\n let response: OpenSearchSearchResponse | undefined = undefined;\n\n try {\n response = await this.elasticsearch.search({\n index,\n body\n });\n } catch (error) {\n if (shouldIgnoreEsResponseError(error)) {\n return [];\n }\n\n throw new WebinyError(\n error.message || \"Error in the Elasticsearch query.\",\n error.code || \"OPENSEARCH_ERROR\",\n {\n error,\n index,\n model,\n body\n }\n );\n }\n\n const aggregations = response.body.aggregations || {};\n const agg = aggregations[\"getUniqueFieldValues\"];\n const buckets = agg && \"buckets\" in agg && Array.isArray(agg.buckets) ? agg.buckets : [];\n return buckets.map((bucket: { key: string; doc_count: number }) => {\n return {\n value: bucket.key,\n count: bucket.doc_count\n };\n });\n }\n}\n\nexport const DdbEsGetUniqueFieldValues = GetUniqueFieldValuesStorageOperation.createImplementation({\n implementation: DdbEsGetUniqueFieldValuesImpl,\n dependencies: [CmsEntryOpenSearchBodyBuilder, OpenSearchClient, CmsModelOpenSearchIndexProvider]\n});\n"],"names":["DdbEsGetUniqueFieldValuesImpl","bodyBuilder","openSearchClient","indexProvider","model","params","where","fieldId","configurations","createConfigurations","index","initialBody","field","f","WebinyError","body","response","error","shouldIgnoreEsResponseError","aggregations","agg","buckets","Array","bucket","DdbEsGetUniqueFieldValues","GetUniqueFieldValuesStorageOperation","CmsEntryOpenSearchBodyBuilder","OpenSearchClient","CmsModelOpenSearchIndexProvider"],"mappings":";;;;;;AAmBA,MAAMA;IAGF,YACYC,WAAoD,EAC5DC,gBAA4C,EACpCC,aAAwD,CAClE;aAHUF,WAAW,GAAXA;aAEAE,aAAa,GAAbA;QAER,IAAI,CAAC,aAAa,GAAGD,iBAAiB,GAAG;IAC7C;IAEA,MAAM,QAAQE,KAAe,EAAEC,MAA2D,EAAE;QACxF,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGF;QAE3B,MAAMG,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAC9D,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YACtCJ;QACJ;QAEA,MAAMO,cAAc,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YACvCP;YACA,QAAQ;gBACJ,OAAO;gBACPE;YACJ;QACJ;QAEA,MAAMM,QAAQR,MAAM,MAAM,CAAC,IAAI,CAACS,CAAAA,IAAKA,EAAE,OAAO,KAAKN;QACnD,IAAI,CAACK,OACD,MAAM,IAAIE,cACN,oDACA,mBACA;YACIP;QACJ;QAIR,MAAMQ,OAA6B;YAC/B,GAAGJ,WAAW;YAId,MAAM;YACN,cAAc;gBACV,sBAAsB;oBAClB,OAAO;wBACH,OAAO,CAAC,OAAO,EAAEC,MAAM,SAAS,CAAC,QAAQ,CAAC;wBAC1C,MAAM;oBACV;gBACJ;YACJ;QACJ;QAEA,IAAII;QAEJ,IAAI;YACAA,WAAW,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;gBACvCN;gBACAK;YACJ;QACJ,EAAE,OAAOE,OAAO;YACZ,IAAIC,4BAA4BD,QAC5B,OAAO,EAAE;YAGb,MAAM,IAAIH,cACNG,MAAM,OAAO,IAAI,qCACjBA,MAAM,IAAI,IAAI,oBACd;gBACIA;gBACAP;gBACAN;gBACAW;YACJ;QAER;QAEA,MAAMI,eAAeH,SAAS,IAAI,CAAC,YAAY,IAAI,CAAC;QACpD,MAAMI,MAAMD,YAAY,CAAC,uBAAuB;QAChD,MAAME,UAAUD,OAAO,aAAaA,OAAOE,MAAM,OAAO,CAACF,IAAI,OAAO,IAAIA,IAAI,OAAO,GAAG,EAAE;QACxF,OAAOC,QAAQ,GAAG,CAAC,CAACE,SACT;gBACH,OAAOA,OAAO,GAAG;gBACjB,OAAOA,OAAO,SAAS;YAC3B;IAER;AACJ;AAEO,MAAMC,4BAA4BC,qCAAqC,oBAAoB,CAAC;IAC/F,gBAAgBzB;IAChB,cAAc;QAAC0B;QAA+BC;QAAkBC;KAAgC;AACpG"}
@@ -0,0 +1,25 @@
1
+ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsListParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
3
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
4
+ import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
5
+ import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
6
+ import { CmsEntryOpenSearchBodyBuilder, CmsEntryOpenSearchFieldIndexRegistry, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
7
+ declare class DdbEsListEntriesImpl implements ListEntriesStorageOperation.Interface {
8
+ private storageModelProvider;
9
+ private bodyBuilder;
10
+ private fieldRegistry;
11
+ private fieldIndexRegistry;
12
+ private indexProvider;
13
+ private elasticsearch;
14
+ constructor(storageModelProvider: CmsStorageModelProvider.Interface, bodyBuilder: CmsEntryOpenSearchBodyBuilder.Interface, fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface, fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface, openSearchClient: OpenSearchClient.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface);
15
+ execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsListParams): Promise<{
16
+ hasMoreItems: boolean;
17
+ totalCount: number;
18
+ cursor: string | null;
19
+ items: import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[];
20
+ }>;
21
+ }
22
+ export declare const DdbEsListEntries: typeof DdbEsListEntriesImpl & {
23
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js").IListEntriesStorageOperation>;
24
+ };
25
+ export {};
@@ -0,0 +1,91 @@
1
+ import _webiny_error from "@webiny/error";
2
+ import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
3
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
4
+ import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
5
+ import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
6
+ import { createLimit, decodeCursor, encodeCursor } from "@webiny/api-opensearch";
7
+ import { getTotalCount } from "@webiny/api-opensearch/types.js";
8
+ import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
9
+ import { extractEntriesFromIndex } from "@webiny/api-headless-cms-utils-os/helpers/index.js";
10
+ import { shouldIgnoreEsResponseError } from "@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js";
11
+ import { CmsEntryOpenSearchBodyBuilder, CmsEntryOpenSearchFieldIndexRegistry, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
12
+ import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
13
+ class DdbEsListEntriesImpl {
14
+ constructor(storageModelProvider, bodyBuilder, fieldRegistry, fieldIndexRegistry, openSearchClient, indexProvider){
15
+ this.storageModelProvider = storageModelProvider;
16
+ this.bodyBuilder = bodyBuilder;
17
+ this.fieldRegistry = fieldRegistry;
18
+ this.fieldIndexRegistry = fieldIndexRegistry;
19
+ this.indexProvider = indexProvider;
20
+ this.elasticsearch = openSearchClient.use();
21
+ }
22
+ async execute(initialModel, params) {
23
+ const model = this.storageModelProvider.getModel(initialModel);
24
+ const limit = createLimit(params.limit, 50);
25
+ const configurations = createConfigurations(this.indexProvider);
26
+ const { index } = await configurations.es({
27
+ model
28
+ });
29
+ const body = this.bodyBuilder.build({
30
+ model,
31
+ params: {
32
+ ...params,
33
+ limit,
34
+ after: decodeCursor(params.after)
35
+ }
36
+ });
37
+ let response;
38
+ try {
39
+ response = await this.elasticsearch.search({
40
+ index,
41
+ body
42
+ });
43
+ } catch (error) {
44
+ if (shouldIgnoreEsResponseError(error)) return {
45
+ hasMoreItems: false,
46
+ totalCount: 0,
47
+ cursor: null,
48
+ items: []
49
+ };
50
+ throw new _webiny_error(error.message, error.code || "OPENSEARCH_ERROR", {
51
+ error,
52
+ index,
53
+ body,
54
+ model
55
+ });
56
+ }
57
+ const { hits, total } = response.body.hits;
58
+ const items = extractEntriesFromIndex({
59
+ fieldRegistry: this.fieldRegistry,
60
+ fieldIndexRegistry: this.fieldIndexRegistry,
61
+ model,
62
+ entries: hits.map((item)=>item._source)
63
+ }).map((item)=>convertEntryKeysFromStorage({
64
+ model,
65
+ entry: item
66
+ }));
67
+ const hasMoreItems = items.length > limit;
68
+ if (hasMoreItems) items.pop();
69
+ const cursor = items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null;
70
+ return {
71
+ hasMoreItems,
72
+ totalCount: getTotalCount(total),
73
+ cursor,
74
+ items
75
+ };
76
+ }
77
+ }
78
+ const DdbEsListEntries = ListEntriesStorageOperation.createImplementation({
79
+ implementation: DdbEsListEntriesImpl,
80
+ dependencies: [
81
+ CmsStorageModelProvider,
82
+ CmsEntryOpenSearchBodyBuilder,
83
+ CmsModelFieldToGraphQLRegistry,
84
+ CmsEntryOpenSearchFieldIndexRegistry,
85
+ OpenSearchClient,
86
+ CmsModelOpenSearchIndexProvider
87
+ ]
88
+ });
89
+ export { DdbEsListEntries };
90
+
91
+ //# sourceMappingURL=DdbEsListEntries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsListEntries.js","sources":["../../../src/operations/entry/DdbEsListEntries.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsListParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { ListEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { OpenSearchClient } from \"@webiny/api-opensearch/exports/api/opensearch.js\";\nimport type { Client } from \"@webiny/api-opensearch\";\nimport { createLimit, decodeCursor, encodeCursor } from \"@webiny/api-opensearch\";\nimport type { OpenSearchSearchResponse } from \"@webiny/api-opensearch/types.js\";\nimport { getTotalCount } from \"@webiny/api-opensearch/types.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { extractEntriesFromIndex } from \"@webiny/api-headless-cms-utils-os/helpers/index.js\";\nimport { shouldIgnoreEsResponseError } from \"@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js\";\nimport {\n CmsEntryOpenSearchBodyBuilder,\n CmsEntryOpenSearchFieldIndexRegistry,\n CmsModelOpenSearchIndexProvider\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\nimport type { CmsIndexEntry } from \"@webiny/api-headless-cms-utils-os/types.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsListEntriesImpl implements ListEntriesStorageOperation.Interface {\n private elasticsearch: Client;\n\n constructor(\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private bodyBuilder: CmsEntryOpenSearchBodyBuilder.Interface,\n private fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface,\n private fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface,\n openSearchClient: OpenSearchClient.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface\n ) {\n this.elasticsearch = openSearchClient.use();\n }\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const limit = createLimit(params.limit, 50);\n const configurations = createConfigurations(this.indexProvider);\n const { index } = await configurations.es({\n model\n });\n\n const body = this.bodyBuilder.build({\n model,\n params: {\n ...params,\n limit,\n after: decodeCursor(params.after)\n }\n });\n\n let response: OpenSearchSearchResponse;\n try {\n response = await this.elasticsearch.search({\n index,\n body\n });\n } catch (error) {\n /**\n * We will silently ignore the `index_not_found_exception` error and return an empty result set.\n * This is because the index might not exist yet, and we don't want to throw an error.\n */\n if (shouldIgnoreEsResponseError(error)) {\n return {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null,\n items: []\n };\n }\n\n throw new WebinyError(error.message, error.code || \"OPENSEARCH_ERROR\", {\n error,\n index,\n body,\n model\n });\n }\n\n const { hits, total } = response.body.hits;\n\n const items = extractEntriesFromIndex<T>({\n fieldRegistry: this.fieldRegistry,\n fieldIndexRegistry: this.fieldIndexRegistry,\n model,\n entries: hits.map(item => {\n return item._source as CmsIndexEntry<T>;\n })\n }).map(item => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry: item\n });\n });\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n /**\n * Remove the last item from results, we don't want to include it.\n */\n items.pop();\n }\n /**\n * Cursor is the `sort` value of the last item in the array.\n * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n */\n /**\n * TODO expect errors over hit properties is required due to opensearch library narrowing types too much because of the _source: false. At least what Claude says, didnt go into it too much.\n * Properties are there, but types are not correct.\n */\n // @ts-expect-error\n const cursor = items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null;\n return {\n hasMoreItems,\n totalCount: getTotalCount(total),\n cursor,\n items\n };\n }\n}\n\nexport const DdbEsListEntries = ListEntriesStorageOperation.createImplementation({\n implementation: DdbEsListEntriesImpl,\n dependencies: [\n CmsStorageModelProvider,\n CmsEntryOpenSearchBodyBuilder,\n CmsModelFieldToGraphQLRegistry,\n CmsEntryOpenSearchFieldIndexRegistry,\n OpenSearchClient,\n CmsModelOpenSearchIndexProvider\n ]\n});\n"],"names":["DdbEsListEntriesImpl","storageModelProvider","bodyBuilder","fieldRegistry","fieldIndexRegistry","openSearchClient","indexProvider","initialModel","params","model","limit","createLimit","configurations","createConfigurations","index","body","decodeCursor","response","error","shouldIgnoreEsResponseError","WebinyError","hits","total","items","extractEntriesFromIndex","item","convertEntryKeysFromStorage","hasMoreItems","cursor","encodeCursor","getTotalCount","DdbEsListEntries","ListEntriesStorageOperation","CmsStorageModelProvider","CmsEntryOpenSearchBodyBuilder","CmsModelFieldToGraphQLRegistry","CmsEntryOpenSearchFieldIndexRegistry","OpenSearchClient","CmsModelOpenSearchIndexProvider"],"mappings":";;;;;;;;;;;;AAyBA,MAAMA;IAGF,YACYC,oBAAuD,EACvDC,WAAoD,EACpDC,aAAuD,EACvDC,kBAAkE,EAC1EC,gBAA4C,EACpCC,aAAwD,CAClE;aANUL,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;aACAC,aAAa,GAAbA;aACAC,kBAAkB,GAAlBA;aAEAE,aAAa,GAAbA;QAER,IAAI,CAAC,aAAa,GAAGD,iBAAiB,GAAG;IAC7C;IAEA,MAAM,QACFE,YAAsB,EACtBC,MAA2C,EAC7C;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAMG,QAAQC,YAAYH,OAAO,KAAK,EAAE;QACxC,MAAMI,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAC9D,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YACtCH;QACJ;QAEA,MAAMM,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YAChCN;YACA,QAAQ;gBACJ,GAAGD,MAAM;gBACTE;gBACA,OAAOM,aAAaR,OAAO,KAAK;YACpC;QACJ;QAEA,IAAIS;QACJ,IAAI;YACAA,WAAW,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;gBACvCH;gBACAC;YACJ;QACJ,EAAE,OAAOG,OAAO;YAKZ,IAAIC,4BAA4BD,QAC5B,OAAO;gBACH,cAAc;gBACd,YAAY;gBACZ,QAAQ;gBACR,OAAO,EAAE;YACb;YAGJ,MAAM,IAAIE,cAAYF,MAAM,OAAO,EAAEA,MAAM,IAAI,IAAI,oBAAoB;gBACnEA;gBACAJ;gBACAC;gBACAN;YACJ;QACJ;QAEA,MAAM,EAAEY,IAAI,EAAEC,KAAK,EAAE,GAAGL,SAAS,IAAI,CAAC,IAAI;QAE1C,MAAMM,QAAQC,wBAA2B;YACrC,eAAe,IAAI,CAAC,aAAa;YACjC,oBAAoB,IAAI,CAAC,kBAAkB;YAC3Cf;YACA,SAASY,KAAK,GAAG,CAACI,CAAAA,OACPA,KAAK,OAAO;QAE3B,GAAG,GAAG,CAACA,CAAAA,OACIC,4BAA+B;gBAClCjB;gBACA,OAAOgB;YACX;QAGJ,MAAME,eAAeJ,MAAM,MAAM,GAAGb;QACpC,IAAIiB,cAIAJ,MAAM,GAAG;QAWb,MAAMK,SAASL,MAAM,MAAM,GAAG,IAAIM,aAAaR,IAAI,CAACE,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,KAAK,OAAO;QACtF,OAAO;YACHI;YACA,YAAYG,cAAcR;YAC1BM;YACAL;QACJ;IACJ;AACJ;AAEO,MAAMQ,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBhC;IAChB,cAAc;QACViC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,20 @@
1
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { MoveEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js";
3
+ import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
4
+ import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
5
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
6
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
7
+ import { CompressionHandler } from "@webiny/utils/exports/api.js";
8
+ declare class DdbEsMoveEntryImpl implements MoveEntryStorageOperation.Interface {
9
+ private entity;
10
+ private esEntity;
11
+ private dataLoaders;
12
+ private storageModelProvider;
13
+ private compressionHandler;
14
+ constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, compressionHandler: CompressionHandler.Interface);
15
+ execute(initialModel: CmsModel, id: string, folderId: string): Promise<void>;
16
+ }
17
+ export declare const DdbEsMoveEntry: typeof DdbEsMoveEntryImpl & {
18
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js").IMoveEntryStorageOperation>;
19
+ };
20
+ export {};
@@ -0,0 +1,113 @@
1
+ import error from "@webiny/error";
2
+ import { MoveEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js";
3
+ import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
4
+ import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
5
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
6
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
7
+ import { CompressionHandler } from "@webiny/utils/exports/api.js";
8
+ import { createLatestSortKey, createPartitionKey, createPublishedSortKey } from "./keys.js";
9
+ class DdbEsMoveEntryImpl {
10
+ constructor(entity, esEntity, dataLoaders, storageModelProvider, compressionHandler){
11
+ this.entity = entity;
12
+ this.esEntity = esEntity;
13
+ this.dataLoaders = dataLoaders;
14
+ this.storageModelProvider = storageModelProvider;
15
+ this.compressionHandler = compressionHandler;
16
+ }
17
+ async execute(initialModel, id, folderId) {
18
+ const model = this.storageModelProvider.getModel(initialModel);
19
+ const partitionKey = createPartitionKey({
20
+ id,
21
+ tenant: model.tenant
22
+ });
23
+ const queryAllParams = {
24
+ partitionKey,
25
+ options: {
26
+ gte: " "
27
+ }
28
+ };
29
+ const latestSortKey = createLatestSortKey();
30
+ const publishedSortKey = createPublishedSortKey();
31
+ const records = await this.entity.queryAll(queryAllParams);
32
+ let latestRecord;
33
+ let publishedRecord;
34
+ const entityBatch = this.entity.createEntityWriter();
35
+ for (const record of records){
36
+ entityBatch.put({
37
+ ...record,
38
+ data: {
39
+ ...record.data,
40
+ location: {
41
+ ...record.data.location,
42
+ folderId
43
+ }
44
+ }
45
+ });
46
+ if (record.SK === publishedSortKey) publishedRecord = record.data;
47
+ else if (record.SK === latestSortKey) latestRecord = record.data;
48
+ }
49
+ try {
50
+ await entityBatch.execute();
51
+ this.dataLoaders.clearAll({
52
+ tenant: initialModel.tenant
53
+ });
54
+ } catch (ex) {
55
+ throw new error(ex.message || "Could not move all entry records from in the DynamoDB table.", ex.code || "MOVE_ENTRY_ERROR", {
56
+ error: ex,
57
+ id
58
+ });
59
+ }
60
+ const esEntityReader = this.esEntity.createEntityReader();
61
+ if (publishedRecord) esEntityReader.get({
62
+ PK: partitionKey,
63
+ SK: publishedSortKey
64
+ });
65
+ if (latestRecord) esEntityReader.get({
66
+ PK: partitionKey,
67
+ SK: latestSortKey
68
+ });
69
+ if (0 === esEntityReader.total) return;
70
+ const esRecords = await esEntityReader.execute();
71
+ const esItems = (await Promise.all(esRecords.map(async (record)=>{
72
+ if (!record) return null;
73
+ return {
74
+ ...record,
75
+ data: await this.compressionHandler.decompress(record.data)
76
+ };
77
+ }))).filter((item)=>!!item);
78
+ if (0 === esItems.length) return;
79
+ try {
80
+ const elasticsearchEntityBatch = this.esEntity.createEntityWriter({
81
+ put: await Promise.all(esItems.map(async (item)=>({
82
+ ...item,
83
+ data: await this.compressionHandler.compress({
84
+ ...item.data,
85
+ location: {
86
+ ...item.data?.location,
87
+ folderId
88
+ }
89
+ })
90
+ })))
91
+ });
92
+ await elasticsearchEntityBatch.execute();
93
+ } catch (ex) {
94
+ throw new error(ex.message || "Could not move entry DynamoDB Elasticsearch records.", ex.code || "MOVE_ES_ENTRY_ERROR", {
95
+ error: ex,
96
+ partitionKey
97
+ });
98
+ }
99
+ }
100
+ }
101
+ const DdbEsMoveEntry = MoveEntryStorageOperation.createImplementation({
102
+ implementation: DdbEsMoveEntryImpl,
103
+ dependencies: [
104
+ CmsDdbEsEntryEntity,
105
+ CmsDdbEsEntriesEsEntity,
106
+ CmsDdbEsDataLoaders,
107
+ CmsStorageModelProvider,
108
+ CompressionHandler
109
+ ]
110
+ });
111
+ export { DdbEsMoveEntry };
112
+
113
+ //# sourceMappingURL=DdbEsMoveEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsMoveEntry.js","sources":["../../../src/operations/entry/DdbEsMoveEntry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { MoveEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\nimport type { IOpenSearchEntityAttributes as IElasticsearchEntityAttributes } from \"@webiny/api-opensearch-aws\";\nimport type { IEntityQueryAllParams } from \"@webiny/db-dynamodb\";\nimport { createLatestSortKey, createPartitionKey, createPublishedSortKey } from \"./keys.js\";\n\nclass DdbEsMoveEntryImpl implements MoveEntryStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private compressionHandler: CompressionHandler.Interface\n ) {}\n\n async execute(initialModel: CmsModel, id: string, folderId: string) {\n const model = this.storageModelProvider.getModel(initialModel);\n\n const partitionKey = createPartitionKey({\n id,\n tenant: model.tenant\n });\n /**\n * First we need to fetch all the records in the regular DynamoDB table.\n */\n const queryAllParams: IEntityQueryAllParams = {\n partitionKey,\n options: {\n gte: \" \"\n }\n };\n const latestSortKey = createLatestSortKey();\n const publishedSortKey = createPublishedSortKey();\n const records = await this.entity.queryAll(queryAllParams);\n /**\n * Then update the folderId in each record and prepare it to be stored.\n */\n let latestRecord: CmsEntry | undefined = undefined;\n let publishedRecord: CmsEntry | undefined = undefined;\n const entityBatch = this.entity.createEntityWriter();\n\n for (const record of records) {\n entityBatch.put({\n ...record,\n data: {\n ...record.data,\n location: {\n ...record.data.location,\n folderId\n }\n }\n });\n\n /**\n * We need to get the published and latest records, so we can update the Elasticsearch.\n */\n if (record.SK === publishedSortKey) {\n publishedRecord = record.data;\n } else if (record.SK === latestSortKey) {\n latestRecord = record.data;\n }\n }\n try {\n await entityBatch.execute();\n this.dataLoaders.clearAll({\n tenant: initialModel.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not move all entry records from in the DynamoDB table.\",\n ex.code || \"MOVE_ENTRY_ERROR\",\n {\n error: ex,\n id\n }\n );\n }\n\n const esEntityReader = this.esEntity.createEntityReader();\n\n if (publishedRecord) {\n esEntityReader.get({\n PK: partitionKey,\n SK: publishedSortKey\n });\n }\n if (latestRecord) {\n esEntityReader.get({\n PK: partitionKey,\n SK: latestSortKey\n });\n }\n if (esEntityReader.total === 0) {\n return;\n }\n const esRecords = await esEntityReader.execute();\n\n const esItems = (\n await Promise.all(\n esRecords.map(async record => {\n if (!record) {\n return null;\n }\n return {\n ...record,\n data: await this.compressionHandler.decompress(record.data)\n };\n })\n )\n ).filter((item): item is IElasticsearchEntityAttributes => !!item);\n\n if (esItems.length === 0) {\n return;\n }\n\n try {\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter({\n put: await Promise.all(\n esItems.map(async item => {\n return {\n ...item,\n data: await this.compressionHandler.compress({\n ...item.data,\n location: {\n ...item.data?.location,\n folderId\n }\n })\n };\n })\n )\n });\n await elasticsearchEntityBatch.execute();\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not move entry DynamoDB Elasticsearch records.\",\n ex.code || \"MOVE_ES_ENTRY_ERROR\",\n {\n error: ex,\n partitionKey\n }\n );\n }\n }\n}\n\nexport const DdbEsMoveEntry = MoveEntryStorageOperation.createImplementation({\n implementation: DdbEsMoveEntryImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider,\n CompressionHandler\n ]\n});\n"],"names":["DdbEsMoveEntryImpl","entity","esEntity","dataLoaders","storageModelProvider","compressionHandler","initialModel","id","folderId","model","partitionKey","createPartitionKey","queryAllParams","latestSortKey","createLatestSortKey","publishedSortKey","createPublishedSortKey","records","latestRecord","publishedRecord","entityBatch","record","ex","WebinyError","esEntityReader","esRecords","esItems","Promise","item","elasticsearchEntityBatch","DdbEsMoveEntry","MoveEntryStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider","CompressionHandler"],"mappings":";;;;;;;;AAYA,MAAMA;IACF,YACYC,MAAqC,EACrCC,QAA2C,EAC3CC,WAA0C,EAC1CC,oBAAuD,EACvDC,kBAAgD,CAC1D;aALUJ,MAAM,GAANA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,kBAAkB,GAAlBA;IACT;IAEH,MAAM,QAAQC,YAAsB,EAAEC,EAAU,EAAEC,QAAgB,EAAE;QAChE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACH;QAEjD,MAAMI,eAAeC,mBAAmB;YACpCJ;YACA,QAAQE,MAAM,MAAM;QACxB;QAIA,MAAMG,iBAAwC;YAC1CF;YACA,SAAS;gBACL,KAAK;YACT;QACJ;QACA,MAAMG,gBAAgBC;QACtB,MAAMC,mBAAmBC;QACzB,MAAMC,UAAU,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAACL;QAI3C,IAAIM;QACJ,IAAIC;QACJ,MAAMC,cAAc,IAAI,CAAC,MAAM,CAAC,kBAAkB;QAElD,KAAK,MAAMC,UAAUJ,QAAS;YAC1BG,YAAY,GAAG,CAAC;gBACZ,GAAGC,MAAM;gBACT,MAAM;oBACF,GAAGA,OAAO,IAAI;oBACd,UAAU;wBACN,GAAGA,OAAO,IAAI,CAAC,QAAQ;wBACvBb;oBACJ;gBACJ;YACJ;YAKA,IAAIa,OAAO,EAAE,KAAKN,kBACdI,kBAAkBE,OAAO,IAAI;iBAC1B,IAAIA,OAAO,EAAE,KAAKR,eACrBK,eAAeG,OAAO,IAAI;QAElC;QACA,IAAI;YACA,MAAMD,YAAY,OAAO;YACzB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACtB,QAAQd,aAAa,MAAM;YAC/B;QACJ,EAAE,OAAOgB,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,gEACdA,GAAG,IAAI,IAAI,oBACX;gBACI,OAAOA;gBACPf;YACJ;QAER;QAEA,MAAMiB,iBAAiB,IAAI,CAAC,QAAQ,CAAC,kBAAkB;QAEvD,IAAIL,iBACAK,eAAe,GAAG,CAAC;YACf,IAAId;YACJ,IAAIK;QACR;QAEJ,IAAIG,cACAM,eAAe,GAAG,CAAC;YACf,IAAId;YACJ,IAAIG;QACR;QAEJ,IAAIW,AAAyB,MAAzBA,eAAe,KAAK,EACpB;QAEJ,MAAMC,YAAY,MAAMD,eAAe,OAAO;QAE9C,MAAME,UACF,OAAMC,QAAQ,GAAG,CACbF,UAAU,GAAG,CAAC,OAAMJ;YAChB,IAAI,CAACA,QACD,OAAO;YAEX,OAAO;gBACH,GAAGA,MAAM;gBACT,MAAM,MAAM,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAACA,OAAO,IAAI;YAC9D;QACJ,GAAE,EAER,MAAM,CAAC,CAACO,OAAiD,CAAC,CAACA;QAE7D,IAAIF,AAAmB,MAAnBA,QAAQ,MAAM,EACd;QAGJ,IAAI;YACA,MAAMG,2BAA2B,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;gBAC9D,KAAK,MAAMF,QAAQ,GAAG,CAClBD,QAAQ,GAAG,CAAC,OAAME,OACP;wBACH,GAAGA,IAAI;wBACP,MAAM,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC;4BACzC,GAAGA,KAAK,IAAI;4BACZ,UAAU;gCACN,GAAGA,KAAK,IAAI,EAAE,QAAQ;gCACtBpB;4BACJ;wBACJ;oBACJ;YAGZ;YACA,MAAMqB,yBAAyB,OAAO;QAC1C,EAAE,OAAOP,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wDACdA,GAAG,IAAI,IAAI,uBACX;gBACI,OAAOA;gBACPZ;YACJ;QAER;IACJ;AACJ;AAEO,MAAMoB,iBAAiBC,0BAA0B,oBAAoB,CAAC;IACzE,gBAAgB/B;IAChB,cAAc;QACVgC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,23 @@
1
+ import type { CmsModel, CmsEntryStorageOperationsMoveToBinParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { MoveToBinStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveToBinStorageOperation.js";
3
+ import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
4
+ import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
5
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
6
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
7
+ import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
8
+ import { CompressionHandler } from "@webiny/utils/exports/api.js";
9
+ declare class DdbEsMoveToBinImpl implements MoveToBinStorageOperation.Interface {
10
+ private entity;
11
+ private esEntity;
12
+ private dataLoaders;
13
+ private storageModelProvider;
14
+ private fieldIndexRegistry;
15
+ private compressionHandler;
16
+ private valuesModifiers;
17
+ constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface, compressionHandler: CompressionHandler.Interface, valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]);
18
+ execute(initialModel: CmsModel, params: CmsEntryStorageOperationsMoveToBinParams): Promise<void>;
19
+ }
20
+ export declare const DdbEsMoveToBin: typeof DdbEsMoveToBinImpl & {
21
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveToBinStorageOperation.js").IMoveToBinStorageOperation>;
22
+ };
23
+ export {};
@@ -0,0 +1,137 @@
1
+ import error from "@webiny/error";
2
+ import { MoveToBinStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveToBinStorageOperation.js";
3
+ import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
4
+ import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
5
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
6
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
7
+ import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
8
+ import { CompressionHandler } from "@webiny/utils/exports/api.js";
9
+ import { createTransformer } from "./transformations/index.js";
10
+ import { createLatestSortKey, createPartitionKey, createPublishedSortKey } from "./keys.js";
11
+ import { isDeletedEntryMetaField, pickEntryMetaFields } from "@webiny/api-headless-cms/constants.js";
12
+ class DdbEsMoveToBinImpl {
13
+ constructor(entity, esEntity, dataLoaders, storageModelProvider, fieldIndexRegistry, compressionHandler, valuesModifiers){
14
+ this.entity = entity;
15
+ this.esEntity = esEntity;
16
+ this.dataLoaders = dataLoaders;
17
+ this.storageModelProvider = storageModelProvider;
18
+ this.fieldIndexRegistry = fieldIndexRegistry;
19
+ this.compressionHandler = compressionHandler;
20
+ this.valuesModifiers = valuesModifiers;
21
+ }
22
+ async execute(initialModel, params) {
23
+ const { entry: initialEntry, storageEntry: initialStorageEntry } = params;
24
+ const model = this.storageModelProvider.getModel(initialModel);
25
+ const transformer = createTransformer({
26
+ valuesModifiers: this.valuesModifiers,
27
+ model,
28
+ entry: initialEntry,
29
+ storageEntry: initialStorageEntry,
30
+ fieldIndexRegistry: this.fieldIndexRegistry,
31
+ compressionHandler: this.compressionHandler
32
+ });
33
+ const { entry, storageEntry } = transformer.transformEntryKeys();
34
+ const partitionKey = createPartitionKey({
35
+ id: entry.id,
36
+ tenant: model.tenant
37
+ });
38
+ const queryAllParams = {
39
+ partitionKey,
40
+ options: {
41
+ gte: " "
42
+ }
43
+ };
44
+ const latestSortKey = createLatestSortKey();
45
+ const publishedSortKey = createPublishedSortKey();
46
+ const records = await this.entity.queryAll(queryAllParams);
47
+ const updatedEntryMetaFields = pickEntryMetaFields(entry, isDeletedEntryMetaField);
48
+ let latestRecord;
49
+ let publishedRecord;
50
+ const entityBatch = this.entity.createEntityWriter();
51
+ for (const record of records){
52
+ entityBatch.put({
53
+ ...record,
54
+ data: {
55
+ ...record.data,
56
+ ...updatedEntryMetaFields,
57
+ wbyDeleted: storageEntry.wbyDeleted,
58
+ location: storageEntry.location,
59
+ binOriginalFolderId: storageEntry.binOriginalFolderId
60
+ }
61
+ });
62
+ if (record.SK === publishedSortKey) publishedRecord = record.data;
63
+ else if (record.SK === latestSortKey) latestRecord = record.data;
64
+ }
65
+ try {
66
+ await entityBatch.execute();
67
+ this.dataLoaders.clearAll({
68
+ tenant: entry.tenant
69
+ });
70
+ } catch (ex) {
71
+ throw new error(ex.message || "Could mark as deleted all entry records from in the DynamoDB table.", ex.code || "MOVE_ENTRY_TO_BIN_ERROR", {
72
+ error: ex,
73
+ entry,
74
+ storageEntry
75
+ });
76
+ }
77
+ const esEntityReader = this.esEntity.createEntityReader();
78
+ if (publishedRecord) esEntityReader.get({
79
+ PK: partitionKey,
80
+ SK: publishedSortKey
81
+ });
82
+ if (latestRecord) esEntityReader.get({
83
+ PK: partitionKey,
84
+ SK: latestSortKey
85
+ });
86
+ if (0 === esEntityReader.total) return;
87
+ const esRecords = await esEntityReader.execute();
88
+ const esItems = (await Promise.all(esRecords.map(async (record)=>{
89
+ if (!record) return null;
90
+ return {
91
+ ...record,
92
+ data: await this.compressionHandler.decompress(record.data)
93
+ };
94
+ }))).filter((item)=>!!item);
95
+ if (0 === esItems.length) return;
96
+ const elasticsearchEntityBatch = this.esEntity.createEntityWriter();
97
+ for (const item of esItems)elasticsearchEntityBatch.put({
98
+ ...item,
99
+ data: await this.compressionHandler.compress({
100
+ ...item.data,
101
+ ...updatedEntryMetaFields,
102
+ wbyDeleted: entry.wbyDeleted,
103
+ location: entry.location,
104
+ binOriginalFolderId: entry.binOriginalFolderId
105
+ })
106
+ });
107
+ try {
108
+ await elasticsearchEntityBatch.execute();
109
+ } catch (ex) {
110
+ throw new error(ex.message || "Could not mark as deleted entry records from DynamoDB Elasticsearch table.", ex.code || "MOVE_ENTRY_TO_BIN_ERROR", {
111
+ error: ex,
112
+ entry,
113
+ storageEntry
114
+ });
115
+ }
116
+ }
117
+ }
118
+ const DdbEsMoveToBin = MoveToBinStorageOperation.createImplementation({
119
+ implementation: DdbEsMoveToBinImpl,
120
+ dependencies: [
121
+ CmsDdbEsEntryEntity,
122
+ CmsDdbEsEntriesEsEntity,
123
+ CmsDdbEsDataLoaders,
124
+ CmsStorageModelProvider,
125
+ CmsEntryOpenSearchFieldIndexRegistry,
126
+ CompressionHandler,
127
+ [
128
+ CmsEntryOpenSearchValuesModifier,
129
+ {
130
+ multiple: true
131
+ }
132
+ ]
133
+ ]
134
+ });
135
+ export { DdbEsMoveToBin };
136
+
137
+ //# sourceMappingURL=DdbEsMoveToBin.js.map