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

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 (431) hide show
  1. package/README.md +6 -30
  2. package/configurations.d.ts +7 -7
  3. package/configurations.js +16 -26
  4. package/configurations.js.map +1 -1
  5. package/definitions/entry.d.ts +4 -6
  6. package/definitions/entry.js +5 -174
  7. package/definitions/entry.js.map +1 -1
  8. package/definitions/group.d.ts +6 -7
  9. package/definitions/group.js +5 -58
  10. package/definitions/group.js.map +1 -1
  11. package/definitions/model.d.ts +6 -7
  12. package/definitions/model.js +5 -102
  13. package/definitions/model.js.map +1 -1
  14. package/definitions/types.d.ts +61 -0
  15. package/definitions/types.js +3 -0
  16. package/definitions/types.js.map +1 -0
  17. package/elasticsearch/createElasticsearchIndex.d.ts +4 -4
  18. package/elasticsearch/createElasticsearchIndex.js +61 -27
  19. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  20. package/elasticsearch/deleteElasticsearchIndex.d.ts +2 -2
  21. package/elasticsearch/deleteElasticsearchIndex.js +3 -10
  22. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  23. package/exports/api/cms/opensearch.d.ts +9 -0
  24. package/exports/api/cms/opensearch.js +11 -0
  25. package/exports/api/cms/opensearch.js.map +1 -0
  26. package/feature.d.ts +1 -0
  27. package/feature.js +188 -0
  28. package/feature.js.map +1 -0
  29. package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +16 -0
  30. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +4 -0
  31. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -0
  32. package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +1 -0
  33. package/features/CmsEntryOpenSearchBodyModifier/index.js +3 -0
  34. package/features/CmsEntryOpenSearchBodyModifier/index.js.map +1 -0
  35. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +13 -0
  36. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +36 -0
  37. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  38. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +35 -0
  39. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +4 -0
  40. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -0
  41. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +11 -0
  42. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +4 -0
  43. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  44. package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +1 -0
  45. package/features/CmsEntryOpenSearchFieldIndex/constants.js +3 -0
  46. package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -0
  47. package/features/CmsEntryOpenSearchFieldIndex/feature.d.ts +4 -0
  48. package/features/CmsEntryOpenSearchFieldIndex/feature.js +24 -0
  49. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -0
  50. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +11 -0
  51. package/{elasticsearch/indexing/dateTimeIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js} +21 -32
  52. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -0
  53. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +10 -0
  54. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +39 -0
  55. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -0
  56. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +10 -0
  57. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +22 -0
  58. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -0
  59. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +10 -0
  60. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +25 -0
  61. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -0
  62. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +11 -0
  63. package/{elasticsearch/indexing/numberIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js} +11 -15
  64. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -0
  65. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +10 -0
  66. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +158 -0
  67. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -0
  68. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +10 -0
  69. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +22 -0
  70. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -0
  71. package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +3 -0
  72. package/features/CmsEntryOpenSearchFieldIndex/index.js +5 -0
  73. package/features/CmsEntryOpenSearchFieldIndex/index.js.map +1 -0
  74. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +11 -0
  75. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +38 -0
  76. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  77. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +37 -0
  78. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +4 -0
  79. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -0
  80. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +9 -0
  81. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +4 -0
  82. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  83. package/features/CmsEntryOpenSearchFilter/constants.d.ts +1 -0
  84. package/features/CmsEntryOpenSearchFilter/constants.js +3 -0
  85. package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -0
  86. package/features/CmsEntryOpenSearchFilter/feature.d.ts +4 -0
  87. package/features/CmsEntryOpenSearchFilter/feature.js +16 -0
  88. package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -0
  89. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +9 -0
  90. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +23 -0
  91. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -0
  92. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +9 -0
  93. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +61 -0
  94. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -0
  95. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +9 -0
  96. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +49 -0
  97. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -0
  98. package/features/CmsEntryOpenSearchFilter/index.d.ts +3 -0
  99. package/features/CmsEntryOpenSearchFilter/index.js +5 -0
  100. package/features/CmsEntryOpenSearchFilter/index.js.map +1 -0
  101. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +20 -0
  102. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +4 -0
  103. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -0
  104. package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +1 -0
  105. package/features/CmsEntryOpenSearchFullTextSearch/index.js +3 -0
  106. package/features/CmsEntryOpenSearchFullTextSearch/index.js.map +1 -0
  107. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +11 -0
  108. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +16 -0
  109. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -0
  110. package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +14 -0
  111. package/features/CmsEntryOpenSearchIndex/abstractions.js +4 -0
  112. package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -0
  113. package/features/CmsEntryOpenSearchIndex/feature.d.ts +4 -0
  114. package/features/CmsEntryOpenSearchIndex/feature.js +10 -0
  115. package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -0
  116. package/features/CmsEntryOpenSearchIndex/index.d.ts +3 -0
  117. package/features/CmsEntryOpenSearchIndex/index.js +5 -0
  118. package/features/CmsEntryOpenSearchIndex/index.js.map +1 -0
  119. package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +16 -0
  120. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +4 -0
  121. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -0
  122. package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +1 -0
  123. package/features/CmsEntryOpenSearchQueryModifier/index.js +3 -0
  124. package/features/CmsEntryOpenSearchQueryModifier/index.js.map +1 -0
  125. package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +15 -0
  126. package/features/CmsEntryOpenSearchSortModifier/abstractions.js +4 -0
  127. package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -0
  128. package/features/CmsEntryOpenSearchSortModifier/index.d.ts +1 -0
  129. package/features/CmsEntryOpenSearchSortModifier/index.js +3 -0
  130. package/features/CmsEntryOpenSearchSortModifier/index.js.map +1 -0
  131. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +12 -0
  132. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +27 -0
  133. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  134. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +22 -0
  135. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +4 -0
  136. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -0
  137. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +10 -0
  138. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +4 -0
  139. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  140. package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +4 -0
  141. package/features/CmsEntryOpenSearchValueSearch/feature.js +16 -0
  142. package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -0
  143. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +10 -0
  144. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +23 -0
  145. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -0
  146. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +10 -0
  147. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +55 -0
  148. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -0
  149. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +10 -0
  150. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +24 -0
  151. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -0
  152. package/features/CmsEntryOpenSearchValueSearch/index.d.ts +3 -0
  153. package/features/CmsEntryOpenSearchValueSearch/index.js +5 -0
  154. package/features/CmsEntryOpenSearchValueSearch/index.js.map +1 -0
  155. package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +23 -0
  156. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +4 -0
  157. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -0
  158. package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +1 -0
  159. package/features/CmsEntryOpenSearchValuesModifier/index.js +3 -0
  160. package/features/CmsEntryOpenSearchValuesModifier/index.js.map +1 -0
  161. package/helpers/entryIndexHelpers.d.ts +13 -11
  162. package/helpers/entryIndexHelpers.js +38 -94
  163. package/helpers/entryIndexHelpers.js.map +1 -1
  164. package/helpers/fieldIdentifier.d.ts +1 -1
  165. package/helpers/fieldIdentifier.js +2 -10
  166. package/helpers/fieldIdentifier.js.map +1 -1
  167. package/helpers/index.d.ts +2 -2
  168. package/helpers/index.js +2 -27
  169. package/helpers/index.js.map +1 -1
  170. package/index.d.ts +1 -3
  171. package/index.js +1 -223
  172. package/index.js.map +1 -1
  173. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
  174. package/operations/entry/dataLoader/DataLoaderCache.js +3 -13
  175. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  176. package/operations/entry/dataLoader/constants.js +1 -7
  177. package/operations/entry/dataLoader/constants.js.map +1 -1
  178. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  179. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  180. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  181. package/operations/entry/dataLoader/getAllEntryRevisions.js +16 -26
  182. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  183. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  184. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +23 -31
  185. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  186. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  187. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +23 -31
  188. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  189. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  190. package/operations/entry/dataLoader/getRevisionById.js +26 -34
  191. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  192. package/operations/entry/dataLoader/index.d.ts +3 -3
  193. package/operations/entry/dataLoader/index.js +10 -31
  194. package/operations/entry/dataLoader/index.js.map +1 -1
  195. package/operations/entry/dataLoader/types.d.ts +4 -4
  196. package/operations/entry/dataLoader/types.js +1 -5
  197. package/operations/entry/dataLoader/types.js.map +1 -1
  198. package/operations/entry/dataLoaders.d.ts +13 -13
  199. package/operations/entry/dataLoaders.js +16 -24
  200. package/operations/entry/dataLoaders.js.map +1 -1
  201. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
  202. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
  203. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
  204. package/operations/entry/elasticsearch/body.d.ts +20 -4
  205. package/operations/entry/elasticsearch/body.js +49 -53
  206. package/operations/entry/elasticsearch/body.js.map +1 -1
  207. package/operations/entry/elasticsearch/fields/createSystemField.d.ts +4 -0
  208. package/operations/entry/elasticsearch/fields/createSystemField.js +10 -0
  209. package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -0
  210. package/operations/entry/elasticsearch/fields/live.d.ts +2 -0
  211. package/operations/entry/elasticsearch/fields/live.js +45 -0
  212. package/operations/entry/elasticsearch/fields/live.js.map +1 -0
  213. package/operations/entry/elasticsearch/fields/location.d.ts +2 -0
  214. package/operations/entry/elasticsearch/fields/location.js +45 -0
  215. package/operations/entry/elasticsearch/fields/location.js.map +1 -0
  216. package/operations/entry/elasticsearch/fields/state.d.ts +2 -0
  217. package/operations/entry/elasticsearch/fields/state.js +93 -0
  218. package/operations/entry/elasticsearch/fields/state.js.map +1 -0
  219. package/operations/entry/elasticsearch/fields.d.ts +8 -6
  220. package/operations/entry/elasticsearch/fields.js +38 -122
  221. package/operations/entry/elasticsearch/fields.js.map +1 -1
  222. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +6 -5
  223. package/operations/entry/elasticsearch/filtering/applyFiltering.js +13 -20
  224. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  225. package/operations/entry/elasticsearch/filtering/exec.d.ts +11 -6
  226. package/operations/entry/elasticsearch/filtering/exec.js +47 -97
  227. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  228. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
  229. package/operations/entry/elasticsearch/filtering/index.js +1 -16
  230. package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
  231. package/operations/entry/elasticsearch/filtering/path.d.ts +5 -3
  232. package/operations/entry/elasticsearch/filtering/path.js +10 -20
  233. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  234. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -2
  235. package/operations/entry/elasticsearch/filtering/populated.js +1 -8
  236. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  237. package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
  238. package/operations/entry/elasticsearch/filtering/values.js +4 -12
  239. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  240. package/operations/entry/elasticsearch/fullTextSearch.d.ts +7 -6
  241. package/operations/entry/elasticsearch/fullTextSearch.js +39 -42
  242. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  243. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +4 -4
  244. package/operations/entry/elasticsearch/fullTextSearchFields.js +11 -18
  245. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  246. package/operations/entry/elasticsearch/initialQuery.d.ts +4 -4
  247. package/operations/entry/elasticsearch/initialQuery.js +9 -27
  248. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  249. package/operations/entry/elasticsearch/keyword.d.ts +1 -1
  250. package/operations/entry/elasticsearch/keyword.js +4 -9
  251. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  252. package/operations/entry/elasticsearch/plugins/operator.d.ts +2 -3
  253. package/operations/entry/elasticsearch/plugins/operator.js +4 -19
  254. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  255. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +2 -9
  256. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
  257. package/operations/entry/elasticsearch/sort.d.ts +6 -6
  258. package/operations/entry/elasticsearch/sort.js +52 -36
  259. package/operations/entry/elasticsearch/sort.js.map +1 -1
  260. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +3 -10
  261. package/operations/entry/elasticsearch/transformValueForSearch.js +5 -20
  262. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  263. package/operations/entry/elasticsearch/types.d.ts +4 -11
  264. package/operations/entry/elasticsearch/types.js +1 -5
  265. package/operations/entry/elasticsearch/types.js.map +1 -1
  266. package/operations/entry/index.d.ts +26 -5
  267. package/operations/entry/index.js +421 -541
  268. package/operations/entry/index.js.map +1 -1
  269. package/operations/entry/keys.d.ts +31 -1
  270. package/operations/entry/keys.js +56 -19
  271. package/operations/entry/keys.js.map +1 -1
  272. package/operations/entry/recordType.js +3 -12
  273. package/operations/entry/recordType.js.map +1 -1
  274. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  275. package/operations/entry/transformations/convertEntryKeys.js +2 -10
  276. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  277. package/operations/entry/transformations/index.d.ts +24 -18
  278. package/operations/entry/transformations/index.js +31 -37
  279. package/operations/entry/transformations/index.js.map +1 -1
  280. package/operations/entry/transformations/modifyEntryValues.d.ts +30 -35
  281. package/operations/entry/transformations/modifyEntryValues.js +4 -11
  282. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  283. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  284. package/operations/entry/transformations/transformEntryKeys.js +4 -11
  285. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  286. package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -8
  287. package/operations/entry/transformations/transformEntryToIndex.js +9 -14
  288. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  289. package/operations/group/index.d.ts +7 -6
  290. package/operations/group/index.js +41 -78
  291. package/operations/group/index.js.map +1 -1
  292. package/operations/model/index.d.ts +4 -4
  293. package/operations/model/index.js +38 -58
  294. package/operations/model/index.js.map +1 -1
  295. package/package.json +32 -34
  296. package/tasks/createIndexTaskPlugin.d.ts +2 -2
  297. package/tasks/createIndexTaskPlugin.js +41 -60
  298. package/tasks/createIndexTaskPlugin.js.map +1 -1
  299. package/types.d.ts +26 -134
  300. package/types.js +2 -28
  301. package/types.js.map +1 -1
  302. package/values/NoValueContainer.d.ts +5 -0
  303. package/values/NoValueContainer.js +13 -0
  304. package/values/NoValueContainer.js.map +1 -0
  305. package/definitions/entryElasticsearch.d.ts +0 -9
  306. package/definitions/entryElasticsearch.js +0 -41
  307. package/definitions/entryElasticsearch.js.map +0 -1
  308. package/definitions/system.d.ts +0 -9
  309. package/definitions/system.js +0 -42
  310. package/definitions/system.js.map +0 -1
  311. package/definitions/table.d.ts +0 -8
  312. package/definitions/table.js +0 -25
  313. package/definitions/table.js.map +0 -1
  314. package/definitions/tableElasticsearch.d.ts +0 -8
  315. package/definitions/tableElasticsearch.js +0 -25
  316. package/definitions/tableElasticsearch.js.map +0 -1
  317. package/dynamoDb/index.d.ts +0 -3
  318. package/dynamoDb/index.js +0 -16
  319. package/dynamoDb/index.js.map +0 -1
  320. package/dynamoDb/storage/longText.d.ts +0 -10
  321. package/dynamoDb/storage/longText.js +0 -96
  322. package/dynamoDb/storage/longText.js.map +0 -1
  323. package/dynamoDb/storage/richText.d.ts +0 -2
  324. package/dynamoDb/storage/richText.js +0 -59
  325. package/dynamoDb/storage/richText.js.map +0 -1
  326. package/elasticsearch/index.d.ts +0 -2
  327. package/elasticsearch/index.js +0 -13
  328. package/elasticsearch/index.js.map +0 -1
  329. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  330. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  331. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  332. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -54
  333. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  334. package/elasticsearch/indexing/index.d.ts +0 -2
  335. package/elasticsearch/indexing/index.js +0 -18
  336. package/elasticsearch/indexing/index.js.map +0 -1
  337. package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
  338. package/elasticsearch/indexing/jsonIndexing.js +0 -28
  339. package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
  340. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  341. package/elasticsearch/indexing/longTextIndexing.js +0 -42
  342. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  343. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  344. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  345. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  346. package/elasticsearch/indexing/objectIndexing.js +0 -201
  347. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  348. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  349. package/elasticsearch/indexing/richTextIndexing.js +0 -31
  350. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  351. package/elasticsearch/indices/base.d.ts +0 -2
  352. package/elasticsearch/indices/base.js +0 -13
  353. package/elasticsearch/indices/base.js.map +0 -1
  354. package/elasticsearch/indices/index.d.ts +0 -1
  355. package/elasticsearch/indices/index.js +0 -14
  356. package/elasticsearch/indices/index.js.map +0 -1
  357. package/elasticsearch/indices/japanese.d.ts +0 -2
  358. package/elasticsearch/indices/japanese.js +0 -14
  359. package/elasticsearch/indices/japanese.js.map +0 -1
  360. package/elasticsearch/search/index.d.ts +0 -3
  361. package/elasticsearch/search/index.js +0 -12
  362. package/elasticsearch/search/index.js.map +0 -1
  363. package/elasticsearch/search/refSearch.d.ts +0 -2
  364. package/elasticsearch/search/refSearch.js +0 -31
  365. package/elasticsearch/search/refSearch.js.map +0 -1
  366. package/elasticsearch/search/timeSearch.d.ts +0 -2
  367. package/elasticsearch/search/timeSearch.js +0 -27
  368. package/elasticsearch/search/timeSearch.js.map +0 -1
  369. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  370. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -30
  371. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  372. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  373. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -15
  374. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  375. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  376. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -69
  377. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  378. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  379. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -57
  380. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  381. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  382. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  383. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  384. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  385. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -18
  386. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  387. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  388. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -18
  389. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  390. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  391. package/operations/entry/elasticsearch/plugins/search.js +0 -26
  392. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  393. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  394. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -18
  395. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  396. package/operations/system/index.d.ts +0 -6
  397. package/operations/system/index.js +0 -94
  398. package/operations/system/index.js.map +0 -1
  399. package/operations/system/indexes.d.ts +0 -10
  400. package/operations/system/indexes.js +0 -41
  401. package/operations/system/indexes.js.map +0 -1
  402. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
  403. package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -52
  404. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
  405. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
  406. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -21
  407. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  408. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  409. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -27
  410. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  411. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  412. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -13
  413. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  414. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -31
  415. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -40
  416. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  417. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
  418. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -21
  419. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  420. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
  421. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -21
  422. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  423. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
  424. package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -50
  425. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
  426. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  427. package/plugins/CmsEntryFilterPlugin.js +0 -22
  428. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  429. package/plugins/index.d.ts +0 -8
  430. package/plugins/index.js +0 -95
  431. package/plugins/index.js.map +0 -1
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DataLoaderCache = void 0;
7
- class DataLoaderCache {
1
+ export class DataLoaderCache {
8
2
  cache = {};
9
3
  getDataLoader(params) {
10
4
  const key = this.createKey(params);
@@ -21,10 +15,7 @@ class DataLoaderCache {
21
15
  }
22
16
  return;
23
17
  }
24
- const key = this.createKey({
25
- ...params,
26
- name: ""
27
- });
18
+ const key = `${params.tenant}_`;
28
19
  for (const current in this.cache) {
29
20
  if (current.startsWith(key) === false) {
30
21
  continue;
@@ -33,9 +24,8 @@ class DataLoaderCache {
33
24
  }
34
25
  }
35
26
  createKey(params) {
36
- return `${params.tenant}_${params.locale}_${params.name}`;
27
+ return `${params.tenant}_${params.modelId}_${params.name}`;
37
28
  }
38
29
  }
39
- exports.DataLoaderCache = DataLoaderCache;
40
30
 
41
31
  //# sourceMappingURL=DataLoaderCache.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","name","startsWith","tenant","locale","exports"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n locale: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n locale: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = this.createKey({\n ...params,\n name: \"\"\n });\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.locale}_${params.name}`;\n }\n}\n"],"mappings":";;;;;;AAaO,MAAMA,eAAe,CAAC;EACRC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,aAAaA,CAAmBC,MAAsB,EAA2B;IACpF,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAElC,OAAO,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,IAAI,IAAI;EAClC;EAEOE,aAAaA,CAACH,MAAsB,EAAEI,UAAgC,EAAQ;IACjF,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAClC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,GAAGG,UAAU;EAChC;EAEOC,QAAQA,CAACL,MAAuB,EAAQ;IAC3C,IAAI,CAACA,MAAM,EAAE;MACT,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;QAC9B,IAAI,CAACA,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;MAClC;MACA;IACJ;IACA,MAAMJ,GAAG,GAAG,IAAI,CAACC,SAAS,CAAC;MACvB,GAAGF,MAAM;MACTO,IAAI,EAAE;IACV,CAAC,CAAC;IACF,KAAK,MAAMD,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;MAC9B,IAAIQ,OAAO,CAACE,UAAU,CAACP,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC;MACJ;MACA,IAAI,CAACH,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;IAClC;EACJ;EAEQH,SAASA,CAACF,MAAsB,EAAU;IAC9C,OAAO,GAAGA,MAAM,CAACS,MAAM,IAAIT,MAAM,CAACU,MAAM,IAAIV,MAAM,CAACO,IAAI,EAAE;EAC7D;AACJ;AAACI,OAAA,CAAAd,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","tenant","startsWith","modelId","name"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n modelId: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = `${params.tenant}_`;\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.modelId}_${params.name}`;\n }\n}\n"],"mappings":"AAYA,OAAO,MAAMA,eAAe,CAAC;EACRC,KAAK,GAAyC,CAAC,CAAC;EAE1DC,aAAaA,CAAmBC,MAAsB,EAA2B;IACpF,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAElC,OAAO,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,IAAI,IAAI;EAClC;EAEOE,aAAaA,CAACH,MAAsB,EAAEI,UAAgC,EAAQ;IACjF,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,MAAM,CAAC;IAClC,IAAI,CAACF,KAAK,CAACG,GAAG,CAAC,GAAGG,UAAU;EAChC;EAEOC,QAAQA,CAACL,MAAuB,EAAQ;IAC3C,IAAI,CAACA,MAAM,EAAE;MACT,KAAK,MAAMM,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;QAC9B,IAAI,CAACA,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;MAClC;MACA;IACJ;IACA,MAAMJ,GAAG,GAAG,GAAGD,MAAM,CAACO,MAAM,GAAG;IAC/B,KAAK,MAAMD,OAAO,IAAI,IAAI,CAACR,KAAK,EAAE;MAC9B,IAAIQ,OAAO,CAACE,UAAU,CAACP,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC;MACJ;MACA,IAAI,CAACH,KAAK,CAACQ,OAAO,CAAC,CAACD,QAAQ,CAAC,CAAC;IAClC;EACJ;EAEQH,SAASA,CAACF,MAAsB,EAAU;IAC9C,OAAO,GAAGA,MAAM,CAACO,MAAM,IAAIP,MAAM,CAACS,OAAO,IAAIT,MAAM,CAACU,IAAI,EAAE;EAC9D;AACJ","ignoreList":[]}
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.CMS_ENTRY_BATCH_SCHEDULE_WAIT = void 0;
7
1
  const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || "0");
8
- const CMS_ENTRY_BATCH_SCHEDULE_WAIT = exports.CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
2
+ export const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
9
3
 
10
4
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["batchScheduleWaitEnv","Number","process","env","WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT","CMS_ENTRY_BATCH_SCHEDULE_WAIT","exports","isNaN"],"sources":["constants.ts"],"sourcesContent":["const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || \"0\");\nexport const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;\n"],"mappings":";;;;;;AAAA,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,wCAAwC,IAAI,GAAG,CAAC;AACzF,MAAMC,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAGE,KAAK,CAACP,oBAAoB,CAAC,GAAG,CAAC,GAAGA,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["batchScheduleWaitEnv","Number","process","env","WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT","CMS_ENTRY_BATCH_SCHEDULE_WAIT","isNaN"],"sources":["constants.ts"],"sourcesContent":["const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || \"0\");\nexport const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;\n"],"mappings":"AAAA,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,OAAO,CAACC,GAAG,CAACC,wCAAwC,IAAI,GAAG,CAAC;AAChG,OAAO,MAAMC,6BAA6B,GAAGC,KAAK,CAACN,oBAAoB,CAAC,GAAG,CAAC,GAAGA,oBAAoB","ignoreList":[]}
@@ -1,10 +1,5 @@
1
- "use strict";
1
+ import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from "./constants.js";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createBatchScheduleFn = void 0;
7
- var _constants = require("./constants");
8
3
  /**
9
4
  * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.
10
5
  * Intended to be used internally or for a specific user case.
@@ -12,14 +7,13 @@ var _constants = require("./constants");
12
7
  *
13
8
  * https://github.com/graphql/dataloader#batch-scheduling
14
9
  */
