@webiny/api-headless-cms-ddb-es 0.0.0-unstable.3bc8100a7f → 0.0.0-unstable.3fddf667ea

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 (426) 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/debuggerNamespaces.d.ts +12 -0
  24. package/debuggerNamespaces.js +0 -0
  25. package/definitions/entry.d.ts +4 -6
  26. package/definitions/entry.js +8 -179
  27. package/definitions/entry.js.map +1 -1
  28. package/definitions/group.d.ts +6 -7
  29. package/definitions/group.js +8 -63
  30. package/definitions/group.js.map +1 -1
  31. package/definitions/model.d.ts +6 -7
  32. package/definitions/model.js +8 -107
  33. package/definitions/model.js.map +1 -1
  34. package/definitions/types.d.ts +65 -0
  35. package/definitions/types.js +0 -0
  36. package/feature.d.ts +10 -0
  37. package/feature.js +69 -0
  38. package/feature.js.map +1 -0
  39. package/index.d.ts +1 -3
  40. package/index.js +1 -225
  41. package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
  42. package/operations/entry/DdbEsCreateEntry.js +134 -0
  43. package/operations/entry/DdbEsCreateEntry.js.map +1 -0
  44. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
  45. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -0
  46. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
  47. package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
  48. package/operations/entry/DdbEsDeleteEntry.js +79 -0
  49. package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
  50. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +24 -0
  51. package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
  52. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
  53. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
  54. package/operations/entry/DdbEsDeleteMultipleEntries.js +78 -0
  55. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
  56. package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
  57. package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
  58. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
  59. package/operations/entry/DdbEsGetEntry.d.ts +14 -0
  60. package/operations/entry/DdbEsGetEntry.js +27 -0
  61. package/operations/entry/DdbEsGetEntry.js.map +1 -0
  62. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
  63. package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
  64. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
  65. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
  66. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
  67. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
  68. package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
  69. package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
  70. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
  71. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
  72. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
  73. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
  74. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
  75. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
  76. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
  77. package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
  78. package/operations/entry/DdbEsGetRevisionById.js +34 -0
  79. package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
  80. package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
  81. package/operations/entry/DdbEsGetRevisions.js +33 -0
  82. package/operations/entry/DdbEsGetRevisions.js.map +1 -0
  83. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +18 -0
  84. package/operations/entry/DdbEsGetUniqueFieldValues.js +77 -0
  85. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
  86. package/operations/entry/DdbEsListEntries.d.ts +28 -0
  87. package/operations/entry/DdbEsListEntries.js +110 -0
  88. package/operations/entry/DdbEsListEntries.js.map +1 -0
  89. package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
  90. package/operations/entry/DdbEsMoveEntry.js +113 -0
  91. package/operations/entry/DdbEsMoveEntry.js.map +1 -0
  92. package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
  93. package/operations/entry/DdbEsMoveToBin.js +137 -0
  94. package/operations/entry/DdbEsMoveToBin.js.map +1 -0
  95. package/operations/entry/DdbEsPublishEntry.d.ts +24 -0
  96. package/operations/entry/DdbEsPublishEntry.js +231 -0
  97. package/operations/entry/DdbEsPublishEntry.js.map +1 -0
  98. package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
  99. package/operations/entry/DdbEsRestoreFromBin.js +137 -0
  100. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
  101. package/operations/entry/DdbEsUnpublishEntry.d.ts +24 -0
  102. package/operations/entry/DdbEsUnpublishEntry.js +127 -0
  103. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
  104. package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
  105. package/operations/entry/DdbEsUpdateEntry.js +175 -0
  106. package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
  107. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
  108. package/operations/entry/dataLoader/DataLoaderCache.js +21 -35
  109. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  110. package/operations/entry/dataLoader/constants.js +2 -7
  111. package/operations/entry/dataLoader/constants.js.map +1 -1
  112. package/operations/entry/dataLoader/createBatchScheduleFn.js +7 -22
  113. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  114. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  115. package/operations/entry/dataLoader/getAllEntryRevisions.js +20 -41
  116. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  117. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  118. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +30 -48
  119. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  120. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  121. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +30 -48
  122. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  123. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  124. package/operations/entry/dataLoader/getRevisionById.js +36 -58
  125. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  126. package/operations/entry/dataLoader/index.d.ts +3 -3
  127. package/operations/entry/dataLoader/index.js +13 -35
  128. package/operations/entry/dataLoader/index.js.map +1 -1
  129. package/operations/entry/dataLoader/types.d.ts +4 -4
  130. package/operations/entry/dataLoader/types.js +0 -7
  131. package/operations/entry/dataLoaders.d.ts +14 -14
  132. package/operations/entry/dataLoaders.js +92 -110
  133. package/operations/entry/dataLoaders.js.map +1 -1
  134. package/operations/entry/feature.d.ts +4 -0
  135. package/operations/entry/feature.js +55 -0
  136. package/operations/entry/feature.js.map +1 -0
  137. package/operations/entry/keys.d.ts +31 -1
  138. package/operations/entry/keys.js +44 -27
  139. package/operations/entry/keys.js.map +1 -1
  140. package/operations/entry/recordType.js +4 -18
  141. package/operations/entry/recordType.js.map +1 -1
  142. package/operations/entry/storageEntryUtils.d.ts +7 -0
  143. package/operations/entry/storageEntryUtils.js +14 -0
  144. package/operations/entry/storageEntryUtils.js.map +1 -0
  145. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  146. package/operations/entry/transformations/convertEntryKeys.js +21 -34
  147. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  148. package/operations/entry/transformations/index.d.ts +21 -18
  149. package/operations/entry/transformations/index.js +87 -123
  150. package/operations/entry/transformations/index.js.map +1 -1
  151. package/operations/entry/transformations/modifyEntryValues.d.ts +30 -35
  152. package/operations/entry/transformations/modifyEntryValues.js +12 -24
  153. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  154. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  155. package/operations/entry/transformations/transformEntryKeys.js +14 -24
  156. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  157. package/operations/group/DdbEsCreateGroup.d.ts +12 -0
  158. package/operations/group/DdbEsCreateGroup.js +35 -0
  159. package/operations/group/DdbEsCreateGroup.js.map +1 -0
  160. package/operations/group/DdbEsDeleteGroup.d.ts +12 -0
  161. package/operations/group/DdbEsDeleteGroup.js +31 -0
  162. package/operations/group/DdbEsDeleteGroup.js.map +1 -0
  163. package/operations/group/DdbEsGetGroup.d.ts +12 -0
  164. package/operations/group/DdbEsGetGroup.js +31 -0
  165. package/operations/group/DdbEsGetGroup.js.map +1 -0
  166. package/operations/group/DdbEsListGroups.d.ts +14 -0
  167. package/operations/group/DdbEsListGroups.js +52 -0
  168. package/operations/group/DdbEsListGroups.js.map +1 -0
  169. package/operations/group/DdbEsUpdateGroup.d.ts +12 -0
  170. package/operations/group/DdbEsUpdateGroup.js +35 -0
  171. package/operations/group/DdbEsUpdateGroup.js.map +1 -0
  172. package/operations/group/feature.d.ts +4 -0
  173. package/operations/group/feature.js +19 -0
  174. package/operations/group/feature.js.map +1 -0
  175. package/operations/group/keys.d.ts +15 -0
  176. package/operations/group/keys.js +17 -0
  177. package/operations/group/keys.js.map +1 -0
  178. package/operations/model/DdbEsCreateModel.d.ts +16 -0
  179. package/operations/model/DdbEsCreateModel.js +56 -0
  180. package/operations/model/DdbEsCreateModel.js.map +1 -0
  181. package/operations/model/DdbEsDeleteModel.d.ts +12 -0
  182. package/operations/model/DdbEsDeleteModel.js +31 -0
  183. package/operations/model/DdbEsDeleteModel.js.map +1 -0
  184. package/operations/model/DdbEsGetModel.d.ts +12 -0
  185. package/operations/model/DdbEsGetModel.js +30 -0
  186. package/operations/model/DdbEsGetModel.js.map +1 -0
  187. package/operations/model/DdbEsListModels.d.ts +12 -0
  188. package/operations/model/DdbEsListModels.js +36 -0
  189. package/operations/model/DdbEsListModels.js.map +1 -0
  190. package/operations/model/DdbEsUpdateModel.d.ts +12 -0
  191. package/operations/model/DdbEsUpdateModel.js +36 -0
  192. package/operations/model/DdbEsUpdateModel.js.map +1 -0
  193. package/operations/model/feature.d.ts +4 -0
  194. package/operations/model/feature.js +19 -0
  195. package/operations/model/feature.js.map +1 -0
  196. package/operations/model/keys.d.ts +15 -0
  197. package/operations/model/keys.js +17 -0
  198. package/operations/model/keys.js.map +1 -0
  199. package/package.json +40 -36
  200. package/registry/CmsEntitiesDbRegistryDecorator.d.ts +27 -0
  201. package/registry/CmsEntitiesDbRegistryDecorator.js +46 -0
  202. package/registry/CmsEntitiesDbRegistryDecorator.js.map +1 -0
  203. package/tasks/CreateElasticsearchIndexTask.d.ts +15 -0
  204. package/tasks/CreateElasticsearchIndexTask.js +49 -0
  205. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  206. package/types.d.ts +12 -159
  207. package/types.js +7 -39
  208. package/types.js.map +1 -1
  209. package/configurations.d.ts +0 -19
  210. package/configurations.js +0 -49
  211. package/configurations.js.map +0 -1
  212. package/definitions/entryElasticsearch.d.ts +0 -9
  213. package/definitions/entryElasticsearch.js +0 -41
  214. package/definitions/entryElasticsearch.js.map +0 -1
  215. package/definitions/system.d.ts +0 -9
  216. package/definitions/system.js +0 -42
  217. package/definitions/system.js.map +0 -1
  218. package/definitions/table.d.ts +0 -8
  219. package/definitions/table.js +0 -25
  220. package/definitions/table.js.map +0 -1
  221. package/definitions/tableElasticsearch.d.ts +0 -8
  222. package/definitions/tableElasticsearch.js +0 -25
  223. package/definitions/tableElasticsearch.js.map +0 -1
  224. package/dynamoDb/index.d.ts +0 -3
  225. package/dynamoDb/index.js +0 -16
  226. package/dynamoDb/index.js.map +0 -1
  227. package/dynamoDb/storage/longText.d.ts +0 -10
  228. package/dynamoDb/storage/longText.js +0 -96
  229. package/dynamoDb/storage/longText.js.map +0 -1
  230. package/dynamoDb/storage/richText.d.ts +0 -2
  231. package/dynamoDb/storage/richText.js +0 -59
  232. package/dynamoDb/storage/richText.js.map +0 -1
  233. package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
  234. package/elasticsearch/createElasticsearchIndex.js +0 -40
  235. package/elasticsearch/createElasticsearchIndex.js.map +0 -1
  236. package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
  237. package/elasticsearch/deleteElasticsearchIndex.js +0 -38
  238. package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
  239. package/elasticsearch/index.d.ts +0 -2
  240. package/elasticsearch/index.js +0 -13
  241. package/elasticsearch/index.js.map +0 -1
  242. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  243. package/elasticsearch/indexing/dateTimeIndexing.js +0 -88
  244. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  245. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  246. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -54
  247. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  248. package/elasticsearch/indexing/index.d.ts +0 -2
  249. package/elasticsearch/indexing/index.js +0 -18
  250. package/elasticsearch/indexing/index.js.map +0 -1
  251. package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
  252. package/elasticsearch/indexing/jsonIndexing.js +0 -28
  253. package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
  254. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  255. package/elasticsearch/indexing/longTextIndexing.js +0 -42
  256. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  257. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  258. package/elasticsearch/indexing/numberIndexing.js +0 -41
  259. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  260. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  261. package/elasticsearch/indexing/objectIndexing.js +0 -201
  262. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  263. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  264. package/elasticsearch/indexing/richTextIndexing.js +0 -31
  265. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  266. package/elasticsearch/indices/base.d.ts +0 -2
  267. package/elasticsearch/indices/base.js +0 -13
  268. package/elasticsearch/indices/base.js.map +0 -1
  269. package/elasticsearch/indices/index.d.ts +0 -1
  270. package/elasticsearch/indices/index.js +0 -14
  271. package/elasticsearch/indices/index.js.map +0 -1
  272. package/elasticsearch/indices/japanese.d.ts +0 -2
  273. package/elasticsearch/indices/japanese.js +0 -14
  274. package/elasticsearch/indices/japanese.js.map +0 -1
  275. package/elasticsearch/search/index.d.ts +0 -3
  276. package/elasticsearch/search/index.js +0 -12
  277. package/elasticsearch/search/index.js.map +0 -1
  278. package/elasticsearch/search/refSearch.d.ts +0 -2
  279. package/elasticsearch/search/refSearch.js +0 -31
  280. package/elasticsearch/search/refSearch.js.map +0 -1
  281. package/elasticsearch/search/timeSearch.d.ts +0 -2
  282. package/elasticsearch/search/timeSearch.js +0 -27
  283. package/elasticsearch/search/timeSearch.js.map +0 -1
  284. package/helpers/entryIndexHelpers.d.ts +0 -18
  285. package/helpers/entryIndexHelpers.js +0 -190
  286. package/helpers/entryIndexHelpers.js.map +0 -1
  287. package/helpers/fieldIdentifier.d.ts +0 -6
  288. package/helpers/fieldIdentifier.js +0 -43
  289. package/helpers/fieldIdentifier.js.map +0 -1
  290. package/helpers/index.d.ts +0 -2
  291. package/helpers/index.js +0 -29
  292. package/helpers/index.js.map +0 -1
  293. package/index.js.map +0 -1
  294. package/operations/entry/dataLoader/types.js.map +0 -1
  295. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
  296. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -34
  297. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
  298. package/operations/entry/elasticsearch/body.d.ts +0 -13
  299. package/operations/entry/elasticsearch/body.js +0 -142
  300. package/operations/entry/elasticsearch/body.js.map +0 -1
  301. package/operations/entry/elasticsearch/fields.d.ts +0 -10
  302. package/operations/entry/elasticsearch/fields.js +0 -315
  303. package/operations/entry/elasticsearch/fields.js.map +0 -1
  304. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -8
  305. package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -59
  306. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
  307. package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -17
  308. package/operations/entry/elasticsearch/filtering/exec.js +0 -175
  309. package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
  310. package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
  311. package/operations/entry/elasticsearch/filtering/index.js +0 -18
  312. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  313. package/operations/entry/elasticsearch/filtering/path.d.ts +0 -15
  314. package/operations/entry/elasticsearch/filtering/path.js +0 -46
  315. package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
  316. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  317. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -30
  318. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  319. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  320. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -15
  321. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  322. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  323. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -69
  324. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  325. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  326. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -57
  327. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  328. package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
  329. package/operations/entry/elasticsearch/filtering/populated.js +0 -25
  330. package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
  331. package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
  332. package/operations/entry/elasticsearch/filtering/values.js +0 -24
  333. package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
  334. package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -12
  335. package/operations/entry/elasticsearch/fullTextSearch.js +0 -91
  336. package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
  337. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
  338. package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -27
  339. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
  340. package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
  341. package/operations/entry/elasticsearch/initialQuery.js +0 -106
  342. package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
  343. package/operations/entry/elasticsearch/keyword.d.ts +0 -2
  344. package/operations/entry/elasticsearch/keyword.js +0 -36
  345. package/operations/entry/elasticsearch/keyword.js.map +0 -1
  346. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  347. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  348. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  349. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  350. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -18
  351. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  352. package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -8
  353. package/operations/entry/elasticsearch/plugins/operator.js +0 -39
  354. package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
  355. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  356. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -18
  357. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  358. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  359. package/operations/entry/elasticsearch/plugins/search.js +0 -26
  360. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  361. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  362. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -18
  363. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  364. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +0 -2
  365. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +0 -13
  366. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +0 -1
  367. package/operations/entry/elasticsearch/sort.d.ts +0 -12
  368. package/operations/entry/elasticsearch/sort.js +0 -87
  369. package/operations/entry/elasticsearch/sort.js.map +0 -1
  370. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -16
  371. package/operations/entry/elasticsearch/transformValueForSearch.js +0 -32
  372. package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
  373. package/operations/entry/elasticsearch/types.d.ts +0 -41
  374. package/operations/entry/elasticsearch/types.js +0 -7
  375. package/operations/entry/elasticsearch/types.js.map +0 -1
  376. package/operations/entry/index.d.ts +0 -11
  377. package/operations/entry/index.js +0 -1881
  378. package/operations/entry/index.js.map +0 -1
  379. package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -10
  380. package/operations/entry/transformations/transformEntryToIndex.js +0 -31
  381. package/operations/entry/transformations/transformEntryToIndex.js.map +0 -1
  382. package/operations/group/index.d.ts +0 -8
  383. package/operations/group/index.js +0 -179
  384. package/operations/group/index.js.map +0 -1
  385. package/operations/model/index.d.ts +0 -8
  386. package/operations/model/index.js +0 -183
  387. package/operations/model/index.js.map +0 -1
  388. package/operations/system/index.d.ts +0 -6
  389. package/operations/system/index.js +0 -94
  390. package/operations/system/index.js.map +0 -1
  391. package/operations/system/indexes.d.ts +0 -10
  392. package/operations/system/indexes.js +0 -41
  393. package/operations/system/indexes.js.map +0 -1
  394. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
  395. package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -52
  396. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
  397. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
  398. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -21
  399. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  400. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  401. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -27
  402. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  403. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  404. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -13
  405. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  406. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -31
  407. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -40
  408. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  409. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
  410. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -21
  411. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  412. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
  413. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -21
  414. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  415. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
  416. package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -50
  417. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
  418. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  419. package/plugins/CmsEntryFilterPlugin.js +0 -22
  420. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  421. package/plugins/index.d.ts +0 -8
  422. package/plugins/index.js +0 -95
  423. package/plugins/index.js.map +0 -1
  424. package/tasks/createIndexTaskPlugin.d.ts +0 -2
  425. package/tasks/createIndexTaskPlugin.js +0 -67
  426. package/tasks/createIndexTaskPlugin.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.3bc8100a7f",
