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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (430) 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 -6
  24. package/definitions/entry.js +8 -179
  25. package/definitions/entry.js.map +1 -1
  26. package/definitions/group.d.ts +6 -7
  27. package/definitions/group.js +8 -63
  28. package/definitions/group.js.map +1 -1
  29. package/definitions/model.d.ts +6 -7
  30. package/definitions/model.js +8 -107
  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 +9 -0
  35. package/feature.js +55 -0
  36. package/feature.js.map +1 -0
  37. package/index.d.ts +2 -3
  38. package/index.js +2 -225
  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 +1 -2
  106. package/operations/entry/dataLoader/DataLoaderCache.js +21 -35
  107. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  108. package/operations/entry/dataLoader/constants.js +2 -7
  109. package/operations/entry/dataLoader/constants.js.map +1 -1
  110. package/operations/entry/dataLoader/createBatchScheduleFn.js +7 -22
  111. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  112. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  113. package/operations/entry/dataLoader/getAllEntryRevisions.js +20 -41
  114. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  115. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  116. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +30 -48
  117. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  118. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  119. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +30 -48
  120. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  121. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  122. package/operations/entry/dataLoader/getRevisionById.js +36 -58
  123. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  124. package/operations/entry/dataLoader/index.d.ts +3 -3
  125. package/operations/entry/dataLoader/index.js +13 -35
  126. package/operations/entry/dataLoader/index.js.map +1 -1
  127. package/operations/entry/dataLoader/types.d.ts +4 -4
  128. package/operations/entry/dataLoader/types.js +0 -7
  129. package/operations/entry/dataLoaders.d.ts +14 -14
  130. package/operations/entry/dataLoaders.js +92 -110
  131. package/operations/entry/dataLoaders.js.map +1 -1
  132. package/operations/entry/feature.d.ts +4 -0
  133. package/operations/entry/feature.js +53 -0
  134. package/operations/entry/feature.js.map +1 -0
  135. package/operations/entry/keys.d.ts +31 -1
  136. package/operations/entry/keys.js +44 -27
  137. package/operations/entry/keys.js.map +1 -1
  138. package/operations/entry/recordType.js +4 -18
  139. package/operations/entry/recordType.js.map +1 -1
  140. package/operations/entry/storageEntryUtils.d.ts +7 -0
  141. package/operations/entry/storageEntryUtils.js +14 -0
  142. package/operations/entry/storageEntryUtils.js.map +1 -0
  143. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  144. package/operations/entry/transformations/convertEntryKeys.js +21 -34
  145. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  146. package/operations/entry/transformations/index.d.ts +21 -18
  147. package/operations/entry/transformations/index.js +87 -123
  148. package/operations/entry/transformations/index.js.map +1 -1
  149. package/operations/entry/transformations/modifyEntryValues.d.ts +30 -35
  150. package/operations/entry/transformations/modifyEntryValues.js +12 -24
  151. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  152. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  153. package/operations/entry/transformations/transformEntryKeys.js +14 -24
  154. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  155. package/operations/group/DdbEsCreateGroup.d.ts +12 -0
  156. package/operations/group/DdbEsCreateGroup.js +35 -0
  157. package/operations/group/DdbEsCreateGroup.js.map +1 -0
  158. package/operations/group/DdbEsDeleteGroup.d.ts +12 -0
  159. package/operations/group/DdbEsDeleteGroup.js +31 -0
  160. package/operations/group/DdbEsDeleteGroup.js.map +1 -0
  161. package/operations/group/DdbEsGetGroup.d.ts +12 -0
  162. package/operations/group/DdbEsGetGroup.js +31 -0
  163. package/operations/group/DdbEsGetGroup.js.map +1 -0
  164. package/operations/group/DdbEsListGroups.d.ts +14 -0
  165. package/operations/group/DdbEsListGroups.js +52 -0
  166. package/operations/group/DdbEsListGroups.js.map +1 -0
  167. package/operations/group/DdbEsUpdateGroup.d.ts +12 -0
  168. package/operations/group/DdbEsUpdateGroup.js +35 -0
  169. package/operations/group/DdbEsUpdateGroup.js.map +1 -0
  170. package/operations/group/feature.d.ts +4 -0
  171. package/operations/group/feature.js +19 -0
  172. package/operations/group/feature.js.map +1 -0
  173. package/operations/group/keys.d.ts +15 -0
  174. package/operations/group/keys.js +17 -0
  175. package/operations/group/keys.js.map +1 -0
  176. package/operations/model/DdbEsCreateModel.d.ts +16 -0
  177. package/operations/model/DdbEsCreateModel.js +56 -0
  178. package/operations/model/DdbEsCreateModel.js.map +1 -0
  179. package/operations/model/DdbEsDeleteModel.d.ts +12 -0
  180. package/operations/model/DdbEsDeleteModel.js +31 -0
  181. package/operations/model/DdbEsDeleteModel.js.map +1 -0
  182. package/operations/model/DdbEsGetModel.d.ts +12 -0
  183. package/operations/model/DdbEsGetModel.js +30 -0
  184. package/operations/model/DdbEsGetModel.js.map +1 -0
  185. package/operations/model/DdbEsListModels.d.ts +12 -0
  186. package/operations/model/DdbEsListModels.js +36 -0
  187. package/operations/model/DdbEsListModels.js.map +1 -0
  188. package/operations/model/DdbEsUpdateModel.d.ts +12 -0
  189. package/operations/model/DdbEsUpdateModel.js +36 -0
  190. package/operations/model/DdbEsUpdateModel.js.map +1 -0
  191. package/operations/model/feature.d.ts +4 -0
  192. package/operations/model/feature.js +19 -0
  193. package/operations/model/feature.js.map +1 -0
  194. package/operations/model/keys.d.ts +15 -0
  195. package/operations/model/keys.js +17 -0
  196. package/operations/model/keys.js.map +1 -0
  197. package/package.json +40 -36
  198. package/requestFeature.d.ts +20 -0
  199. package/requestFeature.js +54 -0
  200. package/requestFeature.js.map +1 -0
  201. package/tasks/CreateElasticsearchIndexTask.d.ts +13 -0
  202. package/tasks/CreateElasticsearchIndexTask.js +40 -0
  203. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  204. package/types.d.ts +12 -159
  205. package/types.js +7 -39
  206. package/types.js.map +1 -1
  207. package/configurations.d.ts +0 -19
  208. package/configurations.js +0 -49
  209. package/configurations.js.map +0 -1
  210. package/definitions/entryElasticsearch.d.ts +0 -9
  211. package/definitions/entryElasticsearch.js +0 -41
  212. package/definitions/entryElasticsearch.js.map +0 -1
  213. package/definitions/system.d.ts +0 -9
  214. package/definitions/system.js +0 -42
  215. package/definitions/system.js.map +0 -1
  216. package/definitions/table.d.ts +0 -8
  217. package/definitions/table.js +0 -25
  218. package/definitions/table.js.map +0 -1
  219. package/definitions/tableElasticsearch.d.ts +0 -8
  220. package/definitions/tableElasticsearch.js +0 -25
  221. package/definitions/tableElasticsearch.js.map +0 -1
  222. package/dynamoDb/index.d.ts +0 -3
  223. package/dynamoDb/index.js +0 -16
  224. package/dynamoDb/index.js.map +0 -1
  225. package/dynamoDb/storage/longText.d.ts +0 -10
  226. package/dynamoDb/storage/longText.js +0 -96
  227. package/dynamoDb/storage/longText.js.map +0 -1
  228. package/dynamoDb/storage/richText.d.ts +0 -2
  229. package/dynamoDb/storage/richText.js +0 -59
  230. package/dynamoDb/storage/richText.js.map +0 -1
  231. package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
  232. package/elasticsearch/createElasticsearchIndex.js +0 -40
  233. package/elasticsearch/createElasticsearchIndex.js.map +0 -1
  234. package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
  235. package/elasticsearch/deleteElasticsearchIndex.js +0 -38
  236. package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
  237. package/elasticsearch/index.d.ts +0 -2
  238. package/elasticsearch/index.js +0 -13
  239. package/elasticsearch/index.js.map +0 -1
  240. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  241. package/elasticsearch/indexing/dateTimeIndexing.js +0 -88
  242. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  243. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  244. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -54
  245. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  246. package/elasticsearch/indexing/index.d.ts +0 -2
  247. package/elasticsearch/indexing/index.js +0 -18
  248. package/elasticsearch/indexing/index.js.map +0 -1
  249. package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
  250. package/elasticsearch/indexing/jsonIndexing.js +0 -28
  251. package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
  252. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  253. package/elasticsearch/indexing/longTextIndexing.js +0 -42
  254. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  255. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  256. package/elasticsearch/indexing/numberIndexing.js +0 -41
  257. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  258. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  259. package/elasticsearch/indexing/objectIndexing.js +0 -201
  260. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  261. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  262. package/elasticsearch/indexing/richTextIndexing.js +0 -31
  263. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  264. package/elasticsearch/indices/base.d.ts +0 -2
  265. package/elasticsearch/indices/base.js +0 -13
  266. package/elasticsearch/indices/base.js.map +0 -1
  267. package/elasticsearch/indices/index.d.ts +0 -1
  268. package/elasticsearch/indices/index.js +0 -14
  269. package/elasticsearch/indices/index.js.map +0 -1
  270. package/elasticsearch/indices/japanese.d.ts +0 -2
  271. package/elasticsearch/indices/japanese.js +0 -14
  272. package/elasticsearch/indices/japanese.js.map +0 -1
  273. package/elasticsearch/search/index.d.ts +0 -3
  274. package/elasticsearch/search/index.js +0 -13
  275. package/elasticsearch/search/index.js.map +0 -1
  276. package/elasticsearch/search/refSearch.d.ts +0 -2
  277. package/elasticsearch/search/refSearch.js +0 -31
  278. package/elasticsearch/search/refSearch.js.map +0 -1
  279. package/elasticsearch/search/searchableJson.d.ts +0 -2
  280. package/elasticsearch/search/searchableJson.js +0 -60
  281. package/elasticsearch/search/searchableJson.js.map +0 -1
  282. package/elasticsearch/search/timeSearch.d.ts +0 -2
  283. package/elasticsearch/search/timeSearch.js +0 -27
  284. package/elasticsearch/search/timeSearch.js.map +0 -1
  285. package/helpers/entryIndexHelpers.d.ts +0 -18
  286. package/helpers/entryIndexHelpers.js +0 -190
  287. package/helpers/entryIndexHelpers.js.map +0 -1
  288. package/helpers/fieldIdentifier.d.ts +0 -6
  289. package/helpers/fieldIdentifier.js +0 -43
  290. package/helpers/fieldIdentifier.js.map +0 -1
  291. package/helpers/index.d.ts +0 -2
  292. package/helpers/index.js +0 -29
  293. package/helpers/index.js.map +0 -1
  294. package/index.js.map +0 -1
  295. package/operations/entry/dataLoader/types.js.map +0 -1
  296. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
  297. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -34
  298. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
  299. package/operations/entry/elasticsearch/body.d.ts +0 -13
  300. package/operations/entry/elasticsearch/body.js +0 -142
  301. package/operations/entry/elasticsearch/body.js.map +0 -1
  302. package/operations/entry/elasticsearch/fields.d.ts +0 -10
  303. package/operations/entry/elasticsearch/fields.js +0 -315
  304. package/operations/entry/elasticsearch/fields.js.map +0 -1
  305. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -8
  306. package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -60
  307. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
  308. package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -17
  309. package/operations/entry/elasticsearch/filtering/exec.js +0 -175
  310. package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
  311. package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
  312. package/operations/entry/elasticsearch/filtering/index.js +0 -18
  313. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  314. package/operations/entry/elasticsearch/filtering/path.d.ts +0 -16
  315. package/operations/entry/elasticsearch/filtering/path.js +0 -48
  316. package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
  317. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  318. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -30
  319. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  320. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  321. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -15
  322. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  323. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  324. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -69
  325. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  326. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  327. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -57
  328. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  329. package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
  330. package/operations/entry/elasticsearch/filtering/populated.js +0 -25
  331. package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
  332. package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
  333. package/operations/entry/elasticsearch/filtering/values.js +0 -24
  334. package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
  335. package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -12
  336. package/operations/entry/elasticsearch/fullTextSearch.js +0 -91
  337. package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
  338. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
  339. package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -27
  340. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
  341. package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
  342. package/operations/entry/elasticsearch/initialQuery.js +0 -106
  343. package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
  344. package/operations/entry/elasticsearch/keyword.d.ts +0 -2
  345. package/operations/entry/elasticsearch/keyword.js +0 -36
  346. package/operations/entry/elasticsearch/keyword.js.map +0 -1
  347. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  348. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  349. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  350. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  351. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -18
  352. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  353. package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -8
  354. package/operations/entry/elasticsearch/plugins/operator.js +0 -39
  355. package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
  356. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  357. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -18
  358. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  359. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  360. package/operations/entry/elasticsearch/plugins/search.js +0 -26
  361. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  362. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  363. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -18
  364. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  365. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +0 -2
  366. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +0 -13
  367. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +0 -1
  368. package/operations/entry/elasticsearch/sort.d.ts +0 -12
  369. package/operations/entry/elasticsearch/sort.js +0 -89
  370. package/operations/entry/elasticsearch/sort.js.map +0 -1
  371. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -16
  372. package/operations/entry/elasticsearch/transformValueForSearch.js +0 -32
  373. package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
  374. package/operations/entry/elasticsearch/types.d.ts +0 -41
  375. package/operations/entry/elasticsearch/types.js +0 -7
  376. package/operations/entry/elasticsearch/types.js.map +0 -1
  377. package/operations/entry/index.d.ts +0 -11
  378. package/operations/entry/index.js +0 -1881
  379. package/operations/entry/index.js.map +0 -1
  380. package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -10
  381. package/operations/entry/transformations/transformEntryToIndex.js +0 -31
  382. package/operations/entry/transformations/transformEntryToIndex.js.map +0 -1
  383. package/operations/group/index.d.ts +0 -8
  384. package/operations/group/index.js +0 -179
  385. package/operations/group/index.js.map +0 -1
  386. package/operations/model/index.d.ts +0 -8
  387. package/operations/model/index.js +0 -183
  388. package/operations/model/index.js.map +0 -1
  389. package/operations/system/index.d.ts +0 -6
  390. package/operations/system/index.js +0 -94
  391. package/operations/system/index.js.map +0 -1
  392. package/operations/system/indexes.d.ts +0 -10
  393. package/operations/system/indexes.js +0 -41
  394. package/operations/system/indexes.js.map +0 -1
  395. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
  396. package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -52
  397. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
  398. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
  399. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -21
  400. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  401. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  402. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -27
  403. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  404. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  405. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -13
  406. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  407. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -32
  408. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -40
  409. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  410. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
  411. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -21
  412. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  413. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
  414. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -21
  415. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  416. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
  417. package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -50
  418. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
  419. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  420. package/plugins/CmsEntryFilterPlugin.js +0 -22
  421. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  422. package/plugins/index.d.ts +0 -8
  423. package/plugins/index.js +0 -95
  424. package/plugins/index.js.map +0 -1
  425. package/tasks/createIndexTaskPlugin.d.ts +0 -2
  426. package/tasks/createIndexTaskPlugin.js +0 -67
  427. package/tasks/createIndexTaskPlugin.js.map +0 -1
  428. package/values/NoValueContainer.d.ts +0 -5
  429. package/values/NoValueContainer.js +0 -20
  430. package/values/NoValueContainer.js.map +0 -1
