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

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 (385) hide show
  1. package/abstractions/CmsDdbEsDataLoaders.d.ts +5 -0
  2. package/abstractions/CmsDdbEsDataLoaders.js +5 -0
  3. package/abstractions/CmsDdbEsDataLoaders.js.map +1 -0
  4. package/abstractions/CmsDdbEsEntriesEsEntity.d.ts +5 -0
  5. package/abstractions/CmsDdbEsEntriesEsEntity.js +5 -0
  6. package/abstractions/CmsDdbEsEntriesEsEntity.js.map +1 -0
  7. package/abstractions/CmsDdbEsEntryEntity.d.ts +5 -0
  8. package/abstractions/CmsDdbEsEntryEntity.js +5 -0
  9. package/abstractions/CmsDdbEsEntryEntity.js.map +1 -0
  10. package/abstractions/CmsDdbEsGroupEntity.d.ts +5 -0
  11. package/abstractions/CmsDdbEsGroupEntity.js +5 -0
  12. package/abstractions/CmsDdbEsGroupEntity.js.map +1 -0
  13. package/abstractions/CmsDdbEsModelEntity.d.ts +5 -0
  14. package/abstractions/CmsDdbEsModelEntity.js +5 -0
  15. package/abstractions/CmsDdbEsModelEntity.js.map +1 -0
  16. package/abstractions/CmsDdbEsOsTable.d.ts +5 -0
  17. package/abstractions/CmsDdbEsOsTable.js +5 -0
  18. package/abstractions/CmsDdbEsOsTable.js.map +1 -0
  19. package/abstractions/CmsDdbEsTable.d.ts +5 -0
  20. package/abstractions/CmsDdbEsTable.js +5 -0
  21. package/abstractions/CmsDdbEsTable.js.map +1 -0
  22. package/debuggerNamespaces.d.ts +12 -0
  23. package/feature.d.ts +10 -1
  24. package/feature.js +51 -161
  25. package/feature.js.map +1 -1
  26. package/index.d.ts +1 -1
  27. package/index.js +1 -1
  28. package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
  29. package/operations/entry/DdbEsCreateEntry.js +134 -0
  30. package/operations/entry/DdbEsCreateEntry.js.map +1 -0
  31. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
  32. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -0
  33. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
  34. package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
  35. package/operations/entry/DdbEsDeleteEntry.js +79 -0
  36. package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
  37. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +24 -0
  38. package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
  39. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
  40. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
  41. package/operations/entry/DdbEsDeleteMultipleEntries.js +80 -0
  42. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
  43. package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
  44. package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
  45. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
  46. package/operations/entry/DdbEsGetEntry.d.ts +14 -0
  47. package/operations/entry/DdbEsGetEntry.js +27 -0
  48. package/operations/entry/DdbEsGetEntry.js.map +1 -0
  49. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
  50. package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
  51. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
  52. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
  53. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
  54. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
  55. package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
  56. package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
  57. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
  58. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
  59. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
  60. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
  61. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
  62. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
  63. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
  64. package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
  65. package/operations/entry/DdbEsGetRevisionById.js +34 -0
  66. package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
  67. package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
  68. package/operations/entry/DdbEsGetRevisions.js +33 -0
  69. package/operations/entry/DdbEsGetRevisions.js.map +1 -0
  70. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +18 -0
  71. package/operations/entry/DdbEsGetUniqueFieldValues.js +77 -0
  72. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
  73. package/operations/entry/DdbEsListEntries.d.ts +28 -0
  74. package/operations/entry/DdbEsListEntries.js +110 -0
  75. package/operations/entry/DdbEsListEntries.js.map +1 -0
  76. package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
  77. package/operations/entry/DdbEsMoveEntry.js +113 -0
  78. package/operations/entry/DdbEsMoveEntry.js.map +1 -0
  79. package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
  80. package/operations/entry/DdbEsMoveToBin.js +137 -0
  81. package/operations/entry/DdbEsMoveToBin.js.map +1 -0
  82. package/operations/entry/DdbEsPublishEntry.d.ts +24 -0
  83. package/operations/entry/DdbEsPublishEntry.js +231 -0
  84. package/operations/entry/DdbEsPublishEntry.js.map +1 -0
  85. package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
  86. package/operations/entry/DdbEsRestoreFromBin.js +137 -0
  87. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
  88. package/operations/entry/DdbEsUnpublishEntry.d.ts +24 -0
  89. package/operations/entry/DdbEsUnpublishEntry.js +127 -0
  90. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
  91. package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
  92. package/operations/entry/DdbEsUpdateEntry.js +175 -0
  93. package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
  94. package/operations/entry/dataLoaders.d.ts +5 -5
  95. package/operations/entry/dataLoaders.js +12 -4
  96. package/operations/entry/dataLoaders.js.map +1 -1
  97. package/{features/CmsEntryOpenSearchIndex → operations/entry}/feature.d.ts +1 -1
  98. package/operations/entry/feature.js +55 -0
  99. package/operations/entry/feature.js.map +1 -0
  100. package/operations/entry/storageEntryUtils.d.ts +7 -0
  101. package/operations/entry/storageEntryUtils.js +14 -0
  102. package/operations/entry/storageEntryUtils.js.map +1 -0
  103. package/operations/entry/transformations/index.d.ts +2 -3
  104. package/operations/entry/transformations/index.js +1 -1
  105. package/operations/entry/transformations/index.js.map +1 -1
  106. package/operations/entry/transformations/modifyEntryValues.d.ts +2 -2
  107. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  108. package/operations/group/DdbEsCreateGroup.d.ts +12 -0
  109. package/operations/group/DdbEsCreateGroup.js +35 -0
  110. package/operations/group/DdbEsCreateGroup.js.map +1 -0
  111. package/operations/group/DdbEsDeleteGroup.d.ts +12 -0
  112. package/operations/group/DdbEsDeleteGroup.js +31 -0
  113. package/operations/group/DdbEsDeleteGroup.js.map +1 -0
  114. package/operations/group/DdbEsGetGroup.d.ts +12 -0
  115. package/operations/group/DdbEsGetGroup.js +31 -0
  116. package/operations/group/DdbEsGetGroup.js.map +1 -0
  117. package/operations/group/DdbEsListGroups.d.ts +14 -0
  118. package/operations/group/DdbEsListGroups.js +52 -0
  119. package/operations/group/DdbEsListGroups.js.map +1 -0
  120. package/operations/group/DdbEsUpdateGroup.d.ts +12 -0
  121. package/operations/group/DdbEsUpdateGroup.js +35 -0
  122. package/operations/group/DdbEsUpdateGroup.js.map +1 -0
  123. package/{features/CmsEntryOpenSearchFilter → operations/group}/feature.d.ts +1 -1
  124. package/operations/group/feature.js +19 -0
  125. package/operations/group/feature.js.map +1 -0
  126. package/operations/group/keys.d.ts +15 -0
  127. package/operations/group/keys.js +17 -0
  128. package/operations/group/keys.js.map +1 -0
  129. package/operations/model/DdbEsCreateModel.d.ts +16 -0
  130. package/operations/model/DdbEsCreateModel.js +56 -0
  131. package/operations/model/DdbEsCreateModel.js.map +1 -0
  132. package/operations/model/DdbEsDeleteModel.d.ts +12 -0
  133. package/operations/model/DdbEsDeleteModel.js +31 -0
  134. package/operations/model/DdbEsDeleteModel.js.map +1 -0
  135. package/operations/model/DdbEsGetModel.d.ts +12 -0
  136. package/operations/model/DdbEsGetModel.js +30 -0
  137. package/operations/model/DdbEsGetModel.js.map +1 -0
  138. package/operations/model/DdbEsListModels.d.ts +12 -0
  139. package/operations/model/DdbEsListModels.js +36 -0
  140. package/operations/model/DdbEsListModels.js.map +1 -0
  141. package/operations/model/DdbEsUpdateModel.d.ts +12 -0
  142. package/operations/model/DdbEsUpdateModel.js +36 -0
  143. package/operations/model/DdbEsUpdateModel.js.map +1 -0
  144. package/{features/CmsEntryOpenSearchFieldIndex → operations/model}/feature.d.ts +1 -1
  145. package/operations/model/feature.js +19 -0
  146. package/operations/model/feature.js.map +1 -0
  147. package/operations/model/keys.d.ts +15 -0
  148. package/operations/model/keys.js +17 -0
  149. package/operations/model/keys.js.map +1 -0
  150. package/package.json +28 -24
  151. package/registry/CmsEntitiesDbRegistryDecorator.d.ts +27 -0
  152. package/registry/CmsEntitiesDbRegistryDecorator.js +46 -0
  153. package/registry/CmsEntitiesDbRegistryDecorator.js.map +1 -0
  154. package/tasks/CreateElasticsearchIndexTask.d.ts +15 -0
  155. package/tasks/CreateElasticsearchIndexTask.js +49 -0
  156. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  157. package/types.d.ts +11 -50
  158. package/types.js.map +1 -1
  159. package/configurations.d.ts +0 -19
  160. package/configurations.js +0 -31
  161. package/configurations.js.map +0 -1
  162. package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
  163. package/elasticsearch/createElasticsearchIndex.js +0 -57
  164. package/elasticsearch/createElasticsearchIndex.js.map +0 -1
  165. package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
  166. package/elasticsearch/deleteElasticsearchIndex.js +0 -23
  167. package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
  168. package/exports/api/cms/opensearch.d.ts +0 -9
  169. package/exports/api/cms/opensearch.js +0 -9
  170. package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +0 -16
  171. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +0 -5
  172. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +0 -1
  173. package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +0 -1
  174. package/features/CmsEntryOpenSearchBodyModifier/index.js +0 -1
  175. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +0 -14
  176. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +0 -42
  177. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +0 -1
  178. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +0 -32
  179. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +0 -5
  180. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +0 -1
  181. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +0 -11
  182. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +0 -5
  183. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +0 -1
  184. package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +0 -1
  185. package/features/CmsEntryOpenSearchFieldIndex/constants.js +0 -4
  186. package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +0 -1
  187. package/features/CmsEntryOpenSearchFieldIndex/feature.js +0 -29
  188. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +0 -1
  189. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +0 -11
  190. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +0 -60
  191. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +0 -1
  192. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +0 -13
  193. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +0 -33
  194. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +0 -1
  195. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +0 -10
  196. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +0 -21
  197. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +0 -1
  198. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +0 -10
  199. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +0 -22
  200. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +0 -1
  201. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +0 -11
  202. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +0 -32
  203. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +0 -1
  204. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +0 -12
  205. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +0 -107
  206. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +0 -1
  207. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +0 -10
  208. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +0 -21
  209. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +0 -1
  210. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.d.ts +0 -15
  211. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js +0 -40
  212. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js.map +0 -1
  213. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.d.ts +0 -15
  214. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js +0 -40
  215. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js.map +0 -1
  216. package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +0 -3
  217. package/features/CmsEntryOpenSearchFieldIndex/index.js +0 -3
  218. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +0 -11
  219. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +0 -36
  220. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +0 -1
  221. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +0 -37
  222. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +0 -5
  223. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +0 -1
  224. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +0 -9
  225. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +0 -5
  226. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +0 -1
  227. package/features/CmsEntryOpenSearchFilter/constants.d.ts +0 -1
  228. package/features/CmsEntryOpenSearchFilter/constants.js +0 -4
  229. package/features/CmsEntryOpenSearchFilter/constants.js.map +0 -1
  230. package/features/CmsEntryOpenSearchFilter/feature.js +0 -17
  231. package/features/CmsEntryOpenSearchFilter/feature.js.map +0 -1
  232. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +0 -9
  233. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +0 -26
  234. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +0 -1
  235. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +0 -9
  236. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +0 -43
  237. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +0 -1
  238. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +0 -9
  239. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +0 -36
  240. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +0 -1
  241. package/features/CmsEntryOpenSearchFilter/index.d.ts +0 -3
  242. package/features/CmsEntryOpenSearchFilter/index.js +0 -3
  243. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +0 -20
  244. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +0 -5
  245. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +0 -1
  246. package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +0 -1
  247. package/features/CmsEntryOpenSearchFullTextSearch/index.js +0 -1
  248. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +0 -11
  249. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +0 -17
  250. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +0 -1
  251. package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +0 -14
  252. package/features/CmsEntryOpenSearchIndex/abstractions.js +0 -5
  253. package/features/CmsEntryOpenSearchIndex/abstractions.js.map +0 -1
  254. package/features/CmsEntryOpenSearchIndex/feature.js +0 -11
  255. package/features/CmsEntryOpenSearchIndex/feature.js.map +0 -1
  256. package/features/CmsEntryOpenSearchIndex/index.d.ts +0 -3
  257. package/features/CmsEntryOpenSearchIndex/index.js +0 -3
  258. package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +0 -16
  259. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +0 -5
  260. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +0 -1
  261. package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +0 -1
  262. package/features/CmsEntryOpenSearchQueryModifier/index.js +0 -1
  263. package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +0 -15
  264. package/features/CmsEntryOpenSearchSortModifier/abstractions.js +0 -5
  265. package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +0 -1
  266. package/features/CmsEntryOpenSearchSortModifier/index.d.ts +0 -1
  267. package/features/CmsEntryOpenSearchSortModifier/index.js +0 -1
  268. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +0 -12
  269. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +0 -31
  270. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +0 -1
  271. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +0 -22
  272. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +0 -5
  273. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +0 -1
  274. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +0 -10
  275. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +0 -5
  276. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +0 -1
  277. package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +0 -4
  278. package/features/CmsEntryOpenSearchValueSearch/feature.js +0 -17
  279. package/features/CmsEntryOpenSearchValueSearch/feature.js.map +0 -1
  280. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +0 -10
  281. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +0 -21
  282. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +0 -1
  283. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +0 -10
  284. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +0 -44
  285. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +0 -1
  286. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +0 -10
  287. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +0 -22
  288. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +0 -1
  289. package/features/CmsEntryOpenSearchValueSearch/index.d.ts +0 -3
  290. package/features/CmsEntryOpenSearchValueSearch/index.js +0 -3
  291. package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +0 -23
  292. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +0 -5
  293. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +0 -1
  294. package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +0 -1
  295. package/features/CmsEntryOpenSearchValuesModifier/index.js +0 -1
  296. package/helpers/entryIndexHelpers.d.ts +0 -20
  297. package/helpers/entryIndexHelpers.js +0 -80
  298. package/helpers/entryIndexHelpers.js.map +0 -1
  299. package/helpers/fieldIdentifier.d.ts +0 -6
  300. package/helpers/fieldIdentifier.js +0 -23
  301. package/helpers/fieldIdentifier.js.map +0 -1
  302. package/helpers/index.d.ts +0 -2
  303. package/helpers/index.js +0 -2
  304. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
  305. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -9
  306. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
  307. package/operations/entry/elasticsearch/body.d.ts +0 -29
  308. package/operations/entry/elasticsearch/body.js +0 -87
  309. package/operations/entry/elasticsearch/body.js.map +0 -1
  310. package/operations/entry/elasticsearch/fields/createSystemField.d.ts +0 -4
  311. package/operations/entry/elasticsearch/fields/createSystemField.js +0 -9
  312. package/operations/entry/elasticsearch/fields/createSystemField.js.map +0 -1
  313. package/operations/entry/elasticsearch/fields/live.d.ts +0 -2
  314. package/operations/entry/elasticsearch/fields/live.js +0 -50
  315. package/operations/entry/elasticsearch/fields/live.js.map +0 -1
  316. package/operations/entry/elasticsearch/fields/location.d.ts +0 -2
  317. package/operations/entry/elasticsearch/fields/location.js +0 -50
  318. package/operations/entry/elasticsearch/fields/location.js.map +0 -1
  319. package/operations/entry/elasticsearch/fields/state.d.ts +0 -2
  320. package/operations/entry/elasticsearch/fields/state.js +0 -104
  321. package/operations/entry/elasticsearch/fields/state.js.map +0 -1
  322. package/operations/entry/elasticsearch/fields.d.ts +0 -12
  323. package/operations/entry/elasticsearch/fields.js +0 -207
  324. package/operations/entry/elasticsearch/fields.js.map +0 -1
  325. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -9
  326. package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -39
  327. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
  328. package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -22
  329. package/operations/entry/elasticsearch/filtering/exec.js +0 -96
  330. package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
  331. package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
  332. package/operations/entry/elasticsearch/filtering/index.js +0 -1
  333. package/operations/entry/elasticsearch/filtering/path.d.ts +0 -17
  334. package/operations/entry/elasticsearch/filtering/path.js +0 -27
  335. package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
  336. package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
  337. package/operations/entry/elasticsearch/filtering/populated.js +0 -12
  338. package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
  339. package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
  340. package/operations/entry/elasticsearch/filtering/values.js +0 -15
  341. package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
  342. package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -13
  343. package/operations/entry/elasticsearch/fullTextSearch.js +0 -51
  344. package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
  345. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
  346. package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -10
  347. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
  348. package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
  349. package/operations/entry/elasticsearch/initialQuery.js +0 -45
  350. package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
  351. package/operations/entry/elasticsearch/keyword.d.ts +0 -2
  352. package/operations/entry/elasticsearch/keyword.js +0 -17
  353. package/operations/entry/elasticsearch/keyword.js.map +0 -1
  354. package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -7
  355. package/operations/entry/elasticsearch/plugins/operator.js +0 -13
  356. package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
  357. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +0 -2
  358. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +0 -8
  359. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +0 -1
  360. package/operations/entry/elasticsearch/sort.d.ts +0 -12
  361. package/operations/entry/elasticsearch/sort.js +0 -80
  362. package/operations/entry/elasticsearch/sort.js.map +0 -1
  363. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -9
  364. package/operations/entry/elasticsearch/transformValueForSearch.js +0 -12
  365. package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
  366. package/operations/entry/elasticsearch/types.d.ts +0 -34
  367. package/operations/entry/index.d.ts +0 -32
  368. package/operations/entry/index.js +0 -1365
  369. package/operations/entry/index.js.map +0 -1
  370. package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -10
  371. package/operations/entry/transformations/transformEntryToIndex.js +0 -20
  372. package/operations/entry/transformations/transformEntryToIndex.js.map +0 -1
  373. package/operations/group/index.d.ts +0 -9
  374. package/operations/group/index.js +0 -121
  375. package/operations/group/index.js.map +0 -1
  376. package/operations/model/index.d.ts +0 -8
  377. package/operations/model/index.js +0 -135
  378. package/operations/model/index.js.map +0 -1
  379. package/tasks/createIndexTaskPlugin.d.ts +0 -2
  380. package/tasks/createIndexTaskPlugin.js +0 -45
  381. package/tasks/createIndexTaskPlugin.js.map +0 -1
  382. package/values/NoValueContainer.d.ts +0 -5
  383. package/values/NoValueContainer.js +0 -11
  384. package/values/NoValueContainer.js.map +0 -1
  385. /package/{operations/entry/elasticsearch/types.js → debuggerNamespaces.js} +0 -0