4
- "main": "index.js",
3
+ "version": "0.0.0-unstable.3fddf667ea",
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.3bc8100a7f",
30
- "@webiny/api-elasticsearch": "0.0.0-unstable.3bc8100a7f",
31
- "@webiny/api-elasticsearch-tasks": "0.0.0-unstable.3bc8100a7f",
32
- "@webiny/api-headless-cms": "0.0.0-unstable.3bc8100a7f",
33
- "@webiny/aws-sdk": "0.0.0-unstable.3bc8100a7f",
34
- "@webiny/db-dynamodb": "0.0.0-unstable.3bc8100a7f",
35
- "@webiny/error": "0.0.0-unstable.3bc8100a7f",
36
- "@webiny/handler-db": "0.0.0-unstable.3bc8100a7f",
37
- "@webiny/plugins": "0.0.0-unstable.3bc8100a7f",
38
- "@webiny/utils": "0.0.0-unstable.3bc8100a7f",
33
+ "@webiny/api": "0.0.0-unstable.3fddf667ea",
34
+ "@webiny/api-core": "0.0.0-unstable.3fddf667ea",
35
+ "@webiny/api-headless-cms": "0.0.0-unstable.3fddf667ea",
36
+ "@webiny/api-headless-cms-storage": "0.0.0-unstable.3fddf667ea",
37
+ "@webiny/api-headless-cms-utils-os": "0.0.0-unstable.3fddf667ea",
38
+ "@webiny/api-opensearch": "0.0.0-unstable.3fddf667ea",
39
+ "@webiny/api-opensearch-aws": "0.0.0-unstable.3fddf667ea",
40
+ "@webiny/api-search-index-tasks": "0.0.0-unstable.3fddf667ea",
41
+ "@webiny/db": "0.0.0-unstable.3fddf667ea",
42
+ "@webiny/db-dynamodb": "0.0.0-unstable.3fddf667ea",
43
+ "@webiny/error": "0.0.0-unstable.3fddf667ea",
44
+ "@webiny/feature": "0.0.0-unstable.3fddf667ea",
45
+ "@webiny/plugins": "0.0.0-unstable.3fddf667ea",
46
+ "@webiny/stdlib": "0.0.21",
47
+ "@webiny/utils": "0.0.0-unstable.3fddf667ea",
39
48
  "dataloader": "2.2.3",
