@webiny/api-headless-cms-ddb-es 0.0.0-unstable.3bc8100a7f → 0.0.0-unstable.3fddf667ea

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 (426) hide show
  1. package/README.md +6 -30
  2. package/abstractions/CmsDdbEsDataLoaders.d.ts +5 -0
  3. package/abstractions/CmsDdbEsDataLoaders.js +5 -0
  4. package/abstractions/CmsDdbEsDataLoaders.js.map +1 -0
  5. package/abstractions/CmsDdbEsEntriesEsEntity.d.ts +5 -0
  6. package/abstractions/CmsDdbEsEntriesEsEntity.js +5 -0
  7. package/abstractions/CmsDdbEsEntriesEsEntity.js.map +1 -0
  8. package/abstractions/CmsDdbEsEntryEntity.d.ts +5 -0
  9. package/abstractions/CmsDdbEsEntryEntity.js +5 -0
  10. package/abstractions/CmsDdbEsEntryEntity.js.map +1 -0
  11. package/abstractions/CmsDdbEsGroupEntity.d.ts +5 -0
  12. package/abstractions/CmsDdbEsGroupEntity.js +5 -0
  13. package/abstractions/CmsDdbEsGroupEntity.js.map +1 -0
  14. package/abstractions/CmsDdbEsModelEntity.d.ts +5 -0
  15. package/abstractions/CmsDdbEsModelEntity.js +5 -0
  16. package/abstractions/CmsDdbEsModelEntity.js.map +1 -0
  17. package/abstractions/CmsDdbEsOsTable.d.ts +5 -0
  18. package/abstractions/CmsDdbEsOsTable.js +5 -0
  19. package/abstractions/CmsDdbEsOsTable.js.map +1 -0
  20. package/abstractions/CmsDdbEsTable.d.ts +5 -0
  21. package/abstractions/CmsDdbEsTable.js +5 -0
  22. package/abstractions/CmsDdbEsTable.js.map +1 -0
  23. package/debuggerNamespaces.d.ts +12 -0
  24. package/debuggerNamespaces.js +0 -0
  25. package/definitions/entry.d.ts +4 -6
  26. package/definitions/entry.js +8 -179
  27. package/definitions/entry.js.map +1 -1
  28. package/definitions/group.d.ts +6 -7
  29. package/definitions/group.js +8 -63
  30. package/definitions/group.js.map +1 -1
  31. package/definitions/model.d.ts +6 -7
  32. package/definitions/model.js +8 -107
  33. package/definitions/model.js.map +1 -1
  34. package/definitions/types.d.ts +65 -0
  35. package/definitions/types.js +0 -0
  36. package/feature.d.ts +10 -0
  37. package/feature.js +69 -0
  38. package/feature.js.map +1 -0
  39. package/index.d.ts +1 -3
  40. package/index.js +1 -225
  41. package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
  42. package/operations/entry/DdbEsCreateEntry.js +134 -0
  43. package/operations/entry/DdbEsCreateEntry.js.map +1 -0
  44. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
  45. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -0
  46. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
  47. package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
  48. package/operations/entry/DdbEsDeleteEntry.js +79 -0
  49. package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
  50. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +24 -0
  51. package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
  52. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
  53. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
  54. package/operations/entry/DdbEsDeleteMultipleEntries.js +78 -0
  55. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
  56. package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
  57. package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
  58. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
  59. package/operations/entry/DdbEsGetEntry.d.ts +14 -0
  60. package/operations/entry/DdbEsGetEntry.js +27 -0
  61. package/operations/entry/DdbEsGetEntry.js.map +1 -0
  62. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
  63. package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
  64. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
  65. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
  66. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
  67. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
  68. package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
  69. package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
  70. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
  71. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
  72. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
  73. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
  74. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
  75. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
  76. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
  77. package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
  78. package/operations/entry/DdbEsGetRevisionById.js +34 -0
  79. package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
  80. package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
  81. package/operations/entry/DdbEsGetRevisions.js +33 -0
  82. package/operations/entry/DdbEsGetRevisions.js.map +1 -0
  83. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +18 -0
  84. package/operations/entry/DdbEsGetUniqueFieldValues.js +77 -0
  85. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
  86. package/operations/entry/DdbEsListEntries.d.ts +28 -0
  87. package/operations/entry/DdbEsListEntries.js +110 -0
  88. package/operations/entry/DdbEsListEntries.js.map +1 -0
  89. package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
  90. package/operations/entry/DdbEsMoveEntry.js +113 -0
  91. package/operations/entry/DdbEsMoveEntry.js.map +1 -0
  92. package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
  93. package/operations/entry/DdbEsMoveToBin.js +137 -0
  94. package/operations/entry/DdbEsMoveToBin.js.map +1 -0
  95. package/operations/entry/DdbEsPublishEntry.d.ts +24 -0
  96. package/operations/entry/DdbEsPublishEntry.js +231 -0
  97. package/operations/entry/DdbEsPublishEntry.js.map +1 -0
  98. package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
  99. package/operations/entry/DdbEsRestoreFromBin.js +137 -0
  100. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
  101. package/operations/entry/DdbEsUnpublishEntry.d.ts +24 -0
  102. package/operations/entry/DdbEsUnpublishEntry.js +127 -0
  103. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
  104. package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
  105. package/operations/entry/DdbEsUpdateEntry.js +175 -0
  106. package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
  107. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
  108. package/operations/entry/dataLoader/DataLoaderCache.js +21 -35
  109. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  110. package/operations/entry/dataLoader/constants.js +2 -7
  111. package/operations/entry/dataLoader/constants.js.map +1 -1
  112. package/operations/entry/dataLoader/createBatchScheduleFn.js +7 -22
  113. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  114. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  115. package/operations/entry/dataLoader/getAllEntryRevisions.js +20 -41
  116. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  117. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  118. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +30 -48
  119. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  120. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  121. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +30 -48
  122. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  123. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  124. package/operations/entry/dataLoader/getRevisionById.js +36 -58
  125. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  126. package/operations/entry/dataLoader/index.d.ts +3 -3
  127. package/operations/entry/dataLoader/index.js +13 -35
  128. package/operations/entry/dataLoader/index.js.map +1 -1
  129. package/operations/entry/dataLoader/types.d.ts +4 -4
  130. package/operations/entry/dataLoader/types.js +0 -7
  131. package/operations/entry/dataLoaders.d.ts +14 -14
  132. package/operations/entry/dataLoaders.js +92 -110
  133. package/operations/entry/dataLoaders.js.map +1 -1
  134. package/operations/entry/feature.d.ts +4 -0
  135. package/operations/entry/feature.js +55 -0
  136. package/operations/entry/feature.js.map +1 -0
  137. package/operations/entry/keys.d.ts +31 -1
  138. package/operations/entry/keys.js +44 -27
  139. package/operations/entry/keys.js.map +1 -1
  140. package/operations/entry/recordType.js +4 -18
  141. package/operations/entry/recordType.js.map +1 -1
  142. package/operations/entry/storageEntryUtils.d.ts +7 -0
  143. package/operations/entry/storageEntryUtils.js +14 -0
  144. package/operations/entry/storageEntryUtils.js.map +1 -0
  145. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  146. package/operations/entry/transformations/convertEntryKeys.js +21 -34
  147. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  148. package/operations/entry/transformations/index.d.ts +21 -18
  149. package/operations/entry/transformations/index.js +87 -123
  150. package/operations/entry/transformations/index.js.map +1 -1
  151. package/operations/entry/transformations/modifyEntryValues.d.ts +30 -35
  152. package/operations/entry/transformations/modifyEntryValues.js +12 -24
  153. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  154. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  155. package/operations/entry/transformations/transformEntryKeys.js +14 -24
  156. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  157. package/operations/group/DdbEsCreateGroup.d.ts +12 -0
  158. package/operations/group/DdbEsCreateGroup.js +35 -0
  159. package/operations/group/DdbEsCreateGroup.js.map +1 -0
  160. package/operations/group/DdbEsDeleteGroup.d.ts +12 -0
  161. package/operations/group/DdbEsDeleteGroup.js +31 -0
  162. package/operations/group/DdbEsDeleteGroup.js.map +1 -0
  163. package/operations/group/DdbEsGetGroup.d.ts +12 -0
  164. package/operations/group/DdbEsGetGroup.js +31 -0
  165. package/operations/group/DdbEsGetGroup.js.map +1 -0
  166. package/operations/group/DdbEsListGroups.d.ts +14 -0
  167. package/operations/group/DdbEsListGroups.js +52 -0
  168. package/operations/group/DdbEsListGroups.js.map +1 -0
  169. package/operations/group/DdbEsUpdateGroup.d.ts +12 -0
  170. package/operations/group/DdbEsUpdateGroup.js +35 -0
  171. package/operations/group/DdbEsUpdateGroup.js.map +1 -0
  172. package/operations/group/feature.d.ts +4 -0
  173. package/operations/group/feature.js +19 -0
  174. package/operations/group/feature.js.map +1 -0
  175. package/operations/group/keys.d.ts +15 -0
  176. package/operations/group/keys.js +17 -0
  177. package/operations/group/keys.js.map +1 -0
  178. package/operations/model/DdbEsCreateModel.d.ts +16 -0
  179. package/operations/model/DdbEsCreateModel.js +56 -0
  180. package/operations/model/DdbEsCreateModel.js.map +1 -0
  181. package/operations/model/DdbEsDeleteModel.d.ts +12 -0
  182. package/operations/model/DdbEsDeleteModel.js +31 -0
  183. package/operations/model/DdbEsDeleteModel.js.map +1 -0
  184. package/operations/model/DdbEsGetModel.d.ts +12 -0
  185. package/operations/model/DdbEsGetModel.js +30 -0
  186. package/operations/model/DdbEsGetModel.js.map +1 -0
  187. package/operations/model/DdbEsListModels.d.ts +12 -0
  188. package/operations/model/DdbEsListModels.js +36 -0
  189. package/operations/model/DdbEsListModels.js.map +1 -0
  190. package/operations/model/DdbEsUpdateModel.d.ts +12 -0
  191. package/operations/model/DdbEsUpdateModel.js +36 -0
  192. package/operations/model/DdbEsUpdateModel.js.map +1 -0
  193. package/operations/model/feature.d.ts +4 -0
  194. package/operations/model/feature.js +19 -0
  195. package/operations/model/feature.js.map +1 -0
  196. package/operations/model/keys.d.ts +15 -0
  197. package/operations/model/keys.js +17 -0
  198. package/operations/model/keys.js.map +1 -0
  199. package/package.json +40 -36
  200. package/registry/CmsEntitiesDbRegistryDecorator.d.ts +27 -0
  201. package/registry/CmsEntitiesDbRegistryDecorator.js +46 -0
  202. package/registry/CmsEntitiesDbRegistryDecorator.js.map +1 -0
  203. package/tasks/CreateElasticsearchIndexTask.d.ts +15 -0
  204. package/tasks/CreateElasticsearchIndexTask.js +49 -0
  205. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  206. package/types.d.ts +12 -159
  207. package/types.js +7 -39
  208. package/types.js.map +1 -1
  209. package/configurations.d.ts +0 -19
  210. package/configurations.js +0 -49
  211. package/configurations.js.map +0 -1
  212. package/definitions/entryElasticsearch.d.ts +0 -9
  213. package/definitions/entryElasticsearch.js +0 -41
  214. package/definitions/entryElasticsearch.js.map +0 -1
  215. package/definitions/system.d.ts +0 -9
  216. package/definitions/system.js +0 -42
  217. package/definitions/system.js.map +0 -1
  218. package/definitions/table.d.ts +0 -8
  219. package/definitions/table.js +0 -25
  220. package/definitions/table.js.map +0 -1
  221. package/definitions/tableElasticsearch.d.ts +0 -8
  222. package/definitions/tableElasticsearch.js +0 -25
  223. package/definitions/tableElasticsearch.js.map +0 -1
  224. package/dynamoDb/index.d.ts +0 -3
  225. package/dynamoDb/index.js +0 -16
  226. package/dynamoDb/index.js.map +0 -1
  227. package/dynamoDb/storage/longText.d.ts +0 -10
  228. package/dynamoDb/storage/longText.js +0 -96
  229. package/dynamoDb/storage/longText.js.map +0 -1
  230. package/dynamoDb/storage/richText.d.ts +0 -2
  231. package/dynamoDb/storage/richText.js +0 -59
  232. package/dynamoDb/storage/richText.js.map +0 -1
  233. package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
  234. package/elasticsearch/createElasticsearchIndex.js +0 -40
  235. package/elasticsearch/createElasticsearchIndex.js.map +0 -1
  236. package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
  237. package/elasticsearch/deleteElasticsearchIndex.js +0 -38
  238. package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
  239. package/elasticsearch/index.d.ts +0 -2
  240. package/elasticsearch/index.js +0 -13
  241. package/elasticsearch/index.js.map +0 -1
  242. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  243. package/elasticsearch/indexing/dateTimeIndexing.js +0 -88
  244. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  245. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  246. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -54
  247. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  248. package/elasticsearch/indexing/index.d.ts +0 -2
  249. package/elasticsearch/indexing/index.js +0 -18
  250. package/elasticsearch/indexing/index.js.map +0 -1
  251. package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
  252. package/elasticsearch/indexing/jsonIndexing.js +0 -28
  253. package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
  254. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  255. package/elasticsearch/indexing/longTextIndexing.js +0 -42
  256. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  257. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  258. package/elasticsearch/indexing/numberIndexing.js +0 -41
  259. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  260. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  261. package/elasticsearch/indexing/objectIndexing.js +0 -201
  262. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  263. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  264. package/elasticsearch/indexing/richTextIndexing.js +0 -31
  265. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  266. package/elasticsearch/indices/base.d.ts +0 -2
  267. package/elasticsearch/indices/base.js +0 -13
  268. package/elasticsearch/indices/base.js.map +0 -1
  269. package/elasticsearch/indices/index.d.ts +0 -1
  270. package/elasticsearch/indices/index.js +0 -14
  271. package/elasticsearch/indices/index.js.map +0 -1
  272. package/elasticsearch/indices/japanese.d.ts +0 -2
  273. package/elasticsearch/indices/japanese.js +0 -14
  274. package/elasticsearch/indices/japanese.js.map +0 -1
  275. package/elasticsearch/search/index.d.ts +0 -3
  276. package/elasticsearch/search/index.js +0 -12
  277. package/elasticsearch/search/index.js.map +0 -1
  278. package/elasticsearch/search/refSearch.d.ts +0 -2
  279. package/elasticsearch/search/refSearch.js +0 -31
  280. package/elasticsearch/search/refSearch.js.map +0 -1
  281. package/elasticsearch/search/timeSearch.d.ts +0 -2
  282. package/elasticsearch/search/timeSearch.js +0 -27
  283. package/elasticsearch/search/timeSearch.js.map +0 -1
  284. package/helpers/entryIndexHelpers.d.ts +0 -18
  285. package/helpers/entryIndexHelpers.js +0 -190
  286. package/helpers/entryIndexHelpers.js.map +0 -1
  287. package/helpers/fieldIdentifier.d.ts +0 -6
  288. package/helpers/fieldIdentifier.js +0 -43
  289. package/helpers/fieldIdentifier.js.map +0 -1
  290. package/helpers/index.d.ts +0 -2
  291. package/helpers/index.js +0 -29
  292. package/helpers/index.js.map +0 -1
  293. package/index.js.map +0 -1
  294. package/operations/entry/dataLoader/types.js.map +0 -1
  295. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
  296. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -34
  297. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
  298. package/operations/entry/elasticsearch/body.d.ts +0 -13
  299. package/operations/entry/elasticsearch/body.js +0 -142
  300. package/operations/entry/elasticsearch/body.js.map +0 -1
  301. package/operations/entry/elasticsearch/fields.d.ts +0 -10
  302. package/operations/entry/elasticsearch/fields.js +0 -315
  303. package/operations/entry/elasticsearch/fields.js.map +0 -1
  304. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -8
  305. package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -59
  306. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
  307. package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -17
  308. package/operations/entry/elasticsearch/filtering/exec.js +0 -175
  309. package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
  310. package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
  311. package/operations/entry/elasticsearch/filtering/index.js +0 -18
  312. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  313. package/operations/entry/elasticsearch/filtering/path.d.ts +0 -15
  314. package/operations/entry/elasticsearch/filtering/path.js +0 -46
  315. package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
  316. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  317. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -30
  318. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  319. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  320. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -15
  321. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  322. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  323. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -69
  324. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  325. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  326. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -57
  327. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  328. package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
  329. package/operations/entry/elasticsearch/filtering/populated.js +0 -25
  330. package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
  331. package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
  332. package/operations/entry/elasticsearch/filtering/values.js +0 -24
  333. package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
  334. package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -12
  335. package/operations/entry/elasticsearch/fullTextSearch.js +0 -91
  336. package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
  337. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
  338. package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -27
  339. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
  340. package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
  341. package/operations/entry/elasticsearch/initialQuery.js +0 -106
  342. package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
  343. package/operations/entry/elasticsearch/keyword.d.ts +0 -2
  344. package/operations/entry/elasticsearch/keyword.js +0 -36
  345. package/operations/entry/elasticsearch/keyword.js.map +0 -1
  346. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  347. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  348. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  349. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  350. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -18
  351. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  352. package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -8
  353. package/operations/entry/elasticsearch/plugins/operator.js +0 -39
  354. package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
  355. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  356. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -18
  357. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  358. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  359. package/operations/entry/elasticsearch/plugins/search.js +0 -26
  360. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  361. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  362. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -18
  363. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  364. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +0 -2
  365. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +0 -13
  366. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +0 -1
  367. package/operations/entry/elasticsearch/sort.d.ts +0 -12
  368. package/operations/entry/elasticsearch/sort.js +0 -87
  369. package/operations/entry/elasticsearch/sort.js.map +0 -1
  370. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -16
  371. package/operations/entry/elasticsearch/transformValueForSearch.js +0 -32
  372. package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
  373. package/operations/entry/elasticsearch/types.d.ts +0 -41
  374. package/operations/entry/elasticsearch/types.js +0 -7
  375. package/operations/entry/elasticsearch/types.js.map +0 -1
  376. package/operations/entry/index.d.ts +0 -11
  377. package/operations/entry/index.js +0 -1881
  378. package/operations/entry/index.js.map +0 -1
  379. package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -10
  380. package/operations/entry/transformations/transformEntryToIndex.js +0 -31
  381. package/operations/entry/transformations/transformEntryToIndex.js.map +0 -1
  382. package/operations/group/index.d.ts +0 -8
  383. package/operations/group/index.js +0 -179
  384. package/operations/group/index.js.map +0 -1
  385. package/operations/model/index.d.ts +0 -8
  386. package/operations/model/index.js +0 -183
  387. package/operations/model/index.js.map +0 -1
  388. package/operations/system/index.d.ts +0 -6
  389. package/operations/system/index.js +0 -94
  390. package/operations/system/index.js.map +0 -1
  391. package/operations/system/indexes.d.ts +0 -10
  392. package/operations/system/indexes.js +0 -41
  393. package/operations/system/indexes.js.map +0 -1
  394. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
  395. package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -52
  396. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
  397. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
  398. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -21
  399. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  400. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  401. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -27
  402. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  403. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  404. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -13
  405. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  406. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -31
  407. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -40
  408. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  409. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
  410. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -21
  411. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  412. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
  413. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -21
  414. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  415. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
  416. package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -50
  417. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
  418. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  419. package/plugins/CmsEntryFilterPlugin.js +0 -22
  420. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  421. package/plugins/index.d.ts +0 -8
  422. package/plugins/index.js +0 -95
  423. package/plugins/index.js.map +0 -1
  424. package/tasks/createIndexTaskPlugin.d.ts +0 -2
  425. package/tasks/createIndexTaskPlugin.js +0 -67
  426. package/tasks/createIndexTaskPlugin.js.map +0 -1
