@webiny/api-headless-cms-ddb-es 6.1.0-beta.3 → 6.2.0-beta.0

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 (302) hide show
  1. package/configurations.d.ts +3 -2
  2. package/configurations.js +10 -8
  3. package/configurations.js.map +1 -1
  4. package/elasticsearch/createElasticsearchIndex.d.ts +2 -2
  5. package/elasticsearch/createElasticsearchIndex.js +58 -16
  6. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  7. package/exports/api/cms/opensearch.d.ts +9 -0
  8. package/exports/api/cms/opensearch.js +11 -0
  9. package/exports/api/cms/opensearch.js.map +1 -0
  10. package/feature.d.ts +1 -0
  11. package/feature.js +188 -0
  12. package/feature.js.map +1 -0
  13. package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +16 -0
  14. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +4 -0
  15. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -0
  16. package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +1 -0
  17. package/features/CmsEntryOpenSearchBodyModifier/index.js +3 -0
  18. package/features/CmsEntryOpenSearchBodyModifier/index.js.map +1 -0
  19. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +13 -0
  20. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +36 -0
  21. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  22. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +35 -0
  23. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +4 -0
  24. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -0
  25. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +11 -0
  26. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +4 -0
  27. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  28. package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +1 -0
  29. package/features/CmsEntryOpenSearchFieldIndex/constants.js +3 -0
  30. package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -0
  31. package/features/CmsEntryOpenSearchFieldIndex/feature.d.ts +1 -0
  32. package/features/CmsEntryOpenSearchFieldIndex/feature.js +24 -0
  33. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -0
  34. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +11 -0
  35. package/{elasticsearch/indexing/dateTimeIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js} +21 -19
  36. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -0
  37. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +10 -0
  38. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +39 -0
  39. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -0
  40. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +10 -0
  41. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +22 -0
  42. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -0
  43. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +10 -0
  44. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +25 -0
  45. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -0
  46. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +11 -0
  47. package/{elasticsearch/indexing/numberIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js} +11 -8
  48. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -0
  49. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +10 -0
  50. package/{elasticsearch/indexing/objectIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js} +50 -86
  51. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -0
  52. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +10 -0
  53. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +22 -0
  54. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -0
  55. package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +3 -0
  56. package/features/CmsEntryOpenSearchFieldIndex/index.js +5 -0
  57. package/features/CmsEntryOpenSearchFieldIndex/index.js.map +1 -0
  58. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +11 -0
  59. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +38 -0
  60. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  61. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +37 -0
  62. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +4 -0
  63. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -0
  64. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +9 -0
  65. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +4 -0
  66. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  67. package/features/CmsEntryOpenSearchFilter/constants.d.ts +1 -0
  68. package/features/CmsEntryOpenSearchFilter/constants.js +3 -0
  69. package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -0
  70. package/features/CmsEntryOpenSearchFilter/feature.d.ts +1 -0
  71. package/features/CmsEntryOpenSearchFilter/feature.js +16 -0
  72. package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -0
  73. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +9 -0
  74. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +23 -0
  75. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -0
  76. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +9 -0
  77. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +61 -0
  78. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -0
  79. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +9 -0
  80. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +49 -0
  81. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -0
  82. package/features/CmsEntryOpenSearchFilter/index.d.ts +3 -0
  83. package/features/CmsEntryOpenSearchFilter/index.js +5 -0
  84. package/features/CmsEntryOpenSearchFilter/index.js.map +1 -0
  85. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +20 -0
  86. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +4 -0
  87. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -0
  88. package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +1 -0
  89. package/features/CmsEntryOpenSearchFullTextSearch/index.js +3 -0
  90. package/features/CmsEntryOpenSearchFullTextSearch/index.js.map +1 -0
  91. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +11 -0
  92. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +17 -0
  93. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -0
  94. package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +14 -0
  95. package/features/CmsEntryOpenSearchIndex/abstractions.js +4 -0
  96. package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -0
  97. package/features/CmsEntryOpenSearchIndex/feature.d.ts +1 -0
  98. package/features/CmsEntryOpenSearchIndex/feature.js +10 -0
  99. package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -0
  100. package/features/CmsEntryOpenSearchIndex/index.d.ts +3 -0
  101. package/features/CmsEntryOpenSearchIndex/index.js +5 -0
  102. package/features/CmsEntryOpenSearchIndex/index.js.map +1 -0
  103. package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +16 -0
  104. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +4 -0
  105. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -0
  106. package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +1 -0
  107. package/features/CmsEntryOpenSearchQueryModifier/index.js +3 -0
  108. package/features/CmsEntryOpenSearchQueryModifier/index.js.map +1 -0
  109. package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +15 -0
  110. package/features/CmsEntryOpenSearchSortModifier/abstractions.js +4 -0
  111. package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -0
  112. package/features/CmsEntryOpenSearchSortModifier/index.d.ts +1 -0
  113. package/features/CmsEntryOpenSearchSortModifier/index.js +3 -0
  114. package/features/CmsEntryOpenSearchSortModifier/index.js.map +1 -0
  115. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +12 -0
  116. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +27 -0
  117. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  118. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +22 -0
  119. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +4 -0
  120. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -0
  121. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +10 -0
  122. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +4 -0
  123. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  124. package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +1 -0
  125. package/features/CmsEntryOpenSearchValueSearch/feature.js +16 -0
  126. package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -0
  127. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +10 -0
  128. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +23 -0
  129. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -0
  130. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +10 -0
  131. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +55 -0
  132. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -0
  133. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +10 -0
  134. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +24 -0
  135. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -0
  136. package/features/CmsEntryOpenSearchValueSearch/index.d.ts +3 -0
  137. package/features/CmsEntryOpenSearchValueSearch/index.js +5 -0
  138. package/features/CmsEntryOpenSearchValueSearch/index.js.map +1 -0
  139. package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +23 -0
  140. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +4 -0
  141. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -0
  142. package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +1 -0
  143. package/features/CmsEntryOpenSearchValuesModifier/index.js +3 -0
  144. package/features/CmsEntryOpenSearchValuesModifier/index.js.map +1 -0
  145. package/helpers/entryIndexHelpers.d.ts +5 -3
  146. package/helpers/entryIndexHelpers.js +28 -90
  147. package/helpers/entryIndexHelpers.js.map +1 -1
  148. package/index.d.ts +1 -3
  149. package/index.js +1 -188
  150. package/index.js.map +1 -1
  151. package/operations/entry/elasticsearch/body.d.ts +18 -2
  152. package/operations/entry/elasticsearch/body.js +32 -29
  153. package/operations/entry/elasticsearch/body.js.map +1 -1
  154. package/operations/entry/elasticsearch/fields.d.ts +6 -4
  155. package/operations/entry/elasticsearch/fields.js +14 -57
  156. package/operations/entry/elasticsearch/fields.js.map +1 -1
  157. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +5 -4
  158. package/operations/entry/elasticsearch/filtering/applyFiltering.js +3 -3
  159. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  160. package/operations/entry/elasticsearch/filtering/exec.d.ts +4 -0
  161. package/operations/entry/elasticsearch/filtering/exec.js +11 -64
  162. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  163. package/operations/entry/elasticsearch/filtering/path.d.ts +4 -3
  164. package/operations/entry/elasticsearch/filtering/path.js +4 -6
  165. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  166. package/operations/entry/elasticsearch/fullTextSearch.d.ts +2 -2
  167. package/operations/entry/elasticsearch/fullTextSearch.js +25 -29
  168. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  169. package/operations/entry/elasticsearch/sort.d.ts +2 -2
  170. package/operations/entry/elasticsearch/sort.js +2 -6
  171. package/operations/entry/elasticsearch/sort.js.map +1 -1
  172. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -9
  173. package/operations/entry/elasticsearch/transformValueForSearch.js +4 -14
  174. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  175. package/operations/entry/elasticsearch/types.d.ts +0 -7
  176. package/operations/entry/elasticsearch/types.js.map +1 -1
  177. package/operations/entry/index.d.ts +21 -1
  178. package/operations/entry/index.js +96 -39
  179. package/operations/entry/index.js.map +1 -1
  180. package/operations/entry/transformations/index.d.ts +8 -2
  181. package/operations/entry/transformations/index.js +14 -12
  182. package/operations/entry/transformations/index.js.map +1 -1
  183. package/operations/entry/transformations/modifyEntryValues.d.ts +2 -2
  184. package/operations/entry/transformations/modifyEntryValues.js +3 -3
  185. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  186. package/operations/entry/transformations/transformEntryToIndex.d.ts +4 -2
  187. package/operations/entry/transformations/transformEntryToIndex.js +6 -4
  188. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  189. package/operations/group/index.d.ts +2 -2
  190. package/operations/group/index.js +6 -9
  191. package/operations/group/index.js.map +1 -1
  192. package/package.json +25 -23
  193. package/tasks/createIndexTaskPlugin.js +8 -1
  194. package/tasks/createIndexTaskPlugin.js.map +1 -1
  195. package/types.d.ts +7 -112
  196. package/types.js +0 -23
  197. package/types.js.map +1 -1
  198. package/dynamoDb/index.d.ts +0 -3
  199. package/dynamoDb/index.js +0 -8
  200. package/dynamoDb/index.js.map +0 -1
  201. package/dynamoDb/storage/longText.d.ts +0 -10
  202. package/dynamoDb/storage/longText.js +0 -88
  203. package/dynamoDb/storage/longText.js.map +0 -1
  204. package/dynamoDb/storage/richText.d.ts +0 -2
  205. package/dynamoDb/storage/richText.js +0 -51
  206. package/dynamoDb/storage/richText.js.map +0 -1
  207. package/elasticsearch/index.d.ts +0 -2
  208. package/elasticsearch/index.js +0 -5
  209. package/elasticsearch/index.js.map +0 -1
  210. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  211. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  212. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  213. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -47
  214. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  215. package/elasticsearch/indexing/index.d.ts +0 -2
  216. package/elasticsearch/indexing/index.js +0 -10
  217. package/elasticsearch/indexing/index.js.map +0 -1
  218. package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
  219. package/elasticsearch/indexing/jsonIndexing.js +0 -21
  220. package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
  221. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  222. package/elasticsearch/indexing/longTextIndexing.js +0 -35
  223. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  224. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  225. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  226. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  227. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  228. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  229. package/elasticsearch/indexing/richTextIndexing.js +0 -24
  230. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  231. package/elasticsearch/indices/base.d.ts +0 -2
  232. package/elasticsearch/indices/base.js +0 -7
  233. package/elasticsearch/indices/base.js.map +0 -1
  234. package/elasticsearch/indices/index.d.ts +0 -1
  235. package/elasticsearch/indices/index.js +0 -6
  236. package/elasticsearch/indices/index.js.map +0 -1
  237. package/elasticsearch/search/index.d.ts +0 -3
  238. package/elasticsearch/search/index.js +0 -6
  239. package/elasticsearch/search/index.js.map +0 -1
  240. package/elasticsearch/search/refSearch.d.ts +0 -2
  241. package/elasticsearch/search/refSearch.js +0 -24
  242. package/elasticsearch/search/refSearch.js.map +0 -1
  243. package/elasticsearch/search/searchableJson.d.ts +0 -2
  244. package/elasticsearch/search/searchableJson.js +0 -53
  245. package/elasticsearch/search/searchableJson.js.map +0 -1
  246. package/elasticsearch/search/timeSearch.d.ts +0 -2
  247. package/elasticsearch/search/timeSearch.js +0 -20
  248. package/elasticsearch/search/timeSearch.js.map +0 -1
  249. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  250. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -22
  251. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  252. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  253. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -8
  254. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  255. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  256. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -61
  257. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  258. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  259. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -49
  260. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  261. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  262. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -11
  263. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  264. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  265. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -11
  266. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  267. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  268. package/operations/entry/elasticsearch/plugins/search.js +0 -18
  269. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  270. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  271. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -11
  272. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  273. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
  274. package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -46
  275. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
  276. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
  277. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -13
  278. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  279. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -24
  280. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -19
  281. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  282. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  283. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -6
  284. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  285. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -32
  286. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -32
  287. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  288. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
  289. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -13
  290. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  291. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
  292. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -13
  293. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  294. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
  295. package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -42
  296. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
  297. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  298. package/plugins/CmsEntryFilterPlugin.js +0 -15
  299. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  300. package/plugins/index.d.ts +0 -8
  301. package/plugins/index.js +0 -10
  302. package/plugins/index.js.map +0 -1
