@webiny/api-headless-cms-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f

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 (325) hide show
  1. package/configurations.d.ts +15 -8
  2. package/configurations.js +29 -12
  3. package/configurations.js.map +1 -0
  4. package/definitions/entry.d.ts +6 -5
  5. package/definitions/entry.js +111 -20
  6. package/definitions/entry.js.map +1 -0
  7. package/definitions/entryElasticsearch.d.ts +6 -5
  8. package/definitions/entryElasticsearch.js +11 -16
  9. package/definitions/entryElasticsearch.js.map +1 -0
  10. package/definitions/group.d.ts +6 -5
  11. package/definitions/group.js +8 -16
  12. package/definitions/group.js.map +1 -0
  13. package/definitions/model.d.ts +6 -5
  14. package/definitions/model.js +30 -16
  15. package/definitions/model.js.map +1 -0
  16. package/definitions/system.d.ts +6 -5
  17. package/definitions/system.js +8 -16
  18. package/definitions/system.js.map +1 -0
  19. package/definitions/table.d.ts +6 -6
  20. package/definitions/table.js +7 -6
  21. package/definitions/table.js.map +1 -0
  22. package/definitions/tableElasticsearch.d.ts +6 -6
  23. package/definitions/tableElasticsearch.js +7 -6
  24. package/definitions/tableElasticsearch.js.map +1 -0
  25. package/dynamoDb/index.d.ts +2 -1
  26. package/dynamoDb/index.js +10 -12
  27. package/dynamoDb/index.js.map +1 -0
  28. package/dynamoDb/storage/longText.d.ts +7 -4
  29. package/dynamoDb/storage/longText.js +75 -62
  30. package/dynamoDb/storage/longText.js.map +1 -0
  31. package/dynamoDb/storage/richText.d.ts +2 -8
  32. package/dynamoDb/storage/richText.js +49 -100
  33. package/dynamoDb/storage/richText.js.map +1 -0
  34. package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
  35. package/elasticsearch/createElasticsearchIndex.js +40 -0
  36. package/elasticsearch/createElasticsearchIndex.js.map +1 -0
  37. package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
  38. package/elasticsearch/deleteElasticsearchIndex.js +38 -0
  39. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
  40. package/elasticsearch/index.d.ts +1 -1
  41. package/elasticsearch/index.js +3 -6
  42. package/elasticsearch/index.js.map +1 -0
  43. package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
  44. package/elasticsearch/indexing/dateTimeIndexing.js +21 -22
  45. package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
  46. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
  47. package/elasticsearch/indexing/defaultFieldIndexing.js +17 -10
  48. package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
  49. package/elasticsearch/indexing/index.js +5 -11
  50. package/elasticsearch/indexing/index.js.map +1 -0
  51. package/elasticsearch/indexing/jsonIndexing.d.ts +2 -0
  52. package/elasticsearch/indexing/jsonIndexing.js +28 -0
  53. package/elasticsearch/indexing/jsonIndexing.js.map +1 -0
  54. package/elasticsearch/indexing/longTextIndexing.d.ts +5 -1
  55. package/elasticsearch/indexing/longTextIndexing.js +16 -10
  56. package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
  57. package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
  58. package/elasticsearch/indexing/numberIndexing.js +2 -9
  59. package/elasticsearch/indexing/numberIndexing.js.map +1 -0
  60. package/elasticsearch/indexing/objectIndexing.d.ts +10 -1
  61. package/elasticsearch/indexing/objectIndexing.js +37 -36
  62. package/elasticsearch/indexing/objectIndexing.js.map +1 -0
  63. package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
  64. package/elasticsearch/indexing/richTextIndexing.js +2 -5
  65. package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
  66. package/elasticsearch/indices/base.d.ts +2 -0
  67. package/elasticsearch/indices/base.js +13 -0
  68. package/elasticsearch/indices/base.js.map +1 -0
  69. package/elasticsearch/indices/index.d.ts +1 -0
  70. package/elasticsearch/indices/index.js +14 -0
  71. package/elasticsearch/indices/index.js.map +1 -0
  72. package/elasticsearch/indices/japanese.d.ts +2 -0
  73. package/elasticsearch/indices/japanese.js +14 -0
  74. package/elasticsearch/indices/japanese.js.map +1 -0
  75. package/elasticsearch/search/index.d.ts +2 -2
  76. package/elasticsearch/search/index.js +6 -9
  77. package/elasticsearch/search/index.js.map +1 -0
  78. package/elasticsearch/search/refSearch.d.ts +2 -3
  79. package/elasticsearch/search/refSearch.js +24 -17
  80. package/elasticsearch/search/refSearch.js.map +1 -0
  81. package/elasticsearch/search/searchableJson.d.ts +2 -0
  82. package/elasticsearch/search/searchableJson.js +60 -0
  83. package/elasticsearch/search/searchableJson.js.map +1 -0
  84. package/elasticsearch/search/timeSearch.d.ts +2 -3
  85. package/elasticsearch/search/timeSearch.js +18 -16
  86. package/elasticsearch/search/timeSearch.js.map +1 -0
  87. package/helpers/entryIndexHelpers.d.ts +3 -3
  88. package/helpers/entryIndexHelpers.js +59 -58
  89. package/helpers/entryIndexHelpers.js.map +1 -0
  90. package/helpers/fieldIdentifier.d.ts +6 -0
  91. package/helpers/fieldIdentifier.js +43 -0
  92. package/helpers/fieldIdentifier.js.map +1 -0
  93. package/helpers/index.d.ts +1 -1
  94. package/helpers/index.js +11 -13
  95. package/helpers/index.js.map +1 -0
  96. package/index.d.ts +2 -1
  97. package/index.js +132 -78
  98. package/index.js.map +1 -0
  99. package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
  100. package/operations/entry/dataLoader/DataLoaderCache.js +41 -0
  101. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  102. package/operations/entry/dataLoader/constants.d.ts +1 -0
  103. package/operations/entry/dataLoader/constants.js +10 -0
  104. package/operations/entry/dataLoader/constants.js.map +1 -0
  105. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  106. package/operations/entry/dataLoader/createBatchScheduleFn.js +25 -0
  107. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  108. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  109. package/operations/entry/dataLoader/getAllEntryRevisions.js +45 -0
  110. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  111. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  112. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +52 -0
  113. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  114. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  115. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +52 -0
  116. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  117. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  118. package/operations/entry/dataLoader/getRevisionById.js +62 -0
  119. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  120. package/operations/entry/dataLoader/index.d.ts +8 -0
  121. package/operations/entry/dataLoader/index.js +40 -0
  122. package/operations/entry/dataLoader/index.js.map +1 -0
  123. package/operations/entry/dataLoader/types.d.ts +6 -0
  124. package/operations/entry/dataLoader/types.js +7 -0
  125. package/operations/entry/dataLoader/types.js.map +1 -0
  126. package/operations/entry/dataLoaders.d.ts +21 -38
  127. package/operations/entry/dataLoaders.js +59 -290
  128. package/operations/entry/dataLoaders.js.map +1 -0
  129. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
  130. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +34 -0
  131. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
  132. package/operations/entry/elasticsearch/body.d.ts +13 -0
  133. package/operations/entry/elasticsearch/body.js +142 -0
  134. package/operations/entry/elasticsearch/body.js.map +1 -0
  135. package/operations/entry/elasticsearch/fields.d.ts +10 -0
  136. package/operations/entry/elasticsearch/fields.js +315 -0
  137. package/operations/entry/elasticsearch/fields.js.map +1 -0
  138. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
  139. package/operations/entry/elasticsearch/filtering/applyFiltering.js +60 -0
  140. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
  141. package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
  142. package/operations/entry/elasticsearch/filtering/exec.js +175 -0
  143. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
  144. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
  145. package/operations/entry/elasticsearch/filtering/index.js +18 -0
  146. package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
  147. package/operations/entry/elasticsearch/filtering/path.d.ts +16 -0
  148. package/operations/entry/elasticsearch/filtering/path.js +48 -0
  149. package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
  150. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
  151. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +30 -0
  152. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
  153. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
  154. package/operations/entry/elasticsearch/filtering/plugins/index.js +15 -0
  155. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
  156. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
  157. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +69 -0
  158. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
  159. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
  160. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +57 -0
  161. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
  162. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
  163. package/operations/entry/elasticsearch/filtering/populated.js +25 -0
  164. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
  165. package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
  166. package/operations/entry/elasticsearch/filtering/values.js +24 -0
  167. package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
  168. package/operations/entry/elasticsearch/fullTextSearch.d.ts +12 -0
  169. package/operations/entry/elasticsearch/fullTextSearch.js +91 -0
  170. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
  171. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
  172. package/operations/entry/elasticsearch/fullTextSearchFields.js +27 -0
  173. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
  174. package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
  175. package/operations/entry/elasticsearch/initialQuery.js +106 -0
  176. package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
  177. package/operations/entry/elasticsearch/keyword.d.ts +2 -0
  178. package/operations/entry/elasticsearch/keyword.js +36 -0
  179. package/operations/entry/elasticsearch/keyword.js.map +1 -0
  180. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +9 -0
  181. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +26 -0
  182. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +1 -0
  183. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
  184. package/operations/entry/elasticsearch/plugins/bodyModifier.js +18 -0
  185. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
  186. package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
  187. package/operations/entry/elasticsearch/plugins/operator.js +39 -0
  188. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
  189. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
  190. package/operations/entry/elasticsearch/plugins/queryModifier.js +18 -0
  191. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
  192. package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
  193. package/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +9 -9
  194. package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
  195. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
  196. package/operations/entry/elasticsearch/plugins/sortModifier.js +18 -0
  197. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
  198. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
  199. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +13 -0
  200. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
  201. package/operations/entry/elasticsearch/sort.d.ts +12 -0
  202. package/operations/entry/elasticsearch/sort.js +89 -0
  203. package/operations/entry/elasticsearch/sort.js.map +1 -0
  204. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
  205. package/operations/entry/elasticsearch/transformValueForSearch.js +32 -0
  206. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
  207. package/operations/entry/elasticsearch/types.d.ts +41 -0
  208. package/operations/entry/elasticsearch/types.js +7 -0
  209. package/operations/entry/elasticsearch/types.js.map +1 -0
  210. package/operations/entry/index.d.ts +6 -8
  211. package/operations/entry/index.js +1422 -693
  212. package/operations/entry/index.js.map +1 -0
  213. package/operations/entry/keys.js +2 -9
  214. package/operations/entry/keys.js.map +1 -0
  215. package/operations/entry/recordType.d.ts +3 -0
  216. package/operations/entry/recordType.js +20 -0
  217. package/operations/entry/recordType.js.map +1 -0
  218. package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
  219. package/operations/entry/transformations/convertEntryKeys.js +38 -0
  220. package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
  221. package/operations/entry/transformations/index.d.ts +29 -0
  222. package/operations/entry/transformations/index.js +127 -0
  223. package/operations/entry/transformations/index.js.map +1 -0
  224. package/operations/entry/transformations/modifyEntryValues.d.ts +58 -0
  225. package/operations/entry/transformations/modifyEntryValues.js +28 -0
  226. package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
  227. package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
  228. package/operations/entry/transformations/transformEntryKeys.js +27 -0
  229. package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
  230. package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
  231. package/operations/entry/transformations/transformEntryToIndex.js +31 -0
  232. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
  233. package/operations/group/index.d.ts +5 -5
  234. package/operations/group/index.js +40 -63
  235. package/operations/group/index.js.map +1 -0
  236. package/operations/model/index.d.ts +5 -5
  237. package/operations/model/index.js +56 -78
  238. package/operations/model/index.js.map +1 -0
  239. package/operations/system/index.d.ts +4 -4
  240. package/operations/system/index.js +20 -31
  241. package/operations/system/index.js.map +1 -0
  242. package/operations/system/indexes.d.ts +10 -0
  243. package/operations/system/indexes.js +41 -0
  244. package/operations/system/indexes.js.map +1 -0
  245. package/package.json +38 -40
  246. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +69 -0
  247. package/plugins/CmsElasticsearchModelFieldPlugin.js +52 -0
  248. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -0
  249. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +9 -4
  250. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +10 -13
  251. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
  252. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
  253. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +27 -0
  254. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
  255. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
  256. package/plugins/CmsEntryElasticsearchIndexPlugin.js +13 -0
  257. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
  258. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +32 -0
  259. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +40 -0
  260. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
  261. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +6 -4
  262. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +10 -13
  263. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
  264. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +6 -4
  265. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +10 -13
  266. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
  267. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +33 -0
  268. package/plugins/CmsEntryElasticsearchValuesModifier.js +50 -0
  269. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -0
  270. package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
  271. package/plugins/CmsEntryFilterPlugin.js +22 -0
  272. package/plugins/CmsEntryFilterPlugin.js.map +1 -0
  273. package/plugins/index.d.ts +8 -0
  274. package/plugins/index.js +95 -0
  275. package/plugins/index.js.map +1 -0
  276. package/tasks/createIndexTaskPlugin.d.ts +2 -0
  277. package/tasks/createIndexTaskPlugin.js +67 -0
  278. package/tasks/createIndexTaskPlugin.js.map +1 -0
  279. package/types.d.ts +30 -52
  280. package/types.js +5 -23
  281. package/types.js.map +1 -0
  282. package/values/NoValueContainer.d.ts +5 -0
  283. package/values/NoValueContainer.js +20 -0
  284. package/values/NoValueContainer.js.map +1 -0
  285. package/definitions/settings.d.ts +0 -8
  286. package/definitions/settings.js +0 -62
  287. package/dynamoDb/storage/date.d.ts +0 -3
  288. package/dynamoDb/storage/date.js +0 -65
  289. package/helpers/createElasticsearchQueryBody.d.ts +0 -11
  290. package/helpers/createElasticsearchQueryBody.js +0 -375
  291. package/helpers/fields.d.ts +0 -77
  292. package/helpers/fields.js +0 -174
  293. package/helpers/operatorPluginsList.d.ts +0 -7
  294. package/helpers/operatorPluginsList.js +0 -30
  295. package/helpers/searchPluginsList.d.ts +0 -6
  296. package/helpers/transformValueForSearch.d.ts +0 -9
  297. package/helpers/transformValueForSearch.js +0 -26
  298. package/operations/entry/elasticsearchFields.d.ts +0 -2
  299. package/operations/entry/elasticsearchFields.js +0 -32
  300. package/operations/entry/fields.d.ts +0 -3
  301. package/operations/entry/fields.js +0 -60
  302. package/operations/settings/index.d.ts +0 -6
  303. package/operations/settings/index.js +0 -141
  304. package/operations/system/createElasticsearchTemplate.d.ts +0 -5
  305. package/operations/system/createElasticsearchTemplate.js +0 -62
  306. package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
  307. package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
  308. package/upgrades/index.d.ts +0 -2
  309. package/upgrades/index.js +0 -16
  310. package/upgrades/utils.d.ts +0 -1
  311. package/upgrades/utils.js +0 -16
  312. package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +0 -6
  313. package/upgrades/v5.0.0/cleanDatabaseRecord.js +0 -16
  314. package/upgrades/v5.0.0/createOldVersionIndiceName.d.ts +0 -2
  315. package/upgrades/v5.0.0/createOldVersionIndiceName.js +0 -12
  316. package/upgrades/v5.0.0/entryValueFixer.d.ts +0 -4
  317. package/upgrades/v5.0.0/entryValueFixer.js +0 -124
  318. package/upgrades/v5.0.0/fieldFinder.d.ts +0 -6
  319. package/upgrades/v5.0.0/fieldFinder.js +0 -42
  320. package/upgrades/v5.0.0/helpers.d.ts +0 -4
  321. package/upgrades/v5.0.0/helpers.js +0 -57
  322. package/upgrades/v5.0.0/index.d.ts +0 -4
  323. package/upgrades/v5.0.0/index.js +0 -232
  324. package/upgrades/v5.8.0/index.d.ts +0 -4
  325. package/upgrades/v5.8.0/index.js +0 -426