@@ -0,0 +1,139 @@
1
+ import error from "@webiny/error";
2
+ import { CONTENT_ENTRY_STATUS } from "@webiny/api-headless-cms/types/index.js";
3
+ import { CreateEntryRevisionFromStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js";
4
+ import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
5
+ import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
6
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
7
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
8
+ import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
9
+ import { CompressionHandler } from "@webiny/utils/exports/api.js";
10
+ import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
11
+ import { createTransformer } from "./transformations/index.js";
12
+ import { createEntryLatestKeys, createEntryPublishedKeys, createEntryRevisionKeys } from "./keys.js";
13
+ class DdbEsCreateEntryRevisionFromImpl {
14
+ constructor(entity, esEntity, dataLoaders, storageModelProvider, fieldIndexRegistry, compressionHandler, indexProvider, valuesModifiers){
15
+ this.entity = entity;
16
+ this.esEntity = esEntity;
17
+ this.dataLoaders = dataLoaders;
18
+ this.storageModelProvider = storageModelProvider;
19
+ this.fieldIndexRegistry = fieldIndexRegistry;
20
+ this.compressionHandler = compressionHandler;
21
+ this.indexProvider = indexProvider;
22
+ this.valuesModifiers = valuesModifiers;
23
+ }
24
+ async execute(initialModel, params) {
25
+ const { entry: initialEntry, storageEntry: initialStorageEntry } = params;
26
+ const model = this.storageModelProvider.getModel(initialModel);
27
+ const transformer = createTransformer({
28
+ model,
29
+ entry: initialEntry,
30
+ storageEntry: initialStorageEntry,
31
+ fieldIndexRegistry: this.fieldIndexRegistry,
32
+ compressionHandler: this.compressionHandler,
33
+ valuesModifiers: this.valuesModifiers
34
+ });
35
+ const { entry, storageEntry } = transformer.transformEntryKeys();
36
+ const revisionKeys = createEntryRevisionKeys(entry);
37
+ const latestKeys = createEntryLatestKeys(entry);
38
+ const publishedKeys = createEntryPublishedKeys(entry);
39
+ const isPublished = "published" === entry.status;
40
+ const esLatestData = await transformer.getElasticsearchLatestEntryData();
41
+ const entityBatch = this.entity.createEntityWriter({
42
+ put: [
43
+ {
44
+ ...revisionKeys,
45
+ data: storageEntry
46
+ },
47
+ {
48
+ ...latestKeys,
49
+ data: storageEntry
50
+ }
51
+ ]
52
+ });
53
+ if (isPublished) {
54
+ entityBatch.put({
55
+ ...publishedKeys,
56
+ data: storageEntry
57
+ });
58
+ const [publishedRevisionStorageEntry] = await this.dataLoaders.getPublishedRevisionByEntryId({
59
+ model,
60
+ ids: [
61
+ entry.id
62
+ ]
63
+ });
64
+ if (publishedRevisionStorageEntry) {
65
+ const publishedRevisionKey = createEntryRevisionKeys(publishedRevisionStorageEntry);
66
+ entityBatch.put({
67
+ ...publishedRevisionKey,
68
+ data: {
69
+ ...publishedRevisionStorageEntry,
70
+ status: CONTENT_ENTRY_STATUS.UNPUBLISHED
71
+ }
72
+ });
73
+ }
74
+ }
75
+ try {
76
+ await entityBatch.execute();
77
+ this.dataLoaders.clearAll({
78
+ tenant: entry.tenant
79
+ });
80
+ } catch (ex) {
81
+ throw new error(ex.message || "Could not create revision from given entry in the DynamoDB table.", ex.code || "CREATE_REVISION_ERROR", {
82
+ error: ex,
83
+ entry,
84
+ storageEntry
85
+ });
86
+ }
87
+ const configurations = createConfigurations(this.indexProvider);
88
+ const { index: esIndex } = await configurations.es({
89
+ model
90
+ });
91
+ const elasticsearchEntityBatch = this.esEntity.createEntityWriter({
92
+ put: [
93
+ {
94
+ ...latestKeys,
95
+ index: esIndex,
96
+ data: esLatestData
97
+ }
98
+ ]
99
+ });
100
+ if (isPublished) {
101
+ const esPublishedData = await transformer.getElasticsearchPublishedEntryData();
102
+ elasticsearchEntityBatch.put({
103
+ ...publishedKeys,
104
+ index: esIndex,
105
+ data: esPublishedData
106
+ });
107
+ }
108
+ try {
109
+ await elasticsearchEntityBatch.execute();
110
+ } catch (ex) {
111
+ throw new error(ex.message || "Could not update latest entry in the DynamoDB Elasticsearch table.", ex.code || "CREATE_REVISION_ERROR", {
112
+ error: ex,
113
+ entry
114
+ });
115
+ }
116
+ return initialStorageEntry;
117
+ }
118
+ }
119
+ const DdbEsCreateEntryRevisionFrom = CreateEntryRevisionFromStorageOperation.createImplementation({
120
+ implementation: DdbEsCreateEntryRevisionFromImpl,
121
+ dependencies: [
122
+ CmsDdbEsEntryEntity,
123
+ CmsDdbEsEntriesEsEntity,
124
+ CmsDdbEsDataLoaders,
125
+ CmsStorageModelProvider,
126
+ CmsEntryOpenSearchFieldIndexRegistry,
127
+ CompressionHandler,
128
+ CmsModelOpenSearchIndexProvider,
129
+ [
130
+ CmsEntryOpenSearchValuesModifier,
131
+ {
132
+ multiple: true
133
+ }
134
+ ]
135
+ ]
136
+ });
137
+ export { DdbEsCreateEntryRevisionFrom };
138
+
139
+ //# sourceMappingURL=DdbEsCreateEntryRevisionFrom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsCreateEntryRevisionFrom.js","sources":["../../../src/operations/entry/DdbEsCreateEntryRevisionFrom.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsCreateRevisionFromParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CONTENT_ENTRY_STATUS } from \"@webiny/api-headless-cms/types/index.js\";\nimport { CreateEntryRevisionFromStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.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 {\n CmsEntryOpenSearchFieldIndexRegistry,\n CmsEntryOpenSearchValuesModifier,\n CmsModelOpenSearchIndexProvider\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { createTransformer } from \"./transformations/index.js\";\nimport {\n createEntryLatestKeys,\n createEntryPublishedKeys,\n createEntryRevisionKeys\n} from \"./keys.js\";\n\nclass DdbEsCreateEntryRevisionFromImpl\n implements CreateEntryRevisionFromStorageOperation.Interface\n{\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface,\n private compressionHandler: CompressionHandler.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface,\n private valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const transformer = createTransformer<T>({\n model,\n entry: initialEntry,\n storageEntry: initialStorageEntry,\n fieldIndexRegistry: this.fieldIndexRegistry,\n compressionHandler: this.compressionHandler,\n valuesModifiers: this.valuesModifiers\n });\n const { entry, storageEntry } = transformer.transformEntryKeys();\n\n const revisionKeys = createEntryRevisionKeys(entry);\n const latestKeys = createEntryLatestKeys(entry);\n const publishedKeys = createEntryPublishedKeys(entry);\n\n // We'll need this flag below.\n const isPublished = entry.status === \"published\";\n\n const esLatestData = await transformer.getElasticsearchLatestEntryData();\n\n const entityBatch = this.entity.createEntityWriter({\n put: [\n {\n ...revisionKeys,\n data: storageEntry\n },\n {\n ...latestKeys,\n data: storageEntry\n }\n ]\n });\n\n if (isPublished) {\n entityBatch.put({\n ...publishedKeys,\n data: storageEntry\n });\n\n // Unpublish previously published revision (if any).\n const [publishedRevisionStorageEntry] =\n await this.dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n if (publishedRevisionStorageEntry) {\n const publishedRevisionKey = createEntryRevisionKeys(publishedRevisionStorageEntry);\n entityBatch.put({\n ...publishedRevisionKey,\n data: {\n ...publishedRevisionStorageEntry,\n status: CONTENT_ENTRY_STATUS.UNPUBLISHED\n }\n });\n }\n }\n\n try {\n await entityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create revision from given entry in the DynamoDB table.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n\n const configurations = createConfigurations(this.indexProvider);\n const { index: esIndex } = await configurations.es({\n model\n });\n\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter({\n put: [\n {\n ...latestKeys,\n index: esIndex,\n data: esLatestData\n }\n ]\n });\n\n if (isPublished) {\n const esPublishedData = await transformer.getElasticsearchPublishedEntryData();\n elasticsearchEntityBatch.put({\n ...publishedKeys,\n index: esIndex,\n data: esPublishedData\n });\n }\n\n try {\n await elasticsearchEntityBatch.execute();\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update latest entry in the DynamoDB Elasticsearch table.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n /**\n * There are no modifications on the entry created so just return the data.\n */\n return initialStorageEntry;\n }\n}\n\nexport const DdbEsCreateEntryRevisionFrom =\n CreateEntryRevisionFromStorageOperation.createImplementation({\n implementation: DdbEsCreateEntryRevisionFromImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider,\n CmsEntryOpenSearchFieldIndexRegistry,\n CompressionHandler,\n CmsModelOpenSearchIndexProvider,\n [CmsEntryOpenSearchValuesModifier, { multiple: true }]\n ]\n });\n"],"names":["DdbEsCreateEntryRevisionFromImpl","entity","esEntity","dataLoaders","storageModelProvider","fieldIndexRegistry","compressionHandler","indexProvider","valuesModifiers","initialModel","params","initialEntry","initialStorageEntry","model","transformer","createTransformer","entry","storageEntry","revisionKeys","createEntryRevisionKeys","latestKeys","createEntryLatestKeys","publishedKeys","createEntryPublishedKeys","isPublished","esLatestData","entityBatch","publishedRevisionStorageEntry","publishedRevisionKey","CONTENT_ENTRY_STATUS","ex","WebinyError","configurations","createConfigurations","esIndex","elasticsearchEntityBatch","esPublishedData","DdbEsCreateEntryRevisionFrom","CreateEntryRevisionFromStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider","CmsEntryOpenSearchFieldIndexRegistry","CompressionHandler","CmsModelOpenSearchIndexProvider","CmsEntryOpenSearchValuesModifier"],"mappings":"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"}
@@ -0,0 +1,18 @@
1
+ import type { CmsModel, CmsEntryStorageOperationsDeleteParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { DeleteEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.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
+ declare class DdbEsDeleteEntryImpl implements DeleteEntryStorageOperation.Interface {
8
+ private entity;
9
+ private esEntity;
10
+ private dataLoaders;
11
+ private storageModelProvider;
12
+ constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
13
+ execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteParams): Promise<void>;
14
+ }
15
+ export declare const DdbEsDeleteEntry: typeof DdbEsDeleteEntryImpl & {
16
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js").IDeleteEntryStorageOperation>;
17
+ };
18
+ export {};
@@ -0,0 +1,79 @@
1
+ import error from "@webiny/error";
2
+ import { DeleteEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.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 { createPartitionKey } from "./keys.js";
8
+ class DdbEsDeleteEntryImpl {
9
+ constructor(entity, esEntity, dataLoaders, storageModelProvider){
10
+ this.entity = entity;
11
+ this.esEntity = esEntity;
12
+ this.dataLoaders = dataLoaders;
13
+ this.storageModelProvider = storageModelProvider;
14
+ }
15
+ async execute(initialModel, params) {
16
+ const { entry } = params;
17
+ const id = entry.id || entry.entryId;
18
+ const model = this.storageModelProvider.getModel(initialModel);
19
+ const partitionKey = createPartitionKey({
20
+ id,
21
+ tenant: model.tenant
22
+ });
23
+ const items = await this.entity.queryAll({
24
+ partitionKey,
25
+ options: {
26
+ gte: " "
27
+ }
28
+ });
29
+ const esItems = await this.esEntity.queryAll({
30
+ partitionKey,
31
+ options: {
32
+ gte: " "
33
+ }
34
+ });
35
+ const entityBatch = this.entity.createEntityWriter({
36
+ delete: items.map((item)=>({
37
+ PK: item.PK,
38
+ SK: item.SK
39
+ }))
40
+ });
41
+ const elasticsearchEntityBatch = this.esEntity.createEntityWriter({
42
+ delete: esItems.map((item)=>({
43
+ PK: item.PK,
44
+ SK: item.SK
45
+ }))
46
+ });
47
+ try {
48
+ await entityBatch.execute();
49
+ this.dataLoaders.clearAll({
50
+ tenant: entry.tenant
51
+ });
52
+ } catch (ex) {
53
+ throw new error(ex.message || "Could not destroy entry records from DynamoDB table.", ex.code || "DELETE_ENTRY_ERROR", {
54
+ error: ex,
55
+ id
56
+ });
57
+ }
58
+ try {
59
+ await elasticsearchEntityBatch.execute();
60
+ } catch (ex) {
61
+ throw new error(ex.message || "Could not destroy entry records from DynamoDB Elasticsearch table.", ex.code || "DELETE_ENTRY_ERROR", {
62
+ error: ex,
63
+ id
64
+ });
65
+ }
66
+ }
67
+ }
68
+ const DdbEsDeleteEntry = DeleteEntryStorageOperation.createImplementation({
69
+ implementation: DdbEsDeleteEntryImpl,
70
+ dependencies: [
71
+ CmsDdbEsEntryEntity,
72
+ CmsDdbEsEntriesEsEntity,
73
+ CmsDdbEsDataLoaders,
74
+ CmsStorageModelProvider
75
+ ]
76
+ });
77
+ export { DdbEsDeleteEntry };
78
+
79
+ //# sourceMappingURL=DdbEsDeleteEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsDeleteEntry.js","sources":["../../../src/operations/entry/DdbEsDeleteEntry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryStorageOperationsDeleteParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.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 { createPartitionKey } from \"./keys.js\";\n\nclass DdbEsDeleteEntryImpl implements DeleteEntryStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteParams) {\n const { entry } = params;\n const id = entry.id || entry.entryId;\n const model = this.storageModelProvider.getModel(initialModel);\n\n const partitionKey = createPartitionKey({\n id,\n tenant: model.tenant\n });\n\n const items = await this.entity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n\n const esItems = await this.esEntity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n\n const entityBatch = this.entity.createEntityWriter({\n delete: items.map(item => {\n return {\n PK: item.PK,\n SK: item.SK\n };\n })\n });\n\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter({\n delete: esItems.map(item => {\n return {\n PK: item.PK,\n SK: item.SK\n };\n })\n });\n\n try {\n await entityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not destroy entry records from DynamoDB table.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n id\n }\n );\n }\n\n try {\n await elasticsearchEntityBatch.execute();\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not destroy entry records from DynamoDB Elasticsearch table.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n id\n }\n );\n }\n }\n}\n\nexport const DdbEsDeleteEntry = DeleteEntryStorageOperation.createImplementation({\n implementation: DdbEsDeleteEntryImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider\n ]\n});\n"],"names":["DdbEsDeleteEntryImpl","entity","esEntity","dataLoaders","storageModelProvider","initialModel","params","entry","id","model","partitionKey","createPartitionKey","items","esItems","entityBatch","item","elasticsearchEntityBatch","ex","WebinyError","DdbEsDeleteEntry","DeleteEntryStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;;;;AAYA,MAAMA;IACF,YACYC,MAAqC,EACrCC,QAA2C,EAC3CC,WAA0C,EAC1CC,oBAAuD,CACjE;aAJUH,MAAM,GAANA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QAAQC,YAAsB,EAAEC,MAA6C,EAAE;QACjF,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,KAAKD,MAAM,EAAE,IAAIA,MAAM,OAAO;QACpC,MAAME,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACJ;QAEjD,MAAMK,eAAeC,mBAAmB;YACpCH;YACA,QAAQC,MAAM,MAAM;QACxB;QAEA,MAAMG,QAAQ,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACrCF;YACA,SAAS;gBACL,KAAK;YACT;QACJ;QAEA,MAAMG,UAAU,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACzCH;YACA,SAAS;gBACL,KAAK;YACT;QACJ;QAEA,MAAMI,cAAc,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;YAC/C,QAAQF,MAAM,GAAG,CAACG,CAAAA,OACP;oBACH,IAAIA,KAAK,EAAE;oBACX,IAAIA,KAAK,EAAE;gBACf;QAER;QAEA,MAAMC,2BAA2B,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC9D,QAAQH,QAAQ,GAAG,CAACE,CAAAA,OACT;oBACH,IAAIA,KAAK,EAAE;oBACX,IAAIA,KAAK,EAAE;gBACf;QAER;QAEA,IAAI;YACA,MAAMD,YAAY,OAAO;YAEzB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACtB,QAAQP,MAAM,MAAM;YACxB;QACJ,EAAE,OAAOU,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wDACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPT;YACJ;QAER;QAEA,IAAI;YACA,MAAMQ,yBAAyB,OAAO;QAC1C,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,sEACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPT;YACJ;QAER;IACJ;AACJ;AAEO,MAAMW,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBpB;IAChB,cAAc;QACVqB;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,24 @@
1
+ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsDeleteRevisionParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { DeleteEntryRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.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, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
8
+ import { CompressionHandler } from "@webiny/utils/exports/api.js";
9
+ declare class DdbEsDeleteEntryRevisionImpl implements DeleteEntryRevisionStorageOperation.Interface {
10
+ private entity;
11
+ private esEntity;
12
+ private dataLoaders;
13
+ private storageModelProvider;
14
+ private fieldIndexRegistry;
15
+ private compressionHandler;
16
+ private indexProvider;
17
+ private valuesModifiers;
18
+ constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface, compressionHandler: CompressionHandler.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface, valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]);
19
+ execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>): Promise<void>;
20
+ }
21
+ export declare const DdbEsDeleteEntryRevision: typeof DdbEsDeleteEntryRevisionImpl & {
22
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js").IDeleteEntryRevisionStorageOperation>;
23
+ };
24
+ export {};
@@ -0,0 +1,136 @@
1
+ import error from "@webiny/error";
2
+ import { DeleteEntryRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.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, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
8
+ import { CompressionHandler } from "@webiny/utils/exports/api.js";
9
+ import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
10
+ import { createTransformer } from "./transformations/index.js";
11
+ import { createEntryLatestKeys, createEntryRevisionKeys, createPartitionKey, createPublishedSortKey, createRevisionSortKey } from "./keys.js";
12
+ import { convertToStorageEntry } from "./storageEntryUtils.js";
13
+ class DdbEsDeleteEntryRevisionImpl {
14
+ constructor(entity, esEntity, dataLoaders, storageModelProvider, fieldIndexRegistry, compressionHandler, indexProvider, valuesModifiers){
15
+ this.entity = entity;
16
+ this.esEntity = esEntity;
17
+ this.dataLoaders = dataLoaders;
18
+ this.storageModelProvider = storageModelProvider;
19
+ this.fieldIndexRegistry = fieldIndexRegistry;
20
+ this.compressionHandler = compressionHandler;
21
+ this.indexProvider = indexProvider;
22
+ this.valuesModifiers = valuesModifiers;
23
+ }
24
+ async execute(initialModel, params) {
25
+ const { entry, latestEntry, latestStorageEntry: initialLatestStorageEntry } = params;
26
+ const model = this.storageModelProvider.getModel(initialModel);
27
+ const partitionKey = createPartitionKey({
28
+ id: entry.id,
29
+ tenant: model.tenant
30
+ });
31
+ const configurations = createConfigurations(this.indexProvider);
32
+ const { index } = await configurations.es({
33
+ model
34
+ });
35
+ const [publishedStorageEntry] = await this.dataLoaders.getPublishedRevisionByEntryId({
36
+ model,
37
+ ids: [
38
+ entry.id
39
+ ]
40
+ });
41
+ const entityBatch = this.entity.createEntityWriter({
42
+ delete: [
43
+ {
44
+ PK: partitionKey,
45
+ SK: createRevisionSortKey(entry)
46
+ }
47
+ ]
48
+ });
49
+ const elasticsearchEntityBatch = this.esEntity.createEntityWriter();
50
+ if (publishedStorageEntry?.id === entry.id) {
51
+ entityBatch.delete({
52
+ PK: partitionKey,
53
+ SK: createPublishedSortKey()
54
+ });
55
+ elasticsearchEntityBatch.delete({
56
+ PK: partitionKey,
57
+ SK: createPublishedSortKey()
58
+ });
59
+ }
60
+ if (latestEntry && initialLatestStorageEntry) {
61
+ const latestStorageEntry = convertToStorageEntry({
62
+ storageEntry: initialLatestStorageEntry,
63
+ model
64
+ });
65
+ const latestStorageEntryLatestKey = createEntryLatestKeys(latestStorageEntry);
66
+ entityBatch.put({
67
+ ...latestStorageEntryLatestKey,
68
+ data: latestStorageEntry
69
+ });
70
+ const actualRevisionEntryKey = createEntryRevisionKeys(initialLatestStorageEntry);
71
+ entityBatch.put({
72
+ ...actualRevisionEntryKey,
73
+ data: latestStorageEntry
74
+ });
75
+ const latestTransformer = createTransformer({
76
+ valuesModifiers: this.valuesModifiers,
77
+ model,
78
+ entry: latestEntry,
79
+ storageEntry: initialLatestStorageEntry,
80
+ fieldIndexRegistry: this.fieldIndexRegistry,
81
+ compressionHandler: this.compressionHandler
82
+ });
83
+ const esLatestData = await latestTransformer.getElasticsearchLatestEntryData();
84
+ const esLatestKeys = createEntryLatestKeys(latestEntry);
85
+ elasticsearchEntityBatch.put({
86
+ ...esLatestKeys,
87
+ index,
88
+ data: esLatestData
89
+ });
90
+ }
91
+ try {
92
+ await entityBatch.execute();
93
+ this.dataLoaders.clearAll({
94
+ tenant: entry.tenant
95
+ });
96
+ } catch (ex) {
97
+ throw new error(ex.message || "Could not batch write entry records to DynamoDB table.", ex.code || "DELETE_REVISION_ERROR", {
98
+ error: ex,
99
+ entry,
100
+ latestEntry,
101
+ initialLatestStorageEntry
102
+ });
103
+ }
104
+ try {
105
+ await elasticsearchEntityBatch.execute();
106
+ } catch (ex) {
107
+ throw new error(ex.message || "Could not batch write entry records to DynamoDB Elasticsearch table.", ex.code || "DELETE_REVISION_ERROR", {
108
+ error: ex,
109
+ entry,
110
+ latestEntry,
111
+ initialLatestStorageEntry
112
+ });
113
+ }
114
+ }
115
+ }
116
+ const DdbEsDeleteEntryRevision = DeleteEntryRevisionStorageOperation.createImplementation({
117
+ implementation: DdbEsDeleteEntryRevisionImpl,
118
+ dependencies: [
119
+ CmsDdbEsEntryEntity,
120
+ CmsDdbEsEntriesEsEntity,
121
+ CmsDdbEsDataLoaders,
122
+ CmsStorageModelProvider,
123
+ CmsEntryOpenSearchFieldIndexRegistry,
124
+ CompressionHandler,
125
+ CmsModelOpenSearchIndexProvider,
126
+ [
127
+ CmsEntryOpenSearchValuesModifier,
128
+ {
129
+ multiple: true
130
+ }
131
+ ]
132
+ ]
133
+ });
134
+ export { DdbEsDeleteEntryRevision };
135
+
136
+ //# sourceMappingURL=DdbEsDeleteEntryRevision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsDeleteEntryRevision.js","sources":["../../../src/operations/entry/DdbEsDeleteEntryRevision.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsDeleteRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteEntryRevisionStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.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 {\n CmsEntryOpenSearchFieldIndexRegistry,\n CmsEntryOpenSearchValuesModifier,\n CmsModelOpenSearchIndexProvider\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { createTransformer } from \"./transformations/index.js\";\nimport {\n createEntryLatestKeys,\n createEntryRevisionKeys,\n createPartitionKey,\n createPublishedSortKey,\n createRevisionSortKey\n} from \"./keys.js\";\nimport { convertToStorageEntry } from \"./storageEntryUtils.js\";\n\nclass DdbEsDeleteEntryRevisionImpl implements DeleteEntryRevisionStorageOperation.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 fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface,\n private compressionHandler: CompressionHandler.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface,\n private valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ): Promise<void> {\n const { entry, latestEntry, latestStorageEntry: initialLatestStorageEntry } = params;\n const model = this.storageModelProvider.getModel(initialModel);\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n tenant: model.tenant\n });\n\n const configurations = createConfigurations(this.indexProvider);\n const { index } = await configurations.es({\n model\n });\n /**\n * We need published entry to delete it if necessary.\n */\n const [publishedStorageEntry] = await this.dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n /**\n * We need to delete all existing records of the given entry revision.\n */\n const entityBatch = this.entity.createEntityWriter({\n delete: [\n {\n PK: partitionKey,\n SK: createRevisionSortKey(entry)\n }\n ]\n });\n\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter();\n\n /**\n * If revision we are deleting is the published one as well, we need to delete those records as well.\n */\n if (publishedStorageEntry?.id === entry.id) {\n entityBatch.delete({\n PK: partitionKey,\n SK: createPublishedSortKey()\n });\n\n elasticsearchEntityBatch.delete({\n PK: partitionKey,\n SK: createPublishedSortKey()\n });\n }\n\n if (latestEntry && initialLatestStorageEntry) {\n const latestStorageEntry = convertToStorageEntry({\n storageEntry: initialLatestStorageEntry,\n model\n });\n\n /**\n * In the end we need to set the new latest entry.\n */\n const latestStorageEntryLatestKey = createEntryLatestKeys(latestStorageEntry);\n entityBatch.put({\n ...latestStorageEntryLatestKey,\n data: latestStorageEntry\n });\n\n /**\n * Also perform an update on the actual revision. This is needed\n * because of updates on the entry-level meta fields.\n */\n const actualRevisionEntryKey = createEntryRevisionKeys(initialLatestStorageEntry);\n entityBatch.put({\n ...actualRevisionEntryKey,\n data: latestStorageEntry\n });\n\n const latestTransformer = createTransformer({\n valuesModifiers: this.valuesModifiers,\n model,\n entry: latestEntry,\n storageEntry: initialLatestStorageEntry,\n fieldIndexRegistry: this.fieldIndexRegistry,\n compressionHandler: this.compressionHandler\n });\n\n const esLatestData = await latestTransformer.getElasticsearchLatestEntryData();\n\n const esLatestKeys = createEntryLatestKeys(latestEntry);\n elasticsearchEntityBatch.put({\n ...esLatestKeys,\n index,\n data: esLatestData\n });\n }\n\n try {\n await entityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch write entry records to DynamoDB table.\",\n ex.code || \"DELETE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n latestEntry,\n initialLatestStorageEntry\n }\n );\n }\n\n try {\n await elasticsearchEntityBatch.execute();\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not batch write entry records to DynamoDB Elasticsearch table.\",\n ex.code || \"DELETE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n latestEntry,\n initialLatestStorageEntry\n }\n );\n }\n }\n}\n\nexport const DdbEsDeleteEntryRevision = DeleteEntryRevisionStorageOperation.createImplementation({\n implementation: DdbEsDeleteEntryRevisionImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider,\n CmsEntryOpenSearchFieldIndexRegistry,\n CompressionHandler,\n CmsModelOpenSearchIndexProvider,\n [CmsEntryOpenSearchValuesModifier, { multiple: true }]\n ]\n});\n"],"names":["DdbEsDeleteEntryRevisionImpl","entity","esEntity","dataLoaders","storageModelProvider","fieldIndexRegistry","compressionHandler","indexProvider","valuesModifiers","initialModel","params","entry","latestEntry","initialLatestStorageEntry","model","partitionKey","createPartitionKey","configurations","createConfigurations","index","publishedStorageEntry","entityBatch","createRevisionSortKey","elasticsearchEntityBatch","createPublishedSortKey","latestStorageEntry","convertToStorageEntry","latestStorageEntryLatestKey","createEntryLatestKeys","actualRevisionEntryKey","createEntryRevisionKeys","latestTransformer","createTransformer","esLatestData","esLatestKeys","ex","WebinyError","DdbEsDeleteEntryRevision","DeleteEntryRevisionStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider","CmsEntryOpenSearchFieldIndexRegistry","CompressionHandler","CmsModelOpenSearchIndexProvider","CmsEntryOpenSearchValuesModifier"],"mappings":"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"}
@@ -0,0 +1,18 @@
1
+ import type { CmsModel, CmsEntryStorageOperationsDeleteEntriesParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { DeleteMultipleEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.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
+ declare class DdbEsDeleteMultipleEntriesImpl implements DeleteMultipleEntriesStorageOperation.Interface {
8
+ private entity;
9
+ private esEntity;
10
+ private dataLoaders;
11
+ private storageModelProvider;
12
+ constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
13
+ execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteEntriesParams): Promise<void>;
14
+ }
15
+ export declare const DdbEsDeleteMultipleEntries: typeof DdbEsDeleteMultipleEntriesImpl & {
16
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js").IDeleteMultipleEntriesStorageOperation>;
17
+ };
18
+ export {};
@@ -0,0 +1,78 @@
1
+ import { DeleteMultipleEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js";
2
+ import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
3
+ import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
4
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
5
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
6
+ import { createPartitionKey, createRevisionSortKey } from "./keys.js";
7
+ class DdbEsDeleteMultipleEntriesImpl {
8
+ constructor(entity, esEntity, dataLoaders, storageModelProvider){
9
+ this.entity = entity;
10
+ this.esEntity = esEntity;
11
+ this.dataLoaders = dataLoaders;
12
+ this.storageModelProvider = storageModelProvider;
13
+ }
14
+ async execute(initialModel, params) {
15
+ const { entries } = params;
16
+ const model = this.storageModelProvider.getModel(initialModel);
17
+ const revisions = await this.dataLoaders.getAllEntryRevisions({
18
+ model,
19
+ ids: entries
20
+ });
21
+ const esItems = (await Promise.all(entries.map((id)=>this.esEntity.queryAll({
22
+ partitionKey: createPartitionKey({
23
+ id,
24
+ tenant: model.tenant
25
+ }),
26
+ options: {
27
+ gte: " "
28
+ }
29
+ })))).flat();
30
+ const entityBatch = this.entity.createEntityWriter();
31
+ const elasticsearchEntityBatch = this.esEntity.createEntityWriter({
32
+ delete: esItems.map((item)=>({
33
+ PK: item.PK,
34
+ SK: item.SK
35
+ }))
36
+ });
37
+ for (const id of entries){
38
+ const partitionKey = createPartitionKey({
39
+ id,
40
+ tenant: model.tenant
41
+ });
42
+ entityBatch.delete({
43
+ PK: partitionKey,
44
+ SK: "L"
45
+ });
46
+ entityBatch.delete({
47
+ PK: partitionKey,
48
+ SK: "P"
49
+ });
50
+ }
51
+ for (const revision of revisions)entityBatch.delete({
52
+ PK: createPartitionKey({
53
+ id: revision.id,
54
+ tenant: model.tenant
55
+ }),
56
+ SK: createRevisionSortKey({
57
+ version: revision.version
58
+ })
59
+ });
60
+ await entityBatch.execute();
61
+ await elasticsearchEntityBatch.execute();
62
+ this.dataLoaders.clearAll({
63
+ tenant: model.tenant
64
+ });
65
+ }
66
+ }
67
+ const DdbEsDeleteMultipleEntries = DeleteMultipleEntriesStorageOperation.createImplementation({
68
+ implementation: DdbEsDeleteMultipleEntriesImpl,
69
+ dependencies: [
70
+ CmsDdbEsEntryEntity,
71
+ CmsDdbEsEntriesEsEntity,
72
+ CmsDdbEsDataLoaders,
73
+ CmsStorageModelProvider
74
+ ]
75
+ });
76
+ export { DdbEsDeleteMultipleEntries };
77
+
78
+ //# sourceMappingURL=DdbEsDeleteMultipleEntries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsDeleteMultipleEntries.js","sources":["../../../src/operations/entry/DdbEsDeleteMultipleEntries.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryStorageOperationsDeleteEntriesParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteMultipleEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.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 { createPartitionKey, createRevisionSortKey } from \"./keys.js\";\n\nclass DdbEsDeleteMultipleEntriesImpl implements DeleteMultipleEntriesStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteEntriesParams) {\n const { entries } = params;\n const model = this.storageModelProvider.getModel(initialModel);\n /**\n * First we need all the revisions of the entries we want to delete.\n */\n const revisions = await this.dataLoaders.getAllEntryRevisions({\n model,\n ids: entries\n });\n /**\n * The Elasticsearch records that exist: an entry that was never published (or was\n * unpublished) has no published record, and deleting a missing record is an error in the\n * stream handling. As DdbEsDeleteEntry does, only the stored records are deleted.\n */\n const esItems = (\n await Promise.all(\n entries.map(id =>\n this.esEntity.queryAll({\n partitionKey: createPartitionKey({\n id,\n tenant: model.tenant\n }),\n options: {\n gte: \" \"\n }\n })\n )\n )\n ).flat();\n\n const entityBatch = this.entity.createEntityWriter();\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter({\n delete: esItems.map(item => ({ PK: item.PK, SK: item.SK }))\n });\n for (const id of entries) {\n const partitionKey = createPartitionKey({\n id,\n tenant: model.tenant\n });\n /**\n * Latest and published items.\n */\n entityBatch.delete({ PK: partitionKey, SK: \"L\" });\n entityBatch.delete({ PK: partitionKey, SK: \"P\" });\n }\n /**\n * Exact revisions of all the entries\n */\n for (const revision of revisions) {\n entityBatch.delete({\n PK: createPartitionKey({\n id: revision.id,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey({\n version: revision.version\n })\n });\n }\n\n await entityBatch.execute();\n await elasticsearchEntityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant: model.tenant\n });\n }\n}\n\nexport const DdbEsDeleteMultipleEntries =\n DeleteMultipleEntriesStorageOperation.createImplementation({\n implementation: DdbEsDeleteMultipleEntriesImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider\n ]\n });\n"],"names":["DdbEsDeleteMultipleEntriesImpl","entity","esEntity","dataLoaders","storageModelProvider","initialModel","params","entries","model","revisions","esItems","Promise","id","createPartitionKey","entityBatch","elasticsearchEntityBatch","item","partitionKey","revision","createRevisionSortKey","DdbEsDeleteMultipleEntries","DeleteMultipleEntriesStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;;;AAWA,MAAMA;IACF,YACYC,MAAqC,EACrCC,QAA2C,EAC3CC,WAA0C,EAC1CC,oBAAuD,CACjE;aAJUH,MAAM,GAANA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QAAQC,YAAsB,EAAEC,MAAoD,EAAE;QACxF,MAAM,EAAEC,OAAO,EAAE,GAAGD;QACpB,MAAME,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACH;QAIjD,MAAMI,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC;YAC1DD;YACA,KAAKD;QACT;QAMA,MAAMG,UACF,OAAMC,QAAQ,GAAG,CACbJ,QAAQ,GAAG,CAACK,CAAAA,KACR,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACnB,cAAcC,mBAAmB;oBAC7BD;oBACA,QAAQJ,MAAM,MAAM;gBACxB;gBACA,SAAS;oBACL,KAAK;gBACT;YACJ,MAGV,IAAI;QAEN,MAAMM,cAAc,IAAI,CAAC,MAAM,CAAC,kBAAkB;QAClD,MAAMC,2BAA2B,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC9D,QAAQL,QAAQ,GAAG,CAACM,CAAAA,OAAS;oBAAE,IAAIA,KAAK,EAAE;oBAAE,IAAIA,KAAK,EAAE;gBAAC;QAC5D;QACA,KAAK,MAAMJ,MAAML,QAAS;YACtB,MAAMU,eAAeJ,mBAAmB;gBACpCD;gBACA,QAAQJ,MAAM,MAAM;YACxB;YAIAM,YAAY,MAAM,CAAC;gBAAE,IAAIG;gBAAc,IAAI;YAAI;YAC/CH,YAAY,MAAM,CAAC;gBAAE,IAAIG;gBAAc,IAAI;YAAI;QACnD;QAIA,KAAK,MAAMC,YAAYT,UACnBK,YAAY,MAAM,CAAC;YACf,IAAID,mBAAmB;gBACnB,IAAIK,SAAS,EAAE;gBACf,QAAQV,MAAM,MAAM;YACxB;YACA,IAAIW,sBAAsB;gBACtB,SAASD,SAAS,OAAO;YAC7B;QACJ;QAGJ,MAAMJ,YAAY,OAAO;QACzB,MAAMC,yBAAyB,OAAO;QAEtC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;YACtB,QAAQP,MAAM,MAAM;QACxB;IACJ;AACJ;AAEO,MAAMY,6BACTC,sCAAsC,oBAAoB,CAAC;IACvD,gBAAgBrB;IAChB,cAAc;QACVsB;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,14 @@
1
+ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetByIdsParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js";
3
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
4
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
5
+ declare class DdbEsGetEntriesByIdsImpl implements GetEntriesByIdsStorageOperation.Interface {
6
+ private dataLoaders;
7
+ private storageModelProvider;
8
+ constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
9
+ execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
10
+ }
11
+ export declare const DdbEsGetEntriesByIds: typeof DdbEsGetEntriesByIdsImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js").IGetEntriesByIdsStorageOperation>;
13
+ };
14
+ export {};
@@ -0,0 +1,31 @@
1
+ import { GetEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.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 DdbEsGetEntriesByIdsImpl {
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.getRevisionById({
13
+ model,
14
+ ids: params.ids
15
+ });
16
+ return entries.map((entry)=>convertEntryKeysFromStorage({
17
+ model,
18
+ entry
19
+ }));
20
+ }
21
+ }
22
+ const DdbEsGetEntriesByIds = GetEntriesByIdsStorageOperation.createImplementation({
23
+ implementation: DdbEsGetEntriesByIdsImpl,
24
+ dependencies: [
25
+ CmsDdbEsDataLoaders,
26
+ CmsStorageModelProvider
27
+ ]
28
+ });
29
+ export { DdbEsGetEntriesByIds };
30
+
31
+ //# sourceMappingURL=DdbEsGetEntriesByIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsGetEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.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 DdbEsGetEntriesByIdsImpl implements GetEntriesByIdsStorageOperation.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: CmsEntryStorageOperationsGetByIdsParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getRevisionById<T>({\n model,\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetEntriesByIds = GetEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n});\n"],"names":["DdbEsGetEntriesByIdsImpl","dataLoaders","storageModelProvider","initialModel","params","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetEntriesByIds","GetEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;AAUA,MAAMA;IACF,YACYC,WAA0C,EAC1CC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAA+C,EACjD;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAMG,UAAU,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAI;YACtDD;YACA,KAAKD,OAAO,GAAG;QACnB;QAEA,OAAOE,QAAQ,GAAG,CAACC,CAAAA,QACRC,4BAA+B;gBAClCH;gBACAE;YACJ;IAER;AACJ;AAEO,MAAME,uBAAuBC,gCAAgC,oBAAoB,CAAC;IACrF,gBAAgBV;IAChB,cAAc;QAACW;QAAqBC;KAAwB;AAChE"}