@@ -1,52 +1,34 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createGetPublishedRevisionByEntryId = void 0;
8
- var _dataloader = _interopRequireDefault(require("dataloader"));
9
- var _dbDynamodb = require("@webiny/db-dynamodb");
10
- var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
11
- var _keys = require("../keys");
12
- var _createBatchScheduleFn = require("./createBatchScheduleFn");
13
- const createGetPublishedRevisionByEntryId = params => {
14
- const {
15
- entity,
16
- locale,
17
- tenant
18
- } = params;
19
- const publishedKey = (0, _keys.createPublishedSortKey)();
20
- return new _dataloader.default(async ids => {
21
- const queries = ids.reduce((collection, id) => {
22
- const partitionKey = (0, _keys.createPartitionKey)({
23
- tenant,
24
- locale,
25
- id
26
- });
27
- if (collection[partitionKey]) {
28
- return collection;
29
- }
30
- collection[partitionKey] = entity.getBatch({
31
- PK: partitionKey,
32
- SK: publishedKey
33
- });
34
- return collection;
35
- }, {});
36
- const records = await (0, _dbDynamodb.batchReadAll)({
37
- table: entity.table,
38
- items: Object.values(queries)
39
- });
40
- const items = (0, _cleanup.cleanupItems)(entity, records);
41
- return ids.map(entryId => {
42
- return items.filter(item => {
43
- return entryId === item.entryId;
44
- });
1
+ import dataloader from "dataloader";
2
+ import { createPartitionKey, createPublishedSortKey } from "../keys.js";
3
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
4
+ const createGetPublishedRevisionByEntryId = (params)=>{
5
+ const { entity, tenant, modelId } = params;
6
+ const publishedKey = createPublishedSortKey();
7
+ return new dataloader(async (ids)=>{
8
+ const reader = entity.createEntityReader();
9
+ const keys = new Set();
10
+ for (const id of ids){
11
+ const partitionKey = createPartitionKey({
12
+ tenant,
13
+ id
14
+ });
15
+ if (!keys.has(partitionKey)) {
16
+ keys.add(partitionKey);
17
+ reader.get({
18
+ PK: partitionKey,
19
+ SK: publishedKey
20
+ });
21
+ }
22
+ }
23
+ const items = (await reader.execute()).map((item)=>item.data);
24
+ return ids.map((entryId)=>items.filter((item)=>{
25
+ if (item.modelId !== modelId) return false;
26
+ return entryId === item.entryId;
27
+ }));
28
+ }, {
29
+ batchScheduleFn: createBatchScheduleFn()
45
30
  });
46
- }, {
47
- batchScheduleFn: (0, _createBatchScheduleFn.createBatchScheduleFn)()
48
- });
49
31
  };
50
- exports.createGetPublishedRevisionByEntryId = createGetPublishedRevisionByEntryId;
32
+ export { createGetPublishedRevisionByEntryId };
51
33
 
52
34
  //# sourceMappingURL=getPublishedRevisionByEntryId.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_keys","_createBatchScheduleFn","createGetPublishedRevisionByEntryId","params","entity","locale","tenant","publishedKey","createPublishedSortKey","DataLoader","ids","queries","reduce","collection","id","partitionKey","createPartitionKey","getBatch","PK","SK","records","batchReadAll","table","items","Object","values","cleanupItems","map","entryId","filter","item","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getPublishedRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { createPartitionKey, createPublishedSortKey } from \"~/operations/entry/keys\";\nimport type { DataLoaderParams } from \"./types\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\n\nexport const createGetPublishedRevisionByEntryId = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n\n const publishedKey = createPublishedSortKey();\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const queries = ids.reduce<Record<string, ReturnType<typeof entity.getBatch>>>(\n (collection, id) => {\n const partitionKey = createPartitionKey({\n tenant,\n locale,\n id\n });\n if (collection[partitionKey]) {\n return collection;\n }\n collection[partitionKey] = entity.getBatch({\n PK: partitionKey,\n SK: publishedKey\n });\n return collection;\n },\n {}\n );\n\n const records = await batchReadAll<CmsStorageEntry>({\n table: entity.table,\n items: Object.values(queries)\n });\n const items = cleanupItems(entity, records);\n\n return ids.map(entryId => {\n return items.filter(item => {\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,sBAAA,GAAAJ,OAAA;AAEO,MAAMK,mCAAmC,GAAIC,MAAwB,IAAK;EAC7E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEzC,MAAMI,YAAY,GAAG,IAAAC,4BAAsB,EAAC,CAAC;EAC7C,OAAO,IAAIC,mBAAU,CACjB,MAAOC,GAAsB,IAAK;IAC9B,MAAMC,OAAO,GAAGD,GAAG,CAACE,MAAM,CACtB,CAACC,UAAU,EAAEC,EAAE,KAAK;MAChB,MAAMC,YAAY,GAAG,IAAAC,wBAAkB,EAAC;QACpCV,MAAM;QACND,MAAM;QACNS;MACJ,CAAC,CAAC;MACF,IAAID,UAAU,CAACE,YAAY,CAAC,EAAE;QAC1B,OAAOF,UAAU;MACrB;MACAA,UAAU,CAACE,YAAY,CAAC,GAAGX,MAAM,CAACa,QAAQ,CAAC;QACvCC,EAAE,EAAEH,YAAY;QAChBI,EAAE,EAAEZ;MACR,CAAC,CAAC;MACF,OAAOM,UAAU;IACrB,CAAC,EACD,CAAC,CACL,CAAC;IAED,MAAMO,OAAO,GAAG,MAAM,IAAAC,wBAAY,EAAkB;MAChDC,KAAK,EAAElB,MAAM,CAACkB,KAAK;MACnBC,KAAK,EAAEC,MAAM,CAACC,MAAM,CAACd,OAAO;IAChC,CAAC,CAAC;IACF,MAAMY,KAAK,GAAG,IAAAG,qBAAY,EAACtB,MAAM,EAAEgB,OAAO,CAAC;IAE3C,OAAOV,GAAG,CAACiB,GAAG,CAACC,OAAO,IAAI;MACtB,OAAOL,KAAK,CAACM,MAAM,CAACC,IAAI,IAAI;QACxB,OAAOF,OAAO,KAAKE,IAAI,CAACF,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIG,eAAe,EAAE,IAAAC,4CAAqB,EAAC;EAC3C,CACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAA/B,mCAAA,GAAAA,mCAAA","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoader/getPublishedRevisionByEntryId.js","sources":["../../../../src/operations/entry/dataLoader/getPublishedRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createPartitionKey, createPublishedSortKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetPublishedRevisionByEntryId = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n\n const publishedKey = createPublishedSortKey();\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const reader = entity.createEntityReader();\n\n const keys = new Set<string>();\n\n for (const id of ids) {\n const partitionKey = createPartitionKey({\n tenant,\n id\n });\n if (keys.has(partitionKey)) {\n continue;\n }\n keys.add(partitionKey);\n reader.get({\n PK: partitionKey,\n SK: publishedKey\n });\n }\n\n const items = (await reader.execute()).map(item => {\n return item.data;\n });\n\n return ids.map(entryId => {\n return items.filter(item => {\n if (item.modelId !== modelId) {\n return false;\n }\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"names":["createGetPublishedRevisionByEntryId","params","entity","tenant","modelId","publishedKey","createPublishedSortKey","DataLoader","ids","reader","keys","Set","id","partitionKey","createPartitionKey","items","item","entryId","createBatchScheduleFn"],"mappings":";;;AAMO,MAAMA,sCAAsC,CAACC;IAChD,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IAEpC,MAAMI,eAAeC;IACrB,OAAO,IAAIC,WACP,OAAMC;QACF,MAAMC,SAASP,OAAO,kBAAkB;QAExC,MAAMQ,OAAO,IAAIC;QAEjB,KAAK,MAAMC,MAAMJ,IAAK;YAClB,MAAMK,eAAeC,mBAAmB;gBACpCX;gBACAS;YACJ;YACA,KAAIF,KAAK,GAAG,CAACG;gBAGbH,KAAK,GAAG,CAACG;gBACTJ,OAAO,GAAG,CAAC;oBACP,IAAII;oBACJ,IAAIR;gBACR;;QACJ;QAEA,MAAMU,QAAS,OAAMN,OAAO,OAAO,EAAC,EAAG,GAAG,CAACO,CAAAA,OAChCA,KAAK,IAAI;QAGpB,OAAOR,IAAI,GAAG,CAACS,CAAAA,UACJF,MAAM,MAAM,CAACC,CAAAA;gBAChB,IAAIA,KAAK,OAAO,KAAKZ,SACjB,OAAO;gBAEX,OAAOa,YAAYD,KAAK,OAAO;YACnC;IAER,GACA;QACI,iBAAiBE;IACrB;AAER"}
@@ -1,4 +1,4 @@
1
1
  import DataLoader from "dataloader";
2
- import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
3
- import type { DataLoaderParams } from "./types";
4
- export declare const createGetRevisionById: (params: DataLoaderParams) => DataLoader<string, CmsStorageEntry[], string>;
2
+ import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { IDataLoaderParams } from "./types.js";
4
+ export declare const createGetRevisionById: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
@@ -1,62 +1,40 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createGetRevisionById = void 0;
8
- var _dataloader = _interopRequireDefault(require("dataloader"));
9
- var _dbDynamodb = require("@webiny/db-dynamodb");
10
- var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
11
- var _keys = require("../keys");
12
- var _utils = require("@webiny/utils");
13
- var _createBatchScheduleFn = require("./createBatchScheduleFn");
14
- const createGetRevisionById = params => {
15
- const {
16
- entity,
17
- tenant,
18
- locale
19
- } = params;
20
- return new _dataloader.default(async ids => {
21
- const queries = ids.reduce((collection, id) => {
22
- const partitionKey = (0, _keys.createPartitionKey)({
23
- tenant,
24
- locale,
25
- id
26
- });
27
- const {
28
- version
29
- } = (0, _utils.parseIdentifier)(id);
30
- if (version === null) {
31
- return collection;
32
- }
33
- const sortKey = (0, _keys.createRevisionSortKey)({
34
- version
35
- });
36
- const keys = `${partitionKey}__${sortKey}`;
37
- if (collection[keys]) {
38
- return collection;
39
- }
40
- collection[keys] = entity.getBatch({
41
- PK: partitionKey,
42
- SK: sortKey
43
- });
44
- return collection;
45
- }, {});
46
- const records = await (0, _dbDynamodb.batchReadAll)({
47
- table: entity.table,
48
- items: Object.values(queries)
49
- });
50
- const items = (0, _cleanup.cleanupItems)(entity, records);
51
- return ids.map(id => {
52
- return items.filter(item => {
53
- return id === item.id;
54
- });
1
+ import dataloader from "dataloader";
2
+ import { createPartitionKey, createRevisionSortKey } from "../keys.js";
3
+ import { parseIdentifier } from "@webiny/utils";
4
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
5
+ const createGetRevisionById = (params)=>{
6
+ const { entity, tenant, modelId } = params;
7
+ return new dataloader(async (ids)=>{
8
+ const reader = entity.createEntityReader();
9
+ const keys = new Set();
10
+ for (const id of ids){
11
+ const partitionKey = createPartitionKey({
12
+ tenant,
13
+ id
14
+ });
15
+ const { version } = parseIdentifier(id);
16
+ if (null === version) continue;
17
+ const sortKey = createRevisionSortKey({
18
+ version
19
+ });
20
+ const key = `${partitionKey}__${sortKey}`;
21
+ if (!keys.has(key)) {
22
+ keys.add(key);
23
+ reader.get({
24
+ PK: partitionKey,
25
+ SK: sortKey
26
+ });
27
+ }
28
+ }
29
+ const items = (await reader.execute()).map((item)=>item.data);
30
+ return ids.map((id)=>items.filter((item)=>{
31
+ if (item.modelId !== modelId) return false;
32
+ return id === item.id;
33
+ }));
34
+ }, {
35
+ batchScheduleFn: createBatchScheduleFn()
55
36
  });
56
- }, {
57
- batchScheduleFn: (0, _createBatchScheduleFn.createBatchScheduleFn)()
58
- });
59
37
  };
60
- exports.createGetRevisionById = createGetRevisionById;
38
+ export { createGetRevisionById };
61
39
 
62
40
  //# sourceMappingURL=getRevisionById.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_keys","_utils","_createBatchScheduleFn","createGetRevisionById","params","entity","tenant","locale","DataLoader","ids","queries","reduce","collection","id","partitionKey","createPartitionKey","version","parseIdentifier","sortKey","createRevisionSortKey","keys","getBatch","PK","SK","records","batchReadAll","table","items","Object","values","cleanupItems","map","filter","item","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getRevisionById.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport { batchReadAll } from \"@webiny/db-dynamodb\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { createPartitionKey, createRevisionSortKey } from \"~/operations/entry/keys\";\nimport type { DataLoaderParams } from \"./types\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\n\nexport const createGetRevisionById = (params: DataLoaderParams) => {\n const { entity, tenant, locale } = params;\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const queries = ids.reduce<Record<string, ReturnType<typeof entity.getBatch>>>(\n (collection, id) => {\n const partitionKey = createPartitionKey({\n tenant,\n locale,\n id\n });\n const { version } = parseIdentifier(id);\n if (version === null) {\n return collection;\n }\n const sortKey = createRevisionSortKey({\n version\n });\n const keys = `${partitionKey}__${sortKey}`;\n if (collection[keys]) {\n return collection;\n }\n\n collection[keys] = entity.getBatch({\n PK: partitionKey,\n SK: sortKey\n });\n\n return collection;\n },\n {}\n );\n\n const records = await batchReadAll<CmsStorageEntry>({\n table: entity.table,\n items: Object.values(queries)\n });\n const items = cleanupItems(entity, records);\n\n return ids.map(id => {\n return items.filter(item => {\n return id === item.id;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AAEO,MAAMM,qBAAqB,GAAIC,MAAwB,IAAK;EAC/D,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEzC,OAAO,IAAII,mBAAU,CACjB,MAAOC,GAAsB,IAAK;IAC9B,MAAMC,OAAO,GAAGD,GAAG,CAACE,MAAM,CACtB,CAACC,UAAU,EAAEC,EAAE,KAAK;MAChB,MAAMC,YAAY,GAAG,IAAAC,wBAAkB,EAAC;QACpCT,MAAM;QACNC,MAAM;QACNM;MACJ,CAAC,CAAC;MACF,MAAM;QAAEG;MAAQ,CAAC,GAAG,IAAAC,sBAAe,EAACJ,EAAE,CAAC;MACvC,IAAIG,OAAO,KAAK,IAAI,EAAE;QAClB,OAAOJ,UAAU;MACrB;MACA,MAAMM,OAAO,GAAG,IAAAC,2BAAqB,EAAC;QAClCH;MACJ,CAAC,CAAC;MACF,MAAMI,IAAI,GAAG,GAAGN,YAAY,KAAKI,OAAO,EAAE;MAC1C,IAAIN,UAAU,CAACQ,IAAI,CAAC,EAAE;QAClB,OAAOR,UAAU;MACrB;MAEAA,UAAU,CAACQ,IAAI,CAAC,GAAGf,MAAM,CAACgB,QAAQ,CAAC;QAC/BC,EAAE,EAAER,YAAY;QAChBS,EAAE,EAAEL;MACR,CAAC,CAAC;MAEF,OAAON,UAAU;IACrB,CAAC,EACD,CAAC,CACL,CAAC;IAED,MAAMY,OAAO,GAAG,MAAM,IAAAC,wBAAY,EAAkB;MAChDC,KAAK,EAAErB,MAAM,CAACqB,KAAK;MACnBC,KAAK,EAAEC,MAAM,CAACC,MAAM,CAACnB,OAAO;IAChC,CAAC,CAAC;IACF,MAAMiB,KAAK,GAAG,IAAAG,qBAAY,EAACzB,MAAM,EAAEmB,OAAO,CAAC;IAE3C,OAAOf,GAAG,CAACsB,GAAG,CAAClB,EAAE,IAAI;MACjB,OAAOc,KAAK,CAACK,MAAM,CAACC,IAAI,IAAI;QACxB,OAAOpB,EAAE,KAAKoB,IAAI,CAACpB,EAAE;MACzB,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIqB,eAAe,EAAE,IAAAC,4CAAqB,EAAC;EAC3C,CACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAjC,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoader/getRevisionById.js","sources":["../../../../src/operations/entry/dataLoader/getRevisionById.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createPartitionKey, createRevisionSortKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetRevisionById = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const reader = entity.createEntityReader();\n\n const keys = new Set<string>();\n\n for (const id of ids) {\n const partitionKey = createPartitionKey({\n tenant,\n id\n });\n const { version } = parseIdentifier(id);\n if (version === null) {\n continue;\n }\n const sortKey = createRevisionSortKey({\n version\n });\n const key = `${partitionKey}__${sortKey}`;\n if (keys.has(key)) {\n continue;\n }\n keys.add(key);\n\n reader.get({\n PK: partitionKey,\n SK: sortKey\n });\n }\n\n const items = (await reader.execute()).map(item => {\n return item.data;\n });\n\n return ids.map(id => {\n return items.filter(item => {\n if (item.modelId !== modelId) {\n return false;\n }\n return id === item.id;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"names":["createGetRevisionById","params","entity","tenant","modelId","DataLoader","ids","reader","keys","Set","id","partitionKey","createPartitionKey","version","parseIdentifier","sortKey","createRevisionSortKey","key","items","item","createBatchScheduleFn"],"mappings":";;;;AAOO,MAAMA,wBAAwB,CAACC;IAClC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IAEpC,OAAO,IAAII,WACP,OAAMC;QACF,MAAMC,SAASL,OAAO,kBAAkB;QAExC,MAAMM,OAAO,IAAIC;QAEjB,KAAK,MAAMC,MAAMJ,IAAK;YAClB,MAAMK,eAAeC,mBAAmB;gBACpCT;gBACAO;YACJ;YACA,MAAM,EAAEG,OAAO,EAAE,GAAGC,gBAAgBJ;YACpC,IAAIG,AAAY,SAAZA,SACA;YAEJ,MAAME,UAAUC,sBAAsB;gBAClCH;YACJ;YACA,MAAMI,MAAM,GAAGN,aAAa,EAAE,EAAEI,SAAS;YACzC,KAAIP,KAAK,GAAG,CAACS;gBAGbT,KAAK,GAAG,CAACS;gBAETV,OAAO,GAAG,CAAC;oBACP,IAAII;oBACJ,IAAII;gBACR;;QACJ;QAEA,MAAMG,QAAS,OAAMX,OAAO,OAAO,EAAC,EAAG,GAAG,CAACY,CAAAA,OAChCA,KAAK,IAAI;QAGpB,OAAOb,IAAI,GAAG,CAACI,CAAAA,KACJQ,MAAM,MAAM,CAACC,CAAAA;gBAChB,IAAIA,KAAK,OAAO,KAAKf,SACjB,OAAO;gBAEX,OAAOM,OAAOS,KAAK,EAAE;YACzB;IAER,GACA;QACI,iBAAiBC;IACrB;AAER"}
@@ -1,8 +1,8 @@
1
1
  import type DataLoader from "dataloader";
2
- import type { DataLoaderParams } from "./types";
3
- export * from "./DataLoaderCache";
2
+ import type { IDataLoaderParams } from "./types.js";
3
+ export * from "./DataLoaderCache.js";
4
4
  interface Callable {
5
- (params: DataLoaderParams): DataLoader<any, any>;
5
+ (params: IDataLoaderParams): DataLoader<any, any>;
6
6
  }
7
7
  export type DataLoaders = "getAllEntryRevisions" | "getRevisionById" | "getPublishedRevisionByEntryId" | "getLatestRevisionByEntryId";
8
8
  export declare const getDataLoaderFactory: (name: string) => Callable;
@@ -1,40 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- getDataLoaderFactory: true
8
- };
9
- exports.getDataLoaderFactory = void 0;
10
- var _getAllEntryRevisions = require("./getAllEntryRevisions");
11
- var _getLatestRevisionByEntryId = require("./getLatestRevisionByEntryId");
12
- var _getPublishedRevisionByEntryId = require("./getPublishedRevisionByEntryId");
13
- var _getRevisionById = require("./getRevisionById");
14
- var _DataLoaderCache = require("./DataLoaderCache");
15
- Object.keys(_DataLoaderCache).forEach(function (key) {
16
- if (key === "default" || key === "__esModule") return;
17
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
18
- if (key in exports && exports[key] === _DataLoaderCache[key]) return;
19
- Object.defineProperty(exports, key, {
20
- enumerable: true,
21
- get: function () {
22
- return _DataLoaderCache[key];
23
- }
24
- });
25
- });
1
+ import { createGetAllEntryRevisions } from "./getAllEntryRevisions.js";
2
+ import { createGetLatestRevisionByEntryId } from "./getLatestRevisionByEntryId.js";
3
+ import { createGetPublishedRevisionByEntryId } from "./getPublishedRevisionByEntryId.js";
4
+ import { createGetRevisionById } from "./getRevisionById.js";
5
+ export * from "./DataLoaderCache.js";
26
6
  const dataLoaders = {
27
- getAllEntryRevisions: _getAllEntryRevisions.createGetAllEntryRevisions,
28
- getLatestRevisionByEntryId: _getLatestRevisionByEntryId.createGetLatestRevisionByEntryId,
29
- getPublishedRevisionByEntryId: _getPublishedRevisionByEntryId.createGetPublishedRevisionByEntryId,
30
- getRevisionById: _getRevisionById.createGetRevisionById
7
+ getAllEntryRevisions: createGetAllEntryRevisions,
8
+ getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,
9
+ getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,
10
+ getRevisionById: createGetRevisionById
31
11
  };
32
- const getDataLoaderFactory = name => {
33
- if (!dataLoaders[name]) {
34
- throw new Error(`Missing data loader "${name}".`);
35
- }
36
- return dataLoaders[name];
12
+ const getDataLoaderFactory = (name)=>{
13
+ if (!dataLoaders[name]) throw new Error(`Missing data loader "${name}".`);
14
+ return dataLoaders[name];
37
15
  };
38
- exports.getDataLoaderFactory = getDataLoaderFactory;
16
+ export { getDataLoaderFactory };
39
17
 
40
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_getAllEntryRevisions","require","_getLatestRevisionByEntryId","_getPublishedRevisionByEntryId","_getRevisionById","_DataLoaderCache","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","dataLoaders","getAllEntryRevisions","createGetAllEntryRevisions","getLatestRevisionByEntryId","createGetLatestRevisionByEntryId","getPublishedRevisionByEntryId","createGetPublishedRevisionByEntryId","getRevisionById","createGetRevisionById","getDataLoaderFactory","name","Error"],"sources":["index.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport type { DataLoaderParams } from \"./types\";\nimport { createGetAllEntryRevisions } from \"./getAllEntryRevisions\";\nimport { createGetLatestRevisionByEntryId } from \"./getLatestRevisionByEntryId\";\nimport { createGetPublishedRevisionByEntryId } from \"./getPublishedRevisionByEntryId\";\nimport { createGetRevisionById } from \"./getRevisionById\";\n\nexport * from \"./DataLoaderCache\";\n\ninterface Callable {\n (params: DataLoaderParams): DataLoader<any, any>;\n}\n\nconst dataLoaders: Record<string, Callable> = {\n getAllEntryRevisions: createGetAllEntryRevisions,\n getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,\n getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,\n getRevisionById: createGetRevisionById\n};\n\nexport type DataLoaders =\n | \"getAllEntryRevisions\"\n | \"getRevisionById\"\n | \"getPublishedRevisionByEntryId\"\n | \"getLatestRevisionByEntryId\";\n\nexport const getDataLoaderFactory = (name: string) => {\n if (!dataLoaders[name]) {\n throw new Error(`Missing data loader \"${name}\".`);\n }\n return dataLoaders[name];\n};\n"],"mappings":";;;;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAD,OAAA;AACA,IAAAE,8BAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,gBAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,gBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,gBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,gBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAMA,MAAMS,WAAqC,GAAG;EAC1CC,oBAAoB,EAAEC,gDAA0B;EAChDC,0BAA0B,EAAEC,4DAAgC;EAC5DC,6BAA6B,EAAEC,kEAAmC;EAClEC,eAAe,EAAEC;AACrB,CAAC;AAQM,MAAMC,oBAAoB,GAAIC,IAAY,IAAK;EAClD,IAAI,CAACV,WAAW,CAACU,IAAI,CAAC,EAAE;IACpB,MAAM,IAAIC,KAAK,CAAC,wBAAwBD,IAAI,IAAI,CAAC;EACrD;EACA,OAAOV,WAAW,CAACU,IAAI,CAAC;AAC5B,CAAC;AAACd,OAAA,CAAAa,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoader/index.js","sources":["../../../../src/operations/entry/dataLoader/index.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { createGetAllEntryRevisions } from \"./getAllEntryRevisions.js\";\nimport { createGetLatestRevisionByEntryId } from \"./getLatestRevisionByEntryId.js\";\nimport { createGetPublishedRevisionByEntryId } from \"./getPublishedRevisionByEntryId.js\";\nimport { createGetRevisionById } from \"./getRevisionById.js\";\n\nexport * from \"./DataLoaderCache.js\";\n\ninterface Callable {\n (params: IDataLoaderParams): DataLoader<any, any>;\n}\n\nconst dataLoaders: Record<string, Callable> = {\n getAllEntryRevisions: createGetAllEntryRevisions,\n getLatestRevisionByEntryId: createGetLatestRevisionByEntryId,\n getPublishedRevisionByEntryId: createGetPublishedRevisionByEntryId,\n getRevisionById: createGetRevisionById\n};\n\nexport type DataLoaders =\n | \"getAllEntryRevisions\"\n | \"getRevisionById\"\n | \"getPublishedRevisionByEntryId\"\n | \"getLatestRevisionByEntryId\";\n\nexport const getDataLoaderFactory = (name: string) => {\n if (!dataLoaders[name]) {\n throw new Error(`Missing data loader \"${name}\".`);\n }\n return dataLoaders[name];\n};\n"],"names":["dataLoaders","createGetAllEntryRevisions","createGetLatestRevisionByEntryId","createGetPublishedRevisionByEntryId","createGetRevisionById","getDataLoaderFactory","name","Error"],"mappings":";;;;;AAaA,MAAMA,cAAwC;IAC1C,sBAAsBC;IACtB,4BAA4BC;IAC5B,+BAA+BC;IAC/B,iBAAiBC;AACrB;AAQO,MAAMC,uBAAuB,CAACC;IACjC,IAAI,CAACN,WAAW,CAACM,KAAK,EAClB,MAAM,IAAIC,MAAM,CAAC,qBAAqB,EAAED,KAAK,EAAE,CAAC;IAEpD,OAAON,WAAW,CAACM,KAAK;AAC5B"}
@@ -1,6 +1,6 @@
1
- import type { Entity } from "@webiny/db-dynamodb/toolbox";
2
- export interface DataLoaderParams {
3
- entity: Entity<any>;
1
+ import type { IEntryEntity } from "../../../definitions/types.js";
2
+ export interface IDataLoaderParams {
3
+ entity: IEntryEntity;
4
4
  tenant: string;
5
- locale: string;
5
+ modelId: string;
6
6
  }
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- //# sourceMappingURL=types.js.map
@@ -1,24 +1,21 @@
1
- import type { CmsModel, CmsStorageEntry } from "@webiny/api-headless-cms/types";
2
- import type { Entity } from "@webiny/db-dynamodb/toolbox";
3
- import type { DataLoadersHandlerInterface, DataLoadersHandlerInterfaceClearAllParams } from "../../types";
1
+ import type { CmsEntryValues, CmsModel, CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { DataLoadersHandlerInterfaceClearAllParams, IDataLoadersHandler } from "../../types.js";
3
+ import type { IEntryEntity } from "../../definitions/types.js";
4
4
  interface DataLoaderParams {
5
- model: Pick<CmsModel, "tenant" | "locale" | "modelId">;
5
+ model: Pick<CmsModel, "tenant" | "modelId">;
6
6
  ids: readonly string[];
7
7
  }
8
- interface DataLoadersHandlerParams {
9
- entity: Entity<any>;
10
- }
11
8
  export interface ClearAllParams {
12
- model: Pick<CmsModel, "tenant" | "locale" | "modelId">;
9
+ model: Pick<CmsModel, "tenant" | "modelId">;
13
10
  }
14
- export declare class DataLoadersHandler implements DataLoadersHandlerInterface {
11
+ declare class DataLoadersHandlerImpl implements IDataLoadersHandler {
15
12
  private readonly entity;
16
13
  private readonly cache;
17
- constructor(params: DataLoadersHandlerParams);
18
- getAllEntryRevisions(params: DataLoaderParams): Promise<CmsStorageEntry[]>;
19
- getRevisionById(params: DataLoaderParams): Promise<CmsStorageEntry[]>;
20
- getPublishedRevisionByEntryId(params: DataLoaderParams): Promise<CmsStorageEntry[]>;
21
- getLatestRevisionByEntryId(params: DataLoaderParams): Promise<CmsStorageEntry[]>;
14
+ constructor(entity: IEntryEntity);
15
+ getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(params: DataLoaderParams): Promise<CmsStorageEntry<T>[]>;
16
+ getRevisionById<T extends CmsEntryValues = CmsEntryValues>(params: DataLoaderParams): Promise<CmsStorageEntry<T>[]>;
17
+ getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(params: DataLoaderParams): Promise<CmsStorageEntry<T>[]>;
18
+ getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(params: DataLoaderParams): Promise<CmsStorageEntry<T>[]>;
22
19
  /**
23
20
  * TODO @ts-refactor
24
21
  * Maybe pass on the generics to DataLoader definition?
@@ -27,4 +24,7 @@ export declare class DataLoadersHandler implements DataLoadersHandlerInterface {
27
24
  private loadMany;
28
25
  clearAll(params?: DataLoadersHandlerInterfaceClearAllParams): void;
29
26
  }
27
+ export declare const DataLoadersHandler: typeof DataLoadersHandlerImpl & {
28
+ __abstraction: import("@webiny/di").Abstraction<IDataLoadersHandler>;
29
+ };
30
30
  export {};
@@ -1,116 +1,98 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.DataLoadersHandler = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _DataLoaderCache = require("./dataLoader/DataLoaderCache");
10
- var _dataLoader = require("./dataLoader");
11
- var _utils = require("@webiny/utils");
12
- class DataLoadersHandler {
13
- cache = new _DataLoaderCache.DataLoaderCache();
14
- constructor(params) {
15
- this.entity = params.entity;
16
- }
17
- async getAllEntryRevisions(params) {
18
- const ids = params.ids.map(id => {
19
- const {
20
- id: entryId
21
- } = (0, _utils.parseIdentifier)(id);
22
- return entryId;
23
- });
24
- return await this.loadMany("getAllEntryRevisions", params, ids);
25
- }
26
- async getRevisionById(params) {
27
- return await this.loadMany("getRevisionById", params, params.ids);
28
- }
29
- async getPublishedRevisionByEntryId(params) {
30
- const ids = params.ids.map(id => {
31
- const {
32
- id: entryId
33
- } = (0, _utils.parseIdentifier)(id);
34
- return entryId;
35
- });
36
- return await this.loadMany("getPublishedRevisionByEntryId", params, ids);
37
- }
38
- async getLatestRevisionByEntryId(params) {
39
- const ids = params.ids.map(id => {
40
- const {
41
- id: entryId
42
- } = (0, _utils.parseIdentifier)(id);
43
- return entryId;
44
- });
45
- return await this.loadMany("getLatestRevisionByEntryId", params, ids);
46
- }
47
-
48
- /**
49
- * TODO @ts-refactor
50
- * Maybe pass on the generics to DataLoader definition?
51
- */
52
- getLoader(name, params) {
53
- const {
54
- model
55
- } = params;
56
- const cacheParams = {
57
- tenant: model.tenant,
58
- locale: model.locale,
59
- name
60
- };
61
- let loader = this.cache.getDataLoader(cacheParams);
62
- if (loader) {
63
- return loader;
1
+ import error from "@webiny/error";
2
+ import { DataLoaderCache } from "./dataLoader/DataLoaderCache.js";
3
+ import { getDataLoaderFactory } from "./dataLoader/index.js";
4
+ import { parseIdentifier } from "@webiny/utils";
5
+ import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
6
+ import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
7
+ class DataLoadersHandlerImpl {
8
+ constructor(entity){
9
+ this.entity = entity;
10
+ this.cache = new DataLoaderCache();
11
+ }
12
+ async getAllEntryRevisions(params) {
13
+ const ids = params.ids.map((id)=>{
14
+ const { id: entryId } = parseIdentifier(id);
15
+ return entryId;
16
+ });
17
+ return await this.loadMany("getAllEntryRevisions", params, ids);
18
+ }
19
+ async getRevisionById(params) {
20
+ return await this.loadMany("getRevisionById", params, params.ids);
64
21
  }
65
- const factory = (0, _dataLoader.getDataLoaderFactory)(name);
66
- loader = factory({
67
- entity: this.entity,
68
- tenant: model.tenant,
69
- locale: model.locale
70
- });
71
- this.cache.setDataLoader(cacheParams, loader);
72
- return loader;
73
- }
74
- async loadMany(loader, params, ids) {
75
- let results = [];
76
- try {
77
- results = await this.getLoader(loader, params).loadMany(ids);
78
- if (Array.isArray(results) === true) {
79
- return results.reduce((acc, res) => {
80
- if (Array.isArray(res) === false) {
81
- if (res && res.message) {
82
- throw new _error.default(res.message, res.code, {
83
- ...res,
84
- data: JSON.stringify(res.data || {})
85
- });
86
- }
87
- throw new _error.default("Result from the data loader must be an array of arrays which contain requested items.", "DATA_LOADER_RESULTS_ERROR", {
88
- ...params,
89
- loader
22
+ async getPublishedRevisionByEntryId(params) {
23
+ const ids = params.ids.map((id)=>{
24
+ const { id: entryId } = parseIdentifier(id);
25
+ return entryId;
26
+ });
27
+ return await this.loadMany("getPublishedRevisionByEntryId", params, ids);
28
+ }
29
+ async getLatestRevisionByEntryId(params) {
30
+ const ids = params.ids.map((id)=>{
31
+ const { id: entryId } = parseIdentifier(id);
32
+ return entryId;
33
+ });
34
+ return await this.loadMany("getLatestRevisionByEntryId", params, ids);
35
+ }
36
+ getLoader(name, params) {
37
+ const { model } = params;
38
+ const cacheParams = {
39
+ tenant: model.tenant,
40
+ modelId: model.modelId,
41
+ name
42
+ };
43
+ let loader = this.cache.getDataLoader(cacheParams);
44
+ if (loader) return loader;
45
+ const factory = getDataLoaderFactory(name);
46
+ loader = factory({
47
+ entity: this.entity,
48
+ tenant: model.tenant,
49
+ modelId: model.modelId
50
+ });
51
+ this.cache.setDataLoader(cacheParams, loader);
52
+ return loader;
53
+ }
54
+ async loadMany(loader, params, ids) {
55
+ let results = [];
56
+ try {
57
+ results = await this.getLoader(loader, params).loadMany(ids);
58
+ if (true === Array.isArray(results)) return results.reduce((acc, res)=>{
59
+ if (false === Array.isArray(res)) {
60
+ if (res && res.message) throw new error(res.message, res.code, {
61
+ ...res,
62
+ data: JSON.stringify(res.data || {})
63
+ });
64
+ throw new error("Result from the data loader must be an array of arrays which contain requested items.", "DATA_LOADER_RESULTS_ERROR", {
65
+ ...params,
66
+ loader
67
+ });
68
+ }
69
+ acc.push(...res);
70
+ return acc;
71
+ }, []);
72
+ } catch (ex) {
73
+ throw new error(ex.message || "Data loader error.", ex.code || "DATA_LOADER_ERROR", {
74
+ error: ex,
75
+ ...params,
76
+ loader,
77
+ ids
90
78
  });
91
- }
92
- acc.push(...res);
93
- return acc;
94
- }, []);
95
- }
96
- } catch (ex) {
97
- throw new _error.default(ex.message || "Data loader error.", ex.code || "DATA_LOADER_ERROR", {
98
- error: ex,
99
- ...params,
100
- loader,
101
- ids
102
- });
79
+ }
80
+ throw new error("Data loader did not return array of items or empty array.", "INVALID_DATA_LOADER_RESULT", {
81
+ loader,
82
+ ids,
83
+ results
84
+ });
85
+ }
86
+ clearAll(params) {
87
+ this.cache.clearAll(params);
103
88
  }
104
- throw new _error.default(`Data loader did not return array of items or empty array.`, "INVALID_DATA_LOADER_RESULT", {
105
- loader,
106
- ids,
107
- results
108
- });
109
- }
110
- clearAll(params) {
111
- this.cache.clearAll(params?.model);
112
- }
113
89
  }
114
- exports.DataLoadersHandler = DataLoadersHandler;
90
+ const DataLoadersHandler = CmsDdbEsDataLoaders.createImplementation({
91
+ implementation: DataLoadersHandlerImpl,
92
+ dependencies: [
93
+ CmsDdbEsEntryEntity
94
+ ]
95
+ });
96
+ export { DataLoadersHandler };
115
97
 
116
98
  //# sourceMappingURL=dataLoaders.js.map