@@ -0,0 +1,38 @@
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
+ client,
11
+ model
12
+ } = params;
13
+ const {
14
+ index
15
+ } = _configurations.configurations.es({
16
+ model
17
+ });
18
+ const {
19
+ body: exists
20
+ } = await client.indices.exists({
21
+ index
22
+ });
23
+ if (!exists) {
24
+ return;
25
+ }
26
+ try {
27
+ await client.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;
37
+
38
+ //# sourceMappingURL=deleteElasticsearchIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_configurations","require","deleteElasticsearchIndex","params","client","model","index","configurations","es","body","exists","indices","delete","ignore_unavailable","ex","console","log","message","exports"],"sources":["deleteElasticsearchIndex.ts"],"sourcesContent":["import type { Client } from \"@elastic/elasticsearch\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { configurations } from \"~/configurations\";\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"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AAOO,MAAMC,wBAAwB,GAAG,MACpCC,MAAsC,IACtB;EAChB,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEhC,MAAM;IAAEG;EAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;IAChCH;EACJ,CAAC,CAAC;EACF,MAAM;IAAEI,IAAI,EAAEC;EAAO,CAAC,GAAG,MAAMN,MAAM,CAACO,OAAO,CAACD,MAAM,CAAC;IACjDJ;EACJ,CAAC,CAAC;EACF,IAAI,CAACI,MAAM,EAAE;IACT;EACJ;EAEA,IAAI;IACA,MAAMN,MAAM,CAACO,OAAO,CAACC,MAAM,CAAC;MACxBN,KAAK;MACLO,kBAAkB,EAAE;IACxB,CAAC,CAAC;EACN,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,GAAG,CAAC,yCAAyCV,KAAK,2BAA2B,CAAC;IACtFS,OAAO,CAACC,GAAG,CAACF,EAAE,CAACG,OAAO,CAAC;EAC3B;AACJ,CAAC;AAACC,OAAA,CAAAhB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- declare const _default: () => (import("../types").CmsModelFieldToElasticsearchPlugin[] | import("../types").ElasticsearchQueryBuilderValueSearchPlugin[])[];
1
+ declare const _default: () => (import("../types").CmsModelFieldToElasticsearchPlugin[] | import("..").CmsEntryElasticsearchQueryBuilderValueSearchPlugin[])[];
2
2
  export default _default;
@@ -1,16 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _indexing = _interopRequireDefault(require("./indexing"));
11
-
12
9
  var _search = _interopRequireDefault(require("./search"));
13
-
14
10
  var _default = () => [(0, _indexing.default)(), (0, _search.default)()];
11
+ exports.default = _default;
15
12
 
16
- exports.default = _default;
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_indexing","_interopRequireDefault","require","_search","_default","elasticsearchIndexingPlugins","elasticsearchSearchPlugins","exports","default"],"sources":["index.ts"],"sourcesContent":["import elasticsearchIndexingPlugins from \"./indexing\";\nimport elasticsearchSearchPlugins from \"./search\";\n\nexport default () => [elasticsearchIndexingPlugins(), elasticsearchSearchPlugins()];\n"],"mappings":";;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAkD,IAAAE,QAAA,GAEnCA,CAAA,KAAM,CAAC,IAAAC,iBAA4B,EAAC,CAAC,EAAE,IAAAC,eAA0B,EAAC,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAJ,QAAA","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
1
+ import type { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
2
  declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
3
  export default _default;
@@ -4,37 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  const convertTimeToNumber = time => {
9
8
  if (!time) {
10
9
  return null;
11
10
  }
12
-
13
11
  const [hours, minutes, seconds = 0] = time.split(":").map(Number);
14
12
  return hours * 60 * 60 + minutes * 60 + seconds;
15
13
  };
16
-
17
14
  const convertNumberToTime = value => {
18
15
  if (value === undefined || value === null) {
19
16
  return null;
20
- } // TODO remove when v5 goes out
17
+ }
18
+ // TODO remove when v5 goes out
21
19
  // this is a fix for pre beta.5
22
-
23
-
24
20
  if (String(value).match(/^([0-9]{2}):([0-9]{2})/) !== null) {
25
21
  return String(value);
26
- } //
27
-
28
-
22
+ }
23
+ //
29
24
  const hours = Math.floor(value / 60 / 60);
