@webiny/api-headless-cms-ddb-es 0.0.0-unstable.496cf268ac → 0.0.0-unstable.5387e5f7c8

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 (410) hide show
  1. package/README.md +6 -30
  2. package/abstractions/CmsDdbEsDataLoaders.d.ts +5 -0
  3. package/abstractions/CmsDdbEsDataLoaders.js +5 -0
  4. package/abstractions/CmsDdbEsDataLoaders.js.map +1 -0
  5. package/abstractions/CmsDdbEsEntriesEsEntity.d.ts +5 -0
  6. package/abstractions/CmsDdbEsEntriesEsEntity.js +5 -0
  7. package/abstractions/CmsDdbEsEntriesEsEntity.js.map +1 -0
  8. package/abstractions/CmsDdbEsEntryEntity.d.ts +5 -0
  9. package/abstractions/CmsDdbEsEntryEntity.js +5 -0
  10. package/abstractions/CmsDdbEsEntryEntity.js.map +1 -0
  11. package/abstractions/CmsDdbEsGroupEntity.d.ts +5 -0
  12. package/abstractions/CmsDdbEsGroupEntity.js +5 -0
  13. package/abstractions/CmsDdbEsGroupEntity.js.map +1 -0
  14. package/abstractions/CmsDdbEsModelEntity.d.ts +5 -0
  15. package/abstractions/CmsDdbEsModelEntity.js +5 -0
  16. package/abstractions/CmsDdbEsModelEntity.js.map +1 -0
  17. package/abstractions/CmsDdbEsOsTable.d.ts +5 -0
  18. package/abstractions/CmsDdbEsOsTable.js +5 -0
  19. package/abstractions/CmsDdbEsOsTable.js.map +1 -0
  20. package/abstractions/CmsDdbEsTable.d.ts +5 -0
  21. package/abstractions/CmsDdbEsTable.js +5 -0
  22. package/abstractions/CmsDdbEsTable.js.map +1 -0
  23. package/definitions/entry.d.ts +4 -5
  24. package/definitions/entry.js +10 -87
  25. package/definitions/entry.js.map +1 -1
  26. package/definitions/group.d.ts +6 -6
  27. package/definitions/group.js +10 -64
  28. package/definitions/group.js.map +1 -1
  29. package/definitions/model.d.ts +6 -6
  30. package/definitions/model.js +10 -108
  31. package/definitions/model.js.map +1 -1
  32. package/definitions/types.d.ts +65 -0
  33. package/definitions/types.js +0 -0
  34. package/feature.d.ts +10 -0
  35. package/feature.js +69 -0
  36. package/feature.js.map +1 -0
  37. package/index.d.ts +1 -3
  38. package/index.js +1 -214
  39. package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
  40. package/operations/entry/DdbEsCreateEntry.js +134 -0
  41. package/operations/entry/DdbEsCreateEntry.js.map +1 -0
  42. package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
  43. package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -0
  44. package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
  45. package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
  46. package/operations/entry/DdbEsDeleteEntry.js +79 -0
  47. package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
  48. package/operations/entry/DdbEsDeleteEntryRevision.d.ts +24 -0
  49. package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
  50. package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
  51. package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
  52. package/operations/entry/DdbEsDeleteMultipleEntries.js +80 -0
  53. package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
  54. package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
  55. package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
  56. package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
  57. package/operations/entry/DdbEsGetEntry.d.ts +14 -0
  58. package/operations/entry/DdbEsGetEntry.js +27 -0
  59. package/operations/entry/DdbEsGetEntry.js.map +1 -0
  60. package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
  61. package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
  62. package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
  63. package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
  64. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
  65. package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
  66. package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
  67. package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
  68. package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
  69. package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
  70. package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
  71. package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
  72. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
  73. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
  74. package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
  75. package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
  76. package/operations/entry/DdbEsGetRevisionById.js +34 -0
  77. package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
  78. package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
  79. package/operations/entry/DdbEsGetRevisions.js +33 -0
  80. package/operations/entry/DdbEsGetRevisions.js.map +1 -0
  81. package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +18 -0
  82. package/operations/entry/DdbEsGetUniqueFieldValues.js +76 -0
  83. package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
  84. package/operations/entry/DdbEsListEntries.d.ts +25 -0
  85. package/operations/entry/DdbEsListEntries.js +91 -0
  86. package/operations/entry/DdbEsListEntries.js.map +1 -0
  87. package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
  88. package/operations/entry/DdbEsMoveEntry.js +113 -0
  89. package/operations/entry/DdbEsMoveEntry.js.map +1 -0
  90. package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
  91. package/operations/entry/DdbEsMoveToBin.js +137 -0
  92. package/operations/entry/DdbEsMoveToBin.js.map +1 -0
  93. package/operations/entry/DdbEsPublishEntry.d.ts +24 -0
  94. package/operations/entry/DdbEsPublishEntry.js +231 -0
  95. package/operations/entry/DdbEsPublishEntry.js.map +1 -0
  96. package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
  97. package/operations/entry/DdbEsRestoreFromBin.js +137 -0
  98. package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
  99. package/operations/entry/DdbEsUnpublishEntry.d.ts +24 -0
  100. package/operations/entry/DdbEsUnpublishEntry.js +127 -0
  101. package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
  102. package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
  103. package/operations/entry/DdbEsUpdateEntry.js +175 -0
  104. package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
  105. package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
  106. package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
  107. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  108. package/operations/entry/dataLoader/constants.d.ts +1 -0
  109. package/operations/entry/dataLoader/constants.js +5 -0
  110. package/operations/entry/dataLoader/constants.js.map +1 -0
  111. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  112. package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
  113. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  114. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  115. package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
  116. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  117. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  118. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +34 -0
  119. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  120. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  121. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +34 -0
  122. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  123. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  124. package/operations/entry/dataLoader/getRevisionById.js +40 -0
  125. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  126. package/operations/entry/dataLoader/index.d.ts +8 -0
  127. package/operations/entry/dataLoader/index.js +18 -0
  128. package/operations/entry/dataLoader/index.js.map +1 -0
  129. package/operations/entry/dataLoader/types.d.ts +6 -0
  130. package/operations/entry/dataLoader/types.js +0 -0
  131. package/operations/entry/dataLoaders.d.ts +18 -39
  132. package/operations/entry/dataLoaders.js +91 -306
  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 +46 -27
  139. package/operations/entry/keys.js.map +1 -1
  140. package/operations/entry/recordType.js +5 -17
  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 +8 -0
  146. package/operations/entry/transformations/convertEntryKeys.js +25 -0
  147. package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
  148. package/operations/entry/transformations/index.d.ts +32 -0
  149. package/operations/entry/transformations/index.js +91 -0
  150. package/operations/entry/transformations/index.js.map +1 -0
  151. package/operations/entry/transformations/modifyEntryValues.d.ts +53 -0
  152. package/operations/entry/transformations/modifyEntryValues.js +16 -0
  153. package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
  154. package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
  155. package/operations/entry/transformations/transformEntryKeys.js +17 -0
  156. package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
  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 +48 -41
  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 +13 -0
  204. package/tasks/CreateElasticsearchIndexTask.js +40 -0
  205. package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
  206. package/types.d.ts +13 -155
  207. package/types.js +9 -41
  208. package/types.js.map +1 -1
  209. package/configurations.d.ts +0 -12
  210. package/configurations.js +0 -35
  211. package/configurations.js.map +0 -1
  212. package/definitions/entryElasticsearch.d.ts +0 -8
  213. package/definitions/entryElasticsearch.js +0 -37
  214. package/definitions/entryElasticsearch.js.map +0 -1
  215. package/definitions/settings.d.ts +0 -8
  216. package/definitions/settings.js +0 -53
  217. package/definitions/settings.js.map +0 -1
  218. package/definitions/system.d.ts +0 -8
  219. package/definitions/system.js +0 -41
  220. package/definitions/system.js.map +0 -1
  221. package/definitions/table.d.ts +0 -8
  222. package/definitions/table.js +0 -21
  223. package/definitions/table.js.map +0 -1
  224. package/definitions/tableElasticsearch.d.ts +0 -8
  225. package/definitions/tableElasticsearch.js +0 -21
  226. package/definitions/tableElasticsearch.js.map +0 -1
  227. package/dynamoDb/index.d.ts +0 -2
  228. package/dynamoDb/index.js +0 -11
  229. package/dynamoDb/index.js.map +0 -1
  230. package/dynamoDb/storage/date.d.ts +0 -3
  231. package/dynamoDb/storage/date.js +0 -86
  232. package/dynamoDb/storage/date.js.map +0 -1
  233. package/dynamoDb/storage/longText.d.ts +0 -10
  234. package/dynamoDb/storage/longText.js +0 -93
  235. package/dynamoDb/storage/longText.js.map +0 -1
  236. package/dynamoDb/storage/richText.d.ts +0 -7
  237. package/dynamoDb/storage/richText.js +0 -110
  238. package/dynamoDb/storage/richText.js.map +0 -1
  239. package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
  240. package/elasticsearch/createElasticsearchIndex.js +0 -49
  241. package/elasticsearch/createElasticsearchIndex.js.map +0 -1
  242. package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
  243. package/elasticsearch/deleteElasticsearchIndex.js +0 -36
  244. package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
  245. package/elasticsearch/index.d.ts +0 -2
  246. package/elasticsearch/index.js +0 -11
  247. package/elasticsearch/index.js.map +0 -1
  248. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  249. package/elasticsearch/indexing/dateTimeIndexing.js +0 -86
  250. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  251. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  252. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -52
  253. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  254. package/elasticsearch/indexing/index.d.ts +0 -2
  255. package/elasticsearch/indexing/index.js +0 -15
  256. package/elasticsearch/indexing/index.js.map +0 -1
  257. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  258. package/elasticsearch/indexing/longTextIndexing.js +0 -46
  259. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  260. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  261. package/elasticsearch/indexing/numberIndexing.js +0 -39
  262. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  263. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  264. package/elasticsearch/indexing/objectIndexing.js +0 -196
  265. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  266. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  267. package/elasticsearch/indexing/richTextIndexing.js +0 -29
  268. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  269. package/elasticsearch/indices/base.d.ts +0 -2
  270. package/elasticsearch/indices/base.js +0 -12
  271. package/elasticsearch/indices/base.js.map +0 -1
  272. package/elasticsearch/indices/index.d.ts +0 -1
  273. package/elasticsearch/indices/index.js +0 -12
  274. package/elasticsearch/indices/index.js.map +0 -1
  275. package/elasticsearch/indices/japanese.d.ts +0 -2
  276. package/elasticsearch/indices/japanese.js +0 -13
  277. package/elasticsearch/indices/japanese.js.map +0 -1
  278. package/elasticsearch/search/index.d.ts +0 -3
  279. package/elasticsearch/search/index.js +0 -10
  280. package/elasticsearch/search/index.js.map +0 -1
  281. package/elasticsearch/search/refSearch.d.ts +0 -2
  282. package/elasticsearch/search/refSearch.js +0 -29
  283. package/elasticsearch/search/refSearch.js.map +0 -1
  284. package/elasticsearch/search/timeSearch.d.ts +0 -2
  285. package/elasticsearch/search/timeSearch.js +0 -26
  286. package/elasticsearch/search/timeSearch.js.map +0 -1
  287. package/helpers/entryIndexHelpers.d.ts +0 -18
  288. package/helpers/entryIndexHelpers.js +0 -175
  289. package/helpers/entryIndexHelpers.js.map +0 -1
  290. package/helpers/index.d.ts +0 -1
  291. package/helpers/index.js +0 -16
  292. package/helpers/index.js.map +0 -1
  293. package/index.js.map +0 -1
  294. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
  295. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -32
  296. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
  297. package/operations/entry/elasticsearch/body.d.ts +0 -13
  298. package/operations/entry/elasticsearch/body.js +0 -140
  299. package/operations/entry/elasticsearch/body.js.map +0 -1
  300. package/operations/entry/elasticsearch/fields.d.ts +0 -9
  301. package/operations/entry/elasticsearch/fields.js +0 -229
  302. package/operations/entry/elasticsearch/fields.js.map +0 -1
  303. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -8
  304. package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -57
  305. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
  306. package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -17
  307. package/operations/entry/elasticsearch/filtering/exec.js +0 -172
  308. package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
  309. package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
  310. package/operations/entry/elasticsearch/filtering/index.js +0 -16
  311. package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
  312. package/operations/entry/elasticsearch/filtering/path.d.ts +0 -15
  313. package/operations/entry/elasticsearch/filtering/path.js +0 -44
  314. package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
  315. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  316. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -28
  317. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  318. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  319. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -13
  320. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  321. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  322. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -65
  323. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  324. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  325. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -48
  326. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  327. package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
  328. package/operations/entry/elasticsearch/filtering/populated.js +0 -23
  329. package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
  330. package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
  331. package/operations/entry/elasticsearch/filtering/values.js +0 -22
  332. package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
  333. package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -12
  334. package/operations/entry/elasticsearch/fullTextSearch.js +0 -89
  335. package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
  336. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
  337. package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -25
  338. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
  339. package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
  340. package/operations/entry/elasticsearch/initialQuery.js +0 -103
  341. package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
  342. package/operations/entry/elasticsearch/keyword.d.ts +0 -2
  343. package/operations/entry/elasticsearch/keyword.js +0 -34
  344. package/operations/entry/elasticsearch/keyword.js.map +0 -1
  345. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  346. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -16
  347. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  348. package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -8
  349. package/operations/entry/elasticsearch/plugins/operator.js +0 -37
  350. package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
  351. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  352. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -16
  353. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  354. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  355. package/operations/entry/elasticsearch/plugins/search.js +0 -24
  356. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  357. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  358. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -16
  359. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  360. package/operations/entry/elasticsearch/sort.d.ts +0 -12
  361. package/operations/entry/elasticsearch/sort.js +0 -82
  362. package/operations/entry/elasticsearch/sort.js.map +0 -1
  363. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -16
  364. package/operations/entry/elasticsearch/transformValueForSearch.js +0 -30
  365. package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
  366. package/operations/entry/elasticsearch/types.d.ts +0 -41
  367. package/operations/entry/elasticsearch/types.js +0 -5
  368. package/operations/entry/elasticsearch/types.js.map +0 -1
  369. package/operations/entry/index.d.ts +0 -11
  370. package/operations/entry/index.js +0 -1128
  371. package/operations/entry/index.js.map +0 -1
  372. package/operations/group/index.d.ts +0 -8
  373. package/operations/group/index.js +0 -165
  374. package/operations/group/index.js.map +0 -1
  375. package/operations/model/index.d.ts +0 -8
  376. package/operations/model/index.js +0 -171
  377. package/operations/model/index.js.map +0 -1
  378. package/operations/settings/index.d.ts +0 -6
  379. package/operations/settings/index.js +0 -111
  380. package/operations/settings/index.js.map +0 -1
  381. package/operations/system/index.d.ts +0 -6
  382. package/operations/system/index.js +0 -82
  383. package/operations/system/index.js.map +0 -1
  384. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -21
  385. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -22
  386. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  387. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
  388. package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -18
  389. package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +0 -1
  390. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  391. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -28
  392. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  393. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  394. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -12
  395. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  396. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -31
  397. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -37
  398. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  399. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -18
  400. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -22
  401. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  402. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -18
  403. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -22
  404. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  405. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  406. package/plugins/CmsEntryFilterPlugin.js +0 -24
  407. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  408. package/plugins/index.d.ts +0 -7
  409. package/plugins/index.js +0 -82
  410. package/plugins/index.js.map +0 -1
