@webiny/api-headless-cms-ddb-es 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9

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 (388) hide show
  1. package/configurations.d.ts +5 -4
  2. package/configurations.js +27 -33
  3. package/configurations.js.map +1 -1
  4. package/definitions/entry.js +7 -9
  5. package/definitions/entry.js.map +1 -1
  6. package/definitions/group.js +7 -9
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.js +7 -9
  9. package/definitions/model.js.map +1 -1
  10. package/definitions/types.d.ts +9 -3
  11. package/definitions/types.js +0 -3
  12. package/elasticsearch/createElasticsearchIndex.d.ts +3 -3
  13. package/elasticsearch/createElasticsearchIndex.js +52 -27
  14. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  15. package/elasticsearch/deleteElasticsearchIndex.d.ts +1 -1
  16. package/elasticsearch/deleteElasticsearchIndex.js +18 -26
  17. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  18. package/exports/api/cms/opensearch.d.ts +9 -0
  19. package/exports/api/cms/opensearch.js +9 -0
  20. package/feature.d.ts +1 -0
  21. package/feature.js +179 -0
  22. package/feature.js.map +1 -0
  23. package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +16 -0
  24. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +5 -0
  25. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -0
  26. package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +1 -0
  27. package/features/CmsEntryOpenSearchBodyModifier/index.js +1 -0
  28. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +14 -0
  29. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +42 -0
  30. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  31. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +32 -0
  32. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +5 -0
  33. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -0
  34. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +11 -0
  35. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +5 -0
  36. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  37. package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +1 -0
  38. package/features/CmsEntryOpenSearchFieldIndex/constants.js +4 -0
  39. package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -0
  40. package/features/CmsEntryOpenSearchFieldIndex/feature.d.ts +4 -0
  41. package/features/CmsEntryOpenSearchFieldIndex/feature.js +29 -0
  42. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -0
  43. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +11 -0
  44. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +60 -0
  45. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -0
  46. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +13 -0
  47. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +33 -0
  48. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -0
  49. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +10 -0
  50. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +21 -0
  51. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -0
  52. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +10 -0
  53. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +22 -0
  54. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -0
  55. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +11 -0
  56. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +32 -0
  57. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -0
  58. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +12 -0
  59. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +107 -0
  60. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -0
  61. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +10 -0
  62. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +21 -0
  63. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -0
  64. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.d.ts +15 -0
  65. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js +40 -0
  66. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js.map +1 -0
  67. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.d.ts +15 -0
  68. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js +40 -0
  69. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js.map +1 -0
  70. package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +3 -0
  71. package/features/CmsEntryOpenSearchFieldIndex/index.js +3 -0
  72. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +11 -0
  73. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +36 -0
  74. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  75. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +37 -0
  76. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +5 -0
  77. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -0
  78. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +9 -0
  79. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +5 -0
  80. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  81. package/features/CmsEntryOpenSearchFilter/constants.d.ts +1 -0
  82. package/features/CmsEntryOpenSearchFilter/constants.js +4 -0
  83. package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -0
  84. package/features/CmsEntryOpenSearchFilter/feature.d.ts +4 -0
  85. package/features/CmsEntryOpenSearchFilter/feature.js +17 -0
  86. package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -0
  87. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +9 -0
  88. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +26 -0
  89. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -0
  90. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +9 -0
  91. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +43 -0
  92. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -0
  93. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +9 -0
  94. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +36 -0
  95. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -0
  96. package/features/CmsEntryOpenSearchFilter/index.d.ts +3 -0
  97. package/features/CmsEntryOpenSearchFilter/index.js +3 -0
  98. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +20 -0
  99. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +5 -0
  100. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -0
  101. package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +1 -0
  102. package/features/CmsEntryOpenSearchFullTextSearch/index.js +1 -0
  103. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +11 -0
  104. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +17 -0
  105. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -0
  106. package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +14 -0
  107. package/features/CmsEntryOpenSearchIndex/abstractions.js +5 -0
  108. package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -0
  109. package/features/CmsEntryOpenSearchIndex/feature.d.ts +4 -0
  110. package/features/CmsEntryOpenSearchIndex/feature.js +11 -0
  111. package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -0
  112. package/features/CmsEntryOpenSearchIndex/index.d.ts +3 -0
  113. package/features/CmsEntryOpenSearchIndex/index.js +3 -0
  114. package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +16 -0
  115. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +5 -0
  116. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -0
  117. package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +1 -0
  118. package/features/CmsEntryOpenSearchQueryModifier/index.js +1 -0
  119. package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +15 -0
  120. package/features/CmsEntryOpenSearchSortModifier/abstractions.js +5 -0
  121. package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -0
  122. package/features/CmsEntryOpenSearchSortModifier/index.d.ts +1 -0
  123. package/features/CmsEntryOpenSearchSortModifier/index.js +1 -0
  124. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +12 -0
  125. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +31 -0
  126. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  127. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +22 -0
  128. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +5 -0
  129. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -0
  130. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +10 -0
  131. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +5 -0
  132. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  133. package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +4 -0
  134. package/features/CmsEntryOpenSearchValueSearch/feature.js +17 -0
  135. package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -0
  136. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +10 -0
  137. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +21 -0
  138. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -0
  139. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +10 -0
  140. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +44 -0
  141. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -0
  142. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +10 -0
  143. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +22 -0
  144. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -0
  145. package/features/CmsEntryOpenSearchValueSearch/index.d.ts +3 -0
  146. package/features/CmsEntryOpenSearchValueSearch/index.js +3 -0
  147. package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +23 -0
  148. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +5 -0
  149. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -0
  150. package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +1 -0
  151. package/features/CmsEntryOpenSearchValuesModifier/index.js +1 -0
  152. package/helpers/entryIndexHelpers.d.ts +6 -4
  153. package/helpers/entryIndexHelpers.js +70 -186
  154. package/helpers/entryIndexHelpers.js.map +1 -1
  155. package/helpers/fieldIdentifier.js +18 -30
  156. package/helpers/fieldIdentifier.js.map +1 -1
  157. package/helpers/index.js +0 -2
  158. package/index.d.ts +1 -3
  159. package/index.js +1 -190
  160. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -0
  161. package/operations/entry/dataLoader/DataLoaderCache.js +22 -29
  162. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  163. package/operations/entry/dataLoader/constants.js +2 -1
  164. package/operations/entry/dataLoader/constants.js.map +1 -1
  165. package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
  166. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  167. package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -26
  168. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  169. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +28 -34
  170. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  171. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +28 -34
  172. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  173. package/operations/entry/dataLoader/getRevisionById.js +33 -43
  174. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  175. package/operations/entry/dataLoader/index.js +8 -9
  176. package/operations/entry/dataLoader/index.js.map +1 -1
  177. package/operations/entry/dataLoader/types.d.ts +1 -0
  178. package/operations/entry/dataLoader/types.js +0 -3
  179. package/operations/entry/dataLoaders.js +81 -97
  180. package/operations/entry/dataLoaders.js.map +1 -1
  181. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
  182. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +6 -24
  183. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
  184. package/operations/entry/elasticsearch/body.d.ts +19 -3
  185. package/operations/entry/elasticsearch/body.js +74 -122
  186. package/operations/entry/elasticsearch/body.js.map +1 -1
  187. package/operations/entry/elasticsearch/fields/createSystemField.d.ts +4 -0
  188. package/operations/entry/elasticsearch/fields/createSystemField.js +9 -0
  189. package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -0
  190. package/operations/entry/elasticsearch/fields/live.d.ts +2 -0
  191. package/operations/entry/elasticsearch/fields/live.js +50 -0
  192. package/operations/entry/elasticsearch/fields/live.js.map +1 -0
  193. package/operations/entry/elasticsearch/fields/location.d.ts +2 -0
  194. package/operations/entry/elasticsearch/fields/location.js +50 -0
  195. package/operations/entry/elasticsearch/fields/location.js.map +1 -0
  196. package/operations/entry/elasticsearch/fields/state.d.ts +2 -0
  197. package/operations/entry/elasticsearch/fields/state.js +104 -0
  198. package/operations/entry/elasticsearch/fields/state.js.map +1 -0
  199. package/operations/entry/elasticsearch/fields.d.ts +6 -4
  200. package/operations/entry/elasticsearch/fields.js +194 -388
  201. package/operations/entry/elasticsearch/fields.js.map +1 -1
  202. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +6 -5
  203. package/operations/entry/elasticsearch/filtering/applyFiltering.js +32 -45
  204. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  205. package/operations/entry/elasticsearch/filtering/exec.d.ts +6 -2
  206. package/operations/entry/elasticsearch/filtering/exec.js +84 -166
  207. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  208. package/operations/entry/elasticsearch/filtering/index.js +0 -2
  209. package/operations/entry/elasticsearch/filtering/path.d.ts +4 -3
  210. package/operations/entry/elasticsearch/filtering/path.js +24 -35
  211. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  212. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -2
  213. package/operations/entry/elasticsearch/filtering/populated.js +8 -14
  214. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  215. package/operations/entry/elasticsearch/filtering/values.js +11 -12
  216. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  217. package/operations/entry/elasticsearch/fullTextSearch.d.ts +7 -6
  218. package/operations/entry/elasticsearch/fullTextSearch.js +45 -79
  219. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  220. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +4 -4
  221. package/operations/entry/elasticsearch/fullTextSearchFields.js +7 -17
  222. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  223. package/operations/entry/elasticsearch/initialQuery.d.ts +3 -3
  224. package/operations/entry/elasticsearch/initialQuery.js +37 -80
  225. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  226. package/operations/entry/elasticsearch/keyword.js +13 -27
  227. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  228. package/operations/entry/elasticsearch/plugins/operator.d.ts +2 -2
  229. package/operations/entry/elasticsearch/plugins/operator.js +10 -21
  230. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  231. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +6 -4
  232. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
  233. package/operations/entry/elasticsearch/sort.d.ts +4 -4
  234. package/operations/entry/elasticsearch/sort.js +69 -96
  235. package/operations/entry/elasticsearch/sort.js.map +1 -1
  236. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -9
  237. package/operations/entry/elasticsearch/transformValueForSearch.js +9 -24
  238. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  239. package/operations/entry/elasticsearch/types.d.ts +3 -10
  240. package/operations/entry/elasticsearch/types.js +0 -3
  241. package/operations/entry/index.d.ts +22 -2
  242. package/operations/entry/index.js +1316 -1650
  243. package/operations/entry/index.js.map +1 -1
  244. package/operations/entry/keys.js +43 -63
  245. package/operations/entry/keys.js.map +1 -1
  246. package/operations/entry/recordType.js +4 -9
  247. package/operations/entry/recordType.js.map +1 -1
  248. package/operations/entry/transformations/convertEntryKeys.js +21 -26
  249. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  250. package/operations/entry/transformations/index.d.ts +6 -2
  251. package/operations/entry/transformations/index.js +84 -112
  252. package/operations/entry/transformations/index.js.map +1 -1
  253. package/operations/entry/transformations/modifyEntryValues.d.ts +6 -4
  254. package/operations/entry/transformations/modifyEntryValues.js +12 -17
  255. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  256. package/operations/entry/transformations/transformEntryKeys.js +13 -16
  257. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  258. package/operations/entry/transformations/transformEntryToIndex.d.ts +2 -2
  259. package/operations/entry/transformations/transformEntryToIndex.js +16 -20
  260. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  261. package/operations/group/index.d.ts +2 -2
  262. package/operations/group/index.js +115 -139
  263. package/operations/group/index.js.map +1 -1
  264. package/operations/model/index.d.ts +1 -1
  265. package/operations/model/index.js +128 -157
  266. package/operations/model/index.js.map +1 -1
  267. package/package.json +35 -30
  268. package/tasks/createIndexTaskPlugin.js +36 -32
  269. package/tasks/createIndexTaskPlugin.js.map +1 -1
  270. package/types.d.ts +7 -112
  271. package/types.js +7 -36
  272. package/types.js.map +1 -1
  273. package/values/NoValueContainer.js +8 -10
  274. package/values/NoValueContainer.js.map +1 -1
  275. package/definitions/types.js.map +0 -1
  276. package/dynamoDb/index.d.ts +0 -3
  277. package/dynamoDb/index.js +0 -8
  278. package/dynamoDb/index.js.map +0 -1
  279. package/dynamoDb/storage/longText.d.ts +0 -10
  280. package/dynamoDb/storage/longText.js +0 -88
  281. package/dynamoDb/storage/longText.js.map +0 -1
  282. package/dynamoDb/storage/richText.d.ts +0 -2
  283. package/dynamoDb/storage/richText.js +0 -51
  284. package/dynamoDb/storage/richText.js.map +0 -1
  285. package/elasticsearch/index.d.ts +0 -2
  286. package/elasticsearch/index.js +0 -5
  287. package/elasticsearch/index.js.map +0 -1
  288. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  289. package/elasticsearch/indexing/dateTimeIndexing.js +0 -81
  290. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  291. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  292. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -47
  293. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  294. package/elasticsearch/indexing/index.d.ts +0 -2
  295. package/elasticsearch/indexing/index.js +0 -10
  296. package/elasticsearch/indexing/index.js.map +0 -1
  297. package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
  298. package/elasticsearch/indexing/jsonIndexing.js +0 -21
  299. package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
  300. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  301. package/elasticsearch/indexing/longTextIndexing.js +0 -35
  302. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  303. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  304. package/elasticsearch/indexing/numberIndexing.js +0 -34
  305. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  306. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  307. package/elasticsearch/indexing/objectIndexing.js +0 -194
  308. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  309. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  310. package/elasticsearch/indexing/richTextIndexing.js +0 -24
  311. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  312. package/elasticsearch/indices/base.d.ts +0 -2
  313. package/elasticsearch/indices/base.js +0 -7
  314. package/elasticsearch/indices/base.js.map +0 -1
  315. package/elasticsearch/indices/index.d.ts +0 -1
  316. package/elasticsearch/indices/index.js +0 -6
  317. package/elasticsearch/indices/index.js.map +0 -1
  318. package/elasticsearch/search/index.d.ts +0 -3
  319. package/elasticsearch/search/index.js +0 -6
  320. package/elasticsearch/search/index.js.map +0 -1
  321. package/elasticsearch/search/refSearch.d.ts +0 -2
  322. package/elasticsearch/search/refSearch.js +0 -24
  323. package/elasticsearch/search/refSearch.js.map +0 -1
  324. package/elasticsearch/search/searchableJson.d.ts +0 -2
  325. package/elasticsearch/search/searchableJson.js +0 -53
  326. package/elasticsearch/search/searchableJson.js.map +0 -1
  327. package/elasticsearch/search/timeSearch.d.ts +0 -2
  328. package/elasticsearch/search/timeSearch.js +0 -20
  329. package/elasticsearch/search/timeSearch.js.map +0 -1
  330. package/helpers/index.js.map +0 -1
  331. package/index.js.map +0 -1
  332. package/operations/entry/dataLoader/types.js.map +0 -1
  333. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  334. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  335. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -22
  336. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  337. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  338. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -8
  339. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  340. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  341. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -61
  342. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  343. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  344. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -49
  345. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  346. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  347. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -11
  348. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  349. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  350. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -11
  351. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  352. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  353. package/operations/entry/elasticsearch/plugins/search.js +0 -18
  354. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  355. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  356. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -11
  357. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  358. package/operations/entry/elasticsearch/types.js.map +0 -1
  359. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
  360. package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -46
  361. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
  362. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
  363. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -13
  364. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  365. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  366. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -19
  367. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  368. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  369. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -6
  370. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  371. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -32
  372. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -32
  373. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  374. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
  375. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -13
  376. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  377. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
  378. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -13
  379. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  380. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
  381. package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -42
  382. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
  383. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  384. package/plugins/CmsEntryFilterPlugin.js +0 -15
  385. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  386. package/plugins/index.d.ts +0 -8
  387. package/plugins/index.js +0 -10
  388. package/plugins/index.js.map +0 -1