30
25
  const minutes = Math.floor((value - hours * 60 * 60) / 60);
31
26
  const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);
32
27
  return [hours, minutes, seconds].map(v => String(v).padStart(2, "0")).join(":");
33
28
  };
34
-
35
29
  const convertValueFromIndex = (value, field) => {
36
- const type = field.settings.type;
37
-
30
+ const type = field.settings?.type;
38
31
  if (type === "time") {
39
32
  return convertNumberToTime(value);
40
33
  } else if (!value) {
@@ -43,22 +36,18 @@ const convertValueFromIndex = (value, field) => {
43
36
  return value;
44
37
  } else if (type === "date") {
45
38
  const dateValue = new Date(value);
46
- return dateValue.toISOString().substr(0, 10);
39
+ return dateValue.toISOString().slice(0, 10);
47
40
  }
48
-
49
41
  return new Date(value).toISOString();
50
42
  };
51
-
52
43
  const convertValueToIndex = (value, field) => {
53
44
  if (!value) {
54
45
  return null;
55
- } else if (field.settings.type === "time") {
46
+ } else if (field.settings?.type === "time") {
56
47
  return convertTimeToNumber(value);
57
48
  }
58
-
59
49
  return value;
60
50
  };
61
-
62
51
  var _default = () => ({
63
52
  type: "cms-model-field-to-elastic-search",
64
53
  name: "cms-model-field-to-elastic-search-datetime",
@@ -66,24 +55,34 @@ var _default = () => ({
66
55
  unmappedType: () => {
67
56
  return "date";
68
57
  },
69
-
70
58
  toIndex({
71
59
  field,
72
60
  value
73
61
  }) {
62
+ if (Array.isArray(value) === true) {
63
+ return {
64
+ value: value.map(v => {
65
+ return convertValueToIndex(v, field);
66
+ })
67
+ };
68
+ }
74
69
  const dateValue = convertValueToIndex(value, field);
75
70
  return {
76
71
  value: dateValue
77
72
  };
78
73
  },
79
-
80
74
  fromIndex({
81
75
  field,
82
76
  value
83
77
  }) {
78
+ if (Array.isArray(value)) {
79
+ return value.map(v => {
80
+ return convertValueFromIndex(v, field);
81
+ });
82
+ }
84
83
  return convertValueFromIndex(value, field);
85
84
  }
86
-
87
85
  });
86
+ exports.default = _default;
88
87
 
89
- exports.default = _default;
88
+ //# sourceMappingURL=dateTimeIndexing.js.map
@@ -0,0 +1 @@
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","_default","name","fieldType","unmappedType","toIndex","Array","isArray","fromIndex","exports","default"],"sources":["dateTimeIndexing.ts"],"sourcesContent":["import type { CmsModelDateTimeField } from \"@webiny/api-headless-cms/types\";\nimport type { 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":"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","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
1
+ import type { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
2
  declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
3
  export default _default;
@@ -4,32 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _default = () => ({
9
8
  type: "cms-model-field-to-elastic-search",
10
9
  name: "cms-model-field-to-elastic-search-default",
11
10
  fieldType: "*",
12
-
13
11
  toIndex({
14
12
  field,
15
13
  getFieldTypePlugin,
16
14
  value
17
15
  }) {
18
- const fieldTypePlugin = getFieldTypePlugin(field.type); // when field is searchable, assign it to `values`
16
+ const fieldTypePlugin = getFieldTypePlugin(field.type);
19
17
 
18
+ // when field is searchable, assign it to `values`
20
19
  if (fieldTypePlugin.isSearchable === true) {
21
20
  return {
22
21
  value
23
22
  };
24
- } // when field is not searchable, move its value to `rawValues`.
25
- // `rawValues` is a field in ES index that's not being indexed.
26
-
23
+ }
27
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.
28
27
  return {
29
28
  rawValue: value
30
29
  };
31
30
  },
32
-
33
31
  fromIndex({
34
32
  field,
35
33
  getFieldTypePlugin,
@@ -39,9 +37,18 @@ var _default = () => ({
39
37
  const {
40
38
  isSearchable
41
39
  } = getFieldTypePlugin(field.type);
42
- return isSearchable === true ? value : rawValue;
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;
43
50
  }
44
-
45
51
  });
52
+ exports.default = _default;
46
53
 
47
- exports.default = _default;
54
+ //# sourceMappingURL=defaultFieldIndexing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_default","type","name","fieldType","toIndex","field","getFieldTypePlugin","value","fieldTypePlugin","isSearchable","rawValue","fromIndex","undefined","exports","default"],"sources":["defaultFieldIndexing.ts"],"sourcesContent":["import type { 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":";;;;;;eAEeA,CAAA,MAA2C;EACtDC,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,2CAA2C;EACjDC,SAAS,EAAE,GAAG;EACdC,OAAOA,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,SAASA,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;AAAAG,OAAA,CAAAC,OAAA,GAAAd,QAAA","ignoreList":[]}
@@ -1,24 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _richTextIndexing = _interopRequireDefault(require("./richTextIndexing"));
11
-
12
9
  var _longTextIndexing = _interopRequireDefault(require("./longTextIndexing"));
13
-
14
10
  var _defaultFieldIndexing = _interopRequireDefault(require("./defaultFieldIndexing"));
15
-
16
11
  var _dateTimeIndexing = _interopRequireDefault(require("./dateTimeIndexing"));
17
-
18
12
  var _numberIndexing = _interopRequireDefault(require("./numberIndexing"));
19
-
20
13
  var _objectIndexing = _interopRequireDefault(require("./objectIndexing"));
14
+ var _jsonIndexing = require("./jsonIndexing");
15
+ var _default = () => [(0, _dateTimeIndexing.default)(), (0, _richTextIndexing.default)(), (0, _longTextIndexing.default)(), (0, _defaultFieldIndexing.default)(), (0, _numberIndexing.default)(), (0, _objectIndexing.default)(), (0, _jsonIndexing.createJsonIndexing)()];
16
+ exports.default = _default;
21
17
 
22
- var _default = () => [(0, _dateTimeIndexing.default)(), (0, _richTextIndexing.default)(), (0, _longTextIndexing.default)(), (0, _defaultFieldIndexing.default)(), (0, _numberIndexing.default)(), (0, _objectIndexing.default)()];
23
-
24
- exports.default = _default;
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_richTextIndexing","_interopRequireDefault","require","_longTextIndexing","_defaultFieldIndexing","_dateTimeIndexing","_numberIndexing","_objectIndexing","_jsonIndexing","_default","dateTimeIndexing","richTextIndexing","longTextIndexing","defaultFieldIndexing","numberIndexing","objectIndexing","createJsonIndexing","exports","default"],"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\";\nimport { createJsonIndexing } from \"./jsonIndexing\";\n\nexport default () => [\n dateTimeIndexing(),\n richTextIndexing(),\n longTextIndexing(),\n defaultFieldIndexing(),\n numberIndexing(),\n objectIndexing(),\n createJsonIndexing()\n];\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAAoD,IAAAO,QAAA,GAErCA,CAAA,KAAM,CACjB,IAAAC,yBAAgB,EAAC,CAAC,EAClB,IAAAC,yBAAgB,EAAC,CAAC,EAClB,IAAAC,yBAAgB,EAAC,CAAC,EAClB,IAAAC,6BAAoB,EAAC,CAAC,EACtB,IAAAC,uBAAc,EAAC,CAAC,EAChB,IAAAC,uBAAc,EAAC,CAAC,EAChB,IAAAC,gCAAkB,EAAC,CAAC,CACvB;AAAAC,OAAA,CAAAC,OAAA,GAAAT,QAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import type { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
+ export declare const createJsonIndexing: () => CmsModelFieldToElasticsearchPlugin;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createJsonIndexing = void 0;
7
+ const createJsonIndexing = () => {
8
+ return {
9
+ type: "cms-model-field-to-elastic-search",
10
+ name: "cms-model-field-to-elastic-search-json",
11
+ fieldType: "json",
12
+ toIndex({
13
+ value
14
+ }) {
15
+ return {
16
+ rawValue: value
17
+ };
18
+ },
19
+ fromIndex({
20
+ rawValue
21
+ }) {
22
+ return rawValue;
23
+ }
24
+ };
25
+ };
26
+ exports.createJsonIndexing = createJsonIndexing;
27
+
28
+ //# sourceMappingURL=jsonIndexing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createJsonIndexing","type","name","fieldType","toIndex","value","rawValue","fromIndex","exports"],"sources":["jsonIndexing.ts"],"sourcesContent":["import type { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nexport const createJsonIndexing = (): CmsModelFieldToElasticsearchPlugin => {\n return {\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-json\",\n fieldType: \"json\",\n toIndex({ value }) {\n return {\n rawValue: value\n };\n },\n fromIndex({ rawValue }) {\n return rawValue;\n }\n };\n};\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAkB,GAAGA,CAAA,KAA0C;EACxE,OAAO;IACHC,IAAI,EAAE,mCAAmC;IACzCC,IAAI,EAAE,wCAAwC;IAC9CC,SAAS,EAAE,MAAM;IACjBC,OAAOA,CAAC;MAAEC;IAAM,CAAC,EAAE;MACf,OAAO;QACHC,QAAQ,EAAED;MACd,CAAC;IACL,CAAC;IACDE,SAASA,CAAC;MAAED;IAAS,CAAC,EAAE;MACpB,OAAOA,QAAQ;IACnB;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAR,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,3 +1,7 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
1
+ import type { 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
+ */
2
6
  declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
7
  export default _default;
@@ -4,33 +4,39 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
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
+ */
8
11
  var _default = () => ({
9
12
  type: "cms-model-field-to-elastic-search",
10
13
  name: "cms-model-field-to-elastic-search-long-text",
11
14
  fieldType: "long-text",
12
-
13
15
  toIndex({
14
16
  rawValue
15
17
  }) {
16
18
  /**
17
- * We want to store the value (rawValue) from entry before it was prepared for storage as value to be searched on.
18
- * And we want to store prepared value into rawValue so it is not indexed.
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.
19
20
  */
20
21
  return {
21
- value: rawValue ? encodeURIComponent(rawValue) : ""
22
+ value: Array.isArray(rawValue) ? rawValue : rawValue || ""
22
23
  };
23
24
  },
24
-
25
25
  /**
26
- * When extracting from index, we can return the value that was stored to be searched - and then no decompression will be required.
26
+ * When taking value from the index, we can return the original value.
27
+ * At that point the `transformFromStorage` does not need to do anything.
28
+ *
29
+ * We need to decode to support older systems.
27
30
  */
28
31
  fromIndex({
29
32
  value
30
33
  }) {
31
- return value ? decodeURIComponent(value) : "";
34
+ if (Array.isArray(value)) {
35
+ return value;
36
+ }
37
+ return value || "";
32
38
  }
33
-
34
39
  });
40
+ exports.default = _default;
35
41
 
36
- exports.default = _default;
42
+ //# sourceMappingURL=longTextIndexing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_default","type","name","fieldType","toIndex","rawValue","value","Array","isArray","fromIndex","exports","default"],"sources":["longTextIndexing.ts"],"sourcesContent":["import type { 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 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;\n }\n return value || \"\";\n }\n});\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AAHA,IAAAA,QAAA,GAIeA,CAAA,MAA2C;EACtDC,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,6CAA6C;EACnDC,SAAS,EAAE,WAAW;EACtBC,OAAOA,CAAC;IAAEC;EAAS,CAAC,EAAE;IAClB;AACR;AACA;IACQ,OAAO;MACHC,KAAK,EAAEC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,GAAGA,QAAQ,GAAGA,QAAQ,IAAI;IAC5D,CAAC;EACL,CAAC;EACD;AACJ;AACA;AACA;AACA;AACA;EACII,SAASA,CAAC;IAAEH;EAAM,CAAC,EAAE;IACjB,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK;IAChB;IACA,OAAOA,KAAK,IAAI,EAAE;EACtB;AACJ,CAAC,CAAC;AAAAI,OAAA,CAAAC,OAAA,GAAAX,QAAA","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
1
+ import type { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
2
  declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
3
  export default _default;
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  const convertToString = value => {
9
8
  if (Array.isArray(value) === false) {
10
9
  return value;
11
10
  }
12
-
13
11
  return value.map(String);
14
12
  };
15
-
16
13
  const convertToFloat = value => {
17
14
  if (Array.isArray(value) === false) {
18
15
  return typeof value === "string" ? parseFloat(value) : value;
19
16
  }
20
-
21
17
  return value.map(v => parseFloat(v));
22
18
  };
23
-
24
19
  var _default = () => ({
25
20
  type: "cms-model-field-to-elastic-search",
26
21
  name: "cms-model-field-to-elastic-search-number",
@@ -28,7 +23,6 @@ var _default = () => ({
28
23
  unmappedType: () => {
29
24
  return "float";
30
25
  },
31
-
32
26
  toIndex({
33
27
  value
34
28
  }) {
@@ -36,13 +30,12 @@ var _default = () => ({
36
30
  value: convertToString(value)
37
31
  };
38
32
  },
39
-
40
33
  fromIndex({
41
34
  value
42
35
  }) {
43
36
  return convertToFloat(value);
44
37
  }
45
-
46
38
  });
39
+ exports.default = _default;
47
40
 
48
- exports.default = _default;
41
+ //# sourceMappingURL=numberIndexing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["convertToString","value","Array","isArray","map","String","convertToFloat","parseFloat","v","_default","type","name","fieldType","unmappedType","toIndex","fromIndex","exports","default"],"sources":["numberIndexing.ts"],"sourcesContent":["import type { 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,IAAAC,QAAA,GAEaA,CAAA,MAA2C;EACtDC,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,0CAA0C;EAChDC,SAAS,EAAE,QAAQ;EACnBC,YAAY,EAAEA,CAAA,KAAM;IAChB,OAAO,OAAO;EAClB,CAAC;EACDC,OAAOA,CAAC;IAAEb;EAAM,CAAC,EAAE;IACf,OAAO;MACHA,KAAK,EAAED,eAAe,CAACC,KAAK;IAChC,CAAC;EACL,CAAC;EACDc,SAASA,CAAC;IAAEd;EAAM,CAAC,EAAE;IACjB,OAAOK,cAAc,CAACL,KAAK,CAAC;EAChC;AACJ,CAAC,CAAC;AAAAe,OAAA,CAAAC,OAAA,GAAAR,QAAA","ignoreList":[]}
@@ -1,3 +1,12 @@
1
- import { CmsModelFieldToElasticsearchPlugin } from "../../types";
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 type { CmsModelFieldToElasticsearchPlugin } from "../../types";
2
11
  declare const _default: () => CmsModelFieldToElasticsearchPlugin;
3
12
  export default _default;