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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (430) hide show
  1. package/README.md +6 -30
  2. package/abstractions/CmsDdbEsDataLoaders.d.ts +5 -0
  3. package/abstractions/CmsDdbEsDataLoaders.js +5 -0
  4. package/abstractions/CmsDdbEsDataLoaders.js.map +1 -0
  5. package/abstractions/CmsDdbEsEntriesEsEntity.d.ts +5 -0
  6. package/abstractions/CmsDdbEsEntriesEsEntity.js +5 -0
  7. package/abstractions/CmsDdbEsEntriesEsEntity.js.map +1 -0
  8. package/abstractions/CmsDdbEsEntryEntity.d.ts +5 -0
  9. package/abstractions/CmsDdbEsEntryEntity.js +5 -0
  10. package/abstractions/CmsDdbEsEntryEntity.js.map +1 -0
  11. package/abstractions/CmsDdbEsGroupEntity.d.ts +5 -0
  12. package/abstractions/CmsDdbEsGroupEntity.js +5 -0
  13. package/abstractions/CmsDdbEsGroupEntity.js.map +1 -0
  14. package/abstractions/CmsDdbEsModelEntity.d.ts +5 -0
  15. package/abstractions/CmsDdbEsModelEntity.js +5 -0
  16. package/abstractions/CmsDdbEsModelEntity.js.map +1 -0
  17. package/abstractions/CmsDdbEsOsTable.d.ts +5 -0
  18. package/abstractions/CmsDdbEsOsTable.js +5 -0
  19. package/abstractions/CmsDdbEsOsTable.js.map +1 -0
  20. package/abstractions/CmsDdbEsTable.d.ts +5 -0
  21. package/abstractions/CmsDdbEsTable.js +5 -0
  22. package/abstractions/CmsDdbEsTable.js.map +1 -0
  23. package/definitions/entry.d.ts +4 -6
  24. package/definitions/entry.js +8 -179
  25. package/definitions/entry.js.map +1 -1
  26. package/definitions/group.d.ts +6 -7
  27. package/definitions/group.js +8 -63
  28. package/definitions/group.js.map +1 -1
  29. package/definitions/model.d.ts +6 -7
  30. package/definitions/model.js +8 -107
  31. package/definitions/model.js.map +1 -1
  32. package/definitions/types.d.ts +65 -0
  33. package/definitions/types.js +0 -0
  34. package/feature.d.ts +9 -0
  35. package/feature.js +55 -0
  36. package/feature.js.map +1 -0
  37. package/index.d.ts +2 -3
  38. package/index.js +2 -225
  39. package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
  40. package/operations/entry/DdbEsCreateEntry.js +134 -0
  41. package/operations/entry/DdbEsCreateEntry.js.map +1 -0
  42. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
  43. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -0
  44. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
  45. package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
  46. package/operations/entry/DdbEsDeleteEntry.js +79 -0
  47. package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
  48. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +24 -0
  49. package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
  50. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
  51. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
  52. package/operations/entry/DdbEsDeleteMultipleEntries.js +80 -0
  53. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
  54. package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
  55. package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
  56. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
  57. package/operations/entry/DdbEsGetEntry.d.ts +14 -0
  58. package/operations/entry/DdbEsGetEntry.js +27 -0
  59. package/operations/entry/DdbEsGetEntry.js.map +1 -0
  60. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
  61. package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
  62. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
  63. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
  64. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
  65. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
  66. package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
  67. package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
  68. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
  69. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
  70. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
  71. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
  72. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
  73. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
  74. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
  75. package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
  76. package/operations/entry/DdbEsGetRevisionById.js +34 -0
  77. package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
  78. package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
  79. package/operations/entry/DdbEsGetRevisions.js +33 -0
  80. package/operations/entry/DdbEsGetRevisions.js.map +1 -0
  81. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +18 -0
  82. package/operations/entry/DdbEsGetUniqueFieldValues.js +76 -0
  83. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
  84. package/operations/entry/DdbEsListEntries.d.ts +25 -0
  85. package/operations/entry/DdbEsListEntries.js +91 -0
  86. package/operations/entry/DdbEsListEntries.js.map +1 -0
  87. package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
  88. package/operations/entry/DdbEsMoveEntry.js +113 -0
  89. package/operations/entry/DdbEsMoveEntry.js.map +1 -0
  90. package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
  91. package/operations/entry/DdbEsMoveToBin.js +137 -0
  92. package/operations/entry/DdbEsMoveToBin.js.map +1 -0
  93. package/operations/entry/DdbEsPublishEntry.d.ts +24 -0
  94. package/operations/entry/DdbEsPublishEntry.js +231 -0
  95. package/operations/entry/DdbEsPublishEntry.js.map +1 -0
  96. package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
  97. package/operations/entry/DdbEsRestoreFromBin.js +137 -0
  98. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
  99. package/operations/entry/DdbEsUnpublishEntry.d.ts +24 -0
  100. package/operations/entry/DdbEsUnpublishEntry.js +127 -0
  101. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
  102. package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
  103. package/operations/entry/DdbEsUpdateEntry.js +175 -0
  104. package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
  105. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
  106. package/operations/entry/dataLoader/DataLoaderCache.js +21 -35
  107. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  108. package/operations/entry/dataLoader/constants.js +2 -7
  109. package/operations/entry/dataLoader/constants.js.map +1 -1
  110. package/operations/entry/dataLoader/createBatchScheduleFn.js +7 -22
  111. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  112. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  113. package/operations/entry/dataLoader/getAllEntryRevisions.js +20 -41
  114. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  115. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  116. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +30 -48
  117. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  118. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  119. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +30 -48
  120. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  121. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  122. package/operations/entry/dataLoader/getRevisionById.js +36 -58
  123. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  124. package/operations/entry/dataLoader/index.d.ts +3 -3
  125. package/operations/entry/dataLoader/index.js +13 -35
  126. package/operations/entry/dataLoader/index.js.map +1 -1
  127. package/operations/entry/dataLoader/types.d.ts +4 -4
  128. package/operations/entry/dataLoader/types.js +0 -7
  129. package/operations/entry/dataLoaders.d.ts +14 -14
  130. package/operations/entry/dataLoaders.js +92 -110
  131. package/operations/entry/dataLoaders.js.map +1 -1
  132. package/operations/entry/feature.d.ts +4 -0
  133. package/operations/entry/feature.js +53 -0
  134. package/operations/entry/feature.js.map +1 -0
  135. package/operations/entry/keys.d.ts +31 -1
  136. package/operations/entry/keys.js +44 -27
  137. package/operations/entry/keys.js.map +1 -1
  138. package/operations/entry/recordType.js +4 -18
  139. package/operations/entry/recordType.js.map +1 -1
  140. package/operations/entry/storageEntryUtils.d.ts +7 -0
  141. package/operations/entry/storageEntryUtils.js +14 -0
  142. package/operations/entry/storageEntryUtils.js.map +1 -0
  143. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  144. package/operations/entry/transformations/convertEntryKeys.js +21 -34
  145. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  146. package/operations/entry/transformations/index.d.ts +21 -18
  147. package/operations/entry/transformations/index.js +87 -123
  148. package/operations/entry/transformations/index.js.map +1 -1
  149. package/operations/entry/transformations/modifyEntryValues.d.ts +30 -35
  150. package/operations/entry/transformations/modifyEntryValues.js +12 -24
  151. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  152. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  153. package/operations/entry/transformations/transformEntryKeys.js +14 -24
  154. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  155. package/operations/group/DdbEsCreateGroup.d.ts +12 -0
  156. package/operations/group/DdbEsCreateGroup.js +35 -0
  157. package/operations/group/DdbEsCreateGroup.js.map +1 -0
  158. package/operations/group/DdbEsDeleteGroup.d.ts +12 -0
  159. package/operations/group/DdbEsDeleteGroup.js +31 -0
  160. package/operations/group/DdbEsDeleteGroup.js.map +1 -0
  161. package/operations/group/DdbEsGetGroup.d.ts +12 -0
  162. package/operations/group/DdbEsGetGroup.js +31 -0
  163. package/operations/group/DdbEsGetGroup.js.map +1 -0
  164. package/operations/group/DdbEsListGroups.d.ts +14 -0
  165. package/operations/group/DdbEsListGroups.js +52 -0
  166. package/operations/group/DdbEsListGroups.js.map +1 -0
  167. package/operations/group/DdbEsUpdateGroup.d.ts +12 -0
  168. package/operations/group/DdbEsUpdateGroup.js +35 -0
  169. package/operations/group/DdbEsUpdateGroup.js.map +1 -0
  170. package/operations/group/feature.d.ts +4 -0
  171. package/operations/group/feature.js +19 -0
  172. package/operations/group/feature.js.map +1 -0
  173. package/operations/group/keys.d.ts +15 -0
  174. package/operations/group/keys.js +17 -0
  175. package/operations/group/keys.js.map +1 -0
  176. package/operations/model/DdbEsCreateModel.d.ts +16 -0
  177. package/operations/model/DdbEsCreateModel.js +56 -0
  178. package/operations/model/DdbEsCreateModel.js.map +1 -0
  179. package/operations/model/DdbEsDeleteModel.d.ts +12 -0
  180. package/operations/model/DdbEsDeleteModel.js +31 -0
  181. package/operations/model/DdbEsDeleteModel.js.map +1 -0
  182. package/operations/model/DdbEsGetModel.d.ts +12 -0
  183. package/operations/model/DdbEsGetModel.js +30 -0
  184. package/operations/model/DdbEsGetModel.js.map +1 -0
  185. package/operations/model/DdbEsListModels.d.ts +12 -0
  186. package/operations/model/DdbEsListModels.js +36 -0
  187. package/operations/model/DdbEsListModels.js.map +1 -0
  188. package/operations/model/DdbEsUpdateModel.d.ts +12 -0
  189. package/operations/model/DdbEsUpdateModel.js +36 -0
  190. package/operations/model/DdbEsUpdateModel.js.map +1 -0
  191. package/operations/model/feature.d.ts +4 -0
  192. package/operations/model/feature.js +19 -0
  193. package/operations/model/feature.js.map +1 -0
  194. package/operations/model/keys.d.ts +15 -0
  195. package/operations/model/keys.js +17 -0
  196. package/operations/model/keys.js.map +1 -0
  197. package/package.json +40 -36
  198. package/requestFeature.d.ts +20 -0
  199. package/requestFeature.js +54 -0
  200. package/requestFeature.js.map +1 -0
  201. package/tasks/CreateElasticsearchIndexTask.d.ts +13 -0
  202. package/tasks/CreateElasticsearchIndexTask.js +40 -0
  203. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  204. package/types.d.ts +12 -159
  205. package/types.js +7 -39
  206. package/types.js.map +1 -1
  207. package/configurations.d.ts +0 -19
  208. package/configurations.js +0 -49
  209. package/configurations.js.map +0 -1
  210. package/definitions/entryElasticsearch.d.ts +0 -9
  211. package/definitions/entryElasticsearch.js +0 -41
  212. package/definitions/entryElasticsearch.js.map +0 -1
  213. package/definitions/system.d.ts +0 -9
  214. package/definitions/system.js +0 -42
  215. package/definitions/system.js.map +0 -1
  216. package/definitions/table.d.ts +0 -8
  217. package/definitions/table.js +0 -25
  218. package/definitions/table.js.map +0 -1
  219. package/definitions/tableElasticsearch.d.ts +0 -8
  220. package/definitions/tableElasticsearch.js +0 -25
  221. package/definitions/tableElasticsearch.js.map +0 -1
  222. package/dynamoDb/index.d.ts +0 -3
  223. package/dynamoDb/index.js +0 -16
  224. package/dynamoDb/index.js.map +0 -1
  225. package/dynamoDb/storage/longText.d.ts +0 -10
  226. package/dynamoDb/storage/longText.js +0 -96
  227. package/dynamoDb/storage/longText.js.map +0 -1
  228. package/dynamoDb/storage/richText.d.ts +0 -2
  229. package/dynamoDb/storage/richText.js +0 -59
  230. package/dynamoDb/storage/richText.js.map +0 -1
  231. package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
  232. package/elasticsearch/createElasticsearchIndex.js +0 -40
  233. package/elasticsearch/createElasticsearchIndex.js.map +0 -1
  234. package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
  235. package/elasticsearch/deleteElasticsearchIndex.js +0 -38
  236. package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
  237. package/elasticsearch/index.d.ts +0 -2
  238. package/elasticsearch/index.js +0 -13
  239. package/elasticsearch/index.js.map +0 -1
  240. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  241. package/elasticsearch/indexing/dateTimeIndexing.js +0 -88
  242. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  243. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  244. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -54
  245. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  246. package/elasticsearch/indexing/index.d.ts +0 -2
  247. package/elasticsearch/indexing/index.js +0 -18
  248. package/elasticsearch/indexing/index.js.map +0 -1
  249. package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
  250. package/elasticsearch/indexing/jsonIndexing.js +0 -28
  251. package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
  252. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  253. package/elasticsearch/indexing/longTextIndexing.js +0 -42
  254. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  255. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  256. package/elasticsearch/indexing/numberIndexing.js +0 -41
  257. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  258. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  259. package/elasticsearch/indexing/objectIndexing.js +0 -201
  260. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  261. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  262. package/elasticsearch/indexing/richTextIndexing.js +0 -31
  263. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  264. package/elasticsearch/indices/base.d.ts +0 -2
  265. package/elasticsearch/indices/base.js +0 -13
  266. package/elasticsearch/indices/base.js.map +0 -1
  267. package/elasticsearch/indices/index.d.ts +0 -1
  268. package/elasticsearch/indices/index.js +0 -14
  269. package/elasticsearch/indices/index.js.map +0 -1
  270. package/elasticsearch/indices/japanese.d.ts +0 -2
  271. package/elasticsearch/indices/japanese.js +0 -14
  272. package/elasticsearch/indices/japanese.js.map +0 -1
  273. package/elasticsearch/search/index.d.ts +0 -3
  274. package/elasticsearch/search/index.js +0 -13
  275. package/elasticsearch/search/index.js.map +0 -1
  276. package/elasticsearch/search/refSearch.d.ts +0 -2
  277. package/elasticsearch/search/refSearch.js +0 -31
  278. package/elasticsearch/search/refSearch.js.map +0 -1
  279. package/elasticsearch/search/searchableJson.d.ts +0 -2
  280. package/elasticsearch/search/searchableJson.js +0 -60
  281. package/elasticsearch/search/searchableJson.js.map +0 -1
  282. package/elasticsearch/search/timeSearch.d.ts +0 -2
  283. package/elasticsearch/search/timeSearch.js +0 -27
  284. package/elasticsearch/search/timeSearch.js.map +0 -1
  285. package/helpers/entryIndexHelpers.d.ts +0 -18
  286. package/helpers/entryIndexHelpers.js +0 -190
  287. package/helpers/entryIndexHelpers.js.map +0 -1
  288. package/helpers/fieldIdentifier.d.ts +0 -6
  289. package/helpers/fieldIdentifier.js +0 -43
  290. package/helpers/fieldIdentifier.js.map +0 -1
  291. package/helpers/index.d.ts +0 -2
  292. package/helpers/index.js +0 -29
  293. package/helpers/index.js.map +0 -1
  294. package/index.js.map +0 -1
  295. package/operations/entry/dataLoader/types.js.map +0 -1
  296. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
  297. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -34
  298. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
  299. package/operations/entry/elasticsearch/body.d.ts +0 -13
  300. package/operations/entry/elasticsearch/body.js +0 -142
  301. package/operations/entry/elasticsearch/body.js.map +0 -1
  302. package/operations/entry/elasticsearch/fields.d.ts +0 -10
  303. package/operations/entry/elasticsearch/fields.js +0 -315
  304. package/operations/entry/elasticsearch/fields.js.map +0 -1
  305. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -8
  306. package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -60
  307. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
  308. package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -17
  309. package/operations/entry/elasticsearch/filtering/exec.js +0 -175
  310. package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
  311. package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
  312. package/operations/entry/elasticsearch/filtering/index.js +0 -18
  313. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  314. package/operations/entry/elasticsearch/filtering/path.d.ts +0 -16
  315. package/operations/entry/elasticsearch/filtering/path.js +0 -48
  316. package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
  317. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  318. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -30
  319. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  320. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  321. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -15
  322. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  323. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  324. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -69
  325. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  326. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  327. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -57
  328. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  329. package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
  330. package/operations/entry/elasticsearch/filtering/populated.js +0 -25
  331. package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
  332. package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
  333. package/operations/entry/elasticsearch/filtering/values.js +0 -24
  334. package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
  335. package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -12
  336. package/operations/entry/elasticsearch/fullTextSearch.js +0 -91
  337. package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
  338. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
  339. package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -27
  340. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
  341. package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
  342. package/operations/entry/elasticsearch/initialQuery.js +0 -106
  343. package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
  344. package/operations/entry/elasticsearch/keyword.d.ts +0 -2
  345. package/operations/entry/elasticsearch/keyword.js +0 -36
  346. package/operations/entry/elasticsearch/keyword.js.map +0 -1
  347. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  348. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  349. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  350. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  351. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -18
  352. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  353. package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -8
  354. package/operations/entry/elasticsearch/plugins/operator.js +0 -39
  355. package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
  356. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  357. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -18
  358. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  359. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  360. package/operations/entry/elasticsearch/plugins/search.js +0 -26
  361. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  362. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  363. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -18
  364. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  365. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +0 -2
  366. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +0 -13
  367. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +0 -1
  368. package/operations/entry/elasticsearch/sort.d.ts +0 -12
  369. package/operations/entry/elasticsearch/sort.js +0 -89
  370. package/operations/entry/elasticsearch/sort.js.map +0 -1
  371. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -16
  372. package/operations/entry/elasticsearch/transformValueForSearch.js +0 -32
  373. package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
  374. package/operations/entry/elasticsearch/types.d.ts +0 -41
  375. package/operations/entry/elasticsearch/types.js +0 -7
  376. package/operations/entry/elasticsearch/types.js.map +0 -1
  377. package/operations/entry/index.d.ts +0 -11
  378. package/operations/entry/index.js +0 -1881
  379. package/operations/entry/index.js.map +0 -1
  380. package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -10
  381. package/operations/entry/transformations/transformEntryToIndex.js +0 -31
  382. package/operations/entry/transformations/transformEntryToIndex.js.map +0 -1
  383. package/operations/group/index.d.ts +0 -8
  384. package/operations/group/index.js +0 -179
  385. package/operations/group/index.js.map +0 -1
  386. package/operations/model/index.d.ts +0 -8
  387. package/operations/model/index.js +0 -183
  388. package/operations/model/index.js.map +0 -1
  389. package/operations/system/index.d.ts +0 -6
  390. package/operations/system/index.js +0 -94
  391. package/operations/system/index.js.map +0 -1
  392. package/operations/system/indexes.d.ts +0 -10
  393. package/operations/system/indexes.js +0 -41
  394. package/operations/system/indexes.js.map +0 -1
  395. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
  396. package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -52
  397. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
  398. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
  399. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -21
  400. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  401. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  402. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -27
  403. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  404. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  405. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -13
  406. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  407. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -32
  408. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -40
  409. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  410. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
  411. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -21
  412. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  413. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
  414. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -21
  415. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  416. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
  417. package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -50
  418. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
  419. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  420. package/plugins/CmsEntryFilterPlugin.js +0 -22
  421. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  422. package/plugins/index.d.ts +0 -8
  423. package/plugins/index.js +0 -95
  424. package/plugins/index.js.map +0 -1
  425. package/tasks/createIndexTaskPlugin.d.ts +0 -2
  426. package/tasks/createIndexTaskPlugin.js +0 -67
  427. package/tasks/createIndexTaskPlugin.js.map +0 -1
  428. package/values/NoValueContainer.d.ts +0 -5
  429. package/values/NoValueContainer.js +0 -20
  430. package/values/NoValueContainer.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/keys.js","sources":["../../../src/operations/model/keys.ts"],"sourcesContent":["interface PartitionKeysParams {\n tenant: string;\n}\n\nexport const createPartitionKey = (params: PartitionKeysParams): string => {\n const { tenant } = params;\n return `T#${tenant}#CMS#CM`;\n};\n\ninterface SortKeyParams {\n modelId: string;\n}\n\nconst createSortKey = (params: SortKeyParams): string => {\n return params.modelId;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n}\n\nexport const createKeys = (params: PartitionKeysParams & SortKeyParams): Keys => {\n if (!params.tenant) {\n throw new Error(\"Missing tenant when creating model keys!\");\n }\n return {\n PK: createPartitionKey(params),\n SK: createSortKey(params),\n GSI_TENANT: params.tenant\n };\n};\n\nexport const createType = (): string => {\n return \"cms.model\";\n};\n"],"names":["createPartitionKey","params","tenant","createSortKey","createKeys","Error","createType"],"mappings":"AAIO,MAAMA,qBAAqB,CAACC;IAC/B,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,OAAO,CAAC,EAAE,EAAEC,OAAO,OAAO,CAAC;AAC/B;AAMA,MAAMC,gBAAgB,CAACF,SACZA,OAAO,OAAO;AASlB,MAAMG,aAAa,CAACH;IACvB,IAAI,CAACA,OAAO,MAAM,EACd,MAAM,IAAII,MAAM;IAEpB,OAAO;QACH,IAAIL,mBAAmBC;QACvB,IAAIE,cAAcF;QAClB,YAAYA,OAAO,MAAM;IAC7B;AACJ;AAEO,MAAMK,aAAa,IACf"}
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb-es",
3
- "version": "0.0.0-unstable.eb196ccd2f",
4
- "main": "index.js",
3
+ "version": "0.0.0-unstable.eb81deee7e",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
5
9
  "keywords": [
6
10
  "@webiny/api-headless-cms",
7
11
  "storage-operations",
@@ -26,46 +30,46 @@
26
30
  ],
27
31
  "license": "MIT",
28
32
  "dependencies": {
29
- "@webiny/api": "0.0.0-unstable.eb196ccd2f",
30
- "@webiny/api-elasticsearch": "0.0.0-unstable.eb196ccd2f",
31
- "@webiny/api-elasticsearch-tasks": "0.0.0-unstable.eb196ccd2f",
32
- "@webiny/api-headless-cms": "0.0.0-unstable.eb196ccd2f",
33
- "@webiny/aws-sdk": "0.0.0-unstable.eb196ccd2f",
34
- "@webiny/db-dynamodb": "0.0.0-unstable.eb196ccd2f",
35
- "@webiny/error": "0.0.0-unstable.eb196ccd2f",
36
- "@webiny/handler-db": "0.0.0-unstable.eb196ccd2f",
37
- "@webiny/plugins": "0.0.0-unstable.eb196ccd2f",
38
- "@webiny/utils": "0.0.0-unstable.eb196ccd2f",
33
+ "@webiny/api": "0.0.0-unstable.eb81deee7e",
34
+ "@webiny/api-headless-cms": "0.0.0-unstable.eb81deee7e",
35
+ "@webiny/api-headless-cms-storage": "0.0.0-unstable.eb81deee7e",
36
+ "@webiny/api-headless-cms-utils-os": "0.0.0-unstable.eb81deee7e",
37
+ "@webiny/api-opensearch": "0.0.0-unstable.eb81deee7e",
38
+ "@webiny/api-opensearch-aws": "0.0.0-unstable.eb81deee7e",
39
+ "@webiny/api-search-index-tasks": "0.0.0-unstable.eb81deee7e",
40
+ "@webiny/db": "0.0.0-unstable.eb81deee7e",
41
+ "@webiny/db-dynamodb": "0.0.0-unstable.eb81deee7e",
42
+ "@webiny/error": "0.0.0-unstable.eb81deee7e",
43
+ "@webiny/feature": "0.0.0-unstable.eb81deee7e",
44
+ "@webiny/plugins": "0.0.0-unstable.eb81deee7e",
45
+ "@webiny/stdlib": "0.0.17",
46
+ "@webiny/utils": "0.0.0-unstable.eb81deee7e",
39
47
  "dataloader": "2.2.3",
40
- "lodash": "4.17.21"
48
+ "lodash": "4.18.1"
41
49
  },
42
50
  "devDependencies": {
43
- "@elastic/elasticsearch": "7.12.0",
44
51
  "@types/jsonpack": "1.1.6",
45
- "@webiny/api-dynamodb-to-elasticsearch": "0.0.0-unstable.eb196ccd2f",
46
- "@webiny/api-i18n": "0.0.0-unstable.eb196ccd2f",
47
- "@webiny/api-log": "0.0.0-unstable.eb196ccd2f",
48
- "@webiny/api-security": "0.0.0-unstable.eb196ccd2f",
49
- "@webiny/api-tenancy": "0.0.0-unstable.eb196ccd2f",
50
- "@webiny/api-wcp": "0.0.0-unstable.eb196ccd2f",
51
- "@webiny/handler": "0.0.0-unstable.eb196ccd2f",
52
- "@webiny/handler-aws": "0.0.0-unstable.eb196ccd2f",
53
- "@webiny/handler-graphql": "0.0.0-unstable.eb196ccd2f",
54
- "@webiny/project-utils": "0.0.0-unstable.eb196ccd2f",
55
- "@webiny/tasks": "0.0.0-unstable.eb196ccd2f",
56
- "jest": "29.7.0",
52
+ "@webiny/api-core": "0.0.0-unstable.eb81deee7e",
53
+ "@webiny/api-core-testing": "0.0.0-unstable.eb81deee7e",
54
+ "@webiny/api-graphql": "0.0.0-unstable.eb81deee7e",
55
+ "@webiny/api-search-index-tasks-ddb-os": "0.0.0-unstable.eb81deee7e",
56
+ "@webiny/api-sync-ddb-to-opensearch": "0.0.0-unstable.eb81deee7e",
57
+ "@webiny/background-tasks": "0.0.0-unstable.eb81deee7e",
58
+ "@webiny/build-tools": "0.0.0-unstable.eb81deee7e",
59
+ "@webiny/di": "1.1.0",
60
+ "@webiny/event-handler-core": "0.0.0-unstable.eb81deee7e",
61
+ "@webiny/handler": "0.0.0-unstable.eb81deee7e",
62
+ "@webiny/wcp": "0.0.0-unstable.eb81deee7e",
57
63
  "jest-dynalite": "3.6.1",
58
- "prettier": "2.8.8",
59
- "rimraf": "6.0.1",
60
- "typescript": "5.3.3"
64
+ "rimraf": "6.1.3",
65
+ "typescript": "7.0.2",
66
+ "vitest": "4.1.11"
61
67
  },
62
68
  "publishConfig": {
63
- "access": "public",
64
- "directory": "dist"
65
- },
66
- "scripts": {
67
- "build": "node ../cli/bin.js run build",
68
- "watch": "node ../cli/bin.js run watch"
69
+ "access": "public"
69
70
  },
70
- "gitHead": "eb196ccd2f32296e10f7add6dd7220d4e3abece4"
71
+ "gitHead": "b8aec8a1be3f25c3b428b357fe1e352c7cbff9ae",
72
+ "webiny": {
73
+ "publishFrom": "dist"
74
+ }
71
75
  }