@@ -1,4 +1,4 @@
1
- export declare const CmsEntryOpenSearchFieldIndexFeature: {
1
+ export declare const DdbEsModelStorageOpsFeature: {
2
2
  name: string;
3
3
  register(container: import("@webiny/di").Container): void;
4
4
  };
@@ -0,0 +1,19 @@
1
+ import { createFeature } from "@webiny/feature/api/index.js";
2
+ import { DdbEsGetModel } from "./DdbEsGetModel.js";
3
+ import { DdbEsListModels } from "./DdbEsListModels.js";
4
+ import { DdbEsCreateModel } from "./DdbEsCreateModel.js";
5
+ import { DdbEsUpdateModel } from "./DdbEsUpdateModel.js";
6
+ import { DdbEsDeleteModel } from "./DdbEsDeleteModel.js";
7
+ const DdbEsModelStorageOpsFeature = createFeature({
8
+ name: "cms.ddbEs.modelStorageOps",
9
+ register: (container)=>{
10
+ container.register(DdbEsGetModel);
11
+ container.register(DdbEsListModels);
12
+ container.register(DdbEsCreateModel);
13
+ container.register(DdbEsUpdateModel);
14
+ container.register(DdbEsDeleteModel);
15
+ }
16
+ });
17
+ export { DdbEsModelStorageOpsFeature };
18
+
19
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/model/feature.js","sources":["../../../src/operations/model/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { DdbEsGetModel } from \"./DdbEsGetModel.js\";\nimport { DdbEsListModels } from \"./DdbEsListModels.js\";\nimport { DdbEsCreateModel } from \"./DdbEsCreateModel.js\";\nimport { DdbEsUpdateModel } from \"./DdbEsUpdateModel.js\";\nimport { DdbEsDeleteModel } from \"./DdbEsDeleteModel.js\";\n\nexport const DdbEsModelStorageOpsFeature = createFeature({\n name: \"cms.ddbEs.modelStorageOps\",\n register: container => {\n container.register(DdbEsGetModel);\n container.register(DdbEsListModels);\n container.register(DdbEsCreateModel);\n container.register(DdbEsUpdateModel);\n container.register(DdbEsDeleteModel);\n }\n});\n"],"names":["DdbEsModelStorageOpsFeature","createFeature","container","DdbEsGetModel","DdbEsListModels","DdbEsCreateModel","DdbEsUpdateModel","DdbEsDeleteModel"],"mappings":";;;;;;AAOO,MAAMA,8BAA8BC,cAAc;IACrD,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;IACvB;AACJ"}
@@ -0,0 +1,15 @@
1
+ interface PartitionKeysParams {
2
+ tenant: string;
3
+ }
4
+ export declare const createPartitionKey: (params: PartitionKeysParams) => string;
5
+ interface SortKeyParams {
6
+ modelId: string;
7
+ }
8
+ interface Keys {
9
+ PK: string;
10
+ SK: string;
11
+ GSI_TENANT: string;
12
+ }
13
+ export declare const createKeys: (params: PartitionKeysParams & SortKeyParams) => Keys;
14
+ export declare const createType: () => string;
15
+ export {};
@@ -0,0 +1,17 @@
1
+ const createPartitionKey = (params)=>{
2
+ const { tenant } = params;
3
+ return `T#${tenant}#CMS#CM`;
4
+ };
5
+ const createSortKey = (params)=>params.modelId;
6
+ const createKeys = (params)=>{
7
+ if (!params.tenant) throw new Error("Missing tenant when creating model keys!");
8
+ return {
9
+ PK: createPartitionKey(params),
10
+ SK: createSortKey(params),
11
+ GSI_TENANT: params.tenant
12
+ };
13
+ };
14
+ const createType = ()=>"cms.model";
15
+ export { createKeys, createPartitionKey, createType };
16
+
17
+ //# sourceMappingURL=keys.js.map
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb-es",
3
- "version": "0.0.0-unstable.7be00a75a9",
3
+ "version": "0.0.0-unstable.7c2def32a7",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -30,36 +30,40 @@
30
30
  ],
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "@webiny/api": "0.0.0-unstable.7be00a75a9",
34
- "@webiny/api-elasticsearch-tasks": "0.0.0-unstable.7be00a75a9",
35
- "@webiny/api-headless-cms": "0.0.0-unstable.7be00a75a9",
36
- "@webiny/api-opensearch": "0.0.0-unstable.7be00a75a9",
37
- "@webiny/aws-sdk": "0.0.0-unstable.7be00a75a9",
38
- "@webiny/db-dynamodb": "0.0.0-unstable.7be00a75a9",
39
- "@webiny/error": "0.0.0-unstable.7be00a75a9",
40
- "@webiny/feature": "0.0.0-unstable.7be00a75a9",
41
- "@webiny/handler-db": "0.0.0-unstable.7be00a75a9",
42
- "@webiny/plugins": "0.0.0-unstable.7be00a75a9",
43
- "@webiny/utils": "0.0.0-unstable.7be00a75a9",
33
+ "@webiny/api": "0.0.0-unstable.7c2def32a7",
34
+ "@webiny/api-core": "0.0.0-unstable.7c2def32a7",
35
+ "@webiny/api-headless-cms": "0.0.0-unstable.7c2def32a7",
36
+ "@webiny/api-headless-cms-storage": "0.0.0-unstable.7c2def32a7",
37
+ "@webiny/api-headless-cms-utils-os": "0.0.0-unstable.7c2def32a7",
38
+ "@webiny/api-opensearch": "0.0.0-unstable.7c2def32a7",
39
+ "@webiny/api-opensearch-aws": "0.0.0-unstable.7c2def32a7",
40
+ "@webiny/api-search-index-tasks": "0.0.0-unstable.7c2def32a7",
41
+ "@webiny/db": "0.0.0-unstable.7c2def32a7",
42
+ "@webiny/db-dynamodb": "0.0.0-unstable.7c2def32a7",
43
+ "@webiny/error": "0.0.0-unstable.7c2def32a7",
44
+ "@webiny/feature": "0.0.0-unstable.7c2def32a7",
45
+ "@webiny/plugins": "0.0.0-unstable.7c2def32a7",
46
+ "@webiny/stdlib": "0.0.21",
47
+ "@webiny/utils": "0.0.0-unstable.7c2def32a7",
44
48
  "dataloader": "2.2.3",
