@webiny/api-headless-cms-ddb-es 0.0.0-unstable.496cf268ac → 0.0.0-unstable.5387e5f7c8

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 (410) 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/definitions/entry.d.ts +4 -5
  24. package/definitions/entry.js +10 -87
  25. package/definitions/entry.js.map +1 -1
  26. package/definitions/group.d.ts +6 -6
  27. package/definitions/group.js +10 -64
  28. package/definitions/group.js.map +1 -1
  29. package/definitions/model.d.ts +6 -6
  30. package/definitions/model.js +10 -108
  31. package/definitions/model.js.map +1 -1
  32. package/definitions/types.d.ts +65 -0
  33. package/definitions/types.js +0 -0
  34. package/feature.d.ts +10 -0
  35. package/feature.js +69 -0
  36. package/feature.js.map +1 -0
  37. package/index.d.ts +1 -3
  38. package/index.js +1 -214
  39. package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
  40. package/operations/entry/DdbEsCreateEntry.js +134 -0
  41. package/operations/entry/DdbEsCreateEntry.js.map +1 -0
  42. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
  43. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -0
  44. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
  45. package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
  46. package/operations/entry/DdbEsDeleteEntry.js +79 -0
  47. package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
  48. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +24 -0
  49. package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
  50. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
  51. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
  52. package/operations/entry/DdbEsDeleteMultipleEntries.js +80 -0
  53. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
  54. package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
  55. package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
  56. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
  57. package/operations/entry/DdbEsGetEntry.d.ts +14 -0
  58. package/operations/entry/DdbEsGetEntry.js +27 -0
  59. package/operations/entry/DdbEsGetEntry.js.map +1 -0
  60. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
  61. package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
  62. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
  63. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
  64. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
  65. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
  66. package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
  67. package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
  68. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
  69. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
  70. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
  71. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
  72. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
  73. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
  74. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
  75. package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
  76. package/operations/entry/DdbEsGetRevisionById.js +34 -0
  77. package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
  78. package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
  79. package/operations/entry/DdbEsGetRevisions.js +33 -0
  80. package/operations/entry/DdbEsGetRevisions.js.map +1 -0
  81. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +18 -0
  82. package/operations/entry/DdbEsGetUniqueFieldValues.js +76 -0
  83. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
  84. package/operations/entry/DdbEsListEntries.d.ts +25 -0
  85. package/operations/entry/DdbEsListEntries.js +91 -0
  86. package/operations/entry/DdbEsListEntries.js.map +1 -0
  87. package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
  88. package/operations/entry/DdbEsMoveEntry.js +113 -0
  89. package/operations/entry/DdbEsMoveEntry.js.map +1 -0
  90. package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
  91. package/operations/entry/DdbEsMoveToBin.js +137 -0
  92. package/operations/entry/DdbEsMoveToBin.js.map +1 -0
  93. package/operations/entry/DdbEsPublishEntry.d.ts +24 -0
  94. package/operations/entry/DdbEsPublishEntry.js +231 -0
  95. package/operations/entry/DdbEsPublishEntry.js.map +1 -0
  96. package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
  97. package/operations/entry/DdbEsRestoreFromBin.js +137 -0
  98. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
  99. package/operations/entry/DdbEsUnpublishEntry.d.ts +24 -0
  100. package/operations/entry/DdbEsUnpublishEntry.js +127 -0
  101. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
  102. package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
  103. package/operations/entry/DdbEsUpdateEntry.js +175 -0
  104. package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
  105. package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
  106. package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
  107. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  108. package/operations/entry/dataLoader/constants.d.ts +1 -0
  109. package/operations/entry/dataLoader/constants.js +5 -0
  110. package/operations/entry/dataLoader/constants.js.map +1 -0
  111. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  112. package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
  113. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  114. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  115. package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
  116. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  117. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  118. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +34 -0
  119. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  120. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  121. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +34 -0
  122. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  123. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  124. package/operations/entry/dataLoader/getRevisionById.js +40 -0
  125. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  126. package/operations/entry/dataLoader/index.d.ts +8 -0
  127. package/operations/entry/dataLoader/index.js +18 -0
  128. package/operations/entry/dataLoader/index.js.map +1 -0
  129. package/operations/entry/dataLoader/types.d.ts +6 -0
  130. package/operations/entry/dataLoader/types.js +0 -0
  131. package/operations/entry/dataLoaders.d.ts +18 -39
  132. package/operations/entry/dataLoaders.js +91 -306
  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 +46 -27
  139. package/operations/entry/keys.js.map +1 -1
  140. package/operations/entry/recordType.js +5 -17
  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 +8 -0
  146. package/operations/entry/transformations/convertEntryKeys.js +25 -0
  147. package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
  148. package/operations/entry/transformations/index.d.ts +32 -0
  149. package/operations/entry/transformations/index.js +91 -0
  150. package/operations/entry/transformations/index.js.map +1 -0
  151. package/operations/entry/transformations/modifyEntryValues.d.ts +53 -0
  152. package/operations/entry/transformations/modifyEntryValues.js +16 -0
  153. package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
  154. package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
  155. package/operations/entry/transformations/transformEntryKeys.js +17 -0
  156. package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
  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 +48 -41
  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 +13 -0
  204. package/tasks/CreateElasticsearchIndexTask.js +40 -0
  205. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  206. package/types.d.ts +13 -155
  207. package/types.js +9 -41
  208. package/types.js.map +1 -1
  209. package/configurations.d.ts +0 -12
  210. package/configurations.js +0 -35
  211. package/configurations.js.map +0 -1
  212. package/definitions/entryElasticsearch.d.ts +0 -8
  213. package/definitions/entryElasticsearch.js +0 -37
  214. package/definitions/entryElasticsearch.js.map +0 -1
  215. package/definitions/settings.d.ts +0 -8
  216. package/definitions/settings.js +0 -53
  217. package/definitions/settings.js.map +0 -1
  218. package/definitions/system.d.ts +0 -8
  219. package/definitions/system.js +0 -41
  220. package/definitions/system.js.map +0 -1
  221. package/definitions/table.d.ts +0 -8
  222. package/definitions/table.js +0 -21
  223. package/definitions/table.js.map +0 -1
  224. package/definitions/tableElasticsearch.d.ts +0 -8
  225. package/definitions/tableElasticsearch.js +0 -21
  226. package/definitions/tableElasticsearch.js.map +0 -1
  227. package/dynamoDb/index.d.ts +0 -2
  228. package/dynamoDb/index.js +0 -11
  229. package/dynamoDb/index.js.map +0 -1
  230. package/dynamoDb/storage/date.d.ts +0 -3
  231. package/dynamoDb/storage/date.js +0 -86
  232. package/dynamoDb/storage/date.js.map +0 -1
  233. package/dynamoDb/storage/longText.d.ts +0 -10
  234. package/dynamoDb/storage/longText.js +0 -93
  235. package/dynamoDb/storage/longText.js.map +0 -1
  236. package/dynamoDb/storage/richText.d.ts +0 -7
  237. package/dynamoDb/storage/richText.js +0 -110
  238. package/dynamoDb/storage/richText.js.map +0 -1
  239. package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
  240. package/elasticsearch/createElasticsearchIndex.js +0 -49
  241. package/elasticsearch/createElasticsearchIndex.js.map +0 -1
  242. package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
  243. package/elasticsearch/deleteElasticsearchIndex.js +0 -36
  244. package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
  245. package/elasticsearch/index.d.ts +0 -2
  246. package/elasticsearch/index.js +0 -11
  247. package/elasticsearch/index.js.map +0 -1
  248. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  249. package/elasticsearch/indexing/dateTimeIndexing.js +0 -86
  250. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  251. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  252. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -52
  253. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  254. package/elasticsearch/indexing/index.d.ts +0 -2
  255. package/elasticsearch/indexing/index.js +0 -15
  256. package/elasticsearch/indexing/index.js.map +0 -1
  257. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  258. package/elasticsearch/indexing/longTextIndexing.js +0 -46
  259. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  260. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  261. package/elasticsearch/indexing/numberIndexing.js +0 -39
  262. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  263. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  264. package/elasticsearch/indexing/objectIndexing.js +0 -196
  265. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  266. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  267. package/elasticsearch/indexing/richTextIndexing.js +0 -29
  268. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  269. package/elasticsearch/indices/base.d.ts +0 -2
  270. package/elasticsearch/indices/base.js +0 -12
  271. package/elasticsearch/indices/base.js.map +0 -1
  272. package/elasticsearch/indices/index.d.ts +0 -1
  273. package/elasticsearch/indices/index.js +0 -12
  274. package/elasticsearch/indices/index.js.map +0 -1
  275. package/elasticsearch/indices/japanese.d.ts +0 -2
  276. package/elasticsearch/indices/japanese.js +0 -13
  277. package/elasticsearch/indices/japanese.js.map +0 -1
  278. package/elasticsearch/search/index.d.ts +0 -3
  279. package/elasticsearch/search/index.js +0 -10
  280. package/elasticsearch/search/index.js.map +0 -1
  281. package/elasticsearch/search/refSearch.d.ts +0 -2
  282. package/elasticsearch/search/refSearch.js +0 -29
  283. package/elasticsearch/search/refSearch.js.map +0 -1
  284. package/elasticsearch/search/timeSearch.d.ts +0 -2
  285. package/elasticsearch/search/timeSearch.js +0 -26
  286. package/elasticsearch/search/timeSearch.js.map +0 -1
  287. package/helpers/entryIndexHelpers.d.ts +0 -18
  288. package/helpers/entryIndexHelpers.js +0 -175
  289. package/helpers/entryIndexHelpers.js.map +0 -1
  290. package/helpers/index.d.ts +0 -1
  291. package/helpers/index.js +0 -16
  292. package/helpers/index.js.map +0 -1
  293. package/index.js.map +0 -1
  294. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
  295. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -32
  296. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
  297. package/operations/entry/elasticsearch/body.d.ts +0 -13
  298. package/operations/entry/elasticsearch/body.js +0 -140
  299. package/operations/entry/elasticsearch/body.js.map +0 -1
  300. package/operations/entry/elasticsearch/fields.d.ts +0 -9
  301. package/operations/entry/elasticsearch/fields.js +0 -229
  302. package/operations/entry/elasticsearch/fields.js.map +0 -1
  303. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -8
  304. package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -57
  305. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
  306. package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -17
  307. package/operations/entry/elasticsearch/filtering/exec.js +0 -172
  308. package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
  309. package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
  310. package/operations/entry/elasticsearch/filtering/index.js +0 -16
  311. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  312. package/operations/entry/elasticsearch/filtering/path.d.ts +0 -15
  313. package/operations/entry/elasticsearch/filtering/path.js +0 -44
  314. package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
  315. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  316. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -28
  317. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  318. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  319. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -13
  320. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  321. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  322. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -65
  323. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  324. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  325. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -48
  326. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  327. package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
  328. package/operations/entry/elasticsearch/filtering/populated.js +0 -23
  329. package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
  330. package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
  331. package/operations/entry/elasticsearch/filtering/values.js +0 -22
  332. package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
  333. package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -12
  334. package/operations/entry/elasticsearch/fullTextSearch.js +0 -89
  335. package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
  336. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
  337. package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -25
  338. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
  339. package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
  340. package/operations/entry/elasticsearch/initialQuery.js +0 -103
  341. package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
  342. package/operations/entry/elasticsearch/keyword.d.ts +0 -2
  343. package/operations/entry/elasticsearch/keyword.js +0 -34
  344. package/operations/entry/elasticsearch/keyword.js.map +0 -1
  345. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  346. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -16
  347. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  348. package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -8
  349. package/operations/entry/elasticsearch/plugins/operator.js +0 -37
  350. package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
  351. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  352. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -16
  353. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  354. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  355. package/operations/entry/elasticsearch/plugins/search.js +0 -24
  356. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  357. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  358. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -16
  359. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  360. package/operations/entry/elasticsearch/sort.d.ts +0 -12
  361. package/operations/entry/elasticsearch/sort.js +0 -82
  362. package/operations/entry/elasticsearch/sort.js.map +0 -1
  363. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -16
  364. package/operations/entry/elasticsearch/transformValueForSearch.js +0 -30
  365. package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
  366. package/operations/entry/elasticsearch/types.d.ts +0 -41
  367. package/operations/entry/elasticsearch/types.js +0 -5
  368. package/operations/entry/elasticsearch/types.js.map +0 -1
  369. package/operations/entry/index.d.ts +0 -11
  370. package/operations/entry/index.js +0 -1128
  371. package/operations/entry/index.js.map +0 -1
  372. package/operations/group/index.d.ts +0 -8
  373. package/operations/group/index.js +0 -165
  374. package/operations/group/index.js.map +0 -1
  375. package/operations/model/index.d.ts +0 -8
  376. package/operations/model/index.js +0 -171
  377. package/operations/model/index.js.map +0 -1
  378. package/operations/settings/index.d.ts +0 -6
  379. package/operations/settings/index.js +0 -111
  380. package/operations/settings/index.js.map +0 -1
  381. package/operations/system/index.d.ts +0 -6
  382. package/operations/system/index.js +0 -82
  383. package/operations/system/index.js.map +0 -1
  384. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -21
  385. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -22
  386. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  387. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
  388. package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -18
  389. package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +0 -1
  390. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  391. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -28
  392. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  393. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  394. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -12
  395. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  396. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -31
  397. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -37
  398. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  399. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -18
  400. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -22
  401. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  402. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -18
  403. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -22
  404. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  405. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  406. package/plugins/CmsEntryFilterPlugin.js +0 -24
  407. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  408. package/plugins/index.d.ts +0 -7
  409. package/plugins/index.js +0 -82
  410. package/plugins/index.js.map +0 -1