40
- "lodash": "4.17.21"
49
+ "lodash": "4.18.1"
41
50
  },
42
51
  "devDependencies": {
43
- "@elastic/elasticsearch": "7.12.0",
44
52
  "@types/jsonpack": "1.1.6",
45
- "@webiny/api-dynamodb-to-elasticsearch": "0.0.0-unstable.3bc8100a7f",
46
- "@webiny/api-i18n": "0.0.0-unstable.3bc8100a7f",
47
- "@webiny/api-log": "0.0.0-unstable.3bc8100a7f",
48
- "@webiny/api-security": "0.0.0-unstable.3bc8100a7f",
49
- "@webiny/api-tenancy": "0.0.0-unstable.3bc8100a7f",
50
- "@webiny/api-wcp": "0.0.0-unstable.3bc8100a7f",
51
- "@webiny/handler": "0.0.0-unstable.3bc8100a7f",
52
- "@webiny/handler-aws": "0.0.0-unstable.3bc8100a7f",
53
- "@webiny/handler-graphql": "0.0.0-unstable.3bc8100a7f",
54
- "@webiny/project-utils": "0.0.0-unstable.3bc8100a7f",
55
- "@webiny/tasks": "0.0.0-unstable.3bc8100a7f",
56
- "jest": "29.7.0",
53
+ "@webiny/api-core-testing": "0.0.0-unstable.3fddf667ea",
54
+ "@webiny/api-graphql": "0.0.0-unstable.3fddf667ea",
55
+ "@webiny/api-search-index-tasks-ddb-os": "0.0.0-unstable.3fddf667ea",
56
+ "@webiny/api-sync-ddb-to-opensearch": "0.0.0-unstable.3fddf667ea",
57
+ "@webiny/background-tasks": "0.0.0-unstable.3fddf667ea",
58
+ "@webiny/build-tools": "0.0.0-unstable.3fddf667ea",
59
+ "@webiny/di": "2.0.0",
60
+ "@webiny/event-handler-core": "0.0.0-unstable.3fddf667ea",
61
+ "@webiny/handler": "0.0.0-unstable.3fddf667ea",
62
+ "@webiny/wcp": "0.0.0-unstable.3fddf667ea",
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": "5.0.5"
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": "3bc8100a7f1fb3a8d6a3454a2765f8ef377c279e"
71
+ "gitHead": "b8aec8a1be3f25c3b428b357fe1e352c7cbff9ae",
72
+ "webiny": {
73
+ "publishFrom": "dist"
74
+ }
71
75
  }