@@ -0,0 +1,4 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ export const CmsEntryOpenSearchFieldIndexRegistry = createAbstraction("Cms/Entry/OpenSearch/FieldIndexRegistry");
3
+
4
+ //# sourceMappingURL=CmsEntryOpenSearchFieldIndexRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createAbstraction","CmsEntryOpenSearchFieldIndexRegistry"],"sources":["CmsEntryOpenSearchFieldIndexRegistry.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CmsEntryOpenSearchFieldIndex } from \"./CmsEntryOpenSearchFieldIndex.js\";\n\nexport interface ICmsEntryOpenSearchFieldIndexRegistry {\n get(fieldType: string): CmsEntryOpenSearchFieldIndex.Interface | undefined;\n getDefault(): CmsEntryOpenSearchFieldIndex.Interface;\n getAll(): CmsEntryOpenSearchFieldIndex.Interface[];\n}\n\nexport const CmsEntryOpenSearchFieldIndexRegistry =\n createAbstraction<ICmsEntryOpenSearchFieldIndexRegistry>(\n \"Cms/Entry/OpenSearch/FieldIndexRegistry\"\n );\n\nexport namespace CmsEntryOpenSearchFieldIndexRegistry {\n export type Interface = ICmsEntryOpenSearchFieldIndexRegistry;\n export type FieldIndex = CmsEntryOpenSearchFieldIndex.Interface;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AASvD,OAAO,MAAMC,oCAAoC,GAC7CD,iBAAiB,CACb,yCACJ,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const FIELD_INDEXING_DEFAULT: "*";
@@ -0,0 +1,3 @@
1
+ export const FIELD_INDEXING_DEFAULT = "*";
2
+
3
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FIELD_INDEXING_DEFAULT"],"sources":["constants.ts"],"sourcesContent":["export const FIELD_INDEXING_DEFAULT = \"*\" as const;\n"],"mappings":"AAAA,OAAO,MAAMA,sBAAsB,GAAG,GAAY","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const CmsEntryOpenSearchFieldIndexFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
@@ -0,0 +1,24 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { CmsEntryOpenSearchFieldIndexRegistry } from "./CmsEntryOpenSearchFieldIndexRegistry.js";
3
+ import { RichTextFieldIndex } from "./fields/RichTextFieldIndex.js";
4
+ import { JsonFieldIndex } from "./fields/JsonFieldIndex.js";
5
+ import { LongTextFieldIndex } from "./fields/LongTextFieldIndex.js";
6
+ import { NumberFieldIndex } from "./fields/NumberFieldIndex.js";
7
+ import { DefaultFieldIndex } from "./fields/DefaultFieldIndex.js";
8
+ import { DateTimeFieldIndex } from "./fields/DateTimeFieldIndex.js";
9
+ import { ObjectFieldIndex } from "./fields/ObjectFieldIndex.js";
10
+ export const CmsEntryOpenSearchFieldIndexFeature = createFeature({
11
+ name: "Cms/Entry/OpenSearch/FieldIndexFeature",
12
+ register: container => {
13
+ container.register(RichTextFieldIndex);
14
+ container.register(JsonFieldIndex);
15
+ container.register(LongTextFieldIndex);
16
+ container.register(NumberFieldIndex);
17
+ container.register(DefaultFieldIndex);
18
+ container.register(DateTimeFieldIndex);
19
+ container.register(ObjectFieldIndex);
20
+ container.register(CmsEntryOpenSearchFieldIndexRegistry);
21
+ }
22
+ });
23
+
24
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFeature","CmsEntryOpenSearchFieldIndexRegistry","RichTextFieldIndex","JsonFieldIndex","LongTextFieldIndex","NumberFieldIndex","DefaultFieldIndex","DateTimeFieldIndex","ObjectFieldIndex","CmsEntryOpenSearchFieldIndexFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CmsEntryOpenSearchFieldIndexRegistry } from \"./CmsEntryOpenSearchFieldIndexRegistry.js\";\nimport { RichTextFieldIndex } from \"./fields/RichTextFieldIndex.js\";\nimport { JsonFieldIndex } from \"./fields/JsonFieldIndex.js\";\nimport { LongTextFieldIndex } from \"./fields/LongTextFieldIndex.js\";\nimport { NumberFieldIndex } from \"./fields/NumberFieldIndex.js\";\nimport { DefaultFieldIndex } from \"./fields/DefaultFieldIndex.js\";\nimport { DateTimeFieldIndex } from \"./fields/DateTimeFieldIndex.js\";\nimport { ObjectFieldIndex } from \"./fields/ObjectFieldIndex.js\";\n\nexport const CmsEntryOpenSearchFieldIndexFeature = createFeature({\n name: \"Cms/Entry/OpenSearch/FieldIndexFeature\",\n register: container => {\n container.register(RichTextFieldIndex);\n container.register(JsonFieldIndex);\n container.register(LongTextFieldIndex);\n container.register(NumberFieldIndex);\n container.register(DefaultFieldIndex);\n container.register(DateTimeFieldIndex);\n container.register(ObjectFieldIndex);\n container.register(CmsEntryOpenSearchFieldIndexRegistry);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,oCAAoC;AAC7C,SAASC,kBAAkB;AAC3B,SAASC,cAAc;AACvB,SAASC,kBAAkB;AAC3B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAC3B,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,mCAAmC,GAAGT,aAAa,CAAC;EAC7DU,IAAI,EAAE,wCAAwC;EAC9CC,QAAQ,EAAEC,SAAS,IAAI;IACnBA,SAAS,CAACD,QAAQ,CAACT,kBAAkB,CAAC;IACtCU,SAAS,CAACD,QAAQ,CAACR,cAAc,CAAC;IAClCS,SAAS,CAACD,QAAQ,CAACP,kBAAkB,CAAC;IACtCQ,SAAS,CAACD,QAAQ,CAACN,gBAAgB,CAAC;IACpCO,SAAS,CAACD,QAAQ,CAACL,iBAAiB,CAAC;IACrCM,SAAS,CAACD,QAAQ,CAACJ,kBAAkB,CAAC;IACtCK,SAAS,CAACD,QAAQ,CAACH,gBAAgB,CAAC;IACpCI,SAAS,CAACD,QAAQ,CAACV,oCAAoC,CAAC;EAC5D;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ declare class DateTimeFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
3
+ readonly fieldType = "datetime";
4
+ unmappedType(): string;
5
+ toIndex({ field, value }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
6
+ fromIndex({ field, value }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
7
+ }
8
+ export declare const DateTimeFieldIndex: typeof DateTimeFieldIndexImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
10
+ };
11
+ export {};
@@ -1,3 +1,4 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
1
2
  const convertTimeToNumber = time => {
2
3
  if (!time) {
3
4
  return null;
@@ -14,6 +15,14 @@ const convertNumberToTime = value => {
14
15
  const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);
15
16
  return [hours, minutes, seconds].map(v => String(v).padStart(2, "0")).join(":");
16
17
  };
18
+ const convertValueToIndex = (value, field) => {
19
+ if (!value) {
20
+ return null;
21
+ } else if (field.settings?.type === "time") {
22
+ return convertTimeToNumber(value);
23
+ }
24
+ return value;
25
+ };
17
26
  const convertValueFromIndex = (value, field) => {
18
27
  const type = field.settings?.type;
19
28
  if (type === "time") {
@@ -28,21 +37,11 @@ const convertValueFromIndex = (value, field) => {
28
37
  }
29
38
  return new Date(value).toISOString();
30
39
  };
31
- const convertValueToIndex = (value, field) => {
32
- if (!value) {
33
- return null;
34
- } else if (field.settings?.type === "time") {
35
- return convertTimeToNumber(value);
36
- }
37
- return value;
38
- };
39
- export default () => ({
40
- type: "cms-model-field-to-elastic-search",
41
- name: "cms-model-field-to-elastic-search-datetime",
42
- fieldType: "datetime",
43
- unmappedType: () => {
40
+ class DateTimeFieldIndexImpl {
41
+ fieldType = "datetime";
42
+ unmappedType() {
44
43
  return "date";
45
- },
44
+ }
46
45
  toIndex({
47
46
  field,
48
47
  value
@@ -54,22 +53,25 @@ export default () => ({
54
53
  })
55
54
  };
56
55
  }
57
- const dateValue = convertValueToIndex(value, field);
58
56
  return {
59
- value: dateValue
57
+ value: convertValueToIndex(value, field)
60
58
  };
61
- },
59
+ }
62
60
  fromIndex({
63
61
  field,
64
62
  value
65
63
  }) {
66
- if (Array.isArray(value)) {
64
+ if (Array.isArray(value) === true) {
67
65
  return value.map(v => {
68
66
  return convertValueFromIndex(v, field);
69
67
  });
70
68
  }
71
69
  return convertValueFromIndex(value, field);
72
70
  }
71
+ }
72
+ export const DateTimeFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
73
+ implementation: DateTimeFieldIndexImpl,
74
+ dependencies: []
73
75
  });
74
76
 
75
- //# sourceMappingURL=dateTimeIndexing.js.map
77
+ //# sourceMappingURL=DateTimeFieldIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryOpenSearchFieldIndex","convertTimeToNumber","time","hours","minutes","seconds","split","map","Number","convertNumberToTime","value","undefined","Math","floor","v","String","padStart","join","convertValueToIndex","field","settings","type","convertValueFromIndex","dateValue","Date","toISOString","slice","DateTimeFieldIndexImpl","fieldType","unmappedType","toIndex","Array","isArray","fromIndex","DateTimeFieldIndex","createImplementation","implementation","dependencies"],"sources":["DateTimeFieldIndex.ts"],"sourcesContent":["import type { CmsModelDateTimeField } from \"@webiny/api-headless-cms/types/index.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\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\n const hours = Math.floor(value / 60 / 60);\n const minutes = Math.floor((value - hours * 60 * 60) / 60);\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 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\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\nclass DateTimeFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"datetime\";\n\n public unmappedType(): string {\n return \"date\";\n }\n\n public toIndex({\n field,\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\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 return {\n value: convertValueToIndex(value, field as CmsModelDateTimeField)\n };\n }\n\n public fromIndex({ field, value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (Array.isArray(value) === true) {\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\nexport const DateTimeFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: DateTimeFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AACA,SAASA,4BAA4B;AAErC,MAAMC,mBAAmB,GAAIC,IAAa,IAAoB;EAC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5B,OAAOQ,qBAAqB,CAACR,CAAC,EAAEK,KAA8B,CAAC;MACnE,CAAC,CAAC;IACN;IACA,OAAOG,qBAAqB,CAACZ,KAAK,EAAES,KAA8B,CAAC;EACvE;AACJ;AAEA,OAAO,MAAMe,kBAAkB,GAAGlC,4BAA4B,CAACmC,oBAAoB,CAAC;EAChFC,cAAc,EAAET,sBAAsB;EACtCU,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ declare class DefaultFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
3
+ readonly fieldType: "*";
4
+ toIndex({ field, fieldRegistry, value }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
5
+ fromIndex({ field, fieldRegistry, value, rawValue }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
6
+ }
7
+ export declare const DefaultFieldIndex: typeof DefaultFieldIndexImpl & {
8
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
9
+ };
10
+ export {};
@@ -0,0 +1,39 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ import { FIELD_INDEXING_DEFAULT } from "../constants.js";
3
+ class DefaultFieldIndexImpl {
4
+ fieldType = FIELD_INDEXING_DEFAULT;
5
+ toIndex({
6
+ field,
7
+ fieldRegistry,
8
+ value
9
+ }) {
10
+ const fieldType = fieldRegistry.get(field.type);
11
+ if (fieldType?.isSearchable === true) {
12
+ return {
13
+ value
14
+ };
15
+ }
16
+ return {
17
+ rawValue: value
18
+ };
19
+ }
20
+ fromIndex({
21
+ field,
22
+ fieldRegistry,
23
+ value,
24
+ rawValue
25
+ }) {
26
+ const fieldType = fieldRegistry.get(field.type);
27
+ const isSearchable = fieldType?.isSearchable ?? false;
28
+ if (isSearchable) {
29
+ return value === undefined ? rawValue : value;
30
+ }
31
+ return rawValue === undefined ? value : rawValue;
32
+ }
33
+ }
34
+ export const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
35
+ implementation: DefaultFieldIndexImpl,
36
+ dependencies: []
37
+ });
38
+
39
+ //# sourceMappingURL=DefaultFieldIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryOpenSearchFieldIndex","FIELD_INDEXING_DEFAULT","DefaultFieldIndexImpl","fieldType","toIndex","field","fieldRegistry","value","get","type","isSearchable","rawValue","fromIndex","undefined","DefaultFieldIndex","createImplementation","implementation","dependencies"],"sources":["DefaultFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\nimport { FIELD_INDEXING_DEFAULT } from \"../constants.js\";\n\nclass DefaultFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = FIELD_INDEXING_DEFAULT;\n\n public toIndex({\n field,\n fieldRegistry,\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n const fieldType = fieldRegistry.get(field.type);\n\n if (fieldType?.isSearchable === true) {\n return { value };\n }\n\n return { rawValue: value };\n }\n\n public fromIndex({\n field,\n fieldRegistry,\n value,\n rawValue\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n const fieldType = fieldRegistry.get(field.type);\n const isSearchable = fieldType?.isSearchable ?? false;\n\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n}\n\nexport const DefaultFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: DefaultFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,4BAA4B;AACrC,SAASC,sBAAsB;AAE/B,MAAMC,qBAAqB,CAAmD;EAC1DC,SAAS,GAAGF,sBAAsB;EAE3CG,OAAOA,CAAC;IACXC,KAAK;IACLC,aAAa;IACbC;EACkC,CAAC,EAAwC;IAC3E,MAAMJ,SAAS,GAAGG,aAAa,CAACE,GAAG,CAACH,KAAK,CAACI,IAAI,CAAC;IAE/C,IAAIN,SAAS,EAAEO,YAAY,KAAK,IAAI,EAAE;MAClC,OAAO;QAAEH;MAAM,CAAC;IACpB;IAEA,OAAO;MAAEI,QAAQ,EAAEJ;IAAM,CAAC;EAC9B;EAEOK,SAASA,CAAC;IACbP,KAAK;IACLC,aAAa;IACbC,KAAK;IACLI;EACoC,CAAC,EAAO;IAC5C,MAAMR,SAAS,GAAGG,aAAa,CAACE,GAAG,CAACH,KAAK,CAACI,IAAI,CAAC;IAC/C,MAAMC,YAAY,GAAGP,SAAS,EAAEO,YAAY,IAAI,KAAK;IAErD,IAAIA,YAAY,EAAE;MACd,OAAOH,KAAK,KAAKM,SAAS,GAAGF,QAAQ,GAAGJ,KAAK;IACjD;IACA,OAAOI,QAAQ,KAAKE,SAAS,GAAGN,KAAK,GAAGI,QAAQ;EACpD;AACJ;AAEA,OAAO,MAAMG,iBAAiB,GAAGd,4BAA4B,CAACe,oBAAoB,CAAC;EAC/EC,cAAc,EAAEd,qBAAqB;EACrCe,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ declare class JsonFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
3
+ readonly fieldType = "json";
4
+ toIndex({ value }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
5
+ fromIndex({ rawValue }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
6
+ }
7
+ export declare const JsonFieldIndex: typeof JsonFieldIndexImpl & {
8
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
9
+ };
10
+ export {};
@@ -0,0 +1,22 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ class JsonFieldIndexImpl {
3
+ fieldType = "json";
4
+ toIndex({
5
+ value
6
+ }) {
7
+ return {
8
+ rawValue: value
9
+ };
10
+ }
11
+ fromIndex({
12
+ rawValue
13
+ }) {
14
+ return rawValue;
15
+ }
16
+ }
17
+ export const JsonFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
18
+ implementation: JsonFieldIndexImpl,
19
+ dependencies: []
20
+ });
21
+
22
+ //# sourceMappingURL=JsonFieldIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryOpenSearchFieldIndex","JsonFieldIndexImpl","fieldType","toIndex","value","rawValue","fromIndex","JsonFieldIndex","createImplementation","implementation","dependencies"],"sources":["JsonFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nclass JsonFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"json\";\n\n public toIndex({\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n rawValue: value\n };\n }\n\n public fromIndex({ rawValue }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n return rawValue;\n }\n}\n\nexport const JsonFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: JsonFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,4BAA4B;AAErC,MAAMC,kBAAkB,CAAmD;EACvDC,SAAS,GAAG,MAAM;EAE3BC,OAAOA,CAAC;IACXC;EACkC,CAAC,EAAwC;IAC3E,OAAO;MACHC,QAAQ,EAAED;IACd,CAAC;EACL;EAEOE,SAASA,CAAC;IAAED;EAAiD,CAAC,EAAO;IACxE,OAAOA,QAAQ;EACnB;AACJ;AAEA,OAAO,MAAME,cAAc,GAAGP,4BAA4B,CAACQ,oBAAoB,CAAC;EAC5EC,cAAc,EAAER,kBAAkB;EAClCS,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ declare class LongTextFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
3
+ readonly fieldType = "long-text";
4
+ toIndex({ rawValue }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
5
+ fromIndex({ value }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
6
+ }
7
+ export declare const LongTextFieldIndex: typeof LongTextFieldIndexImpl & {
8
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
9
+ };
10
+ export {};
@@ -0,0 +1,25 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ class LongTextFieldIndexImpl {
3
+ fieldType = "long-text";
4
+ toIndex({
5
+ rawValue
6
+ }) {
7
+ return {
8
+ value: Array.isArray(rawValue) ? rawValue : rawValue || ""
9
+ };
10
+ }
11
+ fromIndex({
12
+ value
13
+ }) {
14
+ if (Array.isArray(value)) {
15
+ return value;
16
+ }
17
+ return value || "";
18
+ }
19
+ }
20
+ export const LongTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
21
+ implementation: LongTextFieldIndexImpl,
22
+ dependencies: []
23
+ });
24
+
25
+ //# sourceMappingURL=LongTextFieldIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryOpenSearchFieldIndex","LongTextFieldIndexImpl","fieldType","toIndex","rawValue","value","Array","isArray","fromIndex","LongTextFieldIndex","createImplementation","implementation","dependencies"],"sources":["LongTextFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\nclass LongTextFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"long-text\";\n\n public toIndex({\n rawValue\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n value: Array.isArray(rawValue) ? rawValue : rawValue || \"\"\n };\n }\n\n public fromIndex({ value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (Array.isArray(value)) {\n return value;\n }\n return value || \"\";\n }\n}\n\nexport const LongTextFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: LongTextFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,4BAA4B;AAErC,MAAMC,sBAAsB,CAAmD;EAC3DC,SAAS,GAAG,WAAW;EAEhCC,OAAOA,CAAC;IACXC;EACkC,CAAC,EAAwC;IAC3E,OAAO;MACHC,KAAK,EAAEC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,GAAGA,QAAQ,GAAGA,QAAQ,IAAI;IAC5D,CAAC;EACL;EAEOI,SAASA,CAAC;IAAEH;EAA8C,CAAC,EAAO;IACrE,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK;IAChB;IACA,OAAOA,KAAK,IAAI,EAAE;EACtB;AACJ;AAEA,OAAO,MAAMI,kBAAkB,GAAGT,4BAA4B,CAACU,oBAAoB,CAAC;EAChFC,cAAc,EAAEV,sBAAsB;EACtCW,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ declare class NumberFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
3
+ readonly fieldType = "number";
4
+ unmappedType(): string;
5
+ toIndex({ value }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
6
+ fromIndex({ value }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
7
+ }
8
+ export declare const NumberFieldIndex: typeof NumberFieldIndexImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
10
+ };
11
+ export {};
@@ -1,3 +1,4 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
1
2
  const convertToString = value => {
2
3
  if (Array.isArray(value) === false) {
3
4
  return value;
@@ -10,25 +11,27 @@ const convertToFloat = value => {
10
11
  }
11
12
  return value.map(v => parseFloat(v));
12
13
  };
13
- export default () => ({
14
- type: "cms-model-field-to-elastic-search",
15
- name: "cms-model-field-to-elastic-search-number",
16
- fieldType: "number",
17
- unmappedType: () => {
14
+ class NumberFieldIndexImpl {
15
+ fieldType = "number";
16
+ unmappedType() {
18
17
  return "float";
19
- },
18
+ }
20
19
  toIndex({
21
20
  value
22
21
  }) {
23
22
  return {
24
23
  value: convertToString(value)
25
24
  };
26
- },
25
+ }
27
26
  fromIndex({
28
27
  value
29
28
  }) {
30
29
  return convertToFloat(value);
31
30
  }
31
+ }
32
+ export const NumberFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
33
+ implementation: NumberFieldIndexImpl,
34
+ dependencies: []
32
35
  });