@@ -0,0 +1,20 @@
1
+ import type { Container } from "@webiny/feature/api/index.js";
2
+ /**
3
+ * Per-request half of the DynamoDB+OpenSearch CMS storage: the storage operations, the OpenSearch
4
+ * extension points, and everything they keep state in. Register it in the request (child) container,
5
+ * after `HeadlessCmsDdbEsFeature` is in the root.
6
+ *
7
+ * - @webiny/di applies a decorator only if it sits in the same container as the registration it
8
+ * decorates, or in one of that container's parents. Extensions register their decorators in the
9
+ * request container, so with the storage operations and OpenSearch extension points (index, field
10
+ * indexes, filters, modifiers) in the root, an extension decorator on one of them (e.g.
11
+ * `CmsModelOpenSearchIndex`) would be skipped without an error. Registering them here puts the
12
+ * decorator and its target in the same container.
13
+ * - The DataLoader cache must live for one request. A root singleton outlives the request and keeps
14
+ * serving the entries it read first.
15
+ * - The filter registries are mutable; a root instance would collect every request's registrations.
16
+ */
17
+ export declare const HeadlessCmsDdbEsRequestFeature: {
18
+ name: string;
19
+ register(container: Container): void;
20
+ };
@@ -0,0 +1,54 @@
1
+ import { createFeature } from "@webiny/feature/api/index.js";
2
+ import { CmsEntryOpenSearchUtilsFeature } from "@webiny/api-headless-cms-utils-os";
3
+ import { FilterRegistriesFeature } from "@webiny/api-headless-cms-storage";
4
+ import { DbRegistry } from "@webiny/db/exports/api/db.js";
5
+ import { CreateElasticsearchIndexTask } from "./tasks/CreateElasticsearchIndexTask.js";
6
+ import { CmsDdbEsEntryEntity } from "./abstractions/CmsDdbEsEntryEntity.js";
7
+ import { CmsDdbEsEntriesEsEntity } from "./abstractions/CmsDdbEsEntriesEsEntity.js";
8
+ import { DdbEsGroupStorageOpsFeature } from "./operations/group/feature.js";
9
+ import { DdbEsModelStorageOpsFeature } from "./operations/model/feature.js";
10
+ import { DdbEsEntryStorageOpsFeature } from "./operations/entry/feature.js";
11
+ import { DataLoadersHandler } from "./operations/entry/dataLoaders.js";
12
+ const resolveDbRegistry = (container)=>{
13
+ try {
14
+ return container.resolve(DbRegistry);
15
+ } catch {
16
+ return;
17
+ }
18
+ };
19
+ const HeadlessCmsDdbEsRequestFeature = createFeature({
20
+ name: "cms.storageOperations.openSearch.request",
21
+ register: (container)=>{
22
+ CmsEntryOpenSearchUtilsFeature.register(container);
23
+ FilterRegistriesFeature.register(container);
24
+ container.register(CreateElasticsearchIndexTask);
25
+ const dbRegistry = resolveDbRegistry(container);
26
+ if (dbRegistry) {
27
+ const entryEntity = container.resolve(CmsDdbEsEntryEntity);
28
+ const entriesEsEntity = container.resolve(CmsDdbEsEntriesEsEntity);
29
+ dbRegistry.register({
30
+ item: entryEntity,
31
+ app: "cms",
32
+ tags: [
33
+ "regular",
34
+ entryEntity.name
35
+ ]
36
+ });
37
+ dbRegistry.register({
38
+ item: entriesEsEntity,
39
+ app: "cms",
40
+ tags: [
41
+ "es",
42
+ entriesEsEntity.name
43
+ ]
44
+ });
45
+ }
46
+ DdbEsGroupStorageOpsFeature.register(container);
47
+ DdbEsModelStorageOpsFeature.register(container);
48
+ DdbEsEntryStorageOpsFeature.register(container);
49
+ container.register(DataLoadersHandler).inSingletonScope();
50
+ }
51
+ });
52
+ export { HeadlessCmsDdbEsRequestFeature };
53
+
54
+ //# sourceMappingURL=requestFeature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestFeature.js","sources":["../src/requestFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport type { Container } from \"@webiny/feature/api/index.js\";\nimport { CmsEntryOpenSearchUtilsFeature } from \"@webiny/api-headless-cms-utils-os\";\nimport { FilterRegistriesFeature } from \"@webiny/api-headless-cms-storage\";\nimport { DbRegistry } from \"@webiny/db/exports/api/db.js\";\nimport { CreateElasticsearchIndexTask } from \"~/tasks/CreateElasticsearchIndexTask.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { DdbEsGroupStorageOpsFeature } from \"~/operations/group/feature.js\";\nimport { DdbEsModelStorageOpsFeature } from \"~/operations/model/feature.js\";\nimport { DdbEsEntryStorageOpsFeature } from \"~/operations/entry/feature.js\";\nimport { DataLoadersHandler } from \"~/operations/entry/dataLoaders.js\";\n\nconst resolveDbRegistry = (container: Container): DbRegistry.Interface | undefined => {\n try {\n return container.resolve(DbRegistry);\n } catch {\n return undefined;\n }\n};\n\n/**\n * Per-request half of the DynamoDB+OpenSearch CMS storage: the storage operations, the OpenSearch\n * extension points, and everything they keep state in. Register it in the request (child) container,\n * after `HeadlessCmsDdbEsFeature` is in the root.\n *\n * - @webiny/di applies a decorator only if it sits in the same container as the registration it\n * decorates, or in one of that container's parents. Extensions register their decorators in the\n * request container, so with the storage operations and OpenSearch extension points (index, field\n * indexes, filters, modifiers) in the root, an extension decorator on one of them (e.g.\n * `CmsModelOpenSearchIndex`) would be skipped without an error. Registering them here puts the\n * decorator and its target in the same container.\n * - The DataLoader cache must live for one request. A root singleton outlives the request and keeps\n * serving the entries it read first.\n * - The filter registries are mutable; a root instance would collect every request's registrations.\n */\nexport const HeadlessCmsDdbEsRequestFeature = createFeature({\n name: \"cms.storageOperations.openSearch.request\",\n register: container => {\n CmsEntryOpenSearchUtilsFeature.register(container);\n FilterRegistriesFeature.register(container);\n\n container.register(CreateElasticsearchIndexTask);\n\n // DbRegistry is per request (DbRegistryFeature), so the root entities are registered into it\n // here. Optional: not every setup registers DbRegistry.\n const dbRegistry = resolveDbRegistry(container);\n if (dbRegistry) {\n const entryEntity = container.resolve(CmsDdbEsEntryEntity);\n const entriesEsEntity = container.resolve(CmsDdbEsEntriesEsEntity);\n dbRegistry.register({\n item: entryEntity,\n app: \"cms\",\n tags: [\"regular\", entryEntity.name]\n });\n dbRegistry.register({\n item: entriesEsEntity,\n app: \"cms\",\n tags: [\"es\", entriesEsEntity.name]\n });\n }\n\n DdbEsGroupStorageOpsFeature.register(container);\n DdbEsModelStorageOpsFeature.register(container);\n DdbEsEntryStorageOpsFeature.register(container);\n\n container.register(DataLoadersHandler).inSingletonScope();\n }\n});\n"],"names":["resolveDbRegistry","container","DbRegistry","HeadlessCmsDdbEsRequestFeature","createFeature","CmsEntryOpenSearchUtilsFeature","FilterRegistriesFeature","CreateElasticsearchIndexTask","dbRegistry","entryEntity","CmsDdbEsEntryEntity","entriesEsEntity","CmsDdbEsEntriesEsEntity","DdbEsGroupStorageOpsFeature","DdbEsModelStorageOpsFeature","DdbEsEntryStorageOpsFeature","DataLoadersHandler"],"mappings":";;;;;;;;;;;AAaA,MAAMA,oBAAoB,CAACC;IACvB,IAAI;QACA,OAAOA,UAAU,OAAO,CAACC;IAC7B,EAAE,OAAM;QACJ;IACJ;AACJ;AAiBO,MAAMC,iCAAiCC,cAAc;IACxD,MAAM;IACN,UAAUH,CAAAA;QACNI,+BAA+B,QAAQ,CAACJ;QACxCK,wBAAwB,QAAQ,CAACL;QAEjCA,UAAU,QAAQ,CAACM;QAInB,MAAMC,aAAaR,kBAAkBC;QACrC,IAAIO,YAAY;YACZ,MAAMC,cAAcR,UAAU,OAAO,CAACS;YACtC,MAAMC,kBAAkBV,UAAU,OAAO,CAACW;YAC1CJ,WAAW,QAAQ,CAAC;gBAChB,MAAMC;gBACN,KAAK;gBACL,MAAM;oBAAC;oBAAWA,YAAY,IAAI;iBAAC;YACvC;YACAD,WAAW,QAAQ,CAAC;gBAChB,MAAMG;gBACN,KAAK;gBACL,MAAM;oBAAC;oBAAMA,gBAAgB,IAAI;iBAAC;YACtC;QACJ;QAEAE,4BAA4B,QAAQ,CAACZ;QACrCa,4BAA4B,QAAQ,CAACb;QACrCc,4BAA4B,QAAQ,CAACd;QAErCA,UAAU,QAAQ,CAACe,oBAAoB,gBAAgB;IAC3D;AACJ"}
@@ -0,0 +1,13 @@
1
+ import { TenantIndexFactory } from "@webiny/api-search-index-tasks";
2
+ import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
3
+ import { CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
4
+ declare class CreateElasticsearchIndexTaskImpl implements TenantIndexFactory.Interface {
5
+ private readonly indexProvider;
6
+ private listModels;
7
+ constructor(indexProvider: CmsModelOpenSearchIndexProvider.Interface, listModels: ListModelsUseCase.Interface);
8
+ getIndexList(tenant: TenantIndexFactory.Tenant): Promise<TenantIndexFactory.IndexConfig[]>;
9
+ }
10
+ export declare const CreateElasticsearchIndexTask: typeof CreateElasticsearchIndexTaskImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-search-index-tasks/abstractions/TenantIndexFactory").ITenantIndexFactory>;
12
+ };
13
+ export {};
@@ -0,0 +1,40 @@
1
+ import { TenantIndexFactory } from "@webiny/api-search-index-tasks";
2
+ import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
3
+ import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
4
+ import { CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
5
+ class CreateElasticsearchIndexTaskImpl {
6
+ constructor(indexProvider, listModels){
7
+ this.indexProvider = indexProvider;
8
+ this.listModels = listModels;
9
+ }
10
+ async getIndexList(tenant) {
11
+ const result = await this.listModels.execute();
12
+ const models = result.value;
13
+ if (0 === models.length) return [];
14
+ const configurations = createConfigurations(this.indexProvider);
15
+ const indices = [];
16
+ for (const model of models){
17
+ const { index, settings } = await configurations.es({
18
+ model: {
19
+ ...model,
20
+ tenant: tenant.id
21
+ }
22
+ });
23
+ indices.push({
24
+ index,
25
+ settings
26
+ });
27
+ }
28
+ return indices;
29
+ }
30
+ }
31
+ const CreateElasticsearchIndexTask = TenantIndexFactory.createImplementation({
32
+ implementation: CreateElasticsearchIndexTaskImpl,
33
+ dependencies: [
34
+ CmsModelOpenSearchIndexProvider,
35
+ ListModelsUseCase
36
+ ]
37
+ });
38
+ export { CreateElasticsearchIndexTask };
39
+
40
+ //# sourceMappingURL=CreateElasticsearchIndexTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks/CreateElasticsearchIndexTask.js","sources":["../../src/tasks/CreateElasticsearchIndexTask.ts"],"sourcesContent":["import { TenantIndexFactory } from \"@webiny/api-search-index-tasks\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { CmsModelOpenSearchIndexProvider } from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\n\nclass CreateElasticsearchIndexTaskImpl implements TenantIndexFactory.Interface {\n constructor(\n private readonly indexProvider: CmsModelOpenSearchIndexProvider.Interface,\n private listModels: ListModelsUseCase.Interface\n ) {}\n\n async getIndexList(\n tenant: TenantIndexFactory.Tenant\n ): Promise<TenantIndexFactory.IndexConfig[]> {\n const result = await this.listModels.execute();\n const models = result.value;\n\n if (models.length === 0) {\n return [];\n }\n\n const configurations = createConfigurations(this.indexProvider);\n\n const indices: TenantIndexFactory.IndexConfig[] = [];\n for (const model of models) {\n const { index, settings } = await configurations.es({\n model: {\n ...model,\n tenant: tenant.id\n }\n });\n indices.push({ index, settings });\n }\n return indices;\n }\n}\n\nexport const CreateElasticsearchIndexTask = TenantIndexFactory.createImplementation({\n implementation: CreateElasticsearchIndexTaskImpl,\n dependencies: [CmsModelOpenSearchIndexProvider, ListModelsUseCase]\n});\n"],"names":["CreateElasticsearchIndexTaskImpl","indexProvider","listModels","tenant","result","models","configurations","createConfigurations","indices","model","index","settings","CreateElasticsearchIndexTask","TenantIndexFactory","CmsModelOpenSearchIndexProvider","ListModelsUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YACqBC,aAAwD,EACjEC,UAAuC,CACjD;aAFmBD,aAAa,GAAbA;aACTC,UAAU,GAAVA;IACT;IAEH,MAAM,aACFC,MAAiC,EACQ;QACzC,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;QAC5C,MAAMC,SAASD,OAAO,KAAK;QAE3B,IAAIC,AAAkB,MAAlBA,OAAO,MAAM,EACb,OAAO,EAAE;QAGb,MAAMC,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAE9D,MAAMC,UAA4C,EAAE;QACpD,KAAK,MAAMC,SAASJ,OAAQ;YACxB,MAAM,EAAEK,KAAK,EAAEC,QAAQ,EAAE,GAAG,MAAML,eAAe,EAAE,CAAC;gBAChD,OAAO;oBACH,GAAGG,KAAK;oBACR,QAAQN,OAAO,EAAE;gBACrB;YACJ;YACAK,QAAQ,IAAI,CAAC;gBAAEE;gBAAOC;YAAS;QACnC;QACA,OAAOH;IACX;AACJ;AAEO,MAAMI,+BAA+BC,mBAAmB,oBAAoB,CAAC;IAChF,gBAAgBb;IAChB,cAAc;QAACc;QAAiCC;KAAkB;AACtE"}
package/types.d.ts CHANGED
@@ -1,169 +1,22 @@
1
- import type { Plugin, PluginCollection } from "@webiny/plugins/types";
2
- import type { CmsContext as BaseCmsContext, CmsEntry, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModel, CmsModelField, CmsModelFieldToGraphQLPlugin, CmsModelFieldType, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
- import type { AttributeDefinition, Entity, Table, TableConstructor } from "@webiny/db-dynamodb/toolbox";
4
- import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
5
- import type { Client } from "@elastic/elasticsearch";
6
- import type { PluginsContainer } from "@webiny/plugins";
7
- /**
8
- * A definition of the entry that is being prepared for the Elasticsearch.
9
- *
10
- * @category Elasticsearch
11
- * @category CmsEntry
12
- */
13
- export interface CmsIndexEntry extends CmsEntry {
14
- /**
15
- * Values that are not going to be indexed.
16
- */
17
- rawValues: Record<string, any>;
18
- /**
19
- * A first part of the ID, without the revision.
20
- * For example, we can search for all the revisions of the given entry.
21
- */
22
- primaryId: string;
23
- /**
24
- * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.
25
- */
26
- [key: string]: any;
27
- }
28
- /**
29
- * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.
30
- *
31
- * @category Elasticsearch
32
- * @category CmsEntry
33
- */
34
- export interface CmsModelFieldToElasticsearchToParams {
35
- plugins: PluginsContainer;
36
- model: CmsModel;
37
- field: CmsModelField;
38
- /**
39
- * Raw value on the entry - before prepare for storage.
40
- */
41
- rawValue: any;
42
- /**
43
- * Value prepared for storage received from base api-headless-cms package.
44
- */
45
- value: any;
46
- getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;
47
- getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;
48
- }
49
- /**
50
- * Arguments for the method that is transforming content entry from Elasticsearch into the original one.
51
- *
52
- * @category Elasticsearch
53
- * @category CmsEntry
54
- */
55
- export interface CmsModelFieldToElasticsearchFromParams {
56
- plugins: PluginsContainer;
57
- model: CmsModel;
58
- field: CmsModelField;
59
- value: any;
60
- rawValue: any;
61
- getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;
62
- getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;
63
- }
64
- interface ToIndexValue {
65
- /**
66
- * Use this key to store value for indexing.
67
- */
68
- value?: any;
69
- /**
70
- * Use this key to tell ES that this value should not be indexed.
71
- */
72
- rawValue?: any;
73
- }
74
- /**
75
- * A plugin defining transformation of entry for Elasticsearch.
76
- *
77
- * @category Plugin
78
- * @category ContentModelField
79
- * @category CmsEntry
80
- * @category Elasticsearch
81
- */
82
- export interface CmsModelFieldToElasticsearchPlugin extends Plugin {
83
- /**
84
- * A plugin type
85
- */
86
- type: "cms-model-field-to-elastic-search";
87
- /**
88
- * A unique identifier of the field type (text, number, json, myField, ...).
89
- *
90
- * ```ts
91
- * fieldType: "myField"
92
- * ```
93
- */
94
- fieldType: CmsModelFieldType;
95
- /**
96
- * If you need to define a type when building an Elasticsearch query.
97
- * Check [dateTimeIndexing](https://github.com/webiny/webiny-js/blob/3074165701b8b45e5fc6ac2444caace7d04ada66/packages/api-headless-cms/src/content/plugins/es/indexing/dateTimeIndexing.ts) plugin for usage example.
98
- *
99
- * ```ts
100
- * unmappedType: "date"
101
- * ```
102
- */
103
- unmappedType?: (field: Pick<CmsModelField, "fieldId" | "type">) => string;
104
- /**
105
- * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.
106
- * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.
107
- *
108
- * ```ts
109
- * toIndex({ value }) {
110
- * return {
111
- * value: value, // This will be stored and indexed
112
- * rawValue: JSON.stringify(value) // This will be stored but excluded from indexing
113
- * };
114
- * }
115
- * ```
116
- */
117
- toIndex?: (params: CmsModelFieldToElasticsearchToParams) => ToIndexValue;
118
- /**
119
- * This is meant to revert a transformation done in the `toIndex` method.
120
- * You have access to "value" or a "rawValue", depending on what you returned from `toIndex`.
121
- *
122
- * ```ts
123
- * fromIndex({ value, rawValue }) {
124
- * return JSON.parse(rawValue);
125
- * }
126
- * ```
127
- */
128
- fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;
129
- }
130
- export type Attributes = Record<string, AttributeDefinition>;
1
+ import type { CmsContext, CmsEntryValues, CmsModel, CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
2
+ export { CmsContext };
131
3
  export declare enum ENTITIES {
132
- SYSTEM = "CmsSystem",
133
4
  GROUPS = "CmsGroups",
134
5
  MODELS = "CmsModels",
135
6
  ENTRIES = "CmsEntries",
136
7
  ENTRIES_ES = "CmsEntriesElasticsearch"
137
8
  }
138
- export interface TableModifier {
139
- (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;
140
- }
141
- export interface StorageOperationsFactoryParams {
142
- documentClient: DynamoDBDocument;
143
- elasticsearch: Client;
144
- table?: TableModifier;
145
- esTable?: TableModifier;
146
- attributes?: Record<ENTITIES, Attributes>;
147
- plugins?: PluginCollection;
148
- }
149
- export interface CmsContext extends BaseCmsContext {
150
- [key: string]: any;
151
- }
152
- export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {
153
- getTable: () => Table<string, string, string>;
154
- getEsTable: () => Table<string, string, string>;
155
- getEntities: () => Record<"system" | "groups" | "models" | "entries" | "entriesEs", Entity<any>>;
156
- }
157
- export interface StorageOperationsFactory {
158
- (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
159
- }
160
- export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
161
- dataLoaders: DataLoadersHandlerInterface;
162
- }
163
9
  export interface DataLoadersHandlerInterfaceClearAllParams {
164
- model: Pick<CmsModel, "tenant" | "locale">;
10
+ tenant: string;
11
+ }
12
+ export interface DataLoadersHandlerDataLoaderParams {
13
+ model: Pick<CmsModel, "tenant" | "modelId">;
14
+ ids: readonly string[];
165
15
  }
166
- export interface DataLoadersHandlerInterface {
16
+ export interface IDataLoadersHandler {
17
+ getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(params: DataLoadersHandlerDataLoaderParams): Promise<CmsStorageEntry<T>[]>;
18
+ getRevisionById<T extends CmsEntryValues = CmsEntryValues>(params: DataLoadersHandlerDataLoaderParams): Promise<CmsStorageEntry<T>[]>;
19
+ getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(params: DataLoadersHandlerDataLoaderParams): Promise<CmsStorageEntry<T>[]>;
20
+ getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(params: DataLoadersHandlerDataLoaderParams): Promise<CmsStorageEntry<T>[]>;
167
21
  clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;
168
22
  }
169
- export {};
package/types.js CHANGED
@@ -1,42 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ENTITIES = void 0;
7
- /**
8
- * A definition of the entry that is being prepared for the Elasticsearch.
9
- *
10
- * @category Elasticsearch
11
- * @category CmsEntry
12
- */
13
- /**
14
- * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.
15
- *
16
- * @category Elasticsearch
17
- * @category CmsEntry
18
- */
19
- /**
20
- * Arguments for the method that is transforming content entry from Elasticsearch into the original one.
21
- *
22
- * @category Elasticsearch
23
- * @category CmsEntry
24
- */
25
- /**
26
- * A plugin defining transformation of entry for Elasticsearch.
27
- *
28
- * @category Plugin
29
- * @category ContentModelField
30
- * @category CmsEntry
31
- * @category Elasticsearch
32
- */
33
- let ENTITIES = exports.ENTITIES = /*#__PURE__*/function (ENTITIES) {
34
- ENTITIES["SYSTEM"] = "CmsSystem";
35
- ENTITIES["GROUPS"] = "CmsGroups";
36
- ENTITIES["MODELS"] = "CmsModels";
37
- ENTITIES["ENTRIES"] = "CmsEntries";
38
- ENTITIES["ENTRIES_ES"] = "CmsEntriesElasticsearch";
39
- return ENTITIES;
1
+ var types_ENTITIES = /*#__PURE__*/ function(ENTITIES) {
2
+ ENTITIES["GROUPS"] = "CmsGroups";
3
+ ENTITIES["MODELS"] = "CmsModels";
4
+ ENTITIES["ENTRIES"] = "CmsEntries";
5
+ ENTITIES["ENTRIES_ES"] = "CmsEntriesElasticsearch";
6
+ return ENTITIES;
40
7
  }({});
8
+ export { types_ENTITIES as ENTITIES };
41
9
 
42
10
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import type { Plugin, PluginCollection } from \"@webiny/plugins/types\";\nimport type {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldType,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport type {\n AttributeDefinition,\n Entity,\n Table,\n TableConstructor\n} from \"@webiny/db-dynamodb/toolbox\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { Client } from \"@elastic/elasticsearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\n\n/**\n * A definition of the entry that is being prepared for the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsIndexEntry extends CmsEntry {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Record<string, any>;\n /**\n * A first part of the ID, without the revision.\n * For example, we can search for all the revisions of the given entry.\n */\n primaryId: string;\n /**\n * Dev can add what ever keys they want and need. Just need to be careful not to break the entry.\n */\n [key: string]: any;\n}\n\n/**\n * Arguments for the method that is transforming content entry in its original form to the one we are storing to the Elasticsearch.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsModelFieldToElasticsearchToParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n /**\n * Raw value on the entry - before prepare for storage.\n */\n rawValue: any;\n /**\n * Value prepared for storage received from base api-headless-cms package.\n */\n value: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\n/**\n * Arguments for the method that is transforming content entry from Elasticsearch into the original one.\n *\n * @category Elasticsearch\n * @category CmsEntry\n */\nexport interface CmsModelFieldToElasticsearchFromParams {\n plugins: PluginsContainer;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n rawValue: any;\n getFieldIndexPlugin(fieldType: string): CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin(fieldType: string): CmsModelFieldToGraphQLPlugin;\n}\n\ninterface ToIndexValue {\n /**\n * Use this key to store value for indexing.\n */\n value?: any;\n /**\n * Use this key to tell ES that this value should not be indexed.\n */\n rawValue?: any;\n}\n\n/**\n * A plugin defining transformation of entry for Elasticsearch.\n *\n * @category Plugin\n * @category ContentModelField\n * @category CmsEntry\n * @category Elasticsearch\n */\nexport interface CmsModelFieldToElasticsearchPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-to-elastic-search\";\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * fieldType: \"myField\"\n * ```\n */\n fieldType: CmsModelFieldType;\n /**\n * If you need to define a type when building an Elasticsearch query.\n * Check [dateTimeIndexing](https://github.com/webiny/webiny-js/blob/3074165701b8b45e5fc6ac2444caace7d04ada66/packages/api-headless-cms/src/content/plugins/es/indexing/dateTimeIndexing.ts) plugin for usage example.\n *\n * ```ts\n * unmappedType: \"date\"\n * ```\n */\n unmappedType?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string;\n /**\n * This is meant to do some transformation of the entry, preferably only to fieldType it was defined for. Nothing is stopping you to do anything you want to other fields, but try to separate field transformations.\n * It returns `Partial<CmsContentIndexEntryType>`. Always return a top-level property of the entry since it is merged via spread operator.\n *\n * ```ts\n * toIndex({ value }) {\n * return {\n * value: value, // This will be stored and indexed\n * rawValue: JSON.stringify(value) // This will be stored but excluded from indexing\n * };\n * }\n * ```\n */\n toIndex?: (params: CmsModelFieldToElasticsearchToParams) => ToIndexValue;\n /**\n * This is meant to revert a transformation done in the `toIndex` method.\n * You have access to \"value\" or a \"rawValue\", depending on what you returned from `toIndex`.\n *\n * ```ts\n * fromIndex({ value, rawValue }) {\n * return JSON.parse(rawValue);\n * }\n * ```\n */\n fromIndex?: (params: CmsModelFieldToElasticsearchFromParams) => any;\n}\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n elasticsearch: Client;\n table?: TableModifier;\n esTable?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: PluginCollection;\n}\n\nexport interface CmsContext extends BaseCmsContext {\n [key: string]: any;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations<CmsContext> {\n getTable: () => Table<string, string, string>;\n getEsTable: () => Table<string, string, string>;\n getEntities: () => Record<\n \"system\" | \"groups\" | \"models\" | \"entries\" | \"entriesEs\",\n Entity<any>\n >;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: DataLoadersHandlerInterface;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\">;\n}\nexport interface DataLoadersHandlerInterface {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"mappings":";;;;;;AAqBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IA2DYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsContext,\n CmsEntryValues,\n CmsModel,\n CmsStorageEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\n\nexport { CmsContext };\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n tenant: string;\n}\n\nexport interface DataLoadersHandlerDataLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n ids: readonly string[];\n}\n\nexport interface IDataLoadersHandler {\n getAllEntryRevisions<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getRevisionById<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getPublishedRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n getLatestRevisionByEntryId<T extends CmsEntryValues = CmsEntryValues>(\n params: DataLoadersHandlerDataLoaderParams\n ): Promise<CmsStorageEntry<T>[]>;\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AASO,IAAKA,iBAAQA,WAAAA,GAAAA,SAARA,QAAQ;;;;;WAARA"}
@@ -1,19 +0,0 @@
1
- import type { CmsModel } from "@webiny/api-headless-cms/types";
2
- import type { CmsContext } from "./types";
3
- import type { ElasticsearchIndexRequestBody } from "@webiny/api-elasticsearch/types";
4
- interface ConfigurationsElasticsearch {
5
- index: string;
6
- }
7
- export interface CmsElasticsearchParams {
8
- model: Pick<CmsModel, "tenant" | "locale" | "modelId">;
9
- }
10
- export interface ConfigurationsIndexSettingsParams {
11
- context: CmsContext;
12
- model: Pick<CmsModel, "locale">;
13
- }
14
- export interface Configurations {
15
- es: (params: CmsElasticsearchParams) => ConfigurationsElasticsearch;
16
- indexSettings: (params: ConfigurationsIndexSettingsParams) => Partial<ElasticsearchIndexRequestBody>;
17
- }
18
- export declare const configurations: Configurations;
19
- export {};
package/configurations.js DELETED
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.configurations = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- var _plugins = require("./plugins");
11
- const configurations = exports.configurations = {
12
- es({
13
- model
14
- }) {
15
- const {
16
- tenant,
17
- locale
18
- } = model;
19
- if (!tenant) {
20
- throw new _error.default(`Missing "tenant" parameter when trying to create Elasticsearch index name.`, "TENANT_ERROR");
21
- } else if (!locale) {
22
- throw new _error.default(`Missing "locale" parameter when trying to create Elasticsearch index name.`, "LOCALE_ERROR");
23
- }
24
- const sharedIndex = (0, _apiElasticsearch.isSharedElasticsearchIndex)();
25
- const index = [sharedIndex ? "root" : tenant, "headless-cms", locale, model.modelId].join("-").toLowerCase();
26
- const prefix = (0, _apiElasticsearch.getElasticsearchIndexPrefix)();
27
- if (!prefix) {
28
- return {
29
- index
30
- };
31
- }
32
- return {
33
- index: prefix + index
34
- };
35
- },
36
- indexSettings: ({
37
- context,
38
- model
39
- }) => {
40
- const plugin = (0, _apiElasticsearch.getLastAddedIndexPlugin)({
41
- container: context.plugins,
42
- type: _plugins.CmsEntryElasticsearchIndexPlugin.type,
43
- locale: model.locale
44
- });
45
- return plugin ? plugin.body : {};
46
- }
47
- };
48
-
49
- //# sourceMappingURL=configurations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_apiElasticsearch","_plugins","configurations","exports","es","model","tenant","locale","WebinyError","sharedIndex","isSharedElasticsearchIndex","index","modelId","join","toLowerCase","prefix","getElasticsearchIndexPrefix","indexSettings","context","plugin","getLastAddedIndexPlugin","container","plugins","type","CmsEntryElasticsearchIndexPlugin","body"],"sources":["configurations.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\nimport type { CmsContext } from \"~/types\";\nimport {\n getElasticsearchIndexPrefix,\n getLastAddedIndexPlugin,\n isSharedElasticsearchIndex\n} from \"@webiny/api-elasticsearch\";\nimport type { ElasticsearchIndexRequestBody } from \"@webiny/api-elasticsearch/types\";\nimport { CmsEntryElasticsearchIndexPlugin } from \"~/plugins\";\n\ninterface ConfigurationsElasticsearch {\n index: string;\n}\n\nexport interface CmsElasticsearchParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\" | \"modelId\">;\n}\n\nexport interface ConfigurationsIndexSettingsParams {\n context: CmsContext;\n model: Pick<CmsModel, \"locale\">;\n}\n\nexport interface Configurations {\n es: (params: CmsElasticsearchParams) => ConfigurationsElasticsearch;\n indexSettings: (\n params: ConfigurationsIndexSettingsParams\n ) => Partial<ElasticsearchIndexRequestBody>;\n}\n\nexport const configurations: Configurations = {\n es({ model }) {\n const { tenant, locale } = model;\n\n if (!tenant) {\n throw new WebinyError(\n `Missing \"tenant\" parameter when trying to create Elasticsearch index name.`,\n \"TENANT_ERROR\"\n );\n } else if (!locale) {\n throw new WebinyError(\n `Missing \"locale\" parameter when trying to create Elasticsearch index name.`,\n \"LOCALE_ERROR\"\n );\n }\n\n const sharedIndex = isSharedElasticsearchIndex();\n const index = [sharedIndex ? \"root\" : tenant, \"headless-cms\", locale, model.modelId]\n .join(\"-\")\n .toLowerCase();\n\n const prefix = getElasticsearchIndexPrefix();\n\n if (!prefix) {\n return {\n index\n };\n }\n return {\n index: prefix + index\n };\n },\n indexSettings: ({ context, model }) => {\n const plugin = getLastAddedIndexPlugin<CmsEntryElasticsearchIndexPlugin>({\n container: context.plugins,\n type: CmsEntryElasticsearchIndexPlugin.type,\n locale: model.locale\n });\n\n return plugin ? plugin.body : {};\n }\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AAsBO,MAAMG,cAA8B,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC1CE,EAAEA,CAAC;IAAEC;EAAM,CAAC,EAAE;IACV,MAAM;MAAEC,MAAM;MAAEC;IAAO,CAAC,GAAGF,KAAK;IAEhC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,cAAW,CACjB,4EAA4E,EAC5E,cACJ,CAAC;IACL,CAAC,MAAM,IAAI,CAACD,MAAM,EAAE;MAChB,MAAM,IAAIC,cAAW,CACjB,4EAA4E,EAC5E,cACJ,CAAC;IACL;IAEA,MAAMC,WAAW,GAAG,IAAAC,4CAA0B,EAAC,CAAC;IAChD,MAAMC,KAAK,GAAG,CAACF,WAAW,GAAG,MAAM,GAAGH,MAAM,EAAE,cAAc,EAAEC,MAAM,EAAEF,KAAK,CAACO,OAAO,CAAC,CAC/EC,IAAI,CAAC,GAAG,CAAC,CACTC,WAAW,CAAC,CAAC;IAElB,MAAMC,MAAM,GAAG,IAAAC,6CAA2B,EAAC,CAAC;IAE5C,IAAI,CAACD,MAAM,EAAE;MACT,OAAO;QACHJ;MACJ,CAAC;IACL;IACA,OAAO;MACHA,KAAK,EAAEI,MAAM,GAAGJ;IACpB,CAAC;EACL,CAAC;EACDM,aAAa,EAAEA,CAAC;IAAEC,OAAO;IAAEb;EAAM,CAAC,KAAK;IACnC,MAAMc,MAAM,GAAG,IAAAC,yCAAuB,EAAmC;MACrEC,SAAS,EAAEH,OAAO,CAACI,OAAO;MAC1BC,IAAI,EAAEC,yCAAgC,CAACD,IAAI;MAC3ChB,MAAM,EAAEF,KAAK,CAACE;IAClB,CAAC,CAAC;IAEF,OAAOY,MAAM,GAAGA,MAAM,CAACM,IAAI,GAAG,CAAC,CAAC;EACpC;AACJ,CAAC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import type { Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Entity } from "@webiny/db-dynamodb/toolbox";
3
- import type { Attributes } from "../types";
4
- export interface CreateEntryElasticsearchEntityParams {
5
- table: Table<string, string, string>;
6
- entityName: string;
7
- attributes: Attributes;
8
- }
9
- export declare const createEntryElasticsearchEntity: (params: CreateEntryElasticsearchEntityParams) => Entity<any>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createEntryElasticsearchEntity = void 0;
7
- var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
- const createEntryElasticsearchEntity = params => {
9
- const {
10
- table,
11
- entityName,
12
- attributes
13
- } = params;
14
- return new _toolbox.Entity({
15
- name: entityName,
16
- table,
17
- attributes: {
18
- PK: {
19
- type: "string",
20
- partitionKey: true
21
- },
22
- SK: {
23
- type: "string",
24
- sortKey: true
25
- },
26
- index: {
27
- type: "string"
28
- },
29
- data: {
30
- type: "map"
31
- },
32
- TYPE: {
33
- type: "string"
34
- },
35
- ...(attributes || {})
36
- }
37
- });
38
- };
39
- exports.createEntryElasticsearchEntity = createEntryElasticsearchEntity;
40
-
41
- //# sourceMappingURL=entryElasticsearch.js.map