package/feature.js ADDED
@@ -0,0 +1,69 @@
1
+ import { DynamoDBClient, createTable } from "@webiny/db-dynamodb";
2
+ import { ENTITIES } from "./types.js";
3
+ import { createFeature } from "@webiny/feature/api/index.js";
4
+ import { createGroupEntity } from "./definitions/group.js";
5
+ import { createModelEntity } from "./definitions/model.js";
6
+ import { createEntryEntity } from "./definitions/entry.js";
7
+ import { createOpenSearchEntity, createOpenSearchTable } from "@webiny/api-opensearch-aws";
8
+ import { FilterUtilFeature } from "@webiny/db-dynamodb/feature/FilterUtil/feature.js";
9
+ import { CmsDdbEsTable } from "./abstractions/CmsDdbEsTable.js";
10
+ import { CmsDdbEsOsTable } from "./abstractions/CmsDdbEsOsTable.js";
11
+ import { CmsDdbEsGroupEntity } from "./abstractions/CmsDdbEsGroupEntity.js";
12
+ import { CmsDdbEsModelEntity } from "./abstractions/CmsDdbEsModelEntity.js";
13
+ import { CmsDdbEsEntryEntity } from "./abstractions/CmsDdbEsEntryEntity.js";
14
+ import { CmsDdbEsEntriesEsEntity } from "./abstractions/CmsDdbEsEntriesEsEntity.js";
15
+ import { CmsEntryOpenSearchUtilsFeature } from "@webiny/api-headless-cms-utils-os";
16
+ import { FilterRegistriesFeature } from "@webiny/api-headless-cms-storage";
17
+ import { CreateElasticsearchIndexTask } from "./tasks/CreateElasticsearchIndexTask.js";
18
+ import { CmsEntitiesDbRegistryDecorator } from "./registry/CmsEntitiesDbRegistryDecorator.js";
19
+ import { DdbEsGroupStorageOpsFeature } from "./operations/group/feature.js";
20
+ import { DdbEsModelStorageOpsFeature } from "./operations/model/feature.js";
21
+ import { DdbEsEntryStorageOpsFeature } from "./operations/entry/feature.js";
22
+ const HeadlessCmsDdbEsFeature = createFeature({
23
+ name: "cms.storageOperations.openSearch",
24
+ register: (container)=>{
25
+ FilterUtilFeature.register(container);
26
+ const db = container.resolve(DynamoDBClient);
27
+ const documentClient = db.client;
28
+ const tableInstance = createTable({
29
+ name: process.env.DB_TABLE,
30
+ documentClient
31
+ });
32
+ const tableElasticsearchInstance = createOpenSearchTable({
33
+ name: process.env.DB_TABLE_OPENSEARCH,
34
+ documentClient
35
+ });
36
+ const groupEntity = createGroupEntity({
37
+ entityName: ENTITIES.GROUPS,
38
+ table: tableInstance
39
+ });
40
+ const modelEntity = createModelEntity({
41
+ entityName: ENTITIES.MODELS,
42
+ table: tableInstance
43
+ });
44
+ const entryEntity = createEntryEntity({
45
+ entityName: ENTITIES.ENTRIES,
46
+ table: tableInstance
47
+ });
48
+ const entriesEsEntity = createOpenSearchEntity({
49
+ entityName: ENTITIES.ENTRIES_ES,
50
+ table: tableElasticsearchInstance
51
+ });
52
+ container.registerInstance(CmsDdbEsTable, tableInstance);
53
+ container.registerInstance(CmsDdbEsOsTable, tableElasticsearchInstance);
54
+ container.registerInstance(CmsDdbEsGroupEntity, groupEntity);
55
+ container.registerInstance(CmsDdbEsModelEntity, modelEntity);
56
+ container.registerInstance(CmsDdbEsEntryEntity, entryEntity);
57
+ container.registerInstance(CmsDdbEsEntriesEsEntity, entriesEsEntity);
58
+ CmsEntryOpenSearchUtilsFeature.register(container);
59
+ FilterRegistriesFeature.register(container);
60
+ container.register(CreateElasticsearchIndexTask);
61
+ container.registerDecorator(CmsEntitiesDbRegistryDecorator);
62
+ DdbEsGroupStorageOpsFeature.register(container);
63
+ DdbEsModelStorageOpsFeature.register(container);
64
+ DdbEsEntryStorageOpsFeature.register(container);
65
+ }
66
+ });
67
+ export { HeadlessCmsDdbEsFeature };
68
+
69
+ //# sourceMappingURL=feature.js.map
package/feature.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.js","sources":["../src/feature.ts"],"sourcesContent":["import { createTable, DynamoDBClient } from \"@webiny/db-dynamodb\";\nimport { ENTITIES } from \"~/types.js\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createOpenSearchEntity, createOpenSearchTable } from \"@webiny/api-opensearch-aws\";\nimport { FilterUtilFeature } from \"@webiny/db-dynamodb/feature/FilterUtil/feature.js\";\nimport { CmsDdbEsTable } from \"~/abstractions/CmsDdbEsTable.js\";\nimport { CmsDdbEsOsTable } from \"~/abstractions/CmsDdbEsOsTable.js\";\nimport { CmsDdbEsGroupEntity } from \"~/abstractions/CmsDdbEsGroupEntity.js\";\nimport { CmsDdbEsModelEntity } from \"~/abstractions/CmsDdbEsModelEntity.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsEntryOpenSearchUtilsFeature } from \"@webiny/api-headless-cms-utils-os\";\nimport { FilterRegistriesFeature } from \"@webiny/api-headless-cms-storage\";\nimport { CreateElasticsearchIndexTask } from \"~/tasks/CreateElasticsearchIndexTask.js\";\nimport { CmsEntitiesDbRegistryDecorator } from \"~/registry/CmsEntitiesDbRegistryDecorator.js\";\nimport { DdbEsGroupStorageOpsFeature } from \"~/operations/group/feature.js\";\nimport { DdbEsModelStorageOpsFeature } from \"~/operations/model/feature.js\";\nimport { DdbEsEntryStorageOpsFeature } from \"~/operations/entry/feature.js\";\n\n/**\n * DynamoDB+OpenSearch CMS storage. Register it once, in the root container. Tables and entities are\n * built once per process; the storage operations are transient, and per-request state (the entry\n * DataLoaders, the filter registries, the OpenSearch field indexes and model index cache) is\n * container scoped, so each request (child) container gets its own.\n */\nexport const HeadlessCmsDdbEsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n FilterUtilFeature.register(container);\n\n const db = container.resolve(DynamoDBClient);\n const documentClient = db.client;\n\n const tableInstance = createTable({\n name: process.env.DB_TABLE as string,\n documentClient\n });\n const tableElasticsearchInstance = createOpenSearchTable({\n name: process.env.DB_TABLE_OPENSEARCH as string,\n documentClient\n });\n\n const groupEntity = createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n });\n const modelEntity = createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n });\n const entryEntity = createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n });\n const entriesEsEntity = createOpenSearchEntity({\n entityName: ENTITIES.ENTRIES_ES,\n table: tableElasticsearchInstance\n });\n\n // Register infrastructure instances (app-scoped)\n container.registerInstance(CmsDdbEsTable, tableInstance);\n container.registerInstance(CmsDdbEsOsTable, tableElasticsearchInstance);\n container.registerInstance(CmsDdbEsGroupEntity, groupEntity);\n container.registerInstance(CmsDdbEsModelEntity, modelEntity);\n container.registerInstance(CmsDdbEsEntryEntity, entryEntity);\n container.registerInstance(CmsDdbEsEntriesEsEntity, entriesEsEntity);\n\n CmsEntryOpenSearchUtilsFeature.register(container);\n FilterRegistriesFeature.register(container);\n\n container.register(CreateElasticsearchIndexTask);\n\n // Adds the CMS entities to every request's DbRegistry, for the DDB to OpenSearch sync.\n container.registerDecorator(CmsEntitiesDbRegistryDecorator);\n\n DdbEsGroupStorageOpsFeature.register(container);\n DdbEsModelStorageOpsFeature.register(container);\n DdbEsEntryStorageOpsFeature.register(container);\n }\n});\n"],"names":["HeadlessCmsDdbEsFeature","createFeature","container","FilterUtilFeature","db","DynamoDBClient","documentClient","tableInstance","createTable","process","tableElasticsearchInstance","createOpenSearchTable","groupEntity","createGroupEntity","ENTITIES","modelEntity","createModelEntity","entryEntity","createEntryEntity","entriesEsEntity","createOpenSearchEntity","CmsDdbEsTable","CmsDdbEsOsTable","CmsDdbEsGroupEntity","CmsDdbEsModelEntity","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsEntryOpenSearchUtilsFeature","FilterRegistriesFeature","CreateElasticsearchIndexTask","CmsEntitiesDbRegistryDecorator","DdbEsGroupStorageOpsFeature","DdbEsModelStorageOpsFeature","DdbEsEntryStorageOpsFeature"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BO,MAAMA,0BAA0BC,cAAc;IACjD,MAAM;IACN,UAAUC,CAAAA;QACNC,kBAAkB,QAAQ,CAACD;QAE3B,MAAME,KAAKF,UAAU,OAAO,CAACG;QAC7B,MAAMC,iBAAiBF,GAAG,MAAM;QAEhC,MAAMG,gBAAgBC,YAAY;YAC9B,MAAMC,QAAQ,GAAG,CAAC,QAAQ;YAC1BH;QACJ;QACA,MAAMI,6BAA6BC,sBAAsB;YACrD,MAAMF,QAAQ,GAAG,CAAC,mBAAmB;YACrCH;QACJ;QAEA,MAAMM,cAAcC,kBAAkB;YAClC,YAAYC,SAAS,MAAM;YAC3B,OAAOP;QACX;QACA,MAAMQ,cAAcC,kBAAkB;YAClC,YAAYF,SAAS,MAAM;YAC3B,OAAOP;QACX;QACA,MAAMU,cAAcC,kBAAkB;YAClC,YAAYJ,SAAS,OAAO;YAC5B,OAAOP;QACX;QACA,MAAMY,kBAAkBC,uBAAuB;YAC3C,YAAYN,SAAS,UAAU;YAC/B,OAAOJ;QACX;QAGAR,UAAU,gBAAgB,CAACmB,eAAed;QAC1CL,UAAU,gBAAgB,CAACoB,iBAAiBZ;QAC5CR,UAAU,gBAAgB,CAACqB,qBAAqBX;QAChDV,UAAU,gBAAgB,CAACsB,qBAAqBT;QAChDb,UAAU,gBAAgB,CAACuB,qBAAqBR;QAChDf,UAAU,gBAAgB,CAACwB,yBAAyBP;QAEpDQ,+BAA+B,QAAQ,CAACzB;QACxC0B,wBAAwB,QAAQ,CAAC1B;QAEjCA,UAAU,QAAQ,CAAC2B;QAGnB3B,UAAU,iBAAiB,CAAC4B;QAE5BC,4BAA4B,QAAQ,CAAC7B;QACrC8B,4BAA4B,QAAQ,CAAC9B;QACrC+B,4BAA4B,QAAQ,CAAC/B;IACzC;AACJ"}
package/index.d.ts CHANGED
@@ -1,3 +1 @@
1
- import { StorageOperationsFactory } from "./types";
2
- export * from "./plugins";
3
- export declare const createStorageOperations: StorageOperationsFactory;
1
+ export { HeadlessCmsDdbEsFeature } from "./feature.js";
package/index.js CHANGED
@@ -1,214 +1 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- var _exportNames = {
8
- createStorageOperations: true
9
- };
10
- exports.createStorageOperations = void 0;
11
- var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
12
- var _elasticsearch = _interopRequireDefault(require("./elasticsearch"));
13
- var _dynamoDb = _interopRequireDefault(require("./dynamoDb"));
14
- var _settings = require("./operations/settings");
15
- var _system = require("./operations/system");
16
- var _model = require("./operations/model");
17
- var _entry = require("./operations/entry");
18
- var _types = require("./types");
19
- var _table = require("./definitions/table");
20
- var _tableElasticsearch = require("./definitions/tableElasticsearch");
21
- var _group = require("./definitions/group");
22
- var _model2 = require("./definitions/model");
23
- var _entry2 = require("./definitions/entry");
24
- var _entryElasticsearch = require("./definitions/entryElasticsearch");
25
- var _system2 = require("./definitions/system");
26
- var _settings2 = require("./definitions/settings");
27
- var _createElasticsearchIndex = require("./elasticsearch/createElasticsearchIndex");
28
- var _plugins = require("@webiny/plugins");
29
- var _group2 = require("./operations/group");
30
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
31
- var _indices = require("./elasticsearch/indices");
32
- var _deleteElasticsearchIndex = require("./elasticsearch/deleteElasticsearchIndex");
33
- var _plugins2 = require("./plugins");
34
- Object.keys(_plugins2).forEach(function (key) {
35
- if (key === "default" || key === "__esModule") return;
36
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
37
- if (key in exports && exports[key] === _plugins2[key]) return;
38
- Object.defineProperty(exports, key, {
39
- enumerable: true,
40
- get: function () {
41
- return _plugins2[key];
42
- }
43
- });
44
- });
45
- var _plugins3 = require("./operations/entry/elasticsearch/filtering/plugins");
46
- var _CmsEntryFilterPlugin = require("./plugins/CmsEntryFilterPlugin");
47
- const createStorageOperations = params => {
48
- const {
49
- attributes,
50
- table,
51
- esTable,
52
- documentClient,
53
- elasticsearch,
54
- plugins: userPlugins
55
- } = params;
56
- const tableInstance = (0, _table.createTable)({
57
- table,
58
- documentClient
59
- });
60
- const tableElasticsearchInstance = (0, _tableElasticsearch.createElasticsearchTable)({
61
- table: esTable,
62
- documentClient
63
- });
64
- const entities = {
65
- settings: (0, _settings2.createSettingsEntity)({
66
- entityName: _types.ENTITIES.SETTINGS,
67
- table: tableInstance,
68
- attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
69
- }),
70
- system: (0, _system2.createSystemEntity)({
71
- entityName: _types.ENTITIES.SYSTEM,
72
- table: tableInstance,
73
- attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
74
- }),
75
- groups: (0, _group.createGroupEntity)({
76
- entityName: _types.ENTITIES.GROUPS,
77
- table: tableInstance,
78
- attributes: attributes ? attributes[_types.ENTITIES.GROUPS] : {}
79
- }),
80
- models: (0, _model2.createModelEntity)({
81
- entityName: _types.ENTITIES.MODELS,
82
- table: tableInstance,
83
- attributes: attributes ? attributes[_types.ENTITIES.MODELS] : {}
84
- }),
85
- entries: (0, _entry2.createEntryEntity)({
86
- entityName: _types.ENTITIES.ENTRIES,
87
- table: tableInstance,
88
- attributes: attributes ? attributes[_types.ENTITIES.ENTRIES] : {}
89
- }),
90
- entriesEs: (0, _entryElasticsearch.createEntryElasticsearchEntity)({
91
- entityName: _types.ENTITIES.ENTRIES_ES,
92
- table: tableElasticsearchInstance,
93
- attributes: attributes ? attributes[_types.ENTITIES.ENTRIES_ES] : {}
94
- })
95
- };
96
- const plugins = new _plugins.PluginsContainer([
97
- /**
98
- * DynamoDB filter plugins for the where conditions.
99
- */
100
- (0, _filters.default)(),
101
- /**
102
- * Field plugins for DynamoDB.
103
- */
104
- (0, _dynamoDb.default)(),
105
- /**
106
- * Field plugins for Elasticsearch.
107
- */
108
- (0, _elasticsearch.default)(),
109
- /**
110
- * Built-in Elasticsearch index templates.
111
- */
112
- (0, _indices.elasticsearchIndexPlugins)(),
113
- /**
114
- * Filter plugins used to apply filtering from where conditions to Elasticsearch query.
115
- */
116
- (0, _plugins3.createFilterPlugins)(),
117
- /**
118
- * User defined custom plugins.
119
- * They are at the end because we can then override existing plugins.
120
- */
121
- ...(userPlugins || [])]);
122
- return {
123
- name: "dynamodb:elasticsearch",
124
- beforeInit: async context => {
125
- /**
126
- * Attach the elasticsearch into context if it is not already attached.
127
- */
128
- if (!context.elasticsearch) {
129
- context.elasticsearch = elasticsearch;
130
- }
131
- /**
132
- * Pass the plugins to the parent context.
133
- */
134
- context.plugins.register([(0, _dynamoDb.default)()]);
135
- /**
136
- * We need to fetch all the plugin types in the list from the main container.
137
- * This way we do not need to register plugins in the storage plugins contains.
138
- */
139
- const types = [
140
- // Elasticsearch
141
- _apiElasticsearch.CompressionPlugin.type, _apiElasticsearch.ElasticsearchQueryBuilderOperatorPlugin.type,
142
- // Headless CMS
143
- "cms-model-field-to-graphql", _CmsEntryFilterPlugin.CmsEntryFilterPlugin.type, _plugins2.CmsEntryElasticsearchBodyModifierPlugin.type, _plugins2.CmsEntryElasticsearchFullTextSearchPlugin.type, _plugins2.CmsEntryElasticsearchIndexPlugin.type, _plugins2.CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type, _plugins2.CmsEntryElasticsearchQueryModifierPlugin.type, _plugins2.CmsEntryElasticsearchSortModifierPlugin.type, _plugins2.CmsEntryElasticsearchFieldPlugin.type];
144
- for (const type of types) {
145
- plugins.mergeByType(context.plugins, type);
146
- }
147
- },
148
- init: async context => {
149
- /**
150
- * We need to create indexes on before model create and on clone (create from).
151
- * Other apps create indexes on locale creation.
152
- */
153
- context.cms.onModelBeforeCreate.subscribe(async ({
154
- model
155
- }) => {
156
- await (0, _createElasticsearchIndex.createElasticsearchIndex)({
157
- elasticsearch,
158
- model,
159
- plugins
160
- });
161
- });
162
- context.cms.onModelBeforeCreateFrom.subscribe(async ({
163
- model
164
- }) => {
165
- await (0, _createElasticsearchIndex.createElasticsearchIndex)({
166
- elasticsearch,
167
- model,
168
- plugins
169
- });
170
- });
171
- context.cms.onModelAfterDelete.subscribe(async ({
172
- model
173
- }) => {
174
- await (0, _deleteElasticsearchIndex.deleteElasticsearchIndex)({
175
- elasticsearch,
176
- model
177
- });
178
- });
179
- context.cms.onModelInitialize.subscribe(async ({
180
- model
181
- }) => {
182
- await (0, _createElasticsearchIndex.createElasticsearchIndex)({
183
- elasticsearch,
184
- model,
185
- plugins
186
- });
187
- });
188
- },
189
- getEntities: () => entities,
190
- getTable: () => tableInstance,
191
- getEsTable: () => tableElasticsearchInstance,
192
- system: (0, _system.createSystemStorageOperations)({
193
- entity: entities.system
194
- }),
195
- settings: (0, _settings.createSettingsStorageOperations)({
196
- entity: entities.settings
197
- }),
198
- groups: (0, _group2.createGroupsStorageOperations)({
199
- entity: entities.groups,
200
- plugins
201
- }),
202
- models: (0, _model.createModelsStorageOperations)({
203
- entity: entities.models,
204
- elasticsearch
205
- }),
206
- entries: (0, _entry.createEntriesStorageOperations)({
207
- entity: entities.entries,
208
- esEntity: entities.entriesEs,
209
- plugins,
210
- elasticsearch
211
- })
212
- };
213
- };
214
- exports.createStorageOperations = createStorageOperations;
1
+ export { HeadlessCmsDdbEsFeature } from "./feature.js";
@@ -0,0 +1,24 @@
1
+ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsCreateParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { CreateEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.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 DdbEsCreateEntryImpl implements CreateEntryStorageOperation.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: CmsEntryStorageOperationsCreateParams<T>): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>>;
20
+ }
21
+ export declare const DdbEsCreateEntry: typeof DdbEsCreateEntryImpl & {
22
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js").ICreateEntryStorageOperation>;
23
+ };
24
+ export {};
@@ -0,0 +1,134 @@
1
+ import error from "@webiny/error";
2
+ import { CreateEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.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, createEntryPublishedKeys, createEntryRevisionKeys } from "./keys.js";
12
+ class DdbEsCreateEntryImpl {
13
+ constructor(entity, esEntity, dataLoaders, storageModelProvider, fieldIndexRegistry, compressionHandler, indexProvider, 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.indexProvider = indexProvider;
21
+ this.valuesModifiers = valuesModifiers;
22
+ }
23
+ async execute(initialModel, params) {
24
+ const { entry: initialEntry, storageEntry: initialStorageEntry } = params;
25
+ const model = this.storageModelProvider.getModel(initialModel);
26
+ const isPublished = "published" === initialEntry.status;
27
+ const locked = isPublished ? true : initialEntry.locked;
28
+ initialEntry.locked = locked;
29
+ initialStorageEntry.locked = locked;
30
+ const transformer = createTransformer({
31
+ fieldIndexRegistry: this.fieldIndexRegistry,
32
+ model,
33
+ entry: initialEntry,
34
+ storageEntry: initialStorageEntry,
35
+ compressionHandler: this.compressionHandler,
36
+ valuesModifiers: this.valuesModifiers
37
+ });
38
+ const { entry, storageEntry } = transformer.transformEntryKeys();
39
+ const esEntry = transformer.transformToIndex();
40
+ const configurations = createConfigurations(this.indexProvider);
41
+ const { index: esIndex } = await configurations.es({
42
+ model
43
+ });
44
+ const revisionKeys = createEntryRevisionKeys(entry);
45
+ const latestKeys = createEntryLatestKeys(entry);
46
+ const publishedKeys = createEntryPublishedKeys(entry);
47
+ const entityBatch = this.entity.createEntityWriter({
48
+ put: [
49
+ {
50
+ ...revisionKeys,
51
+ data: {
52
+ ...storageEntry,
53
+ locked
54
+ }
55
+ },
56
+ {
57
+ ...latestKeys,
58
+ data: {
59
+ ...storageEntry,
60
+ locked
61
+ }
62
+ }
63
+ ]
64
+ });
65
+ if (isPublished) entityBatch.put({
66
+ ...publishedKeys,
67
+ data: {
68
+ ...storageEntry,
69
+ locked
70
+ }
71
+ });
72
+ try {
73
+ await entityBatch.execute();
74
+ this.dataLoaders.clearAll({
75
+ tenant: entry.tenant
76
+ });
77
+ } catch (ex) {
78
+ throw new error(ex.message || "Could not insert entry data into the DynamoDB table.", ex.code || "CREATE_ENTRY_ERROR", {
79
+ error: ex,
80
+ entry,
81
+ storageEntry
82
+ });
83
+ }
84
+ const esLatestData = await transformer.getElasticsearchLatestEntryData();
85
+ const elasticsearchEntityBatch = this.esEntity.createEntityWriter({
86
+ put: [
87
+ {
88
+ ...latestKeys,
89
+ index: esIndex,
90
+ data: esLatestData
91
+ }
92
+ ]
93
+ });
94
+ if (isPublished) {
95
+ const esPublishedData = await transformer.getElasticsearchPublishedEntryData();
96
+ elasticsearchEntityBatch.put({
97
+ ...publishedKeys,
98
+ index: esIndex,
99
+ data: esPublishedData
100
+ });
101
+ }
102
+ try {
103
+ await elasticsearchEntityBatch.execute();
104
+ } catch (ex) {
105
+ throw new error(ex.message || "Could not insert entry data into the Elasticsearch DynamoDB table.", ex.code || "CREATE_ES_ENTRY_ERROR", {
106
+ error: ex,
107
+ entry,
108
+ esEntry
109
+ });
110
+ }
111
+ return initialStorageEntry;
112
+ }
113
+ }
114
+ const DdbEsCreateEntry = CreateEntryStorageOperation.createImplementation({
115
+ implementation: DdbEsCreateEntryImpl,
116
+ dependencies: [
117
+ CmsDdbEsEntryEntity,
118
+ CmsDdbEsEntriesEsEntity,
119
+ CmsDdbEsDataLoaders,
120
+ CmsStorageModelProvider,
121
+ CmsEntryOpenSearchFieldIndexRegistry,
122
+ CompressionHandler,
123
+ CmsModelOpenSearchIndexProvider,
124
+ [
125
+ CmsEntryOpenSearchValuesModifier,
126
+ {
127
+ multiple: true
128
+ }
129
+ ]
130
+ ]
131
+ });
132
+ export { DdbEsCreateEntry };
133
+
134
+ //# sourceMappingURL=DdbEsCreateEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/DdbEsCreateEntry.js","sources":["../../../src/operations/entry/DdbEsCreateEntry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsCreateParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CreateEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.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 DdbEsCreateEntryImpl implements CreateEntryStorageOperation.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: CmsEntryStorageOperationsCreateParams<T>\n ) {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const isPublished = initialEntry.status === \"published\";\n const locked = isPublished ? true : initialEntry.locked;\n\n initialEntry.locked = locked;\n initialStorageEntry.locked = locked;\n\n const transformer = createTransformer<T>({\n fieldIndexRegistry: this.fieldIndexRegistry,\n model,\n entry: initialEntry,\n storageEntry: initialStorageEntry,\n compressionHandler: this.compressionHandler,\n valuesModifiers: this.valuesModifiers\n });\n\n const { entry, storageEntry } = transformer.transformEntryKeys();\n\n const esEntry = transformer.transformToIndex();\n\n const configurations = createConfigurations(this.indexProvider);\n const { index: esIndex } = await configurations.es({\n model\n });\n\n const revisionKeys = createEntryRevisionKeys(entry);\n const latestKeys = createEntryLatestKeys(entry);\n const publishedKeys = createEntryPublishedKeys(entry);\n\n const entityBatch = this.entity.createEntityWriter({\n put: [\n {\n ...revisionKeys,\n data: {\n ...storageEntry,\n locked\n }\n },\n {\n ...latestKeys,\n data: {\n ...storageEntry,\n locked\n }\n }\n ]\n });\n\n if (isPublished) {\n entityBatch.put({\n ...publishedKeys,\n data: {\n ...storageEntry,\n locked\n }\n });\n }\n\n try {\n await entityBatch.execute();\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not insert entry data into the DynamoDB table.\",\n ex.code || \"CREATE_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n\n const esLatestData = await transformer.getElasticsearchLatestEntryData();\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 insert entry data into the Elasticsearch DynamoDB table.\",\n ex.code || \"CREATE_ES_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n esEntry\n }\n );\n }\n\n return initialStorageEntry;\n }\n}\n\nexport const DdbEsCreateEntry = CreateEntryStorageOperation.createImplementation({\n implementation: DdbEsCreateEntryImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider,\n CmsEntryOpenSearchFieldIndexRegistry,\n CompressionHandler,\n CmsModelOpenSearchIndexProvider,\n [CmsEntryOpenSearchValuesModifier, { multiple: true }]\n ]\n});\n"],"names":["DdbEsCreateEntryImpl","entity","esEntity","dataLoaders","storageModelProvider","fieldIndexRegistry","compressionHandler","indexProvider","valuesModifiers","initialModel","params","initialEntry","initialStorageEntry","model","isPublished","locked","transformer","createTransformer","entry","storageEntry","esEntry","configurations","createConfigurations","esIndex","revisionKeys","createEntryRevisionKeys","latestKeys","createEntryLatestKeys","publishedKeys","createEntryPublishedKeys","entityBatch","ex","WebinyError","esLatestData","elasticsearchEntityBatch","esPublishedData","DdbEsCreateEntry","CreateEntryStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider","CmsEntryOpenSearchFieldIndexRegistry","CompressionHandler","CmsModelOpenSearchIndexProvider","CmsEntryOpenSearchValuesModifier"],"mappings":";;;;;;;;;;;AAyBA,MAAMA;IACF,YACYC,MAAqC,EACrCC,QAA2C,EAC3CC,WAA0C,EAC1CC,oBAAuD,EACvDC,kBAAkE,EAClEC,kBAAgD,EAChDC,aAAwD,EACxDC,eAA6D,CACvE;aARUP,MAAM,GAANA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;aACAC,kBAAkB,GAAlBA;aACAC,kBAAkB,GAAlBA;aACAC,aAAa,GAAbA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAgD,EAClD;QACE,MAAM,EAAE,OAAOC,YAAY,EAAE,cAAcC,mBAAmB,EAAE,GAAGF;QAEnE,MAAMG,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIJ;QAEpD,MAAMK,cAAcH,AAAwB,gBAAxBA,aAAa,MAAM;QACvC,MAAMI,SAASD,cAAc,OAAOH,aAAa,MAAM;QAEvDA,aAAa,MAAM,GAAGI;QACtBH,oBAAoB,MAAM,GAAGG;QAE7B,MAAMC,cAAcC,kBAAqB;YACrC,oBAAoB,IAAI,CAAC,kBAAkB;YAC3CJ;YACA,OAAOF;YACP,cAAcC;YACd,oBAAoB,IAAI,CAAC,kBAAkB;YAC3C,iBAAiB,IAAI,CAAC,eAAe;QACzC;QAEA,MAAM,EAAEM,KAAK,EAAEC,YAAY,EAAE,GAAGH,YAAY,kBAAkB;QAE9D,MAAMI,UAAUJ,YAAY,gBAAgB;QAE5C,MAAMK,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAC9D,MAAM,EAAE,OAAOC,OAAO,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YAC/CR;QACJ;QAEA,MAAMW,eAAeC,wBAAwBP;QAC7C,MAAMQ,aAAaC,sBAAsBT;QACzC,MAAMU,gBAAgBC,yBAAyBX;QAE/C,MAAMY,cAAc,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;YAC/C,KAAK;gBACD;oBACI,GAAGN,YAAY;oBACf,MAAM;wBACF,GAAGL,YAAY;wBACfJ;oBACJ;gBACJ;gBACA;oBACI,GAAGW,UAAU;oBACb,MAAM;wBACF,GAAGP,YAAY;wBACfJ;oBACJ;gBACJ;aACH;QACL;QAEA,IAAID,aACAgB,YAAY,GAAG,CAAC;YACZ,GAAGF,aAAa;YAChB,MAAM;gBACF,GAAGT,YAAY;gBACfJ;YACJ;QACJ;QAGJ,IAAI;YACA,MAAMe,YAAY,OAAO;YACzB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACtB,QAAQZ,MAAM,MAAM;YACxB;QACJ,EAAE,OAAOa,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wDACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPb;gBACAC;YACJ;QAER;QAEA,MAAMc,eAAe,MAAMjB,YAAY,+BAA+B;QAEtE,MAAMkB,2BAA2B,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC9D,KAAK;gBACD;oBACI,GAAGR,UAAU;oBACb,OAAOH;oBACP,MAAMU;gBACV;aACH;QACL;QAEA,IAAInB,aAAa;YACb,MAAMqB,kBAAkB,MAAMnB,YAAY,kCAAkC;YAC5EkB,yBAAyB,GAAG,CAAC;gBACzB,GAAGN,aAAa;gBAChB,OAAOL;gBACP,MAAMY;YACV;QACJ;QAEA,IAAI;YACA,MAAMD,yBAAyB,OAAO;QAC1C,EAAE,OAAOH,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,sEACdA,GAAG,IAAI,IAAI,yBACX;gBACI,OAAOA;gBACPb;gBACAE;YACJ;QAER;QAEA,OAAOR;IACX;AACJ;AAEO,MAAMwB,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBrC;IAChB,cAAc;QACVsC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACA;YAACC;YAAkC;gBAAE,UAAU;YAAK;SAAE;KACzD;AACL"}
@@ -0,0 +1,24 @@
1
+ import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsCreateRevisionFromParams } from "@webiny/api-headless-cms/types/index.js";
2
+ import { CreateEntryRevisionFromStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.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 DdbEsCreateEntryRevisionFromImpl implements CreateEntryRevisionFromStorageOperation.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: CmsEntryStorageOperationsCreateRevisionFromParams<T>): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>>;
20
+ }
21
+ export declare const DdbEsCreateEntryRevisionFrom: typeof DdbEsCreateEntryRevisionFromImpl & {
22
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js").ICreateEntryRevisionFromStorageOperation>;
23
+ };
24
+ export {};
@@ -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