15
- const createBatchScheduleFn = () => {
16
- if (_constants.CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
10
+ export const createBatchScheduleFn = () => {
11
+ if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
17
12
  return undefined;
18
13
  }
19
14
  return callback => {
20
- setTimeout(callback, _constants.CMS_ENTRY_BATCH_SCHEDULE_WAIT);
15
+ setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);
21
16
  };
22
17
  };
23
- exports.createBatchScheduleFn = createBatchScheduleFn;
24
18
 
25
19
  //# sourceMappingURL=createBatchScheduleFn.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_constants","require","createBatchScheduleFn","CMS_ENTRY_BATCH_SCHEDULE_WAIT","undefined","callback","setTimeout","exports"],"sources":["createBatchScheduleFn.ts"],"sourcesContent":["import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from \"./constants\";\n\n/**\n * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.\n * Intended to be used internally or for a specific user case.\n * Not to be documented and exposed to publish as it can slow the data loading a lot.\n *\n * https://github.com/graphql/dataloader#batch-scheduling\n */\nexport const createBatchScheduleFn = () => {\n if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {\n return undefined;\n }\n return (callback: () => void) => {\n setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,IAAIC,wCAA6B,IAAI,CAAC,EAAE;IACpC,OAAOC,SAAS;EACpB;EACA,OAAQC,QAAoB,IAAK;IAC7BC,UAAU,CAACD,QAAQ,EAAEF,wCAA6B,CAAC;EACvD,CAAC;AACL,CAAC;AAACI,OAAA,CAAAL,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["CMS_ENTRY_BATCH_SCHEDULE_WAIT","createBatchScheduleFn","undefined","callback","setTimeout"],"sources":["createBatchScheduleFn.ts"],"sourcesContent":["import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from \"./constants.js\";\n\n/**\n * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.\n * Intended to be used internally or for a specific user case.\n * Not to be documented and exposed to publish as it can slow the data loading a lot.\n *\n * https://github.com/graphql/dataloader#batch-scheduling\n */\nexport const createBatchScheduleFn = () => {\n if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {\n return undefined;\n }\n return (callback: () => void) => {\n setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);\n };\n};\n"],"mappings":"AAAA,SAASA,6BAA6B;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,IAAID,6BAA6B,IAAI,CAAC,EAAE;IACpC,OAAOE,SAAS;EACpB;EACA,OAAQC,QAAoB,IAAK;IAC7BC,UAAU,CAACD,QAAQ,EAAEH,6BAA6B,CAAC;EACvD,CAAC;AACL,CAAC","ignoreList":[]}