33
36
 
34
- //# sourceMappingURL=numberIndexing.js.map
37
+ //# sourceMappingURL=NumberFieldIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsEntryOpenSearchFieldIndex","convertToString","value","Array","isArray","map","String","convertToFloat","parseFloat","v","NumberFieldIndexImpl","fieldType","unmappedType","toIndex","fromIndex","NumberFieldIndex","createImplementation","implementation","dependencies"],"sources":["NumberFieldIndex.ts"],"sourcesContent":["import { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\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\nclass NumberFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"number\";\n\n public unmappedType(): string {\n return \"float\";\n }\n\n public toIndex({\n value\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n return {\n value: convertToString(value)\n };\n }\n\n public fromIndex({ value }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n return convertToFloat(value);\n }\n}\n\nexport const NumberFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: NumberFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAAA,SAASA,4BAA4B;AAErC,MAAMC,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;AAED,MAAMC,oBAAoB,CAAmD;EACzDC,SAAS,GAAG,QAAQ;EAE7BC,YAAYA,CAAA,EAAW;IAC1B,OAAO,OAAO;EAClB;EAEOC,OAAOA,CAAC;IACXX;EACkC,CAAC,EAAwC;IAC3E,OAAO;MACHA,KAAK,EAAED,eAAe,CAACC,KAAK;IAChC,CAAC;EACL;EAEOY,SAASA,CAAC;IAAEZ;EAA8C,CAAC,EAAO;IACrE,OAAOK,cAAc,CAACL,KAAK,CAAC;EAChC;AACJ;AAEA,OAAO,MAAMa,gBAAgB,GAAGf,4BAA4B,CAACgB,oBAAoB,CAAC;EAC9EC,cAAc,EAAEP,oBAAoB;EACpCQ,YAAY,EAAE;AAClB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
2
+ declare class ObjectFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {
3
+ readonly fieldType = "object";
4
+ toIndex({ fieldRegistry, model, field, value: initialValue, rawValue: initialRawValue, getFieldIndex }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue;
5
+ fromIndex({ field, value, rawValue, model, getFieldIndex, fieldRegistry }: CmsEntryOpenSearchFieldIndex.FromIndex): any;
6
+ }
7
+ export declare const ObjectFieldIndex: typeof ObjectFieldIndexImpl & {
8
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions/CmsEntryOpenSearchFieldIndex.js").ICmsEntryOpenSearchFieldIndex>;
9
+ };
10
+ export {};
@@ -1,28 +1,16 @@
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
-
11
- import { getFieldIdentifiers } from "../../helpers/index.js";
12
- const processToIndex = ({
13
- fields,
14
- value: sourceValue,
15
- rawValue: sourceRawValue,
16
- getFieldIndexPlugin,
17
- getFieldTypePlugin,
18
- plugins,
19
- model
20
- }) => {
21
- const reducer = (values, field) => {
22
- const plugin = getFieldIndexPlugin(field.type);
23
- if (!plugin || !plugin.toIndex) {
24
- return values;
25
- }
1
+ import { getFieldIdentifiers } from "../../../helpers/index.js";
2
+ import { CmsEntryOpenSearchFieldIndex } from "../abstractions/CmsEntryOpenSearchFieldIndex.js";
3
+ const processToIndex = params => {
4
+ const {
5
+ fields,
6
+ value: sourceValue,
7
+ rawValue: sourceRawValue,
8
+ getFieldIndex,
9
+ fieldRegistry,
10
+ model
11
+ } = params;
12
+ return fields.reduce((values, field) => {
13
+ const plugin = getFieldIndex(field.type);
26
14
  const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
27
15
  if (!identifiers) {
28
16
  return values;
@@ -35,9 +23,8 @@ const processToIndex = ({
35
23
  field,
36
24
  value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
37
25
  rawValue: sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],
38
- getFieldIndexPlugin,
39
- getFieldTypePlugin,
40
- plugins
26
+ getFieldIndex,
27
+ fieldRegistry
41
28
  });
42
29
  if (value !== undefined) {
43
30
  values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
@@ -46,58 +33,49 @@ const processToIndex = ({
46
33
  values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] = rawValue;
47
34
  }
48
35
  return values;
49
- };
50
- return fields.reduce(reducer, {
36
+ }, {
51
37
  value: {},
52
38
  rawValue: {}
53
39
  });
54
40
  };
55
- const processFromIndex = ({
56
- fields,
57
- value: sourceValue,
58
- rawValue: sourceRawValue,
59
- getFieldIndexPlugin,
60
- getFieldTypePlugin,
61
- plugins,
62
- model
63
- }) => {
64
- const reducer = (values, field) => {
65
- const plugin = getFieldIndexPlugin(field.type);
66
- if (!plugin || !plugin.fromIndex) {
67
- return values;
68
- }
41
+ const processFromIndex = params => {
42
+ const {
43
+ fields,
44
+ value: sourceValue,
45
+ rawValue: sourceRawValue,
46
+ getFieldIndex,
47
+ fieldRegistry,
48
+ model
49
+ } = params;
50
+ return fields.reduce((values, field) => {
51
+ const plugin = getFieldIndex(field.type);
69
52
  const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);
70
53
  if (!identifiers) {
71
54
  return values;
72
55
  }
73
56
  const value = plugin.fromIndex({
74
- plugins,
57
+ fieldRegistry,
75
58
  model,
76
59
  field,
77
60
  value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
78
61
  rawValue: sourceRawValue ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] : null,
79
- getFieldIndexPlugin,
80
- getFieldTypePlugin
62
+ getFieldIndex
81
63
  });
82
64
  if (value !== undefined) {
83
65
  values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;
84
66
  }
85
67
  return values;
86
- };
87
- return fields.reduce(reducer, {});
68
+ }, {});
88
69
  };
89
- export default () => ({
90
- type: "cms-model-field-to-elastic-search",
91
- name: "cms-model-field-to-elastic-search-object",
92
- fieldType: "object",
70
+ class ObjectFieldIndexImpl {
71
+ fieldType = "object";
93
72
  toIndex({
94
- plugins,
73
+ fieldRegistry,
95
74
  model,
96
75
  field,
97
76
  value: initialValue,
98
77
  rawValue: initialRawValue,
99
- getFieldIndexPlugin,
100
- getFieldTypePlugin
78
+ getFieldIndex
101
79
  }) {
102
80
  if (!initialValue) {
103
81
  return {
@@ -105,10 +83,6 @@ export default () => ({
105
83
  };
106
84
  }
107
85
  const fields = field.settings?.fields || [];
108
-
109
- /**
110
- * In "object" field, value is either an object or an array of objects.
111
- */
112
86
  if (field.list) {
113
87
  const result = {
114
88
  value: [],
@@ -121,10 +95,9 @@ export default () => ({
121
95
  } = processToIndex({
122
96
  value: initialValue[key],
123
97
  rawValue: initialRawValue[key],
124
- getFieldIndexPlugin,
125
- getFieldTypePlugin,
98
+ getFieldIndex,
126
99
  model,
127
- plugins,
100
+ fieldRegistry,
128
101
  fields
129
102
  });
130
103
  result.value.push(value);
@@ -138,57 +111,48 @@ export default () => ({
138
111
  return processToIndex({
139
112
  value: initialValue,
140
113
  rawValue: initialRawValue,
141
- getFieldIndexPlugin,
142
- getFieldTypePlugin,
114
+ getFieldIndex,
143
115
  model,
144
- plugins,
116
+ fieldRegistry,
145
117
  fields
146
118
  });
147
- },
119
+ }
148
120
  fromIndex({
149
121
  field,
150
122
  value,
151
123
  rawValue,
152
124
  model,
153
- plugins,
154
- getFieldIndexPlugin,
155
- getFieldTypePlugin
125
+ getFieldIndex,
126
+ fieldRegistry
156
127
  }) {
157
128
  if (!value) {
158
129
  return null;
159
130
  }
160
131
  const fields = field.settings?.fields || [];
161
-
162
- /**
163
- * In "object" field, value is either an object or an array of objects.
164
- */
165
132
  if (field.list) {
166
- /**
167
- * Why this `value || rawValue || []`?
168
- * It's possible that an object contains all non-indexable fields, or vice-versa, and so
169
- * we can never be sure which array we can reliably use as a source of values.
170
- */
171
133
  const source = value || rawValue || [];
172
134
  return source.map((_, index) => processFromIndex({
173
135
  value: value ? value[index] || {} : {},
174
136
  rawValue: rawValue ? rawValue[index] || {} : {},
175
- getFieldIndexPlugin,
176
- getFieldTypePlugin,
137
+ getFieldIndex,
177
138
  model,
178
- plugins,
139
+ fieldRegistry,
179
140
  fields
180
141
  }));
181
142
  }
182
143
  return processFromIndex({
183
144
  value,
184
145
  rawValue,
185
- getFieldIndexPlugin,
186
- getFieldTypePlugin,
146
+ getFieldIndex,
187
147
  model,
188
- plugins,
148
+ fieldRegistry,
189
149
  fields
190
150
  });
191
151
  }
152
+ }
153
+ export const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({
154
+ implementation: ObjectFieldIndexImpl,
155
+ dependencies: []
192
156
  });
193
157
 
194
- //# sourceMappingURL=objectIndexing.js.map
158
+ //# sourceMappingURL=ObjectFieldIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getFieldIdentifiers","CmsEntryOpenSearchFieldIndex","processToIndex","params","fields","value","sourceValue","rawValue","sourceRawValue","getFieldIndex","fieldRegistry","model","reduce","values","field","plugin","type","identifiers","toIndex","valueIdentifier","rawValueIdentifier","undefined","processFromIndex","fromIndex","ObjectFieldIndexImpl","fieldType","initialValue","initialRawValue","settings","list","result","key","push","length","source","map","_","index","ObjectFieldIndex","createImplementation","implementation","dependencies"],"sources":["ObjectFieldIndex.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { getFieldIdentifiers } from \"~/helpers/index.js\";\nimport { CmsEntryOpenSearchFieldIndex } from \"../abstractions/CmsEntryOpenSearchFieldIndex.js\";\n\ninterface ProcessToIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue: Record<string, any>;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n model: CmsModel;\n}\n\ninterface ReducerValue {\n value: Record<string, any>;\n rawValue: Record<string, any>;\n}\n\nconst processToIndex = (params: ProcessToIndexParams): ReducerValue => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n fieldRegistry,\n model\n } = params;\n\n return fields.reduce<ReducerValue>(\n (values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const { value, rawValue } = plugin.toIndex({\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue:\n sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier],\n getFieldIndex,\n fieldRegistry\n });\n\n if (value !== undefined) {\n values.value[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n if (rawValue !== undefined) {\n values.rawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier] =\n rawValue;\n }\n\n return values;\n },\n { value: {}, rawValue: {} }\n );\n};\n\ninterface ProcessFromIndexParams {\n fields: CmsModelField[];\n value: Record<string, any>;\n rawValue?: Record<string, any> | null;\n getFieldIndex: (fieldType: string) => CmsEntryOpenSearchFieldIndex.Interface;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n model: CmsModel;\n}\n\nconst processFromIndex = (params: ProcessFromIndexParams): Record<string, any> => {\n const {\n fields,\n value: sourceValue,\n rawValue: sourceRawValue,\n getFieldIndex,\n fieldRegistry,\n model\n } = params;\n\n return fields.reduce<Record<string, any>>((values, field) => {\n const plugin = getFieldIndex(field.type);\n\n const identifiers = getFieldIdentifiers(sourceValue, sourceRawValue, field);\n if (!identifiers) {\n return values;\n }\n\n const value = plugin.fromIndex({\n fieldRegistry,\n model,\n field,\n value: sourceValue[identifiers.valueIdentifier || identifiers.rawValueIdentifier],\n rawValue: sourceRawValue\n ? sourceRawValue[identifiers.rawValueIdentifier || identifiers.valueIdentifier]\n : null,\n getFieldIndex\n });\n\n if (value !== undefined) {\n values[identifiers.valueIdentifier || identifiers.rawValueIdentifier] = value;\n }\n\n return values;\n }, {});\n};\n\nclass ObjectFieldIndexImpl implements CmsEntryOpenSearchFieldIndex.Interface {\n public readonly fieldType = \"object\";\n\n public toIndex({\n fieldRegistry,\n model,\n field,\n value: initialValue,\n rawValue: initialRawValue,\n getFieldIndex\n }: CmsEntryOpenSearchFieldIndex.ToIndex): CmsEntryOpenSearchFieldIndex.ToValue {\n if (!initialValue) {\n return { value: null };\n }\n\n const fields = (field.settings?.fields || []) as CmsModelField[];\n\n if (field.list) {\n const result: { value: Record<string, any>[]; rawValue: Record<string, any>[] } = {\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 getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n\n result.value.push(value);\n result.rawValue.push(rawValue);\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 getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n }\n\n public fromIndex({\n field,\n value,\n rawValue,\n model,\n getFieldIndex,\n fieldRegistry\n }: CmsEntryOpenSearchFieldIndex.FromIndex): any {\n if (!value) {\n return null;\n }\n\n const fields = field.settings?.fields || [];\n\n if (field.list) {\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 getFieldIndex,\n model,\n fieldRegistry,\n fields\n })\n );\n }\n\n return processFromIndex({\n value,\n rawValue,\n getFieldIndex,\n model,\n fieldRegistry,\n fields\n });\n }\n}\n\nexport const ObjectFieldIndex = CmsEntryOpenSearchFieldIndex.createImplementation({\n implementation: ObjectFieldIndexImpl,\n dependencies: []\n});\n"],"mappings":"AAEA,SAASA,mBAAmB;AAC5B,SAASC,4BAA4B;AAgBrC,MAAMC,cAAc,GAAIC,MAA4B,IAAmB;EACnE,MAAM;IACFC,MAAM;IACNC,KAAK,EAAEC,WAAW;IAClBC,QAAQ,EAAEC,cAAc;IACxBC,aAAa;IACbC,aAAa;IACbC;EACJ,CAAC,GAAGR,MAAM;EAEV,OAAOC,MAAM,CAACQ,MAAM,CAChB,CAACC,MAAM,EAAEC,KAAK,KAAK;IACf,MAAMC,MAAM,GAAGN,aAAa,CAACK,KAAK,CAACE,IAAI,CAAC;IAExC,MAAMC,WAAW,GAAGjB,mBAAmB,CAACM,WAAW,EAAEE,cAAc,EAAEM,KAAK,CAAC;IAC3E,IAAI,CAACG,WAAW,EAAE;MACd,OAAOJ,MAAM;IACjB;IAEA,MAAM;MAAER,KAAK;MAAEE;IAAS,CAAC,GAAGQ,MAAM,CAACG,OAAO,CAAC;MACvCP,KAAK;MACLG,KAAK;MACLT,KAAK,EAAEC,WAAW,CAACW,WAAW,CAACE,eAAe,IAAIF,WAAW,CAACG,kBAAkB,CAAC;MACjFb,QAAQ,EACJC,cAAc,CAACS,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