45
49
  "lodash": "4.18.1"
46
50
  },
47
51
  "devDependencies": {
48
52
  "@types/jsonpack": "1.1.6",
49
- "@webiny/api-core": "0.0.0-unstable.7be00a75a9",
50
- "@webiny/api-dynamodb-to-elasticsearch": "0.0.0-unstable.7be00a75a9",
51
- "@webiny/build-tools": "0.0.0-unstable.7be00a75a9",
52
- "@webiny/di": "0.0.0-unstable.7be00a75a9",
53
- "@webiny/handler": "0.0.0-unstable.7be00a75a9",
54
- "@webiny/handler-aws": "0.0.0-unstable.7be00a75a9",
55
- "@webiny/handler-graphql": "0.0.0-unstable.7be00a75a9",
56
- "@webiny/project-utils": "0.0.0-unstable.7be00a75a9",
57
- "@webiny/tasks": "0.0.0-unstable.7be00a75a9",
58
- "@webiny/wcp": "0.0.0-unstable.7be00a75a9",
53
+ "@webiny/api-core-testing": "0.0.0-unstable.7c2def32a7",
54
+ "@webiny/api-graphql": "0.0.0-unstable.7c2def32a7",
55
+ "@webiny/api-search-index-tasks-ddb-os": "0.0.0-unstable.7c2def32a7",
56
+ "@webiny/api-sync-ddb-to-opensearch": "0.0.0-unstable.7c2def32a7",
57
+ "@webiny/background-tasks": "0.0.0-unstable.7c2def32a7",
58
+ "@webiny/build-tools": "0.0.0-unstable.7c2def32a7",
59
+ "@webiny/di": "2.0.0",
60
+ "@webiny/event-handler-core": "0.0.0-unstable.7c2def32a7",
61
+ "@webiny/handler": "0.0.0-unstable.7c2def32a7",
62
+ "@webiny/wcp": "0.0.0-unstable.7c2def32a7",
59
63
  "jest-dynalite": "3.6.1",
60
64
  "rimraf": "6.1.3",
61
- "typescript": "6.0.3",
62
- "vitest": "4.1.7"
65
+ "typescript": "7.0.2",
66
+ "vitest": "4.1.11"
63
67
  },