package/index.js CHANGED
@@ -1,190 +1 @@
1
- import dynamoDbValueFilters from "@webiny/db-dynamodb/plugins/filters/index.js";
2
- import elasticsearchPlugins from "./elasticsearch/index.js";
3
- import dynamoDbPlugins from "./dynamoDb/index.js";
4
- import { createModelsStorageOperations } from "./operations/model/index.js";
5
- import { createEntriesStorageOperations } from "./operations/entry/index.js";
6
- import { ENTITIES } from "./types.js";
7
- import { createGroupEntity } from "./definitions/group.js";
8
- import { createModelEntity } from "./definitions/model.js";
9
- import { createEntryEntity } from "./definitions/entry.js";
10
- import { createElasticsearchIndex } from "./elasticsearch/createElasticsearchIndex.js";
11
- import { PluginsContainer } from "@webiny/plugins";
12
- import { createGroupsStorageOperations } from "./operations/group/index.js";
13
- import { createElasticsearchEntity, createElasticsearchTable, ElasticsearchQueryBuilderOperatorPlugin } from "@webiny/api-elasticsearch";
14
- import { elasticsearchIndexPlugins } from "./elasticsearch/indices/index.js";
15
- import { deleteElasticsearchIndex } from "./elasticsearch/deleteElasticsearchIndex.js";
16
- import { CmsElasticsearchModelFieldPlugin, CmsEntryElasticsearchBodyModifierPlugin, CmsEntryElasticsearchFullTextSearchPlugin, CmsEntryElasticsearchIndexPlugin, CmsEntryElasticsearchQueryBuilderValueSearchPlugin, CmsEntryElasticsearchQueryModifierPlugin, CmsEntryElasticsearchSortModifierPlugin, CmsEntryElasticsearchValuesModifier } from "./plugins/index.js";
17
- import { createFilterPlugins } from "./operations/entry/elasticsearch/filtering/plugins/index.js";
18
- import { CmsEntryFilterPlugin } from "./plugins/CmsEntryFilterPlugin.js";
19
- import { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from "@webiny/api-headless-cms";
20
- import { createCreateIndexTask } from "./tasks/createIndexTaskPlugin.js";
21
- import { CompressorPlugin } from "@webiny/api";
22
- import { ModelAfterCreateEventHandler } from "@webiny/api-headless-cms/features/contentModel/CreateModel/index.js";
23
- import { ModelAfterCreateFromEventHandler } from "@webiny/api-headless-cms/features/contentModel/CreateModelFrom/events.js";
24
- import { ModelAfterDeleteEventHandler } from "@webiny/api-headless-cms/features/contentModel/DeleteModel/events.js";
25
- import { createTable } from "@webiny/db-dynamodb";
26
- export * from "./plugins/index.js";
27
- export const createStorageOperations = params => {
28
- const {
29
- table,
30
- esTable,
31
- documentClient,
32
- elasticsearch,
33
- plugins: userPlugins
34
- } = params;
35
- const tableInstance = createTable({
36
- name: table || process.env.DB_TABLE,
37
- documentClient
38
- });
39
- const tableElasticsearchInstance = createElasticsearchTable({
40
- name: esTable,
41
- documentClient
42
- });
43
- const entities = {
44
- groups: createGroupEntity({
45
- entityName: ENTITIES.GROUPS,
46
- table: tableInstance
47
- }),
48
- models: createModelEntity({
49
- entityName: ENTITIES.MODELS,
50
- table: tableInstance
51
- }),
52
- entries: createEntryEntity({
53
- entityName: ENTITIES.ENTRIES,
54
- table: tableInstance
55
- }),
56
- entriesEs: createElasticsearchEntity({
57
- entityName: ENTITIES.ENTRIES_ES,
58
- table: tableElasticsearchInstance
59
- })
60
- };
61
- const plugins = new PluginsContainer([
62
- /**
63
- * DynamoDB filter plugins for the where conditions.
64
- */
65
- dynamoDbValueFilters(),
66
- /**
67
- * Field plugins for DynamoDB.
68
- */
69
- dynamoDbPlugins(),
70
- /**
71
- * Field plugins for Elasticsearch.
72
- */
73
- elasticsearchPlugins(),
74
- /**
75
- * Built-in Elasticsearch index templates.
76
- */
77
- elasticsearchIndexPlugins(),
78
- /**
79
- * Filter plugins used to apply filtering from where conditions to Elasticsearch query.
80
- */
81
- createFilterPlugins(),
82
- /**
83
- * User defined custom plugins.
84
- * They are at the end because we can then override existing plugins.
85
- */
86
- ...(userPlugins || [])]);
87
- const entries = createEntriesStorageOperations({
88
- entity: entities.entries,
89
- esEntity: entities.entriesEs,
90
- plugins,
91
- elasticsearch
92
- });
93
- return {
94
- name: "dynamodb:elasticsearch",
95
- beforeInit: async context => {
96
- context.db.registry.register({
97
- item: entities.entries,
98
- app: "cms",
99
- tags: ["regular", entities.entries.name]
100
- });
101
- context.db.registry.register({
102
- item: entities.entriesEs,
103
- app: "cms",
104
- tags: ["es", entities.entriesEs.name]
105
- });
106
- /**
107
- * Attach the elasticsearch into context if it is not already attached.
108
- */
109
- if (!context.elasticsearch) {
110
- context.elasticsearch = elasticsearch;
111
- }
112
-
113
- /**
114
- * This registers the task implementation
115
- */
116
- createCreateIndexTask(context);
117
-
118
- /**
119
- * Pass the plugins to the parent context.
120
- */
121
- context.plugins.register([dynamoDbPlugins(), elasticsearchIndexPlugins()]);
122
- /**
123
- * We need to fetch all the plugin types in the list from the main container.
124
- * This way we do not need to register plugins in the storage plugins contains.
125
- */
126
- const types = [ElasticsearchQueryBuilderOperatorPlugin.type,
127
- // Headless CMS
128
- "cms-model-field-to-graphql", CmsEntryFilterPlugin.type, CmsEntryElasticsearchBodyModifierPlugin.type, CmsEntryElasticsearchFullTextSearchPlugin.type, CmsEntryElasticsearchIndexPlugin.type, CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type, CmsEntryElasticsearchQueryModifierPlugin.type, CmsEntryElasticsearchSortModifierPlugin.type, CmsElasticsearchModelFieldPlugin.type, StorageOperationsCmsModelPlugin.type, StorageTransformPlugin.type, CmsEntryElasticsearchValuesModifier.type, CompressorPlugin.type];
129
- for (const type of types) {
130
- plugins.mergeByType(context.plugins, type);
131
- }
132
- entries.dataLoaders.clearAll();
133
- },
134
- init: async context => {
135
- /**
136
- * TODO @pavel
137
- * Moved operations to AFTER create/from because at in before the model does not have modelId - to create the index.
138
- */
139
- context.container.registerFactory(ModelAfterCreateEventHandler, () => ({
140
- async handle(event) {
141
- const {
142
- model
143
- } = event.payload;
144
- await createElasticsearchIndex({
145
- client: elasticsearch,
146
- model,
147
- plugins
148
- });
149
- }
150
- }));
151
- context.container.registerFactory(ModelAfterCreateFromEventHandler, () => ({
152
- async handle(event) {
153
- const {
154
- model
155
- } = event.payload;
156
- await createElasticsearchIndex({
157
- client: elasticsearch,
158
- model,
159
- plugins
160
- });
161
- }
162
- }));
163
- context.container.registerFactory(ModelAfterDeleteEventHandler, () => ({
164
- async handle(event) {
165
- const {
166
- model
167
- } = event.payload;
168
- await deleteElasticsearchIndex({
169
- client: elasticsearch,
170
- model
171
- });
172
- }
173
- }));
174
- },
175
- getEntities: () => entities,
176
- getTable: () => tableInstance,
177
- getEsTable: () => tableElasticsearchInstance,
178
- groups: createGroupsStorageOperations({
179
- entity: entities.groups,
180
- plugins
181
- }),
182
- models: createModelsStorageOperations({
183
- entity: entities.models,
184
- elasticsearch
185
- }),
186
- entries
187
- };
188
- };
189
-
190
- //# sourceMappingURL=index.js.map
1
+ export { registerCmsOpenSearchStorageOperations } from "./feature.js";
@@ -2,6 +2,7 @@ import type DataLoader from "dataloader";
2
2
  export interface CacheKeyParams {
3
3
  name: string;
4
4
  tenant: string;
5
+ modelId: string;
5
6
  }
6
7
  export interface ClearAllParams {
7
8
  tenant: string;
@@ -1,34 +1,27 @@
1
- export class DataLoaderCache {
2
- cache = {};
3
- getDataLoader(params) {
4
- const key = this.createKey(params);
5
- return this.cache[key] || null;
6
- }
7
- setDataLoader(params, dataLoader) {
8
- const key = this.createKey(params);
9
- this.cache[key] = dataLoader;
10
- }
11
- clearAll(params) {
12
- if (!params) {
13
- for (const current in this.cache) {
14
- this.cache[current].clearAll();
15
- }
16
- return;
1
+ class DataLoaderCache {
2
+ getDataLoader(params) {
3
+ const key = this.createKey(params);
4
+ return this.cache[key] || null;
17
5
  }
18
- const key = this.createKey({
19
- ...params,
20
- name: ""
21
- });
22
- for (const current in this.cache) {
23
- if (current.startsWith(key) === false) {
24
- continue;
25
- }
26
- this.cache[current].clearAll();
6
+ setDataLoader(params, dataLoader) {
7
+ const key = this.createKey(params);
8
+ this.cache[key] = dataLoader;
9
+ }
10
+ clearAll(params) {
11
+ if (!params) {
12
+ for(const current in this.cache)this.cache[current].clearAll();
13
+ return;
14
+ }
15
+ const key = `${params.tenant}_`;
16
+ for(const current in this.cache)if (false !== current.startsWith(key)) this.cache[current].clearAll();
17
+ }
18
+ createKey(params) {
19
+ return `${params.tenant}_${params.modelId}_${params.name}`;
20
+ }
21
+ constructor(){
22
+ this.cache = {};
27
23
  }
28
- }
29
- createKey(params) {
30
- return `${params.tenant}_${params.name}`;
31
- }
32
24
  }
25
+ export { DataLoaderCache };
33
26
 
34
27
  //# sourceMappingURL=DataLoaderCache.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DataLoaderCache","cache","getDataLoader","params","key","createKey","setDataLoader","dataLoader","clearAll","current","name","startsWith","tenant"],"sources":["DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: 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 = 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.name}`;\n }\n}\n"],"mappings":"AAWA,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,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,CAACO,IAAI,EAAE;EAC5C;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoader/DataLoaderCache.js","sources":["../../../../src/operations/entry/dataLoader/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"],"names":["DataLoaderCache","params","key","dataLoader","current"],"mappings":"AAYO,MAAMA;IAGF,cAAgCC,MAAsB,EAA2B;QACpF,MAAMC,MAAM,IAAI,CAAC,SAAS,CAACD;QAE3B,OAAO,IAAI,CAAC,KAAK,CAACC,IAAI,IAAI;IAC9B;IAEO,cAAcD,MAAsB,EAAEE,UAAgC,EAAQ;QACjF,MAAMD,MAAM,IAAI,CAAC,SAAS,CAACD;QAC3B,IAAI,CAAC,KAAK,CAACC,IAAI,GAAGC;IACtB;IAEO,SAASF,MAAuB,EAAQ;QAC3C,IAAI,CAACA,QAAQ;YACT,IAAK,MAAMG,WAAW,IAAI,CAAC,KAAK,CAC5B,IAAI,CAAC,KAAK,CAACA,QAAQ,CAAC,QAAQ;YAEhC;QACJ;QACA,MAAMF,MAAM,GAAGD,OAAO,MAAM,CAAC,CAAC,CAAC;QAC/B,IAAK,MAAMG,WAAW,IAAI,CAAC,KAAK,CAC5B,IAAIA,AAA4B,UAA5BA,QAAQ,UAAU,CAACF,MAGvB,IAAI,CAAC,KAAK,CAACE,QAAQ,CAAC,QAAQ;IAEpC;IAEQ,UAAUH,MAAsB,EAAU;QAC9C,OAAO,GAAGA,OAAO,MAAM,CAAC,CAAC,EAAEA,OAAO,OAAO,CAAC,CAAC,EAAEA,OAAO,IAAI,EAAE;IAC9D;;aA/BiB,KAAK,GAAyC,CAAC;;AAgCpE"}
@@ -1,4 +1,5 @@
1
1
  const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || "0");
2
- export const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
2
+ const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
3
+ export { CMS_ENTRY_BATCH_SCHEDULE_WAIT };
3
4
 
4
5
  //# 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","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
+ {"version":3,"file":"operations/entry/dataLoader/constants.js","sources":["../../../../src/operations/entry/dataLoader/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"],"names":["batchScheduleWaitEnv","Number","process","CMS_ENTRY_BATCH_SCHEDULE_WAIT","isNaN"],"mappings":"AAAA,MAAMA,uBAAuBC,OAAOC,QAAQ,GAAG,CAAC,wCAAwC,IAAI;AACrF,MAAMC,gCAAgCC,MAAMJ,wBAAwB,IAAIA"}
@@ -1,19 +1,10 @@
1
1
  import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from "./constants.js";
2
-
3
- /**
4
- * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.
5
- * Intended to be used internally or for a specific user case.
6
- * Not to be documented and exposed to publish as it can slow the data loading a lot.
7
- *
8
- * https://github.com/graphql/dataloader#batch-scheduling
9
- */
10
- export const createBatchScheduleFn = () => {
11
- if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
12
- return undefined;
13
- }
14
- return callback => {
15
- setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);
16
- };
2
+ const createBatchScheduleFn = ()=>{
3
+ if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) return;
4
+ return (callback)=>{
5
+ setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);
6
+ };
17
7
  };
8
+ export { createBatchScheduleFn };
18
9
 
19
10
  //# sourceMappingURL=createBatchScheduleFn.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"operations/entry/dataLoader/createBatchScheduleFn.js","sources":["../../../../src/operations/entry/dataLoader/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"],"names":["createBatchScheduleFn","CMS_ENTRY_BATCH_SCHEDULE_WAIT","callback","setTimeout"],"mappings":";AASO,MAAMA,wBAAwB;IACjC,IAAIC,iCAAiC,GACjC;IAEJ,OAAO,CAACC;QACJC,WAAWD,UAAUD;IACzB;AACJ"}
@@ -1,32 +1,24 @@
1
- import DataLoader from "dataloader";
1
+ import dataloader from "dataloader";
2
2
  import { createPartitionKey } from "../keys.js";
3
3
  import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
4
- export const createGetAllEntryRevisions = params => {
5
- const {
6
- entity,
7
- tenant
8
- } = params;
9
- return new DataLoader(async ids => {
10
- const results = {};
11
- for (const id of ids) {
12
- results[id] = (await entity.queryAllClean({
13
- partitionKey: createPartitionKey({
14
- tenant,
15
- id
16
- }),
17
- options: {
18
- beginsWith: "REV#"
19
- }
20
- })).map(item => {
21
- return item.data;
22
- });
23
- }
24
- return ids.map(entryId => {
25
- return results[entryId] || [];
4
+ const createGetAllEntryRevisions = (params)=>{
5
+ const { entity, tenant, modelId } = params;
6
+ return new dataloader(async (ids)=>{
7
+ const results = {};
8
+ for (const id of ids)results[id] = (await entity.queryAllClean({
9
+ partitionKey: createPartitionKey({
10
+ tenant,
11
+ id
12
+ }),
13
+ options: {
14
+ beginsWith: "REV#"
15
+ }
16
+ })).map((item)=>item.data);
17
+ return ids.map((entryId)=>(results[entryId] || []).filter((item)=>item.modelId === modelId));
18
+ }, {
19
+ batchScheduleFn: createBatchScheduleFn()
26
20
  });
27
- }, {
28
- batchScheduleFn: createBatchScheduleFn()
29
- });
30
21
  };
22
+ export { createGetAllEntryRevisions };
31
23
 
32
24
  //# sourceMappingURL=getAllEntryRevisions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DataLoader","createPartitionKey","createBatchScheduleFn","createGetAllEntryRevisions","params","entity","tenant","ids","results","id","queryAllClean","partitionKey","options","beginsWith","map","item","data","entryId","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 } = 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] || [];\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;EAAO,CAAC,GAAGF,MAAM;EACjC,OAAO,IAAIJ,UAAU,CACjB,MAAMO,GAAG,IAAI;IACT,MAAMC,OAA0C,GAAG,CAAC,CAAC;IAErD,KAAK,MAAMC,EAAE,IAAIF,GAAG,EAAE;MAClBC,OAAO,CAACC,EAAE,CAAC,GAAG,CACV,MAAMJ,MAAM,CAACK,aAAa,CAAC;QACvBC,YAAY,EAAEV,kBAAkB,CAAC;UAC7BK,MAAM;UACNG;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,OAAOT,OAAO,CAACS,OAAO,CAAC,IAAI,EAAE;IACjC,CAAC,CAAC;EACN,CAAC,EACD;IACIC,eAAe,EAAEhB,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoader/getAllEntryRevisions.js","sources":["../../../../src/operations/entry/dataLoader/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"],"names":["createGetAllEntryRevisions","params","entity","tenant","modelId","DataLoader","ids","results","id","createPartitionKey","item","entryId","createBatchScheduleFn"],"mappings":";;;AAMO,MAAMA,6BAA6B,CAACC;IACvC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IACpC,OAAO,IAAII,WACP,OAAMC;QACF,MAAMC,UAA6C,CAAC;QAEpD,KAAK,MAAMC,MAAMF,IACbC,OAAO,CAACC,GAAG,GACP,OAAMN,OAAO,aAAa,CAAC;YACvB,cAAcO,mBAAmB;gBAC7BN;gBACAK;YACJ;YACA,SAAS;gBACL,YAAY;YAChB;QACJ,EAAC,EACH,GAAG,CAACE,CAAAA,OACKA,KAAK,IAAI;QAIxB,OAAOJ,IAAI,GAAG,CAACK,CAAAA,UACHJ,AAAAA,CAAAA,OAAO,CAACI,QAAQ,IAAI,EAAC,EAAG,MAAM,CAACD,CAAAA,OAC5BA,KAAK,OAAO,KAAKN;IAGpC,GACA;QACI,iBAAiBQ;IACrB;AAER"}
@@ -1,40 +1,34 @@
1
- import DataLoader from "dataloader";
1
+ import dataloader from "dataloader";
2
2
  import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
3
3
  import { createLatestSortKey, createPartitionKey } from "../keys.js";
4
- export const createGetLatestRevisionByEntryId = params => {
5
- const {
6
- entity,
7
- tenant
8
- } = params;
9
- const latestKey = createLatestSortKey();
10
- return new DataLoader(async ids => {
11
- const reader = entity.createEntityReader();
12
- const keys = new Set();
13
- for (const id of ids) {
14
- const partitionKey = createPartitionKey({
15
- tenant,
16
- id
17
- });
18
- if (keys.has(partitionKey)) {
19
- continue;
20
- }
21
- keys.add(partitionKey);
22
- reader.get({
23
- PK: partitionKey,
24
- SK: latestKey
25
- });
26
- }
27
- const items = (await reader.execute()).map(item => {
28
- return item.data;
4
+ const createGetLatestRevisionByEntryId = (params)=>{
5
+ const { entity, tenant, modelId } = params;
6
+ const latestKey = createLatestSortKey();
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: latestKey
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()
29
30
  });
30
- return ids.map(entryId => {
31
- return items.filter(item => {
32
- return entryId === item.entryId;
33
- });
34
- });
35
- }, {
36
- batchScheduleFn: createBatchScheduleFn()
37
- });
38
31
  };
32
+ export { createGetLatestRevisionByEntryId };
39
33
 
40
34
  //# sourceMappingURL=getLatestRevisionByEntryId.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DataLoader","createBatchScheduleFn","createLatestSortKey","createPartitionKey","createGetLatestRevisionByEntryId","params","entity","tenant","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 } = 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 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;EAAO,CAAC,GAAGF,MAAM;EAEjC,MAAMG,SAAS,GAAGN,mBAAmB,CAAC,CAAC;EAEvC,OAAO,IAAIF,UAAU,CACjB,MAAMS,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,GAAGZ,kBAAkB,CAAC;QACpCI,MAAM;QACNO;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,OAAOE,OAAO,KAAKF,IAAI,CAACE,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIE,eAAe,EAAE3B,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"operations/entry/dataLoader/getLatestRevisionByEntryId.js","sources":["../../../../src/operations/entry/dataLoader/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"],"names":["createGetLatestRevisionByEntryId","params","entity","tenant","modelId","latestKey","createLatestSortKey","DataLoader","ids","reader","keys","Set","id","partitionKey","createPartitionKey","items","item","entryId","createBatchScheduleFn"],"mappings":";;;AAMO,MAAMA,mCAAmC,CAACC;IAC7C,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IAEpC,MAAMI,YAAYC;IAElB,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,40 +1,34 @@
1
- import DataLoader from "dataloader";
1
+ import dataloader from "dataloader";
2
2
  import { createPartitionKey, createPublishedSortKey } from "../keys.js";
3
3
  import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
4
- export const createGetPublishedRevisionByEntryId = params => {
5
- const {
6
- entity,
7
- tenant
8
- } = params;
9
- const publishedKey = createPublishedSortKey();
10
- return new DataLoader(async ids => {
11
- const reader = entity.createEntityReader();
12
- const keys = new Set();
13
- for (const id of ids) {
14
- const partitionKey = createPartitionKey({
15
- tenant,
16
- id
17
- });
18
- if (keys.has(partitionKey)) {
19
- continue;
20
- }
21
- keys.add(partitionKey);
22
- reader.get({
23
- PK: partitionKey,
24
- SK: publishedKey
25
- });
26
- }
27
- const items = (await reader.execute()).map(item => {
28
- return item.data;
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()
29
30
  });
30
- return ids.map(entryId => {
31
- return items.filter(item => {
32
- return entryId === item.entryId;
33
- });
34
- });
35
- }, {
36
- batchScheduleFn: createBatchScheduleFn()
37
- });
38
31
  };
32
+ export { createGetPublishedRevisionByEntryId };
39
33
 
40
34
  //# sourceMappingURL=getPublishedRevisionByEntryId.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DataLoader","createPartitionKey","createPublishedSortKey","createBatchScheduleFn","createGetPublishedRevisionByEntryId","params","entity","tenant","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 } = 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 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;EAAO,CAAC,GAAGF,MAAM;EAEjC,MAAMG,YAAY,GAAGN,sBAAsB,CAAC,CAAC;EAC7C,OAAO,IAAIF,UAAU,CACjB,MAAMS,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,GAAGd,kBAAkB,CAAC;QACpCM,MAAM;QACNO;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,OAAOE,OAAO,KAAKF,IAAI,CAACE,OAAO;MACnC,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,EACD;IACIE,eAAe,EAAEzB,qBAAqB,CAAC;EAC3C,CACJ,CAAC;AACL,CAAC","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"}