@@ -0,0 +1,27 @@
1
+ import { DbRegistry } from "@webiny/db/exports/api/db.js";
2
+ import { CmsDdbEsEntryEntity } from "../abstractions/CmsDdbEsEntryEntity.js";
3
+ import { CmsDdbEsEntriesEsEntity } from "../abstractions/CmsDdbEsEntriesEsEntity.js";
4
+ /**
5
+ * Adds the CMS entities to every request's DbRegistry.
6
+ *
7
+ * DbRegistry is container scoped: each request (child) container builds its own, empty registry. The
8
+ * DDB to OpenSearch sync looks up two CMS entities in it (the DynamoDB entries entity and the
9
+ * OpenSearch entries entity), so every one of those registries needs them.
10
+ *
11
+ * The CMS storage feature runs once, in the root, before any request exists, so it can't register into
12
+ * per-request registries directly. Instead it registers this decorator in the root. Decorators on a
13
+ * container-scoped registration apply to every instance as it is built, so this constructor runs once
14
+ * per request registry and adds the two entities. Every other call passes through to the registry.
15
+ */
16
+ declare class CmsEntitiesDbRegistryDecoratorImpl implements DbRegistry.Interface {
17
+ private readonly decoratee;
18
+ constructor(entryEntity: CmsDdbEsEntryEntity.Interface, entriesEsEntity: CmsDdbEsEntriesEsEntity.Interface, decoratee: DbRegistry.Interface);
19
+ register<T = unknown>(params: DbRegistry.RegisterParams<T>): void;
20
+ getOneItem<T = unknown>(cb: (item: DbRegistry.RegistryItem<T>) => boolean): DbRegistry.RegistryItem<T>;
21
+ getItem<T = unknown>(cb: (item: DbRegistry.RegistryItem<T>) => boolean): DbRegistry.RegistryItem<T> | null;
22
+ getItems<T = unknown>(cb: (item: DbRegistry.RegistryItem<T>) => boolean): DbRegistry.RegistryItem<T>[];
23
+ }
24
+ export declare const CmsEntitiesDbRegistryDecorator: typeof CmsEntitiesDbRegistryDecoratorImpl & {
25
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/db/features/DbRegistry/abstractions").IRegistry>;
26
+ };
27
+ export {};
@@ -0,0 +1,46 @@
1
+ import { DbRegistry } from "@webiny/db/exports/api/db.js";
2
+ import { CmsDdbEsEntryEntity } from "../abstractions/CmsDdbEsEntryEntity.js";
3
+ import { CmsDdbEsEntriesEsEntity } from "../abstractions/CmsDdbEsEntriesEsEntity.js";
4
+ class CmsEntitiesDbRegistryDecoratorImpl {
5
+ constructor(entryEntity, entriesEsEntity, decoratee){
6
+ this.decoratee = decoratee;
7
+ decoratee.register({
8
+ item: entryEntity,
9
+ app: "cms",
10
+ tags: [
11
+ "regular",
12
+ entryEntity.name
13
+ ]
14
+ });
15
+ decoratee.register({
16
+ item: entriesEsEntity,
17
+ app: "cms",
18
+ tags: [
19
+ "es",
20
+ entriesEsEntity.name
21
+ ]
22
+ });
23
+ }
24
+ register(params) {
25
+ this.decoratee.register(params);
26
+ }
27
+ getOneItem(cb) {
28
+ return this.decoratee.getOneItem(cb);
29
+ }
30
+ getItem(cb) {
31
+ return this.decoratee.getItem(cb);
32
+ }
33
+ getItems(cb) {
34
+ return this.decoratee.getItems(cb);
35
+ }
36
+ }
37
+ const CmsEntitiesDbRegistryDecorator = DbRegistry.createDecorator({
38
+ decorator: CmsEntitiesDbRegistryDecoratorImpl,
39
+ dependencies: [
40
+ CmsDdbEsEntryEntity,
41
+ CmsDdbEsEntriesEsEntity
42
+ ]
43
+ });
44
+ export { CmsEntitiesDbRegistryDecorator };
45
+
46
+ //# sourceMappingURL=CmsEntitiesDbRegistryDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry/CmsEntitiesDbRegistryDecorator.js","sources":["../../src/registry/CmsEntitiesDbRegistryDecorator.ts"],"sourcesContent":["import { DbRegistry } from \"@webiny/db/exports/api/db.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\n\n/**\n * Adds the CMS entities to every request's DbRegistry.\n *\n * DbRegistry is container scoped: each request (child) container builds its own, empty registry. The\n * DDB to OpenSearch sync looks up two CMS entities in it (the DynamoDB entries entity and the\n * OpenSearch entries entity), so every one of those registries needs them.\n *\n * The CMS storage feature runs once, in the root, before any request exists, so it can't register into\n * per-request registries directly. Instead it registers this decorator in the root. Decorators on a\n * container-scoped registration apply to every instance as it is built, so this constructor runs once\n * per request registry and adds the two entities. Every other call passes through to the registry.\n */\nclass CmsEntitiesDbRegistryDecoratorImpl implements DbRegistry.Interface {\n public constructor(\n entryEntity: CmsDdbEsEntryEntity.Interface,\n entriesEsEntity: CmsDdbEsEntriesEsEntity.Interface,\n private readonly decoratee: DbRegistry.Interface\n ) {\n decoratee.register({\n item: entryEntity,\n app: \"cms\",\n tags: [\"regular\", entryEntity.name]\n });\n decoratee.register({\n item: entriesEsEntity,\n app: \"cms\",\n tags: [\"es\", entriesEsEntity.name]\n });\n }\n\n public register<T = unknown>(params: DbRegistry.RegisterParams<T>): void {\n this.decoratee.register(params);\n }\n\n public getOneItem<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T> {\n return this.decoratee.getOneItem(cb);\n }\n\n public getItem<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T> | null {\n return this.decoratee.getItem(cb);\n }\n\n public getItems<T = unknown>(\n cb: (item: DbRegistry.RegistryItem<T>) => boolean\n ): DbRegistry.RegistryItem<T>[] {\n return this.decoratee.getItems(cb);\n }\n}\n\nexport const CmsEntitiesDbRegistryDecorator = DbRegistry.createDecorator({\n decorator: CmsEntitiesDbRegistryDecoratorImpl,\n dependencies: [CmsDdbEsEntryEntity, CmsDdbEsEntriesEsEntity]\n});\n"],"names":["CmsEntitiesDbRegistryDecoratorImpl","entryEntity","entriesEsEntity","decoratee","params","cb","CmsEntitiesDbRegistryDecorator","DbRegistry","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity"],"mappings":";;;AAgBA,MAAMA;IACF,YACIC,WAA0C,EAC1CC,eAAkD,EACjCC,SAA+B,CAClD;aADmBA,SAAS,GAATA;QAEjBA,UAAU,QAAQ,CAAC;YACf,MAAMF;YACN,KAAK;YACL,MAAM;gBAAC;gBAAWA,YAAY,IAAI;aAAC;QACvC;QACAE,UAAU,QAAQ,CAAC;YACf,MAAMD;YACN,KAAK;YACL,MAAM;gBAAC;gBAAMA,gBAAgB,IAAI;aAAC;QACtC;IACJ;IAEO,SAAsBE,MAAoC,EAAQ;QACrE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAACA;IAC5B;IAEO,WACHC,EAAiD,EACvB;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAACA;IACrC;IAEO,QACHA,EAAiD,EAChB;QACjC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA;IAClC;IAEO,SACHA,EAAiD,EACrB;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAACA;IACnC;AACJ;AAEO,MAAMC,iCAAiCC,WAAW,eAAe,CAAC;IACrE,WAAWP;IACX,cAAc;QAACQ;QAAqBC;KAAwB;AAChE"}
@@ -0,0 +1,15 @@
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
+ import { Logger } from "@webiny/api-core/features/logger/index.js";
5
+ declare class CreateElasticsearchIndexTaskImpl implements TenantIndexFactory.Interface {
6
+ private readonly indexProvider;
7
+ private listModels;
8
+ private readonly logger;
9
+ constructor(indexProvider: CmsModelOpenSearchIndexProvider.Interface, listModels: ListModelsUseCase.Interface, logger: Logger.Interface);
10
+ getIndexList(tenant: TenantIndexFactory.Tenant): Promise<TenantIndexFactory.IndexConfig[]>;
11
+ }
12
+ export declare const CreateElasticsearchIndexTask: typeof CreateElasticsearchIndexTaskImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-search-index-tasks/abstractions/TenantIndexFactory").ITenantIndexFactory>;
14
+ };
15
+ export {};
@@ -0,0 +1,49 @@
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
+ import { Logger } from "@webiny/api-core/features/logger/index.js";
6
+ class CreateElasticsearchIndexTaskImpl {
7
+ constructor(indexProvider, listModels, logger){
8
+ this.indexProvider = indexProvider;
9
+ this.listModels = listModels;
10
+ this.logger = logger;
11
+ }
12
+ async getIndexList(tenant) {
13
+ const result = await this.listModels.execute();
14
+ if (result.isFail()) {
15
+ this.logger.error({
16
+ error: result.error
17
+ }, "Failed to list models for index creation.");
18
+ return [];
19
+ }
20
+ const models = result.value;
21
+ if (0 === models.length) return [];
22
+ const configurations = createConfigurations(this.indexProvider);
23
+ const indices = [];
24
+ for (const model of models){
25
+ const { index, settings } = await configurations.es({
26
+ model: {
27
+ ...model,
28
+ tenant: tenant.id
29
+ }
30
+ });
31
+ indices.push({
32
+ index,
33
+ settings
34
+ });
35
+ }
36
+ return indices;
37
+ }
38
+ }
39
+ const CreateElasticsearchIndexTask = TenantIndexFactory.createImplementation({
40
+ implementation: CreateElasticsearchIndexTaskImpl,
41
+ dependencies: [
42
+ CmsModelOpenSearchIndexProvider,
43
+ ListModelsUseCase,
44
+ Logger
45
+ ]
46
+ });
47
+ export { CreateElasticsearchIndexTask };
48
+
49
+ //# 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\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\n\nclass CreateElasticsearchIndexTaskImpl implements TenantIndexFactory.Interface {\n constructor(\n private readonly indexProvider: CmsModelOpenSearchIndexProvider.Interface,\n private listModels: ListModelsUseCase.Interface,\n private readonly logger: Logger.Interface\n ) {}\n\n async getIndexList(\n tenant: TenantIndexFactory.Tenant\n ): Promise<TenantIndexFactory.IndexConfig[]> {\n const result = await this.listModels.execute();\n if (result.isFail()) {\n this.logger.error({ error: result.error }, \"Failed to list models for index creation.\");\n return [];\n }\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, Logger]\n});\n"],"names":["CreateElasticsearchIndexTaskImpl","indexProvider","listModels","logger","tenant","result","models","configurations","createConfigurations","indices","model","index","settings","CreateElasticsearchIndexTask","TenantIndexFactory","CmsModelOpenSearchIndexProvider","ListModelsUseCase","Logger"],"mappings":";;;;;AAMA,MAAMA;IACF,YACqBC,aAAwD,EACjEC,UAAuC,EAC9BC,MAAwB,CAC3C;aAHmBF,aAAa,GAAbA;aACTC,UAAU,GAAVA;aACSC,MAAM,GAANA;IAClB;IAEH,MAAM,aACFC,MAAiC,EACQ;QACzC,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;QAC5C,IAAIA,OAAO,MAAM,IAAI;YACjB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,OAAOA,OAAO,KAAK;YAAC,GAAG;YAC3C,OAAO,EAAE;QACb;QACA,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,gBAAgBd;IAChB,cAAc;QAACe;QAAiCC;QAAmBC;KAAO;AAC9E"}
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>;