@@ -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 createGetAllEntryRevisions: (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 createGetAllEntryRevisions: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
@@ -1,45 +1,35 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createGetAllEntryRevisions = void 0;
8
- var _dataloader = _interopRequireDefault(require("dataloader"));
9
- var _query = require("@webiny/db-dynamodb/utils/query");
10
- var _keys = require("../keys");
11
- var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
12
- var _createBatchScheduleFn = require("./createBatchScheduleFn");
13
- const createGetAllEntryRevisions = params => {
1
+ import DataLoader from "dataloader";
2
+ import { createPartitionKey } from "../keys.js";
3
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
4
+ export const createGetAllEntryRevisions = params => {
14
5
  const {
15
6
  entity,
16
- locale,
17
- tenant
7
+ tenant,
8
+ modelId
18
9
  } = params;
19
- return new _dataloader.default(async ids => {
10
+ return new DataLoader(async ids => {
20
11
  const results = {};
21
12
  for (const id of ids) {
22
- const queryAllParams = {
23
- entity,
24
- partitionKey: (0, _keys.createPartitionKey)({
13
+ results[id] = (await entity.queryAllClean({
14
+ partitionKey: createPartitionKey({
25
15
  tenant,
26
- locale,
27
16
  id
28
17
  }),
29
18
  options: {
30
19
  beginsWith: "REV#"
31
20
  }
32
- };
33
- const items = await (0, _query.queryAll)(queryAllParams);
34
- results[id] = (0, _cleanup.cleanupItems)(entity, items);
21
+ })).map(item => {
22
+ return item.data;
23
+ });
35
24
  }
36
25
  return ids.map(entryId => {
37
- return results[entryId] || [];
26
+ return (results[entryId] || []).filter(item => {
27
+ return item.modelId === modelId;
28
+ });
38
29
  });
39
30
  }, {
40
- batchScheduleFn: (0, _createBatchScheduleFn.createBatchScheduleFn)()
31
+ batchScheduleFn: createBatchScheduleFn()
41
32
  });
42
33
  };
43
- exports.createGetAllEntryRevisions = createGetAllEntryRevisions;
44
34
 
45
35
  //# sourceMappingURL=getAllEntryRevisions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_dataloader","_interopRequireDefault","require","_query","_keys","_cleanup","_createBatchScheduleFn","createGetAllEntryRevisions","params","entity","locale","tenant","DataLoader","ids","results","id","queryAllParams","partitionKey","createPartitionKey","options","beginsWith","items","queryAll","cleanupItems","map","entryId","batchScheduleFn","createBatchScheduleFn","exports"],"sources":["getAllEntryRevisions.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport type { QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { queryAll } from \"@webiny/db-dynamodb/utils/query\";\nimport { createPartitionKey } from \"~/operations/entry/keys\";\nimport { cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport type { DataLoaderParams } from \"./types\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn\";\n\nexport const createGetAllEntryRevisions = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n return new DataLoader<string, CmsStorageEntry[]>(\n async (ids: readonly string[]) => {\n const results: Record<string, CmsStorageEntry[]> = {};\n for (const id of ids) {\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({\n tenant,\n locale,\n id\n }),\n options: {\n beginsWith: \"REV#\"\n }\n };\n const items = await queryAll<CmsStorageEntry>(queryAllParams);\n results[id] = cleanupItems(entity, items);\n }\n\n return ids.map(entryId => {\n return results[entryId] || [];\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,sBAAA,GAAAJ,OAAA;AAEO,MAAMK,0BAA0B,GAAIC,MAAwB,IAAK;EACpE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EACzC,OAAO,IAAII,mBAAU,CACjB,MAAOC,GAAsB,IAAK;IAC9B,MAAMC,OAA0C,GAAG,CAAC,CAAC;IACrD,KAAK,MAAMC,EAAE,IAAIF,GAAG,EAAE;MAClB,MAAMG,cAA8B,GAAG;QACnCP,MAAM;QACNQ,YAAY,EAAE,IAAAC,wBAAkB,EAAC;UAC7BP,MAAM;UACND,MAAM;UACNK;QACJ,CAAC,CAAC;QACFI,OAAO,EAAE;UACLC,UAAU,EAAE;QAChB;MACJ,CAAC;MACD,MAAMC,KAAK,GAAG,MAAM,IAAAC,eAAQ,EAAkBN,cAAc,CAAC;MAC7DF,OAAO,CAACC,EAAE,CAAC,GAAG,IAAAQ,qBAAY,EAACd,MAAM,EAAEY,KAAK,CAAC;IAC7C;IAEA,OAAOR,GAAG,CAACW,GAAG,CAACC,OAAO,IAAI;MACtB,OAAOX,OAAO,CAACW,OAAO,CAAC,IAAI,EAAE;IACjC,CAAC,CAAC;EACN,CAAC,EACD;IACIC,eAAe,EAAE,IAAAC,4CAAqB,EAAC;EAC3C,CACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAArB,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["DataLoader","createPartitionKey","createBatchScheduleFn","createGetAllEntryRevisions","params","entity","tenant","modelId","ids","results","id","queryAllClean","partitionKey","options","beginsWith","map","item","data","entryId","filter","batchScheduleFn"],"sources":["getAllEntryRevisions.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createPartitionKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetAllEntryRevisions = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const results: Record<string, CmsStorageEntry[]> = {};\n\n for (const id of ids) {\n results[id] = (\n await entity.queryAllClean({\n partitionKey: createPartitionKey({\n tenant,\n id\n }),\n options: {\n beginsWith: \"REV#\"\n }\n })\n ).map(item => {\n return item.data;\n });\n }\n\n return ids.map(entryId => {\n return (results[entryId] || []).filter(item => {\n return item.modelId === modelId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAEnC,SAASC,kBAAkB;AAE3B,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,0BAA0B,GAAIC,MAAyB,IAAK;EACrE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAC1C,OAAO,IAAIJ,UAAU,CACjB,MAAMQ,GAAG,IAAI;IACT,MAAMC,OAA0C,GAAG,CAAC,CAAC;IAErD,KAAK,MAAMC,EAAE,IAAIF,GAAG,EAAE;MAClBC,OAAO,CAACC,EAAE,CAAC,GAAG,CACV,MAAML,MAAM,CAACM,aAAa,CAAC;QACvBC,YAAY,EAAEX,kBAAkB,CAAC;UAC7BK,MAAM;UACNI;QACJ,CAAC,CAAC;QACFG,OAAO,EAAE;UACLC,UAAU,EAAE;QAChB;MACJ,CAAC,CAAC,EACJC,GAAG,CAACC,IAAI,IAAI;QACV,OAAOA,IAAI,CAACC,IAAI;MACpB,CAAC,CAAC;IACN;IAEA,OAAOT,GAAG,CAACO,GAAG,CAACG,OAAO,IAAI;MACtB,OAAO,CAACT,OAAO,CAACS,OAAO,CAAC,IAAI,EAAE,EAAEC,MAAM,CAACH,IAAI,IAAI;QAC3C,OAAOA,IAAI,CAACT,OAAO,KAAKA,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIa,eAAe,EAAElB,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -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 createGetLatestRevisionByEntryId: (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 createGetLatestRevisionByEntryId: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
@@ -1,52 +1,44 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createGetLatestRevisionByEntryId = 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 _createBatchScheduleFn = require("./createBatchScheduleFn");
12
- var _keys = require("../keys");
13
- const createGetLatestRevisionByEntryId = params => {
1
+ import DataLoader from "dataloader";
2
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
3
+ import { createLatestSortKey, createPartitionKey } from "../keys.js";
4
+ export const createGetLatestRevisionByEntryId = params => {
14
5
  const {
15
6
  entity,
16
- locale,
17
- tenant
7
+ tenant,
8
+ modelId
18
9
  } = params;
19
- const latestKey = (0, _keys.createLatestSortKey)();
20
- return new _dataloader.default(async ids => {
21
- const queries = ids.reduce((collection, id) => {
22
- const partitionKey = (0, _keys.createPartitionKey)({
10
+ const latestKey = createLatestSortKey();
11
+ return new DataLoader(async ids => {
12
+ const reader = entity.createEntityReader();
13
+ const keys = new Set();
14
+ for (const id of ids) {
15
+ const partitionKey = createPartitionKey({
23
16
  tenant,
24
- locale,
25
17
  id
26
18
  });
27
- if (collection[partitionKey]) {
28
- return collection;
19
+ if (keys.has(partitionKey)) {
20
+ continue;
29
21
  }
30
- collection[partitionKey] = entity.getBatch({
22
+ keys.add(partitionKey);
23
+ reader.get({
31
24
  PK: partitionKey,
32
25
  SK: latestKey
33
26
  });
34
- return collection;
35
- }, {});
36
- const records = await (0, _dbDynamodb.batchReadAll)({
37
- table: entity.table,
38
- items: Object.values(queries)
27
+ }
28
+ const items = (await reader.execute()).map(item => {
29
+ return item.data;
39
30
  });
40
- const items = (0, _cleanup.cleanupItems)(entity, records);
41
31
  return ids.map(entryId => {
42
32
  return items.filter(item => {
33
+ if (item.modelId !== modelId) {
34
+ return false;
35
+ }
43
36
  return entryId === item.entryId;
44
37
  });
45
38
  });
46
39
  }, {
47
- batchScheduleFn: (0, _createBatchScheduleFn.createBatchScheduleFn)()
40
+ batchScheduleFn: createBatchScheduleFn()
48
41
  });
49
42
  };
50
- exports.createGetLatestRevisionByEntryId = createGetLatestRevisionByEntryId;
51
43
 
52
44
  //# sourceMappingURL=getLatestRevisionByEntryId.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_dataloader","_interopRequireDefault","require","_dbDynamodb","_cleanup","_createBatchScheduleFn","_keys","createGetLatestRevisionByEntryId","params","entity","locale","tenant","latestKey","createLatestSortKey","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":["getLatestRevisionByEntryId.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 { createBatchScheduleFn } from \"./createBatchScheduleFn\";\nimport { createLatestSortKey, createPartitionKey } from \"~/operations/entry/keys\";\nimport type { DataLoaderParams } from \"./types\";\n\nexport const createGetLatestRevisionByEntryId = (params: DataLoaderParams) => {\n const { entity, locale, tenant } = params;\n\n const latestKey = createLatestSortKey();\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 if (collection[partitionKey]) {\n return collection;\n }\n collection[partitionKey] = entity.getBatch({\n PK: partitionKey,\n SK: latestKey\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,sBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAGO,MAAMK,gCAAgC,GAAIC,MAAwB,IAAK;EAC1E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAEzC,MAAMI,SAAS,GAAG,IAAAC,yBAAmB,EAAC,CAAC;EAEvC,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,gCAAA,GAAAA,gCAAA","ignoreList":[]}
1
+ {"version":3,"names":["DataLoader","createBatchScheduleFn","createLatestSortKey","createPartitionKey","createGetLatestRevisionByEntryId","params","entity","tenant","modelId","latestKey","ids","reader","createEntityReader","keys","Set","id","partitionKey","has","add","get","PK","SK","items","execute","map","item","data","entryId","filter","batchScheduleFn"],"sources":["getLatestRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\nimport { createLatestSortKey, createPartitionKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\n\nexport const createGetLatestRevisionByEntryId = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n\n const latestKey = createLatestSortKey();\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 if (keys.has(partitionKey)) {\n continue;\n }\n keys.add(partitionKey);\n reader.get({\n PK: partitionKey,\n SK: latestKey\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"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAEnC,SAASC,qBAAqB;AAC9B,SAASC,mBAAmB,EAAEC,kBAAkB;AAGhD,OAAO,MAAMC,gCAAgC,GAAIC,MAAyB,IAAK;EAC3E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE1C,MAAMI,SAAS,GAAGP,mBAAmB,CAAC,CAAC;EAEvC,OAAO,IAAIF,UAAU,CACjB,MAAMU,GAAG,IAAI;IACT,MAAMC,MAAM,GAAGL,MAAM,CAACM,kBAAkB,CAAC,CAAC;IAE1C,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;IAE9B,KAAK,MAAMC,EAAE,IAAIL,GAAG,EAAE;MAClB,MAAMM,YAAY,GAAGb,kBAAkB,CAAC;QACpCI,MAAM;QACNQ;MACJ,CAAC,CAAC;MACF,IAAIF,IAAI,CAACI,GAAG,CAACD,YAAY,CAAC,EAAE;QACxB;MACJ;MACAH,IAAI,CAACK,GAAG,CAACF,YAAY,CAAC;MACtBL,MAAM,CAACQ,GAAG,CAAC;QACPC,EAAE,EAAEJ,YAAY;QAChBK,EAAE,EAAEZ;MACR,CAAC,CAAC;IACN;IAEA,MAAMa,KAAK,GAAG,CAAC,MAAMX,MAAM,CAACY,OAAO,CAAC,CAAC,EAAEC,GAAG,CAACC,IAAI,IAAI;MAC/C,OAAOA,IAAI,CAACC,IAAI;IACpB,CAAC,CAAC;IAEF,OAAOhB,GAAG,CAACc,GAAG,CAACG,OAAO,IAAI;MACtB,OAAOL,KAAK,CAACM,MAAM,CAACH,IAAI,IAAI;QACxB,IAAIA,IAAI,CAACjB,OAAO,KAAKA,OAAO,EAAE;UAC1B,OAAO,KAAK;QAChB;QACA,OAAOmB,OAAO,KAAKF,IAAI,CAACE,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIE,eAAe,EAAE5B,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -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 createGetPublishedRevisionByEntryId: (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 createGetPublishedRevisionByEntryId: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
@@ -1,52 +1,44 @@
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 => {
1
+ import DataLoader from "dataloader";
2
+ import { createPartitionKey, createPublishedSortKey } from "../keys.js";
3
+ import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
4
+ export const createGetPublishedRevisionByEntryId = params => {
14
5
  const {
15
6
  entity,
16
- locale,
17
- tenant
7
+ tenant,
8
+ modelId
18
9
  } = 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)({
10
+ const publishedKey = createPublishedSortKey();
11
+ return new DataLoader(async ids => {
12
+ const reader = entity.createEntityReader();
13
+ const keys = new Set();
14
+ for (const id of ids) {
15
+ const partitionKey = createPartitionKey({
23
16
  tenant,
24
- locale,
25
17
  id
26
18
  });
27
- if (collection[partitionKey]) {
28
- return collection;
19
+ if (keys.has(partitionKey)) {
20
+ continue;
29
21
  }
30
- collection[partitionKey] = entity.getBatch({
22
+ keys.add(partitionKey);
23
+ reader.get({
31
24
  PK: partitionKey,
32
25
  SK: publishedKey
33
26
  });
34
- return collection;
35
- }, {});
36
- const records = await (0, _dbDynamodb.batchReadAll)({
37
- table: entity.table,
38
- items: Object.values(queries)
27
+ }
28
+ const items = (await reader.execute()).map(item => {
29
+ return item.data;
39
30
  });
40
- const items = (0, _cleanup.cleanupItems)(entity, records);
41
31
  return ids.map(entryId => {
42
32
  return items.filter(item => {
33
+ if (item.modelId !== modelId) {
34
+ return false;
35
+ }
43
36
  return entryId === item.entryId;
44
37
  });
45
38
  });
46
39
  }, {
47
- batchScheduleFn: (0, _createBatchScheduleFn.createBatchScheduleFn)()
40
+ batchScheduleFn: createBatchScheduleFn()
48
41
  });
49
42
  };
50
- exports.createGetPublishedRevisionByEntryId = createGetPublishedRevisionByEntryId;
51
43
 
52
44
  //# 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,"names":["DataLoader","createPartitionKey","createPublishedSortKey","createBatchScheduleFn","createGetPublishedRevisionByEntryId","params","entity","tenant","modelId","publishedKey","ids","reader","createEntityReader","keys","Set","id","partitionKey","has","add","get","PK","SK","items","execute","map","item","data","entryId","filter","batchScheduleFn"],"sources":["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"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAEnC,SAASC,kBAAkB,EAAEC,sBAAsB;AAEnD,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,mCAAmC,GAAIC,MAAyB,IAAK;EAC9E,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE1C,MAAMI,YAAY,GAAGP,sBAAsB,CAAC,CAAC;EAC7C,OAAO,IAAIF,UAAU,CACjB,MAAMU,GAAG,IAAI;IACT,MAAMC,MAAM,GAAGL,MAAM,CAACM,kBAAkB,CAAC,CAAC;IAE1C,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;IAE9B,KAAK,MAAMC,EAAE,IAAIL,GAAG,EAAE;MAClB,MAAMM,YAAY,GAAGf,kBAAkB,CAAC;QACpCM,MAAM;QACNQ;MACJ,CAAC,CAAC;MACF,IAAIF,IAAI,CAACI,GAAG,CAACD,YAAY,CAAC,EAAE;QACxB;MACJ;MACAH,IAAI,CAACK,GAAG,CAACF,YAAY,CAAC;MACtBL,MAAM,CAACQ,GAAG,CAAC;QACPC,EAAE,EAAEJ,YAAY;QAChBK,EAAE,EAAEZ;MACR,CAAC,CAAC;IACN;IAEA,MAAMa,KAAK,GAAG,CAAC,MAAMX,MAAM,CAACY,OAAO,CAAC,CAAC,EAAEC,GAAG,CAACC,IAAI,IAAI;MAC/C,OAAOA,IAAI,CAACC,IAAI;IACpB,CAAC,CAAC;IAEF,OAAOhB,GAAG,CAACc,GAAG,CAACG,OAAO,IAAI;MACtB,OAAOL,KAAK,CAACM,MAAM,CAACH,IAAI,IAAI;QACxB,IAAIA,IAAI,CAACjB,OAAO,KAAKA,OAAO,EAAE;UAC1B,OAAO,KAAK;QAChB;QACA,OAAOmB,OAAO,KAAKF,IAAI,CAACE,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIE,eAAe,EAAE1B,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -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,54 @@
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 => {
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
+ export const createGetRevisionById = params => {
15
6
  const {
16
7
  entity,
17
8
  tenant,
18
- locale
9
+ modelId
19
10
  } = params;
20
- return new _dataloader.default(async ids => {
21
- const queries = ids.reduce((collection, id) => {
22
- const partitionKey = (0, _keys.createPartitionKey)({
11
+ return new DataLoader(async ids => {
12
+ const reader = entity.createEntityReader();
13
+ const keys = new Set();
14
+ for (const id of ids) {
15
+ const partitionKey = createPartitionKey({
23
16
  tenant,
24
- locale,
25
17
  id
26
18
  });
27
19
  const {
28
20
  version
29
- } = (0, _utils.parseIdentifier)(id);
21
+ } = parseIdentifier(id);
30
22
  if (version === null) {
31
- return collection;
23
+ continue;
32
24
  }
33
- const sortKey = (0, _keys.createRevisionSortKey)({
25
+ const sortKey = createRevisionSortKey({
34
26
  version
35
27
  });
36
- const keys = `${partitionKey}__${sortKey}`;
37
- if (collection[keys]) {
38
- return collection;
28
+ const key = `${partitionKey}__${sortKey}`;
29
+ if (keys.has(key)) {
30
+ continue;
39
31
  }
40
- collection[keys] = entity.getBatch({
32
+ keys.add(key);
33
+ reader.get({
41
34
  PK: partitionKey,
42
35
  SK: sortKey
43
36
  });
44
- return collection;
45
- }, {});
46
- const records = await (0, _dbDynamodb.batchReadAll)({
47
- table: entity.table,
48
- items: Object.values(queries)
37
+ }
38
+ const items = (await reader.execute()).map(item => {
39
+ return item.data;
49
40
  });
50
- const items = (0, _cleanup.cleanupItems)(entity, records);
51
41
  return ids.map(id => {
52
42
  return items.filter(item => {
43
+ if (item.modelId !== modelId) {
44
+ return false;
45
+ }
53
46
  return id === item.id;
54
47
  });
55
48
  });
56
49
  }, {
57
- batchScheduleFn: (0, _createBatchScheduleFn.createBatchScheduleFn)()
50
+ batchScheduleFn: createBatchScheduleFn()
58
51
  });
59
52
  };
60
- exports.createGetRevisionById = createGetRevisionById;
61
53
 
62
54
  //# 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,"names":["DataLoader","createPartitionKey","createRevisionSortKey","parseIdentifier","createBatchScheduleFn","createGetRevisionById","params","entity","tenant","modelId","ids","reader","createEntityReader","keys","Set","id","partitionKey","version","sortKey","key","has","add","get","PK","SK","items","execute","map","item","data","filter","batchScheduleFn"],"sources":["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"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AAEnC,SAASC,kBAAkB,EAAEC,qBAAqB;AAElD,SAASC,eAAe,QAAQ,eAAe;AAC/C,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,qBAAqB,GAAIC,MAAyB,IAAK;EAChE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE1C,OAAO,IAAIN,UAAU,CACjB,MAAMU,GAAG,IAAI;IACT,MAAMC,MAAM,GAAGJ,MAAM,CAACK,kBAAkB,CAAC,CAAC;IAE1C,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;IAE9B,KAAK,MAAMC,EAAE,IAAIL,GAAG,EAAE;MAClB,MAAMM,YAAY,GAAGf,kBAAkB,CAAC;QACpCO,MAAM;QACNO;MACJ,CAAC,CAAC;MACF,MAAM;QAAEE;MAAQ,CAAC,GAAGd,eAAe,CAACY,EAAE,CAAC;MACvC,IAAIE,OAAO,KAAK,IAAI,EAAE;QAClB;MACJ;MACA,MAAMC,OAAO,GAAGhB,qBAAqB,CAAC;QAClCe;MACJ,CAAC,CAAC;MACF,MAAME,GAAG,GAAG,GAAGH,YAAY,KAAKE,OAAO,EAAE;MACzC,IAAIL,IAAI,CAACO,GAAG,CAACD,GAAG,CAAC,EAAE;QACf;MACJ;MACAN,IAAI,CAACQ,GAAG,CAACF,GAAG,CAAC;MAEbR,MAAM,CAACW,GAAG,CAAC;QACPC,EAAE,EAAEP,YAAY;QAChBQ,EAAE,EAAEN;MACR,CAAC,CAAC;IACN;IAEA,MAAMO,KAAK,GAAG,CAAC,MAAMd,MAAM,CAACe,OAAO,CAAC,CAAC,EAAEC,GAAG,CAACC,IAAI,IAAI;MAC/C,OAAOA,IAAI,CAACC,IAAI;IACpB,CAAC,CAAC;IAEF,OAAOnB,GAAG,CAACiB,GAAG,CAACZ,EAAE,IAAI;MACjB,OAAOU,KAAK,CAACK,MAAM,CAACF,IAAI,IAAI;QACxB,IAAIA,IAAI,CAACnB,OAAO,KAAKA,OAAO,EAAE;UAC1B,OAAO,KAAK;QAChB;QACA,OAAOM,EAAE,KAAKa,IAAI,CAACb,EAAE;MACzB,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIgB,eAAe,EAAE3B,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
@@ -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;