@@ -1,8 +0,0 @@
1
- import { Client } from "@elastic/elasticsearch";
2
- import { CmsModel } from "@webiny/api-headless-cms/types";
3
- interface DeleteElasticsearchIndexParams {
4
- elasticsearch: Client;
5
- model: CmsModel;
6
- }
7
- export declare const deleteElasticsearchIndex: (params: DeleteElasticsearchIndexParams) => Promise<void>;
8
- export {};
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.deleteElasticsearchIndex = void 0;
7
- var _configurations = require("../configurations");
8
- const deleteElasticsearchIndex = async params => {
9
- const {
10
- elasticsearch,
11
- model
12
- } = params;
13
- const {
14
- index
15
- } = _configurations.configurations.es({
16
- model
17
- });
18
- const {
19
- body: exists
20
- } = await elasticsearch.indices.exists({
21
- index
22
- });
23
- if (!exists) {
24
- return;
25
- }
26
- try {
27
- await elasticsearch.indices.delete({
28
- index,
29
- ignore_unavailable: true
30
- });
31
- } catch (ex) {
32
- console.log(`Could not delete Elasticsearch index "${index}". Please do it manually.`);
33
- console.log(ex.message);
34
- }
35
- };
36
- exports.deleteElasticsearchIndex = deleteElasticsearchIndex;
@@ -1 +0,0 @@
1
- {"version":3,"names":["deleteElasticsearchIndex","params","elasticsearch","model","index","configurations","es","body","exists","indices","delete","ignore_unavailable","ex","console","log","message"],"sources":["deleteElasticsearchIndex.ts"],"sourcesContent":["import { Client } from \"@elastic/elasticsearch\";\nimport { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { configurations } from \"~/configurations\";\n\ninterface DeleteElasticsearchIndexParams {\n elasticsearch: Client;\n model: CmsModel;\n}\n\nexport const deleteElasticsearchIndex = async (\n params: DeleteElasticsearchIndexParams\n): Promise<void> => {\n const { elasticsearch, model } = params;\n\n const { index } = configurations.es({\n model\n });\n const { body: exists } = await elasticsearch.indices.exists({\n index\n });\n if (!exists) {\n return;\n }\n\n try {\n await elasticsearch.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"],"mappings":";;;;;;AAEA;AAOO,MAAMA,wBAAwB,GAAG,MACpCC,MAAsC,IACtB;EAChB,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,MAAM;IAAEG;EAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;IAChCH;EACJ,CAAC,CAAC;EACF,MAAM;IAAEI,IAAI,EAAEC;EAAO,CAAC,GAAG,MAAMN,aAAa,CAACO,OAAO,CAACD,MAAM,CAAC;IACxDJ;EACJ,CAAC,CAAC;EACF,IAAI,CAACI,MAAM,EAAE;IACT;EACJ;EAEA,IAAI;IACA,MAAMN,aAAa,CAACO,OAAO,CAACC,MAAM,CAAC;MAC/BN,KAAK;MACLO,kBAAkB,EAAE;IACxB,CAAC,CAAC;EACN,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,GAAG,CAAE,yCAAwCV,KAAM,2BAA0B,CAAC;IACtFS,OAAO,CAACC,GAAG,CAACF,EAAE,CAACG,OAAO,CAAC;EAC3B;AACJ,CAAC;AAAC"}
@@ -1,2 +0,0 @@
1
- declare const _default: () => (import("../types").CmsModelFieldToElasticsearchPlugin[] | import("..").CmsEntryElasticsearchQueryBuilderValueSearchPlugin[])[];
2
- export default _default;
@@ -1,11 +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.default = void 0;
8
- var _indexing = _interopRequireDefault(require("./indexing"));
9
- var _search = _interopRequireDefault(require("./search"));
10
- var _default = () => [(0, _indexing.default)(), (0, _search.default)()];
11
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["elasticsearchIndexingPlugins","elasticsearchSearchPlugins"],"sources":["index.ts"],"sourcesContent":["import elasticsearchIndexingPlugins from \"./indexing\";\nimport elasticsearchSearchPlugins from \"./search\";\n\nexport default () => [elasticsearchIndexingPlugins(), elasticsearchSearchPlugins()];\n"],"mappings":";;;;;;;AAAA;AACA;AAAkD,eAEnC,MAAM,CAAC,IAAAA,iBAA4B,GAAE,EAAE,IAAAC,eAA0B,GAAE,CAAC;AAAA"}
@@ -1,3 +0,0 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
- declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
- export default _default;
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- const convertTimeToNumber = time => {
8
- if (!time) {
9
- return null;
10
- }
11
- const [hours, minutes, seconds = 0] = time.split(":").map(Number);
12
- return hours * 60 * 60 + minutes * 60 + seconds;
13
- };
14
- const convertNumberToTime = value => {
15
- if (value === undefined || value === null) {
16
- return null;
17
- }
18
- // TODO remove when v5 goes out
19
- // this is a fix for pre beta.5
20
- if (String(value).match(/^([0-9]{2}):([0-9]{2})/) !== null) {
21
- return String(value);
22
- }
23
- //
24
- const hours = Math.floor(value / 60 / 60);
25
- const minutes = Math.floor((value - hours * 60 * 60) / 60);
26
- const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);
27
- return [hours, minutes, seconds].map(v => String(v).padStart(2, "0")).join(":");
28
- };
29
- const convertValueFromIndex = (value, field) => {
30
- const type = field.settings.type;
31
- if (type === "time") {
32
- return convertNumberToTime(value);
33
- } else if (!value) {
34
- return null;
35
- } else if (type === "dateTimeWithTimezone") {
36
- return value;
37
- } else if (type === "date") {
38
- const dateValue = new Date(value);
39
- return dateValue.toISOString().slice(0, 10);
40
- }
41
- return new Date(value).toISOString();
42
- };
43
- const convertValueToIndex = (value, field) => {
44
- if (!value) {
45
- return null;
46
- } else if (field.settings.type === "time") {
47
- return convertTimeToNumber(value);
48
- }
49
- return value;
50
- };
51
- var _default = () => ({
52
- type: "cms-model-field-to-elastic-search",
53
- name: "cms-model-field-to-elastic-search-datetime",
54
- fieldType: "datetime",
55
- unmappedType: () => {
56
- return "date";
57
- },
58
- toIndex({
59
- field,
60
- value
61
- }) {
62
- if (Array.isArray(value) === true) {
63
- return {
64
- value: value.map(v => {
65
- return convertValueToIndex(v, field);
66
- })
67
- };
68
- }
69
- const dateValue = convertValueToIndex(value, field);
70
- return {
71
- value: dateValue
72
- };
73
- },
74
- fromIndex({
75
- field,
76
- value
77
- }) {
78
- if (Array.isArray(value)) {
79
- return value.map(v => {
80
- return convertValueFromIndex(v, field);
81
- });
82
- }
83
- return convertValueFromIndex(value, field);
84
- }
85
- });
86
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["convertTimeToNumber","time","hours","minutes","seconds","split","map","Number","convertNumberToTime","value","undefined","String","match","Math","floor","v","padStart","join","convertValueFromIndex","field","type","settings","dateValue","Date","toISOString","slice","convertValueToIndex","name","fieldType","unmappedType","toIndex","Array","isArray","fromIndex"],"sources":["dateTimeIndexing.ts"],"sourcesContent":["import { CmsModelDateTimeField } from \"@webiny/api-headless-cms/types\";\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nconst convertTimeToNumber = (time?: string): number | null => {\n if (!time) {\n return null;\n }\n const [hours, minutes, seconds = 0] = time.split(\":\").map(Number);\n return hours * 60 * 60 + minutes * 60 + seconds;\n};\n\nconst convertNumberToTime = (value?: number): string | null => {\n if (value === undefined || value === null) {\n return null;\n }\n // TODO remove when v5 goes out\n // this is a fix for pre beta.5\n if (String(value).match(/^([0-9]{2}):([0-9]{2})/) !== null) {\n return String(value);\n }\n //\n const hours = Math.floor(value / 60 / 60);\n\n const minutes = Math.floor((value - hours * 60 * 60) / 60);\n\n const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);\n\n return [hours, minutes, seconds].map(v => String(v).padStart(2, \"0\")).join(\":\");\n};\n\nconst convertValueFromIndex = (\n value: string | number,\n field: CmsModelDateTimeField\n): string | null => {\n const type = field.settings.type;\n if (type === \"time\") {\n return convertNumberToTime(value as number);\n } else if (!value) {\n return null;\n } else if (type === \"dateTimeWithTimezone\") {\n return value as string;\n } else if (type === \"date\") {\n const dateValue = new Date(value);\n return dateValue.toISOString().slice(0, 10);\n }\n return new Date(value).toISOString();\n};\n\nconst convertValueToIndex = (value: string, field: CmsModelDateTimeField) => {\n if (!value) {\n return null;\n } else if (field.settings.type === \"time\") {\n return convertTimeToNumber(value);\n }\n return value;\n};\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-datetime\",\n fieldType: \"datetime\",\n unmappedType: () => {\n return \"date\";\n },\n toIndex({ field, value }) {\n if (Array.isArray(value) === true) {\n return {\n value: value.map((v: string) => {\n return convertValueToIndex(v, field as CmsModelDateTimeField);\n })\n };\n }\n const dateValue = convertValueToIndex(value, field as CmsModelDateTimeField);\n return {\n value: dateValue\n };\n },\n fromIndex({ field, value }) {\n if (Array.isArray(value)) {\n return value.map((v: string) => {\n return convertValueFromIndex(v, field as CmsModelDateTimeField);\n });\n }\n return convertValueFromIndex(value, field as CmsModelDateTimeField);\n }\n});\n"],"mappings":";;;;;;AAGA,MAA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AK,CAA0B;IAC5E,OAAO;MACHV,KAAK,EAAEa;IACX,CAAC;EACL,CAAC;EACDW,SAAS,CAAC;IAAEd,KAAK;IAAEV;EAAM,CAAC,EAAE;IACxB,IAAIsB,KAAK,CAACC,OAAO,CAACvB,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK,CAACH,GAAG,CAAES,CAAS,IAAK;QAC5B,OAAOG,qBAAqB,CAACH,CAAC,EAAEI,KAAK,CAA0B;MACnE,CAAC,CAAC;IACN;IACA,OAAOD,qBAAqB,CAACT,KAAK,EAAEU,KAAK,CAA0B;EACvE;AACJ,CAAC,CAAC;AAAA"}
@@ -1,3 +0,0 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
- declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
- export default _default;
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _default = () => ({
8
- type: "cms-model-field-to-elastic-search",
9
- name: "cms-model-field-to-elastic-search-default",
10
- fieldType: "*",
11
- toIndex({
12
- field,
13
- getFieldTypePlugin,
14
- value
15
- }) {
16
- const fieldTypePlugin = getFieldTypePlugin(field.type);
17
-
18
- // when field is searchable, assign it to `values`
19
- if (fieldTypePlugin.isSearchable === true) {
20
- return {
21
- value
22
- };
23
- }
24
-
25
- // when field is not searchable, move its value to `rawValues`.
26
- // `rawValues` is a field in ES index that's not being indexed.
27
- return {
28
- rawValue: value
29
- };
30
- },
31
- fromIndex({
32
- field,
33
- getFieldTypePlugin,
34
- value,
35
- rawValue
36
- }) {
37
- const {
38
- isSearchable
39
- } = getFieldTypePlugin(field.type);
40
- /**
41
- * We will return the rawValue in case if not searchable and value in case of not searchable field.
42
- * This is to make sure that changed isSearchable parameter does not make the data to be null / undefined.
43
- *
44
- * Users can change isSearchable parameter at any time on the GraphQL field - and that could create a problem for them.
45
- */
46
- if (isSearchable) {
47
- return value === undefined ? rawValue : value;
48
- }
49
- return rawValue === undefined ? value : rawValue;
50
- }
51
- });
52
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["type","name","fieldType","toIndex","field","getFieldTypePlugin","value","fieldTypePlugin","isSearchable","rawValue","fromIndex","undefined"],"sources":["defaultFieldIndexing.ts"],"sourcesContent":["import { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-default\",\n fieldType: \"*\",\n toIndex({ field, getFieldTypePlugin, value }) {\n const fieldTypePlugin = getFieldTypePlugin(field.type);\n\n // when field is searchable, assign it to `values`\n if (fieldTypePlugin.isSearchable === true) {\n return { value };\n }\n\n // when field is not searchable, move its value to `rawValues`.\n // `rawValues` is a field in ES index that's not being indexed.\n return { rawValue: value };\n },\n fromIndex({ field, getFieldTypePlugin, value, rawValue }) {\n const { isSearchable } = getFieldTypePlugin(field.type);\n /**\n * We will return the rawValue in case if not searchable and value in case of not searchable field.\n * This is to make sure that changed isSearchable parameter does not make the data to be null / undefined.\n *\n * Users can change isSearchable parameter at any time on the GraphQL field - and that could create a problem for them.\n */\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n});\n"],"mappings":";;;;;;eAEe,OAA2C;EACtDA,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,2CAA2C;EACjDC,SAAS,EAAE,GAAG;EACdC,OAAO,CAAC;IAAEC,KAAK;IAAEC,kBAAkB;IAAEC;EAAM,CAAC,EAAE;IAC1C,MAAMC,eAAe,GAAGF,kBAAkB,CAACD,KAAK,CAACJ,IAAI,CAAC;;IAEtD;IACA,IAAIO,eAAe,CAACC,YAAY,KAAK,IAAI,EAAE;MACvC,OAAO;QAAEF;MAAM,CAAC;IACpB;;IAEA;IACA;IACA,OAAO;MAAEG,QAAQ,EAAEH;IAAM,CAAC;EAC9B,CAAC;EACDI,SAAS,CAAC;IAAEN,KAAK;IAAEC,kBAAkB;IAAEC,KAAK;IAAEG;EAAS,CAAC,EAAE;IACtD,MAAM;MAAED;IAAa,CAAC,GAAGH,kBAAkB,CAACD,KAAK,CAACJ,IAAI,CAAC;IACvD;AACR;AACA;AACA;AACA;AACA;IACQ,IAAIQ,YAAY,EAAE;MACd,OAAOF,KAAK,KAAKK,SAAS,GAAGF,QAAQ,GAAGH,KAAK;IACjD;IACA,OAAOG,QAAQ,KAAKE,SAAS,GAAGL,KAAK,GAAGG,QAAQ;EACpD;AACJ,CAAC,CAAC;AAAA"}
@@ -1,2 +0,0 @@
1
- declare const _default: () => import("../../types").CmsModelFieldToElasticsearchPlugin[];
2
- export default _default;
@@ -1,15 +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.default = void 0;
8
- var _richTextIndexing = _interopRequireDefault(require("./richTextIndexing"));
9
- var _longTextIndexing = _interopRequireDefault(require("./longTextIndexing"));
10
- var _defaultFieldIndexing = _interopRequireDefault(require("./defaultFieldIndexing"));
11
- var _dateTimeIndexing = _interopRequireDefault(require("./dateTimeIndexing"));
12
- var _numberIndexing = _interopRequireDefault(require("./numberIndexing"));
13
- var _objectIndexing = _interopRequireDefault(require("./objectIndexing"));
14
- var _default = () => [(0, _dateTimeIndexing.default)(), (0, _richTextIndexing.default)(), (0, _longTextIndexing.default)(), (0, _defaultFieldIndexing.default)(), (0, _numberIndexing.default)(), (0, _objectIndexing.default)()];
15
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["dateTimeIndexing","richTextIndexing","longTextIndexing","defaultFieldIndexing","numberIndexing","objectIndexing"],"sources":["index.ts"],"sourcesContent":["import richTextIndexing from \"./richTextIndexing\";\nimport longTextIndexing from \"./longTextIndexing\";\nimport defaultFieldIndexing from \"./defaultFieldIndexing\";\nimport dateTimeIndexing from \"./dateTimeIndexing\";\nimport numberIndexing from \"./numberIndexing\";\nimport objectIndexing from \"./objectIndexing\";\n\nexport default () => [\n dateTimeIndexing(),\n richTextIndexing(),\n longTextIndexing(),\n defaultFieldIndexing(),\n numberIndexing(),\n objectIndexing()\n];\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAA8C,eAE/B,MAAM,CACjB,IAAAA,yBAAgB,GAAE,EAClB,IAAAC,yBAAgB,GAAE,EAClB,IAAAC,yBAAgB,GAAE,EAClB,IAAAC,6BAAoB,GAAE,EACtB,IAAAC,uBAAc,GAAE,EAChB,IAAAC,uBAAc,GAAE,CACnB;AAAA"}
@@ -1,7 +0,0 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
- /**
3
- * The long-text indexing plugin must take in consideration that users might have list of long-text fields.
4
- * Also, we used to encode values, and we do not do that anymore - but we need to have backward compatibility.
5
- */
6
- declare const _default: () => CmsModelFieldToElasticsearchPlugin;
7
- export default _default;
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /**
8
- * The long-text indexing plugin must take in consideration that users might have list of long-text fields.
9
- * Also, we used to encode values, and we do not do that anymore - but we need to have backward compatibility.
10
- */
11
- var _default = () => ({
12
- type: "cms-model-field-to-elastic-search",
13
- name: "cms-model-field-to-elastic-search-long-text",
14
- fieldType: "long-text",
15
- toIndex({
16
- rawValue
17
- }) {
18
- /**
19
- * We take the raw value, before it was prepared via `transformToStorage` for storage (there might be some transform due to DynamoDB) and store it in the Elasticsearch to be indexed.
20
- */
21
- return {
22
- /**
23
- * // TODO @Bruno validate and test
24
- * I have no idea why we encoded the raw value. We will see in testing and when upgrading our test projects.
25
- * // TODO remove comments when tested and verified.
26
- */
27
- // value: rawValue ? encodeURIComponent(rawValue) : "",
28
- value: Array.isArray(rawValue) ? rawValue : rawValue || ""
29
- };
30
- },
31
- /**
32
- * When taking value from the index, we can return the original value.
33
- * At that point the `transformFromStorage` does not need to do anything.
34
- *
35
- * We need to decode to support older systems.
36
- */
37
- fromIndex({
38
- value
39
- }) {
40
- if (Array.isArray(value)) {
41
- return value.map(decodeURIComponent);
42
- }
43
- return value ? decodeURIComponent(value) : "";
44
- }
45
- });
46
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["type","name","fieldType","toIndex","rawValue","value","Array","isArray","fromIndex","map","decodeURIComponent"],"sources":["longTextIndexing.ts"],"sourcesContent":["import { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\n/**\n * The long-text indexing plugin must take in consideration that users might have list of long-text fields.\n * Also, we used to encode values, and we do not do that anymore - but we need to have backward compatibility.\n */\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-long-text\",\n fieldType: \"long-text\",\n toIndex({ rawValue }) {\n /**\n * We take the raw value, before it was prepared via `transformToStorage` for storage (there might be some transform due to DynamoDB) and store it in the Elasticsearch to be indexed.\n */\n return {\n /**\n * // TODO @Bruno validate and test\n * I have no idea why we encoded the raw value. We will see in testing and when upgrading our test projects.\n * // TODO remove comments when tested and verified.\n */\n // value: rawValue ? encodeURIComponent(rawValue) : \"\",\n value: Array.isArray(rawValue) ? rawValue : rawValue || \"\"\n };\n },\n /**\n * When taking value from the index, we can return the original value.\n * At that point the `transformFromStorage` does not need to do anything.\n *\n * We need to decode to support older systems.\n */\n fromIndex({ value }) {\n if (Array.isArray(value)) {\n return value.map(decodeURIComponent);\n }\n return value ? decodeURIComponent(value) : \"\";\n }\n});\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AAHA,eAIe,OAA2C;EACtDA,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,6CAA6C;EACnDC,SAAS,EAAE,WAAW;EACtBC,OAAO,CAAC;IAAEC;EAAS,CAAC,EAAE;IAClB;AACR;AACA;IACQ,OAAO;MACH;AACZ;AACA;AACA;AACA;MACY;MACAC,KAAK,EAAEC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,GAAGA,QAAQ,GAAGA,QAAQ,IAAI;IAC5D,CAAC;EACL,CAAC;EACD;AACJ;AACA;AACA;AACA;AACA;EACII,SAAS,CAAC;IAAEH;EAAM,CAAC,EAAE;IACjB,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK,CAACI,GAAG,CAACC,kBAAkB,CAAC;IACxC;IACA,OAAOL,KAAK,GAAGK,kBAAkB,CAACL,KAAK,CAAC,GAAG,EAAE;EACjD;AACJ,CAAC,CAAC;AAAA"}
@@ -1,3 +0,0 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
- declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
- export default _default;
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- const convertToString = value => {
8
- if (Array.isArray(value) === false) {
9
- return value;
10
- }
11
- return value.map(String);
12
- };
13
- const convertToFloat = value => {
14
- if (Array.isArray(value) === false) {
15
- return typeof value === "string" ? parseFloat(value) : value;
16
- }
17
- return value.map(v => parseFloat(v));
18
- };
19
- var _default = () => ({
20
- type: "cms-model-field-to-elastic-search",
21
- name: "cms-model-field-to-elastic-search-number",
22
- fieldType: "number",
23
- unmappedType: () => {
24
- return "float";
25
- },
26
- toIndex({
27
- value
28
- }) {
29
- return {
30
- value: convertToString(value)
31
- };
32
- },
33
- fromIndex({
34
- value
35
- }) {
36
- return convertToFloat(value);
37
- }
38
- });
39
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["convertToString","value","Array","isArray","map","String","convertToFloat","parseFloat","v","type","name","fieldType","unmappedType","toIndex","fromIndex"],"sources":["numberIndexing.ts"],"sourcesContent":["import { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nconst convertToString = (value: number[] | number) => {\n if (Array.isArray(value) === false) {\n return value;\n }\n return (value as number[]).map(String);\n};\n\nconst convertToFloat = (value: string[] | number) => {\n if (Array.isArray(value) === false) {\n return typeof value === \"string\" ? parseFloat(value) : value;\n }\n return (value as string[]).map(v => parseFloat(v));\n};\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-number\",\n fieldType: \"number\",\n unmappedType: () => {\n return \"float\";\n },\n toIndex({ value }) {\n return {\n value: convertToString(value)\n };\n },\n fromIndex({ value }) {\n return convertToFloat(value);\n }\n});\n"],"mappings":";;;;;;AAEA,MAAMA,eAAe,GAAIC,KAAwB,IAAK;EAClD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,KAAK,KAAK,EAAE;IAChC,OAAOA,KAAK;EAChB;EACA,OAAQA,KAAK,CAAcG,GAAG,CAACC,MAAM,CAAC;AAC1C,CAAC;AAED,MAAMC,cAAc,GAAIL,KAAwB,IAAK;EACjD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,KAAK,KAAK,EAAE;IAChC,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGM,UAAU,CAACN,KAAK,CAAC,GAAGA,KAAK;EAChE;EACA,OAAQA,KAAK,CAAcG,GAAG,CAACI,CAAC,IAAID,UAAU,CAACC,CAAC,CAAC,CAAC;AACtD,CAAC;AAAC,eAEa,OAA2C;EACtDC,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,0CAA0C;EAChDC,SAAS,EAAE,QAAQ;EACnBC,YAAY,EAAE,MAAM;IAChB,OAAO,OAAO;EAClB,CAAC;EACDC,OAAO,CAAC;IAAEZ;EAAM,CAAC,EAAE;IACf,OAAO;MACHA,KAAK,EAAED,eAAe,CAACC,KAAK;IAChC,CAAC;EACL,CAAC;EACDa,SAAS,CAAC;IAAEb;EAAM,CAAC,EAAE;IACjB,OAAOK,cAAc,CAACL,KAAK,CAAC;EAChC;AACJ,CAAC,CAAC;AAAA"}
@@ -1,12 +0,0 @@
1
- /**
2
- * TODO remove rawValue when field aliases and field types targeting will be active.
3
- *
4
- * Currently we use rawValue for the values that we do not want to be indexed.
5
- * When field aliases and types in the value path will be active, we can target the keys directly.
6
- *
7
- * This change will be incompatible with the current systems so we will need to release a major version.
8
- *
9
- */
10
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
11
- declare const _default: () => CmsModelFieldToElasticsearchPlugin;
12
- export default _default;
@@ -1,196 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /**
8
- * TODO remove rawValue when field aliases and field types targeting will be active.
9
- *
10
- * Currently we use rawValue for the values that we do not want to be indexed.
11
- * When field aliases and types in the value path will be active, we can target the keys directly.
12
- *
13
- * This change will be incompatible with the current systems so we will need to release a major version.
14
- *
15
- */
16
-
17
- const processToIndex = ({
18
- fields,
19
- value: sourceValue,
20
- rawValue: sourceRawValue,
21
- getFieldIndexPlugin,
22
- getFieldTypePlugin,
23
- plugins,
24
- model
25
- }) => {
26
- const reducer = (values, field) => {
27
- const plugin = getFieldIndexPlugin(field.type);
28
- if (!plugin || !plugin.toIndex) {
29
- return values;
30
- }
31
- const {
32
- value,
33
- rawValue
34
- } = plugin.toIndex({
35
- model,
36
- field,
37
- value: sourceValue[field.storageId],
38
- rawValue: sourceRawValue[field.storageId],
39
- getFieldIndexPlugin,
40
- getFieldTypePlugin,
41
- plugins
42
- });
43
- if (value !== undefined) {
44
- values.value[field.storageId] = value;
45
- }
46
- if (rawValue !== undefined) {
47
- values.rawValue[field.storageId] = rawValue;
48
- }
49
- return values;
50
- };
51
- return fields.reduce(reducer, {
52
- value: {},
53
- rawValue: {}
54
- });
55
- };
56
- const processFromIndex = ({
57
- fields,
58
- value: sourceValue,
59
- rawValue: sourceRawValue,
60
- getFieldIndexPlugin,
61
- getFieldTypePlugin,
62
- plugins,
63
- model
64
- }) => {
65
- const reducer = (values, field) => {
66
- const plugin = getFieldIndexPlugin(field.type);
67
- if (!plugin || !plugin.fromIndex) {
68
- return values;
69
- }
70
- const value = plugin.fromIndex({
71
- plugins,
72
- model,
73
- field,
74
- value: sourceValue[field.storageId],
75
- rawValue: sourceRawValue[field.storageId],
76
- getFieldIndexPlugin,
77
- getFieldTypePlugin
78
- });
79
- if (value !== undefined) {
80
- values[field.storageId] = value;
81
- }
82
- return values;
83
- };
84
- return fields.reduce(reducer, {});
85
- };
86
- var _default = () => ({
87
- type: "cms-model-field-to-elastic-search",
88
- name: "cms-model-field-to-elastic-search-object",
89
- fieldType: "object",
90
- toIndex({
91
- plugins,
92
- model,
93
- field,
94
- value: initialValue,
95
- rawValue: initialRawValue,
96
- getFieldIndexPlugin,
97
- getFieldTypePlugin
98
- }) {
99
- var _field$settings;
100
- if (!initialValue) {
101
- return {
102
- value: null
103
- };
104
- }
105
- const fields = ((_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.fields) || [];
106
-
107
- /**
108
- * In "object" field, value is either an object or an array of objects.
109
- */
110
- if (field.multipleValues) {
111
- const result = {
112
- value: [],
113
- rawValue: []
114
- };
115
- for (const key in initialValue) {
116
- const {
117
- value,
118
- rawValue
119
- } = processToIndex({
120
- value: initialValue[key],
121
- rawValue: initialRawValue[key],
122
- getFieldIndexPlugin,
123
- getFieldTypePlugin,
124
- model,
125
- plugins,
126
- fields
127
- });
128
- if (Object.keys(value).length > 0) {
129
- result.value.push(value);
130
- }
131
- if (Object.keys(rawValue).length > 0) {
132
- result.rawValue.push(rawValue);
133
- }
134
- }
135
- return {
136
- value: result.value.length > 0 ? result.value : undefined,
137
- rawValue: result.rawValue.length > 0 ? result.rawValue : undefined
138
- };
139
- }
140
- return processToIndex({
141
- value: initialValue,
142
- rawValue: initialRawValue,
143
- getFieldIndexPlugin,
144
- getFieldTypePlugin,
145
- model,
146
- plugins,
147
- fields
148
- });
149
- },
150
- fromIndex({
151
- field,
152
- value,
153
- rawValue,
154
- model,
155
- plugins,
156
- getFieldIndexPlugin,
157
- getFieldTypePlugin
158
- }) {
159
- var _field$settings2;
160
- if (!value) {
161
- return null;
162
- }
163
- const fields = ((_field$settings2 = field.settings) === null || _field$settings2 === void 0 ? void 0 : _field$settings2.fields) || [];
164
-
165
- /**
166
- * In "object" field, value is either an object or an array of objects.
167
- */
168
- if (field.multipleValues) {
169
- /**
170
- * Why this `value || rawValue || []`?
171
- * It's possible that an object contains all non-indexable fields, or vice-versa, and so
172
- * we can never be sure which array we can reliably use as a source of values.
173
- */
174
- const source = value || rawValue || [];
175
- return source.map((_, index) => processFromIndex({
176
- value: value ? value[index] || {} : {},
177
- rawValue: rawValue ? rawValue[index] || {} : {},
178
- getFieldIndexPlugin,
179
- getFieldTypePlugin,
180
- model,
181
- plugins,
182
- fields
183
- }));
184
- }
185
- return processFromIndex({
186
- value,
187
- rawValue,
188
- getFieldIndexPlugin,
189
- getFieldTypePlugin,
190
- model,
191
- plugins,
192
- fields
193
- });
194
- }
195
- });
196
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["processToIndex","fields","value","sourceValue","rawValue","sourceRawValue","getFieldIndexPlugin","getFieldTypePlugin","plugins","model","reducer","values","field","plugin","type","toIndex","storageId","undefined","reduce","processFromIndex","fromIndex","name","fieldType","initialValue","initialRawValue","settings","multipleValues","result","key","Object","keys","length","push","source","map","_","index"],"sources":["objectIndexing.ts"],"sourcesContent":["/**\n * TODO remove rawValue when field aliases and field types targeting will be active.\n *\n * Currently we use rawValue for the values that we do not want to be indexed.\n * When field aliases and types in the value path will be active, we can target the keys directly.\n *\n * This change will be incompatible with the current systems so we will need to release a major version.\n *\n */\n\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\nimport {\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"@webiny/api-headless-cms/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\ninterface ProcessToIndex {\n (params: {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue: Record<string, any>;\n getFieldIndexPlugin: (fieldType: string) => CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin: (fieldType: string) => CmsModelFieldToGraphQLPlugin;\n plugins: PluginsContainer;\n model: CmsModel;\n }): Record<\"value\" | \"rawValue\", Record<string, any>>;\n}\n\ninterface ProcessFromIndex {\n (params: {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue: Record<string, any>;\n getFieldIndexPlugin: (fieldType: string) => CmsModelFieldToElasticsearchPlugin;\n getFieldTypePlugin: (fieldType: string) => CmsModelFieldToGraphQLPlugin;\n plugins: PluginsContainer;\n model: CmsModel;\n }): Record<string, any>;\n}\n\ninterface ReducerValue {\n value: {\n [key: string]: string;\n };\n rawValue: {\n [key: string]: string;\n };\n}\n\nconst processToIndex: ProcessToIndex = ({\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndexPlugin,\n getFieldTypePlugin,\n plugins,\n model\n}) => {\n const reducer = (values: ReducerValue, field: CmsModelField) => {\n const plugin = getFieldIndexPlugin(field.type);\n if (!plugin || !plugin.toIndex) {\n return values;\n }\n const { value, rawValue } = plugin.toIndex({\n model,\n field,\n value: sourceValue[field.storageId],\n rawValue: sourceRawValue[field.storageId],\n getFieldIndexPlugin,\n getFieldTypePlugin,\n plugins\n });\n\n if (value !== undefined) {\n values.value[field.storageId] = value;\n }\n if (rawValue !== undefined) {\n values.rawValue[field.storageId] = rawValue;\n }\n\n return values;\n };\n\n return fields.reduce(reducer, { value: {}, rawValue: {} });\n};\nconst processFromIndex: ProcessFromIndex = ({\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndexPlugin,\n getFieldTypePlugin,\n plugins,\n model\n}) => {\n const reducer = (values: Record<string, string>, field: CmsModelField) => {\n const plugin = getFieldIndexPlugin(field.type);\n if (!plugin || !plugin.fromIndex) {\n return values;\n }\n const value = plugin.fromIndex({\n plugins,\n model,\n field,\n value: sourceValue[field.storageId],\n rawValue: sourceRawValue[field.storageId],\n getFieldIndexPlugin,\n getFieldTypePlugin\n });\n\n if (value !== undefined) {\n values[field.storageId] = value;\n }\n\n return values;\n };\n\n return fields.reduce(reducer, {});\n};\n\ninterface ToIndexMultipleFieldValue {\n value: Record<string, string>[];\n rawValue: Record<string, string>[];\n}\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-object\",\n fieldType: \"object\",\n toIndex({\n plugins,\n model,\n field,\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndexPlugin,\n getFieldTypePlugin\n }) {\n if (!initialValue) {\n return { value: null };\n }\n\n const fields = (field.settings?.fields || []) as CmsModelField[];\n\n /**\n * In \"object\" field, value is either an object or an array of objects.\n */\n if (field.multipleValues) {\n const result: ToIndexMultipleFieldValue = {\n value: [],\n rawValue: []\n };\n for (const key in initialValue) {\n const { value, rawValue } = processToIndex({\n value: initialValue[key],\n rawValue: initialRawValue[key],\n getFieldIndexPlugin,\n getFieldTypePlugin,\n model,\n plugins,\n fields\n });\n if (Object.keys(value).length > 0) {\n result.value.push(value);\n }\n\n if (Object.keys(rawValue).length > 0) {\n result.rawValue.push(rawValue);\n }\n }\n\n return {\n value: result.value.length > 0 ? result.value : undefined,\n rawValue: result.rawValue.length > 0 ? result.rawValue : undefined\n };\n }\n\n return processToIndex({\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndexPlugin,\n getFieldTypePlugin,\n model,\n plugins,\n fields\n });\n },\n fromIndex({ field, value, rawValue, model, plugins, getFieldIndexPlugin, getFieldTypePlugin }) {\n if (!value) {\n return null;\n }\n\n const fields = field.settings?.fields || [];\n\n /**\n * In \"object\" field, value is either an object or an array of objects.\n */\n if (field.multipleValues) {\n /**\n * Why this `value || rawValue || []`?\n * It's possible that an object contains all non-indexable fields, or vice-versa, and so\n * we can never be sure which array we can reliably use as a source of values.\n */\n const source = value || rawValue || [];\n\n return source.map((_: any, index: number) =>\n processFromIndex({\n value: value ? value[index] || {} : {},\n rawValue: rawValue ? rawValue[index] || {} : {},\n getFieldIndexPlugin,\n getFieldTypePlugin,\n model,\n plugins,\n fields\n })\n );\n }\n\n return processFromIndex({\n value,\n rawValue,\n getFieldIndexPlugin,\n getFieldTypePlugin,\n model,\n plugins,\n fields\n });\n }\n});\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA2CA,MAAMA,cAA8B,GAAG,CAAC;EACpCC,MAAM;EACNC,KAAK,EAAEC,WAAW;EAClBC,QAAQ,EAAEC,cAAc;EACxBC,mBAAmB;EACnBC,kBAAkB;EAClBC,OAAO;EACPC;AACJ,CAAC,KAAK;EACF,MAAMC,OAAO,GAAG,CAACC,MAAoB,EAAEC,KAAoB,KAAK;IAC5D,MAAMC,MAAM,GAAGP,mBAAmB,CAACM,KAAK,CAACE,IAAI,CAAC;IAC9C,IAAI,CAACD,MAAM,IAAI,CAACA,MAAM,CAACE,OAAO,EAAE;MAC5B,OAAOJ,MAAM;IACjB;IACA,MAAM;MAAET,KAAK;MAAEE;IAAS,CAAC,GAAGS,MAAM,CAACE,OAAO,CAAC;MACvCN,KAAK;MACLG,KAAK;MACLV,KAAK,EAAEC,WAAW,CAACS,KAAK,CAACI,SAAS,CAAC;MACnCZ,QAAQ,EAAEC,cAAc,CAACO,KAAK,CAACI,SAAS,CAAC;MACzCV,mBAAmB;MACnBC,kBAAkB;MAClBC;IACJ,CAAC,CAAC;IAEF,IAAIN,KAAK,KAAKe,SAAS,EAAE;MACrBN,MAAM,CAACT,KAAK,CAACU,KAAK,CAACI,SAAS,CAAC,GAAGd,KAAK;IACzC;IACA,IAAIE,QAAQ,KAAKa,SAAS,EAAE;MACxBN,MAAM,CAACP,QAAQ,CAACQ,KAAK,CAACI,SAAS,CAAC,GAAGZ,QAAQ;IAC/C;IAEA,OAAOO,MAAM;EACjB,CAAC;EAED,OAAOV,MAAM,CAACiB,MAAM,CAACR,OAAO,EA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BE,KAAK;MACLD,OAAO;MACPP;IACJ,CAAC,CAAC;EACN,CAAC;EACDmB,SAAS,CAAC;IAAER,KAAK;IAAEV,KAAK;IAAEE,QAAQ;IAAEK,KAAK;IAAED,OAAO;IAAEF,mBAAmB;IAAEC;EAAmB,CAAC,EAAE;IAAA;IAC3F,IAAI,CAACL,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IAEA,MAAMD,MAAM,GAAG,qBAAAW,KAAK,CAACa,QAAQ,qDAAd,iBAAgBxB,MAAM,KAAI,EAAE;;IAE3C;AACR;AACA;IACQ,IAAIW,KAAK,CAACc,cAAc,EAAE;MACtB;AACZ;AACA;AACA;AACA;MACY,MAAMO,MAAM,GAAG/B,KAAK,IAAIE,QAAQ,IAAI,EAAE;MAEtC,OAAO6B,MAAM,CAACC,GAAG,CAAC,CAACC,CAAM,EAAEC,KAAa,KACpCjB,gBAAgB,CAAC;QACbjB,KAAK,EAAEA,KAAK,GAAGA,KAAK,CAACkC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACtChC,QAAQ,EAAEA,QAAQ,GAAGA,QAAQ,CAACgC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAC/C9B,mBAAmB;QACnBC,kBAAkB;QAClBE,KAAK;QACLD,OAAO;QACPP;MACJ,CAAC,CAAC,CACL;IACL;IAEA,OAAOkB,gBAAgB,CAAC;MACpBjB,KAAK;MACLE,QAAQ;MACRE,mBAAmB;MACnBC,kBAAkB;MAClBE,KAAK;MACLD,OAAO;MACPP;IACJ,CAAC,CAAC;EACN;AACJ,CAAC,CAAC;AAAA"}
@@ -1,3 +0,0 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
- declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
- export default _default;
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _default = () => ({
8
- type: "cms-model-field-to-elastic-search",
9
- name: "cms-model-field-to-elastic-search-rich-text",
10
- fieldType: "rich-text",
11
- toIndex({
12
- value
13
- }) {
14
- // TODO: convert rich-text object to a searchable string to offer full-text search at some point
15
-
16
- /**
17
- * We want to store rich-text value as a "rawValue", meaning it wont' be indexed by ES.
18
- */
19
- return {
20
- rawValue: value
21
- };
22
- },
23
- fromIndex({
24
- rawValue
25
- }) {
26
- return rawValue;
27
- }
28
- });
29
- exports.default = _default;