64
68
  "publishConfig": {
65
69
  "access": "public"
@@ -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,61 +1,22 @@
1
- import type { CmsContext as BaseCmsContext, CmsEntry, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsEntryValues, CmsModel, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types/index.js";
2
- import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
3
- import type { Client, IOpenSearchEntity as IElasticsearchEntity, OpenSearchContext } from "@webiny/api-opensearch";
4
- import type { PluginsContainer } from "@webiny/plugins";
5
- import type { IEntryEntity, IGroupEntity, IModelEntity } from "./definitions/types.js";
6
- import type { ITable } from "@webiny/db-dynamodb";
7
- export interface CmsContext extends BaseCmsContext, OpenSearchContext {
8
- }
9
- /**
10
- * A definition of the entry that is being prepared for the Elasticsearch.
11
- *
12
- * @category Elasticsearch
13
- * @category CmsEntry
14
- */
15
- export interface CmsIndexEntry<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {
16
- /**
17
- * Values that are not going to be indexed.
18
- */
19
- rawValues: Partial<T>;
20
- /**
21
- * Dev can add whatever keys they want and need. Just need to be careful not to break the entry.
22
- */
23
- [key: string]: any;
24
- }
1
+ import type { CmsContext, CmsEntryValues, CmsModel, CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
2
+ export { CmsContext };
25
3
  export declare enum ENTITIES {
26
4
  GROUPS = "CmsGroups",
27
5
  MODELS = "CmsModels",
28
6
  ENTRIES = "CmsEntries",
29
7
  ENTRIES_ES = "CmsEntriesElasticsearch"
30
8
  }
31
- export interface StorageOperationsFactoryParams {
32
- documentClient: DynamoDBDocument;
33
- elasticsearch: Client;
34
- table?: string;
35
- esTable?: string;
36
- plugins: PluginsContainer;
37
- container: CmsContext["container"];
38
- }
39
- export interface IGetEntitiesResponse {
40
- groups: IGroupEntity;
41
- models: IModelEntity;
42
- entries: IEntryEntity;
43
- entriesEs: IElasticsearchEntity;
44
- }
45
- export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
46
- getTable: () => ITable;
47
- getEsTable: () => ITable;
48
- getEntities: () => IGetEntitiesResponse;
49
- }
50
- export interface StorageOperationsFactory {
51
- (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
52
- }
53
- export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
54
- dataLoaders: IDataLoadersHandler;
55
- }
56
9
  export interface DataLoadersHandlerInterfaceClearAllParams {
57
- model: Pick<CmsModel, "tenant">;
10
+ tenant: string;
11
+ }
12
+ export interface DataLoadersHandlerDataLoaderParams {
13
+ model: Pick<CmsModel, "tenant" | "modelId">;
14
+ ids: readonly string[];
58
15
  }
59
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>[]>;
60
21
  clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;
61
22
  }
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n CmsContext as BaseCmsContext,\n CmsEntry,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsEntryValues,\n CmsModel,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type {\n Client,\n IOpenSearchEntity as IElasticsearchEntity,\n OpenSearchContext\n} from \"@webiny/api-opensearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { IEntryEntity, IGroupEntity, IModelEntity } from \"~/definitions/types.js\";\nimport type { ITable } from \"@webiny/db-dynamodb\";\n\nexport interface CmsContext extends BaseCmsContext, OpenSearchContext {}\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<T extends CmsEntryValues = CmsEntryValues> extends CmsEntry<T> {\n /**\n * Values that are not going to be indexed.\n */\n rawValues: Partial<T>;\n /**\n * Dev can add whatever keys they want and need. Just need to be careful not to break the entry.\n */\n [key: string]: any;\n}\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\",\n ENTRIES_ES = \"CmsEntriesElasticsearch\"\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n elasticsearch: Client;\n table?: string;\n esTable?: string;\n plugins: PluginsContainer;\n container: CmsContext[\"container\"];\n}\n\nexport interface IGetEntitiesResponse {\n groups: IGroupEntity;\n models: IModelEntity;\n entries: IEntryEntity;\n entriesEs: IElasticsearchEntity;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => ITable;\n getEsTable: () => ITable;\n getEntities: () => IGetEntitiesResponse;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: IDataLoadersHandler;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\">;\n}\nexport interface IDataLoadersHandler {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AAoCO,IAAKA,iBAAQA,WAAAA,GAAAA,SAARA,QAAQ;;;;;WAARA"}
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/index.js";
2
- import type { OpenSearchIndexRequestBody } from "@webiny/api-opensearch/types.js";
3
- import type { CmsEntryOpenSearchIndex } from "./features/CmsEntryOpenSearchIndex/index.js";
4
- interface ConfigurationsElasticsearch {
5
- index: string;
6
- }
7
- export interface CmsElasticsearchParams {
8
- model: Pick<CmsModel, "tenant" | "modelId">;
9
- }
10
- export interface ConfigurationsIndexSettingsParams {
11
- indexConfigs: CmsEntryOpenSearchIndex.Interface[];
12
- model: Pick<CmsModel, "tenant" | "modelId" | "group">;
13
- }
14
- export interface Configurations {
15
- es: (params: CmsElasticsearchParams) => ConfigurationsElasticsearch;
16
- indexSettings: (params: ConfigurationsIndexSettingsParams) => Partial<OpenSearchIndexRequestBody>;
17
- }
18
- export declare const configurations: Configurations;
19
- export {};
package/configurations.js DELETED
@@ -1,31 +0,0 @@
1
- import error from "@webiny/error";
2
- import { getOpenSearchIndexPrefix, isSharedOpenSearchIndex } from "@webiny/api-opensearch";
3
- const configurations = {
4
- es ({ model }) {
5
- const { tenant } = model;
6
- if (!tenant) throw new error('Missing "tenant" parameter when trying to create Elasticsearch index name.', "TENANT_ERROR");
7
- const sharedIndex = isSharedOpenSearchIndex();
8
- const index = [
9
- sharedIndex ? "root" : tenant,
10
- "headless-cms",
11
- model.modelId
12
- ].join("-").toLowerCase();
13
- const prefix = getOpenSearchIndexPrefix();
14
- if (!prefix) return {
15
- index
16
- };
17
- return {
18
- index: prefix + index
19
- };
20
- },
21
- indexSettings: ({ indexConfigs, model })=>{
22
- const usable = indexConfigs.filter((c)=>c.canUse({
23
- model
24
- }));
25
- if (0 === usable.length) return {};
26
- return usable[usable.length - 1].body;
27
- }
28
- };
29
- export { configurations };
30
-
31
- //# sourceMappingURL=configurations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configurations.js","sources":["../src/configurations.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport {\n getOpenSearchIndexPrefix,\n isSharedOpenSearchIndex as isSharedElasticsearchIndex\n} from \"@webiny/api-opensearch\";\nimport type { OpenSearchIndexRequestBody } from \"@webiny/api-opensearch/types.js\";\nimport type { CmsEntryOpenSearchIndex } from \"~/features/CmsEntryOpenSearchIndex/index.js\";\n\ninterface ConfigurationsElasticsearch {\n index: string;\n}\n\nexport interface CmsElasticsearchParams {\n model: Pick<CmsModel, \"tenant\" | \"modelId\">;\n}\n\nexport interface ConfigurationsIndexSettingsParams {\n indexConfigs: CmsEntryOpenSearchIndex.Interface[];\n model: Pick<CmsModel, \"tenant\" | \"modelId\" | \"group\">;\n}\n\nexport interface Configurations {\n es: (params: CmsElasticsearchParams) => ConfigurationsElasticsearch;\n indexSettings: (\n params: ConfigurationsIndexSettingsParams\n ) => Partial<OpenSearchIndexRequestBody>;\n}\n\nexport const configurations: Configurations = {\n es({ model }) {\n const { tenant } = 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 }\n\n const sharedIndex = isSharedElasticsearchIndex();\n const index = [sharedIndex ? \"root\" : tenant, \"headless-cms\", model.modelId]\n .join(\"-\")\n .toLowerCase();\n\n const prefix = getOpenSearchIndexPrefix();\n\n if (!prefix) {\n return {\n index\n };\n }\n return {\n index: prefix + index\n };\n },\n indexSettings: ({ indexConfigs, model }) => {\n const usable = indexConfigs.filter(c => c.canUse({ model }));\n if (usable.length === 0) {\n return {};\n }\n return usable[usable.length - 1].body;\n }\n};\n"],"names":["configurations","model","tenant","WebinyError","sharedIndex","isSharedElasticsearchIndex","index","prefix","getOpenSearchIndexPrefix","indexConfigs","usable","c"],"mappings":";;AA6BO,MAAMA,iBAAiC;IAC1C,IAAG,EAAEC,KAAK,EAAE;QACR,MAAM,EAAEC,MAAM,EAAE,GAAGD;QAEnB,IAAI,CAACC,QACD,MAAM,IAAIC,MACN,8EACA;QAIR,MAAMC,cAAcC;QACpB,MAAMC,QAAQ;YAACF,cAAc,SAASF;YAAQ;YAAgBD,MAAM,OAAO;SAAC,CACvE,IAAI,CAAC,KACL,WAAW;QAEhB,MAAMM,SAASC;QAEf,IAAI,CAACD,QACD,OAAO;YACHD;QACJ;QAEJ,OAAO;YACH,OAAOC,SAASD;QACpB;IACJ;IACA,eAAe,CAAC,EAAEG,YAAY,EAAER,KAAK,EAAE;QACnC,MAAMS,SAASD,aAAa,MAAM,CAACE,CAAAA,IAAKA,EAAE,MAAM,CAAC;gBAAEV;YAAM;QACzD,IAAIS,AAAkB,MAAlBA,OAAO,MAAM,EACb,OAAO,CAAC;QAEZ,OAAOA,MAAM,CAACA,OAAO,MAAM,GAAG,EAAE,CAAC,IAAI;IACzC;AACJ"}
@@ -1,9 +0,0 @@
1
- import type { Client } from "@webiny/api-opensearch";
2
- import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
3
- import type { CmsEntryOpenSearchIndex } from "../features/CmsEntryOpenSearchIndex/index.js";
4
- export interface CreateElasticsearchIndexParams {
5
- client: Client;
6
- indexConfigs: CmsEntryOpenSearchIndex.Interface[];
7
- model: CmsModel;
8
- }
9
- export declare const createElasticsearchIndex: (params: CreateElasticsearchIndexParams) => Promise<void>;
@@ -1,57 +0,0 @@
1
- import error from "@webiny/error";
2
- import { configurations } from "../configurations.js";
3
- const getLastUsable = (params)=>{
4
- const { configs } = params;
5
- const usable = configs.filter((c)=>c.canUse(params));
6
- if (0 === usable.length) throw new error("Could not find a single usable CmsEntryOpenSearchIndex.", "OPENSEARCH_INDEX_TEMPLATE_ERROR");
7
- return usable[usable.length - 1];
8
- };
9
- const createElasticsearchIndex = async (params)=>{
10
- const { client, indexConfigs, model } = params;
11
- const { index } = configurations.es({
12
- model
13
- });
14
- const config = getLastUsable({
15
- configs: indexConfigs,
16
- model
17
- });
18
- if (!config) throw new Error(`Could not find a usable CmsEntryOpenSearchIndex for the CMS model "${model.name}".`);
19
- try {
20
- const response = await client.indices.exists({
21
- index,
22
- ignore_unavailable: false,
23
- allow_no_indices: true,
24
- include_defaults: true,
25
- flat_settings: false,
26
- local: false
27
- });
28
- if (response.body) return void console.log(`Elasticsearch index "${index}" for the CMS model "${model.name}" already exists.`);
29
- } catch {
30
- console.error(`Could not determine if the index "${index}" exists.`);
31
- }
32
- try {
33
- await client.indices.create({
34
- index,
35
- body: {
36
- ...config.body
37
- }
38
- });
39
- } catch (ex) {
40
- console.error(`Could not create Elasticsearch index "${index}" for the CMS model "${model.name}".`);
41
- console.error(ex);
42
- throw new error(ex.message || "Could not create OpenSearch index for the CMS entry.", ex.code || "CREATE_OPENSEARCH_INDEX_ERROR", {
43
- error: {
44
- ...ex,
45
- message: ex.message,
46
- code: ex.code,
47
- data: ex.data
48
- },
49
- tenant: model.tenant,
50
- index,
51
- body: config.body
52
- });
53
- }
54
- };
55
- export { createElasticsearchIndex };
56
-
57
- //# sourceMappingURL=createElasticsearchIndex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"elasticsearch/createElasticsearchIndex.js","sources":["../../src/elasticsearch/createElasticsearchIndex.ts"],"sourcesContent":["import type { Client } from \"@webiny/api-opensearch\";\nimport WebinyError from \"@webiny/error\";\nimport { configurations } from \"~/configurations.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsEntryOpenSearchIndex } from \"~/features/CmsEntryOpenSearchIndex/index.js\";\n\nexport interface CreateElasticsearchIndexParams {\n client: Client;\n indexConfigs: CmsEntryOpenSearchIndex.Interface[];\n model: CmsModel;\n}\n\ninterface IGetLastUsableParams {\n configs: CmsEntryOpenSearchIndex.Interface[];\n model: CmsModel;\n}\n\nconst getLastUsable = (params: IGetLastUsableParams): CmsEntryOpenSearchIndex.Interface => {\n const { configs } = params;\n const usable = configs.filter(c => c.canUse(params));\n if (usable.length === 0) {\n throw new WebinyError(\n \"Could not find a single usable CmsEntryOpenSearchIndex.\",\n \"OPENSEARCH_INDEX_TEMPLATE_ERROR\"\n );\n }\n return usable[usable.length - 1];\n};\n\nexport const createElasticsearchIndex = async (params: CreateElasticsearchIndexParams) => {\n const { client, indexConfigs, model } = params;\n\n const { index } = configurations.es({\n model\n });\n\n const config = getLastUsable({\n configs: indexConfigs,\n model\n });\n if (!config) {\n /**\n * This can happen only while development as we have a base index setting that is always usable.\n */\n throw new Error(\n `Could not find a usable CmsEntryOpenSearchIndex for the CMS model \"${model.name}\".`\n );\n }\n\n try {\n const response = await client.indices.exists({\n index,\n ignore_unavailable: false,\n allow_no_indices: true,\n include_defaults: true,\n flat_settings: false,\n local: false\n });\n if (response.body) {\n console.log(\n `Elasticsearch index \"${index}\" for the CMS model \"${model.name}\" already exists.`\n );\n return;\n }\n } catch {\n console.error(`Could not determine if the index \"${index}\" exists.`);\n }\n\n try {\n await client.indices.create({\n index,\n body: {\n ...config.body\n }\n });\n } catch (ex) {\n console.error(\n `Could not create Elasticsearch index \"${index}\" for the CMS model \"${model.name}\".`\n );\n console.error(ex);\n throw new WebinyError(\n ex.message || \"Could not create OpenSearch index for the CMS entry.\",\n ex.code || \"CREATE_OPENSEARCH_INDEX_ERROR\",\n {\n error: {\n ...ex,\n message: ex.message,\n code: ex.code,\n data: ex.data\n },\n tenant: model.tenant,\n index,\n body: config.body\n }\n );\n }\n};\n"],"names":["getLastUsable","params","configs","usable","c","WebinyError","createElasticsearchIndex","client","indexConfigs","model","index","configurations","config","Error","response","console","ex"],"mappings":";;AAiBA,MAAMA,gBAAgB,CAACC;IACnB,MAAM,EAAEC,OAAO,EAAE,GAAGD;IACpB,MAAME,SAASD,QAAQ,MAAM,CAACE,CAAAA,IAAKA,EAAE,MAAM,CAACH;IAC5C,IAAIE,AAAkB,MAAlBA,OAAO,MAAM,EACb,MAAM,IAAIE,MACN,2DACA;IAGR,OAAOF,MAAM,CAACA,OAAO,MAAM,GAAG,EAAE;AACpC;AAEO,MAAMG,2BAA2B,OAAOL;IAC3C,MAAM,EAAEM,MAAM,EAAEC,YAAY,EAAEC,KAAK,EAAE,GAAGR;IAExC,MAAM,EAAES,KAAK,EAAE,GAAGC,eAAe,EAAE,CAAC;QAChCF;IACJ;IAEA,MAAMG,SAASZ,cAAc;QACzB,SAASQ;QACTC;IACJ;IACA,IAAI,CAACG,QAID,MAAM,IAAIC,MACN,CAAC,mEAAmE,EAAEJ,MAAM,IAAI,CAAC,EAAE,CAAC;IAI5F,IAAI;QACA,MAAMK,WAAW,MAAMP,OAAO,OAAO,CAAC,MAAM,CAAC;YACzCG;YACA,oBAAoB;YACpB,kBAAkB;YAClB,kBAAkB;YAClB,eAAe;YACf,OAAO;QACX;QACA,IAAII,SAAS,IAAI,EAAE,YACfC,QAAQ,GAAG,CACP,CAAC,qBAAqB,EAAEL,MAAM,qBAAqB,EAAED,MAAM,IAAI,CAAC,iBAAiB,CAAC;IAI9F,EAAE,OAAM;QACJM,QAAQ,KAAK,CAAC,CAAC,kCAAkC,EAAEL,MAAM,SAAS,CAAC;IACvE;IAEA,IAAI;QACA,MAAMH,OAAO,OAAO,CAAC,MAAM,CAAC;YACxBG;YACA,MAAM;gBACF,GAAGE,OAAO,IAAI;YAClB;QACJ;IACJ,EAAE,OAAOI,IAAI;QACTD,QAAQ,KAAK,CACT,CAAC,sCAAsC,EAAEL,MAAM,qBAAqB,EAAED,MAAM,IAAI,CAAC,EAAE,CAAC;QAExFM,QAAQ,KAAK,CAACC;QACd,MAAM,IAAIX,MACNW,GAAG,OAAO,IAAI,wDACdA,GAAG,IAAI,IAAI,iCACX;YACI,OAAO;gBACH,GAAGA,EAAE;gBACL,SAASA,GAAG,OAAO;gBACnB,MAAMA,GAAG,IAAI;gBACb,MAAMA,GAAG,IAAI;YACjB;YACA,QAAQP,MAAM,MAAM;YACpBC;YACA,MAAME,OAAO,IAAI;QACrB;IAER;AACJ"}
@@ -1,8 +0,0 @@
1
- import type { Client } from "@webiny/api-opensearch";
2
- import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
3
- interface DeleteElasticsearchIndexParams {
4
- client: Client;
5
- model: CmsModel;
6
- }
7
- export declare const deleteElasticsearchIndex: (params: DeleteElasticsearchIndexParams) => Promise<void>;
8
- export {};
@@ -1,23 +0,0 @@
1
- import { configurations } from "../configurations.js";
2
- const deleteElasticsearchIndex = async (params)=>{
3
- const { client, model } = params;
4
- const { index } = configurations.es({
5
- model
6
- });
7
- const { body: exists } = await client.indices.exists({
8
- index
9
- });
10
- if (!exists) return;
11
- try {
12
- await client.indices.delete({
13
- index,
14
- ignore_unavailable: true
15
- });
16
- } catch (ex) {
17
- console.log(`Could not delete Elasticsearch index "${index}". Please do it manually.`);
18
- console.log(ex.message);
19
- }
20
- };
21
- export { deleteElasticsearchIndex };
22
-
23
- //# sourceMappingURL=deleteElasticsearchIndex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"elasticsearch/deleteElasticsearchIndex.js","sources":["../../src/elasticsearch/deleteElasticsearchIndex.ts"],"sourcesContent":["import type { Client } from \"@webiny/api-opensearch\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { configurations } from \"~/configurations.js\";\n\ninterface DeleteElasticsearchIndexParams {\n client: Client;\n model: CmsModel;\n}\n\nexport const deleteElasticsearchIndex = async (\n params: DeleteElasticsearchIndexParams\n): Promise<void> => {\n const { client, model } = params;\n\n const { index } = configurations.es({\n model\n });\n const { body: exists } = await client.indices.exists({\n index\n });\n if (!exists) {\n return;\n }\n\n try {\n await client.indices.delete({\n index,\n ignore_unavailable: true\n });\n } catch (ex) {\n console.log(`Could not delete Elasticsearch index \"${index}\". Please do it manually.`);\n console.log(ex.message);\n }\n};\n"],"names":["deleteElasticsearchIndex","params","client","model","index","configurations","exists","ex","console"],"mappings":";AASO,MAAMA,2BAA2B,OACpCC;IAEA,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGF;IAE1B,MAAM,EAAEG,KAAK,EAAE,GAAGC,eAAe,EAAE,CAAC;QAChCF;IACJ;IACA,MAAM,EAAE,MAAMG,MAAM,EAAE,GAAG,MAAMJ,OAAO,OAAO,CAAC,MAAM,CAAC;QACjDE;IACJ;IACA,IAAI,CAACE,QACD;IAGJ,IAAI;QACA,MAAMJ,OAAO,OAAO,CAAC,MAAM,CAAC;YACxBE;YACA,oBAAoB;QACxB;IACJ,EAAE,OAAOG,IAAI;QACTC,QAAQ,GAAG,CAAC,CAAC,sCAAsC,EAAEJ,MAAM,yBAAyB,CAAC;QACrFI,QAAQ,GAAG,CAACD,GAAG,OAAO;IAC1B;AACJ"}
@@ -1,9 +0,0 @@
1
- export { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchFieldIndex } from "../../../features/CmsEntryOpenSearchFieldIndex/index.js";
2
- export { CmsEntryOpenSearchFilterRegistry, CmsEntryOpenSearchFilter } from "../../../features/CmsEntryOpenSearchFilter/index.js";
3
- export { CmsEntryOpenSearchBodyModifier } from "../../../features/CmsEntryOpenSearchBodyModifier/index.js";
4
- export { CmsEntryOpenSearchSortModifier } from "../../../features/CmsEntryOpenSearchSortModifier/index.js";
5
- export { CmsEntryOpenSearchQueryModifier } from "../../../features/CmsEntryOpenSearchQueryModifier/index.js";
6
- export { CmsEntryOpenSearchValueSearch, CmsEntryOpenSearchValueSearchRegistry } from "../../../features/CmsEntryOpenSearchValueSearch/index.js";
7
- export { CmsEntryOpenSearchFullTextSearch } from "../../../features/CmsEntryOpenSearchFullTextSearch/index.js";
8
- export { CmsEntryOpenSearchIndex } from "../../../features/CmsEntryOpenSearchIndex/index.js";
9
- export { CmsEntryOpenSearchValuesModifier } from "../../../features/CmsEntryOpenSearchValuesModifier/index.js";
@@ -1,9 +0,0 @@
1
- export { CmsEntryOpenSearchFieldIndex, CmsEntryOpenSearchFieldIndexRegistry } from "../../../features/CmsEntryOpenSearchFieldIndex/index.js";
2
- export { CmsEntryOpenSearchFilter, CmsEntryOpenSearchFilterRegistry } from "../../../features/CmsEntryOpenSearchFilter/index.js";
3
- export { CmsEntryOpenSearchBodyModifier } from "../../../features/CmsEntryOpenSearchBodyModifier/index.js";
4
- export { CmsEntryOpenSearchSortModifier } from "../../../features/CmsEntryOpenSearchSortModifier/index.js";
5
- export { CmsEntryOpenSearchQueryModifier } from "../../../features/CmsEntryOpenSearchQueryModifier/index.js";
6
- export { CmsEntryOpenSearchValueSearch, CmsEntryOpenSearchValueSearchRegistry } from "../../../features/CmsEntryOpenSearchValueSearch/index.js";
7
- export { CmsEntryOpenSearchFullTextSearch } from "../../../features/CmsEntryOpenSearchFullTextSearch/index.js";
8
- export { CmsEntryOpenSearchIndex } from "../../../features/CmsEntryOpenSearchIndex/index.js";
9
- export { CmsEntryOpenSearchValuesModifier } from "../../../features/CmsEntryOpenSearchValuesModifier/index.js";
@@ -1,16 +0,0 @@
1
- import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
- import type { SearchBody } from "@webiny/api-opensearch";
3
- export interface ModifyBodyParams {
4
- body: SearchBody;
5
- model: CmsModel;
6
- where: Record<string, any>;
7
- }
8
- export interface ICmsEntryOpenSearchBodyModifier {
9
- readonly modelId?: string;
10
- modifyBody(params: ModifyBodyParams): void;
11
- }
12
- export declare const CmsEntryOpenSearchBodyModifier: import("@webiny/di").Abstraction<ICmsEntryOpenSearchBodyModifier>;
13
- export declare namespace CmsEntryOpenSearchBodyModifier {
14
- type Interface = ICmsEntryOpenSearchBodyModifier;
15
- type Params = ModifyBodyParams;
16
- }
@@ -1,5 +0,0 @@
1
- import { createAbstraction } from "@webiny/feature/api";
2
- const CmsEntryOpenSearchBodyModifier = createAbstraction("Cms/Entry/OpenSearch/BodyModifier");
3
- export { CmsEntryOpenSearchBodyModifier };
4
-
5
- //# sourceMappingURL=abstractions.js.map