@webiny/api-headless-cms-ddb-es 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7

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 (431) hide show
  1. package/README.md +6 -30
  2. package/configurations.d.ts +7 -7
  3. package/configurations.js +16 -26
  4. package/configurations.js.map +1 -1
  5. package/definitions/entry.d.ts +4 -6
  6. package/definitions/entry.js +5 -174
  7. package/definitions/entry.js.map +1 -1
  8. package/definitions/group.d.ts +6 -7
  9. package/definitions/group.js +5 -58
  10. package/definitions/group.js.map +1 -1
  11. package/definitions/model.d.ts +6 -7
  12. package/definitions/model.js +5 -102
  13. package/definitions/model.js.map +1 -1
  14. package/definitions/types.d.ts +61 -0
  15. package/definitions/types.js +3 -0
  16. package/definitions/types.js.map +1 -0
  17. package/elasticsearch/createElasticsearchIndex.d.ts +4 -4
  18. package/elasticsearch/createElasticsearchIndex.js +61 -27
  19. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  20. package/elasticsearch/deleteElasticsearchIndex.d.ts +2 -2
  21. package/elasticsearch/deleteElasticsearchIndex.js +3 -10
  22. package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
  23. package/exports/api/cms/opensearch.d.ts +9 -0
  24. package/exports/api/cms/opensearch.js +11 -0
  25. package/exports/api/cms/opensearch.js.map +1 -0
  26. package/feature.d.ts +1 -0
  27. package/feature.js +188 -0
  28. package/feature.js.map +1 -0
  29. package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +16 -0
  30. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +4 -0
  31. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -0
  32. package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +1 -0
  33. package/features/CmsEntryOpenSearchBodyModifier/index.js +3 -0
  34. package/features/CmsEntryOpenSearchBodyModifier/index.js.map +1 -0
  35. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +13 -0
  36. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +36 -0
  37. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  38. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +35 -0
  39. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +4 -0
  40. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -0
  41. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +11 -0
  42. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +4 -0
  43. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  44. package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +1 -0
  45. package/features/CmsEntryOpenSearchFieldIndex/constants.js +3 -0
  46. package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -0
  47. package/features/CmsEntryOpenSearchFieldIndex/feature.d.ts +4 -0
  48. package/features/CmsEntryOpenSearchFieldIndex/feature.js +24 -0
  49. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -0
  50. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +11 -0
  51. package/{elasticsearch/indexing/dateTimeIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js} +21 -32
  52. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -0
  53. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +10 -0
  54. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +39 -0
  55. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -0
  56. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +10 -0
  57. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +22 -0
  58. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -0
  59. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +10 -0
  60. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +25 -0
  61. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -0
  62. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +11 -0
  63. package/{elasticsearch/indexing/numberIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js} +11 -15
  64. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -0
  65. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +10 -0
  66. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +158 -0
  67. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -0
  68. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +10 -0
  69. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +22 -0
  70. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -0
  71. package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +3 -0
  72. package/features/CmsEntryOpenSearchFieldIndex/index.js +5 -0
  73. package/features/CmsEntryOpenSearchFieldIndex/index.js.map +1 -0
  74. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +11 -0
  75. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +38 -0
  76. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  77. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +37 -0
  78. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +4 -0
  79. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -0
  80. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +9 -0
  81. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +4 -0
  82. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  83. package/features/CmsEntryOpenSearchFilter/constants.d.ts +1 -0
  84. package/features/CmsEntryOpenSearchFilter/constants.js +3 -0
  85. package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -0
  86. package/features/CmsEntryOpenSearchFilter/feature.d.ts +4 -0
  87. package/features/CmsEntryOpenSearchFilter/feature.js +16 -0
  88. package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -0
  89. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +9 -0
  90. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +23 -0
  91. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -0
  92. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +9 -0
  93. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +61 -0
  94. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -0
  95. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +9 -0
  96. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +49 -0
  97. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -0
  98. package/features/CmsEntryOpenSearchFilter/index.d.ts +3 -0
  99. package/features/CmsEntryOpenSearchFilter/index.js +5 -0
  100. package/features/CmsEntryOpenSearchFilter/index.js.map +1 -0
  101. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +20 -0
  102. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +4 -0
  103. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -0
  104. package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +1 -0
  105. package/features/CmsEntryOpenSearchFullTextSearch/index.js +3 -0
  106. package/features/CmsEntryOpenSearchFullTextSearch/index.js.map +1 -0
  107. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +11 -0
  108. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +16 -0
  109. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -0
  110. package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +14 -0
  111. package/features/CmsEntryOpenSearchIndex/abstractions.js +4 -0
  112. package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -0
  113. package/features/CmsEntryOpenSearchIndex/feature.d.ts +4 -0
  114. package/features/CmsEntryOpenSearchIndex/feature.js +10 -0
  115. package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -0
  116. package/features/CmsEntryOpenSearchIndex/index.d.ts +3 -0
  117. package/features/CmsEntryOpenSearchIndex/index.js +5 -0
  118. package/features/CmsEntryOpenSearchIndex/index.js.map +1 -0
  119. package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +16 -0
  120. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +4 -0
  121. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -0
  122. package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +1 -0
  123. package/features/CmsEntryOpenSearchQueryModifier/index.js +3 -0
  124. package/features/CmsEntryOpenSearchQueryModifier/index.js.map +1 -0
  125. package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +15 -0
  126. package/features/CmsEntryOpenSearchSortModifier/abstractions.js +4 -0
  127. package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -0
  128. package/features/CmsEntryOpenSearchSortModifier/index.d.ts +1 -0
  129. package/features/CmsEntryOpenSearchSortModifier/index.js +3 -0
  130. package/features/CmsEntryOpenSearchSortModifier/index.js.map +1 -0
  131. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +12 -0
  132. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +27 -0
  133. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  134. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +22 -0
  135. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +4 -0
  136. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -0
  137. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +10 -0
  138. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +4 -0
  139. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  140. package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +4 -0
  141. package/features/CmsEntryOpenSearchValueSearch/feature.js +16 -0
  142. package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -0
  143. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +10 -0
  144. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +23 -0
  145. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -0
  146. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +10 -0
  147. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +55 -0
  148. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -0
  149. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +10 -0
  150. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +24 -0
  151. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -0
  152. package/features/CmsEntryOpenSearchValueSearch/index.d.ts +3 -0
  153. package/features/CmsEntryOpenSearchValueSearch/index.js +5 -0
  154. package/features/CmsEntryOpenSearchValueSearch/index.js.map +1 -0
  155. package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +23 -0
  156. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +4 -0
  157. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -0
  158. package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +1 -0
  159. package/features/CmsEntryOpenSearchValuesModifier/index.js +3 -0
  160. package/features/CmsEntryOpenSearchValuesModifier/index.js.map +1 -0
  161. package/helpers/entryIndexHelpers.d.ts +13 -11
  162. package/helpers/entryIndexHelpers.js +38 -94
  163. package/helpers/entryIndexHelpers.js.map +1 -1
  164. package/helpers/fieldIdentifier.d.ts +1 -1
  165. package/helpers/fieldIdentifier.js +2 -10
  166. package/helpers/fieldIdentifier.js.map +1 -1
  167. package/helpers/index.d.ts +2 -2
  168. package/helpers/index.js +2 -27
  169. package/helpers/index.js.map +1 -1
  170. package/index.d.ts +1 -3
  171. package/index.js +1 -223
  172. package/index.js.map +1 -1
  173. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
  174. package/operations/entry/dataLoader/DataLoaderCache.js +3 -13
  175. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  176. package/operations/entry/dataLoader/constants.js +1 -7
  177. package/operations/entry/dataLoader/constants.js.map +1 -1
  178. package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
  179. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  180. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
  181. package/operations/entry/dataLoader/getAllEntryRevisions.js +16 -26
  182. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  183. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
  184. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +23 -31
  185. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  186. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
  187. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +23 -31
  188. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  189. package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
  190. package/operations/entry/dataLoader/getRevisionById.js +26 -34
  191. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  192. package/operations/entry/dataLoader/index.d.ts +3 -3
  193. package/operations/entry/dataLoader/index.js +10 -31
  194. package/operations/entry/dataLoader/index.js.map +1 -1
  195. package/operations/entry/dataLoader/types.d.ts +4 -4
  196. package/operations/entry/dataLoader/types.js +1 -5
  197. package/operations/entry/dataLoader/types.js.map +1 -1
  198. package/operations/entry/dataLoaders.d.ts +13 -13
  199. package/operations/entry/dataLoaders.js +16 -24
  200. package/operations/entry/dataLoaders.js.map +1 -1
  201. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
  202. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
  203. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
  204. package/operations/entry/elasticsearch/body.d.ts +20 -4
  205. package/operations/entry/elasticsearch/body.js +49 -53
  206. package/operations/entry/elasticsearch/body.js.map +1 -1
  207. package/operations/entry/elasticsearch/fields/createSystemField.d.ts +4 -0
  208. package/operations/entry/elasticsearch/fields/createSystemField.js +10 -0
  209. package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -0
  210. package/operations/entry/elasticsearch/fields/live.d.ts +2 -0
  211. package/operations/entry/elasticsearch/fields/live.js +45 -0
  212. package/operations/entry/elasticsearch/fields/live.js.map +1 -0
  213. package/operations/entry/elasticsearch/fields/location.d.ts +2 -0
  214. package/operations/entry/elasticsearch/fields/location.js +45 -0
  215. package/operations/entry/elasticsearch/fields/location.js.map +1 -0
  216. package/operations/entry/elasticsearch/fields/state.d.ts +2 -0
  217. package/operations/entry/elasticsearch/fields/state.js +93 -0
  218. package/operations/entry/elasticsearch/fields/state.js.map +1 -0
  219. package/operations/entry/elasticsearch/fields.d.ts +8 -6
  220. package/operations/entry/elasticsearch/fields.js +38 -122
  221. package/operations/entry/elasticsearch/fields.js.map +1 -1
  222. package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +6 -5
  223. package/operations/entry/elasticsearch/filtering/applyFiltering.js +13 -20
  224. package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
  225. package/operations/entry/elasticsearch/filtering/exec.d.ts +11 -6
  226. package/operations/entry/elasticsearch/filtering/exec.js +47 -97
  227. package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
  228. package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
  229. package/operations/entry/elasticsearch/filtering/index.js +1 -16
  230. package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
  231. package/operations/entry/elasticsearch/filtering/path.d.ts +5 -3
  232. package/operations/entry/elasticsearch/filtering/path.js +10 -20
  233. package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
  234. package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -2
  235. package/operations/entry/elasticsearch/filtering/populated.js +1 -8
  236. package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
  237. package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
  238. package/operations/entry/elasticsearch/filtering/values.js +4 -12
  239. package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
  240. package/operations/entry/elasticsearch/fullTextSearch.d.ts +7 -6
  241. package/operations/entry/elasticsearch/fullTextSearch.js +39 -42
  242. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
  243. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +4 -4
  244. package/operations/entry/elasticsearch/fullTextSearchFields.js +11 -18
  245. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
  246. package/operations/entry/elasticsearch/initialQuery.d.ts +4 -4
  247. package/operations/entry/elasticsearch/initialQuery.js +9 -27
  248. package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
  249. package/operations/entry/elasticsearch/keyword.d.ts +1 -1
  250. package/operations/entry/elasticsearch/keyword.js +4 -9
  251. package/operations/entry/elasticsearch/keyword.js.map +1 -1
  252. package/operations/entry/elasticsearch/plugins/operator.d.ts +2 -3
  253. package/operations/entry/elasticsearch/plugins/operator.js +4 -19
  254. package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
  255. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +2 -9
  256. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
  257. package/operations/entry/elasticsearch/sort.d.ts +6 -6
  258. package/operations/entry/elasticsearch/sort.js +52 -36
  259. package/operations/entry/elasticsearch/sort.js.map +1 -1
  260. package/operations/entry/elasticsearch/transformValueForSearch.d.ts +3 -10
  261. package/operations/entry/elasticsearch/transformValueForSearch.js +5 -20
  262. package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
  263. package/operations/entry/elasticsearch/types.d.ts +4 -11
  264. package/operations/entry/elasticsearch/types.js +1 -5
  265. package/operations/entry/elasticsearch/types.js.map +1 -1
  266. package/operations/entry/index.d.ts +26 -5
  267. package/operations/entry/index.js +421 -541
  268. package/operations/entry/index.js.map +1 -1
  269. package/operations/entry/keys.d.ts +31 -1
  270. package/operations/entry/keys.js +56 -19
  271. package/operations/entry/keys.js.map +1 -1
  272. package/operations/entry/recordType.js +3 -12
  273. package/operations/entry/recordType.js.map +1 -1
  274. package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
  275. package/operations/entry/transformations/convertEntryKeys.js +2 -10
  276. package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
  277. package/operations/entry/transformations/index.d.ts +24 -18
  278. package/operations/entry/transformations/index.js +31 -37
  279. package/operations/entry/transformations/index.js.map +1 -1
  280. package/operations/entry/transformations/modifyEntryValues.d.ts +30 -35
  281. package/operations/entry/transformations/modifyEntryValues.js +4 -11
  282. package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
  283. package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
  284. package/operations/entry/transformations/transformEntryKeys.js +4 -11
  285. package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
  286. package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -8
  287. package/operations/entry/transformations/transformEntryToIndex.js +9 -14
  288. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
  289. package/operations/group/index.d.ts +7 -6
  290. package/operations/group/index.js +41 -78
  291. package/operations/group/index.js.map +1 -1
  292. package/operations/model/index.d.ts +4 -4
  293. package/operations/model/index.js +38 -58
  294. package/operations/model/index.js.map +1 -1
  295. package/package.json +32 -34
  296. package/tasks/createIndexTaskPlugin.d.ts +2 -2
  297. package/tasks/createIndexTaskPlugin.js +41 -60
  298. package/tasks/createIndexTaskPlugin.js.map +1 -1
  299. package/types.d.ts +26 -134
  300. package/types.js +2 -28
  301. package/types.js.map +1 -1
  302. package/values/NoValueContainer.d.ts +5 -0
  303. package/values/NoValueContainer.js +13 -0
  304. package/values/NoValueContainer.js.map +1 -0
  305. package/definitions/entryElasticsearch.d.ts +0 -9
  306. package/definitions/entryElasticsearch.js +0 -41
  307. package/definitions/entryElasticsearch.js.map +0 -1
  308. package/definitions/system.d.ts +0 -9
  309. package/definitions/system.js +0 -42
  310. package/definitions/system.js.map +0 -1
  311. package/definitions/table.d.ts +0 -8
  312. package/definitions/table.js +0 -25
  313. package/definitions/table.js.map +0 -1
  314. package/definitions/tableElasticsearch.d.ts +0 -8
  315. package/definitions/tableElasticsearch.js +0 -25
  316. package/definitions/tableElasticsearch.js.map +0 -1
  317. package/dynamoDb/index.d.ts +0 -3
  318. package/dynamoDb/index.js +0 -16
  319. package/dynamoDb/index.js.map +0 -1
  320. package/dynamoDb/storage/longText.d.ts +0 -10
  321. package/dynamoDb/storage/longText.js +0 -96
  322. package/dynamoDb/storage/longText.js.map +0 -1
  323. package/dynamoDb/storage/richText.d.ts +0 -2
  324. package/dynamoDb/storage/richText.js +0 -59
  325. package/dynamoDb/storage/richText.js.map +0 -1
  326. package/elasticsearch/index.d.ts +0 -2
  327. package/elasticsearch/index.js +0 -13
  328. package/elasticsearch/index.js.map +0 -1
  329. package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
  330. package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
  331. package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
  332. package/elasticsearch/indexing/defaultFieldIndexing.js +0 -54
  333. package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
  334. package/elasticsearch/indexing/index.d.ts +0 -2
  335. package/elasticsearch/indexing/index.js +0 -18
  336. package/elasticsearch/indexing/index.js.map +0 -1
  337. package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
  338. package/elasticsearch/indexing/jsonIndexing.js +0 -28
  339. package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
  340. package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
  341. package/elasticsearch/indexing/longTextIndexing.js +0 -42
  342. package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
  343. package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
  344. package/elasticsearch/indexing/numberIndexing.js.map +0 -1
  345. package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
  346. package/elasticsearch/indexing/objectIndexing.js +0 -201
  347. package/elasticsearch/indexing/objectIndexing.js.map +0 -1
  348. package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
  349. package/elasticsearch/indexing/richTextIndexing.js +0 -31
  350. package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
  351. package/elasticsearch/indices/base.d.ts +0 -2
  352. package/elasticsearch/indices/base.js +0 -13
  353. package/elasticsearch/indices/base.js.map +0 -1
  354. package/elasticsearch/indices/index.d.ts +0 -1
  355. package/elasticsearch/indices/index.js +0 -14
  356. package/elasticsearch/indices/index.js.map +0 -1
  357. package/elasticsearch/indices/japanese.d.ts +0 -2
  358. package/elasticsearch/indices/japanese.js +0 -14
  359. package/elasticsearch/indices/japanese.js.map +0 -1
  360. package/elasticsearch/search/index.d.ts +0 -3
  361. package/elasticsearch/search/index.js +0 -12
  362. package/elasticsearch/search/index.js.map +0 -1
  363. package/elasticsearch/search/refSearch.d.ts +0 -2
  364. package/elasticsearch/search/refSearch.js +0 -31
  365. package/elasticsearch/search/refSearch.js.map +0 -1
  366. package/elasticsearch/search/timeSearch.d.ts +0 -2
  367. package/elasticsearch/search/timeSearch.js +0 -27
  368. package/elasticsearch/search/timeSearch.js.map +0 -1
  369. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
  370. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -30
  371. package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
  372. package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
  373. package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -15
  374. package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
  375. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
  376. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -69
  377. package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
  378. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
  379. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -57
  380. package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
  381. package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
  382. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
  383. package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
  384. package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
  385. package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -18
  386. package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
  387. package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
  388. package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -18
  389. package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
  390. package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
  391. package/operations/entry/elasticsearch/plugins/search.js +0 -26
  392. package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
  393. package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
  394. package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -18
  395. package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
  396. package/operations/system/index.d.ts +0 -6
  397. package/operations/system/index.js +0 -94
  398. package/operations/system/index.js.map +0 -1
  399. package/operations/system/indexes.d.ts +0 -10
  400. package/operations/system/indexes.js +0 -41
  401. package/operations/system/indexes.js.map +0 -1
  402. package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
  403. package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -52
  404. package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
  405. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
  406. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -21
  407. package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
  408. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
  409. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -27
  410. package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
  411. package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
  412. package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -13
  413. package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
  414. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -31
  415. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -40
  416. package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
  417. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
  418. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -21
  419. package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
  420. package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
  421. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -21
  422. package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
  423. package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
  424. package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -50
  425. package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
  426. package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
  427. package/plugins/CmsEntryFilterPlugin.js +0 -22
  428. package/plugins/CmsEntryFilterPlugin.js.map +0 -1
  429. package/plugins/index.d.ts +0 -8
  430. package/plugins/index.js +0 -95
  431. package/plugins/index.js.map +0 -1
@@ -1,20 +1,13 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createApplyFiltering = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _transformValueForSearch = require("../transformValueForSearch");
10
- var _keyword = require("../keyword");
11
- var _path = require("./path");
12
- const createApplyFiltering = ({
1
+ import WebinyError from "@webiny/error";
2
+ import { transformValueForSearch } from "../transformValueForSearch.js";
3
+ import { hasKeyword } from "../keyword.js";
4
+ import { createFieldPathFactory } from "./path.js";
5
+ export const createApplyFiltering = ({
13
6
  operatorPlugins,
14
- searchPlugins
7
+ valueSearchRegistry
15
8
  }) => {
16
- const createFieldPath = (0, _path.createFieldPathFactory)({
17
- plugins: searchPlugins
9
+ const createFieldPath = createFieldPathFactory({
10
+ valueSearchRegistry
18
11
  });
19
12
  return params => {
20
13
  const {
@@ -26,22 +19,23 @@ const createApplyFiltering = ({
26
19
  } = params;
27
20
  const plugin = operatorPlugins[operator];
28
21
  if (!plugin) {
29
- throw new _error.default(`Elasticsearch operator "${operator}" plugin missing.`, "PLUGIN_MISSING", {
22
+ throw new WebinyError(`Elasticsearch operator "${operator}" plugin missing.`, "PLUGIN_MISSING", {
30
23
  operator
31
24
  });
32
25
  }
33
- const value = (0, _transformValueForSearch.transformValueForSearch)({
34
- plugins: searchPlugins,
26
+ const value = transformValueForSearch({
27
+ valueSearchRegistry,
35
28
  field: field.field,
36
29
  value: initialValue
37
30
  });
38
- const keyword = (0, _keyword.hasKeyword)(field);
31
+ const keyword = hasKeyword(field);
39
32
  const {
40
33
  basePath,
41
34
  path
42
35
  } = createFieldPath({
43
36
  field,
44
37
  value,
38
+ originalValue: initialValue,
45
39
  key,
46
40
  keyword
47
41
  });
@@ -54,6 +48,5 @@ const createApplyFiltering = ({
54
48
  });
55
49
  };
56
50
  };
57
- exports.createApplyFiltering = createApplyFiltering;
58
51
 
59
52
  //# sourceMappingURL=applyFiltering.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_transformValueForSearch","_keyword","_path","createApplyFiltering","operatorPlugins","searchPlugins","createFieldPath","createFieldPathFactory","plugins","params","key","value","initialValue","query","operator","field","plugin","WebinyError","transformValueForSearch","keyword","hasKeyword","basePath","path","apply","name","fieldId","exports"],"sources":["applyFiltering.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { transformValueForSearch } from \"~/operations/entry/elasticsearch/transformValueForSearch\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword\";\nimport type {\n ElasticsearchQueryBuilderOperatorPlugins,\n ElasticsearchQuerySearchValuePlugins\n} from \"~/operations/entry/elasticsearch/types\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path\";\nimport type { ApplyFilteringCb } from \"~/plugins/CmsEntryFilterPlugin\";\n\ninterface CreateParams {\n operatorPlugins: ElasticsearchQueryBuilderOperatorPlugins;\n searchPlugins: ElasticsearchQuerySearchValuePlugins;\n}\n\nexport const createApplyFiltering = ({\n operatorPlugins,\n searchPlugins\n}: CreateParams): ApplyFilteringCb => {\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n return params => {\n const { key, value: initialValue, query, operator, field } = params;\n\n const plugin = operatorPlugins[operator];\n if (!plugin) {\n throw new WebinyError(\n `Elasticsearch operator \"${operator}\" plugin missing.`,\n \"PLUGIN_MISSING\",\n {\n operator\n }\n );\n }\n\n const value = transformValueForSearch({\n plugins: searchPlugins,\n field: field.field,\n value: initialValue\n });\n\n const keyword = hasKeyword(field);\n\n const { basePath, path } = createFieldPath({\n field,\n value,\n key,\n keyword\n });\n\n plugin.apply(query, {\n name: field.field.fieldId,\n basePath,\n path,\n value,\n keyword\n });\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAQO,MAAMI,oBAAoB,GAAGA,CAAC;EACjCC,eAAe;EACfC;AACU,CAAC,KAAuB;EAClC,MAAMC,eAAe,GAAG,IAAAC,4BAAsB,EAAC;IAC3CC,OAAO,EAAEH;EACb,CAAC,CAAC;EAEF,OAAOI,MAAM,IAAI;IACb,MAAM;MAAEC,GAAG;MAAEC,KAAK,EAAEC,YAAY;MAAEC,KAAK;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAGN,MAAM;IAEnE,MAAMO,MAAM,GAAGZ,eAAe,CAACU,QAAQ,CAAC;IACxC,IAAI,CAACE,MAAM,EAAE;MACT,MAAM,IAAIC,cAAW,CACjB,2BAA2BH,QAAQ,mBAAmB,EACtD,gBAAgB,EAChB;QACIA;MACJ,CACJ,CAAC;IACL;IAEA,MAAMH,KAAK,GAAG,IAAAO,gDAAuB,EAAC;MAClCV,OAAO,EAAEH,aAAa;MACtBU,KAAK,EAAEA,KAAK,CAACA,KAAK;MAClBJ,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAMO,OAAO,GAAG,IAAAC,mBAAU,EAACL,KAAK,CAAC;IAEjC,MAAM;MAAEM,QAAQ;MAAEC;IAAK,CAAC,GAAGhB,eAAe,CAAC;MACvCS,KAAK;MACLJ,KAAK;MACLD,GAAG;MACHS;IACJ,CAAC,CAAC;IAEFH,MAAM,CAACO,KAAK,CAACV,KAAK,EAAE;MAChBW,IAAI,EAAET,KAAK,CAACA,KAAK,CAACU,OAAO;MACzBJ,QAAQ;MACRC,IAAI;MACJX,KAAK;MACLQ;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAACO,OAAA,CAAAvB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","transformValueForSearch","hasKeyword","createFieldPathFactory","createApplyFiltering","operatorPlugins","valueSearchRegistry","createFieldPath","params","key","value","initialValue","query","operator","field","plugin","keyword","basePath","path","originalValue","apply","name","fieldId"],"sources":["applyFiltering.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { transformValueForSearch } from \"~/operations/entry/elasticsearch/transformValueForSearch.js\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword.js\";\nimport type { OpenSearchQueryBuilderOperatorPlugins } from \"~/operations/entry/elasticsearch/types.js\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path.js\";\nimport type { CmsEntryOpenSearchFilter } from \"~/features/CmsEntryOpenSearchFilter/index.js\";\nimport type { CmsEntryOpenSearchValueSearchRegistry } from \"~/features/CmsEntryOpenSearchValueSearch/index.js\";\n\ninterface CreateParams {\n operatorPlugins: OpenSearchQueryBuilderOperatorPlugins;\n valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;\n}\n\nexport const createApplyFiltering = ({\n operatorPlugins,\n valueSearchRegistry\n}: CreateParams): CmsEntryOpenSearchFilter.ApplyFiltering => {\n const createFieldPath = createFieldPathFactory({\n valueSearchRegistry\n });\n\n return params => {\n const { key, value: initialValue, query, operator, field } = params;\n\n const plugin = operatorPlugins[operator];\n if (!plugin) {\n throw new WebinyError(\n `Elasticsearch operator \"${operator}\" plugin missing.`,\n \"PLUGIN_MISSING\",\n {\n operator\n }\n );\n }\n\n const value = transformValueForSearch({\n valueSearchRegistry,\n field: field.field,\n value: initialValue\n });\n\n const keyword = hasKeyword(field);\n\n const { basePath, path } = createFieldPath({\n field,\n value,\n originalValue: initialValue,\n key,\n keyword\n });\n\n plugin.apply(query, {\n name: field.field.fieldId,\n basePath,\n path,\n value,\n keyword\n });\n };\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,uBAAuB;AAChC,SAASC,UAAU;AAEnB,SAASC,sBAAsB;AAS/B,OAAO,MAAMC,oBAAoB,GAAGA,CAAC;EACjCC,eAAe;EACfC;AACU,CAAC,KAA8C;EACzD,MAAMC,eAAe,GAAGJ,sBAAsB,CAAC;IAC3CG;EACJ,CAAC,CAAC;EAEF,OAAOE,MAAM,IAAI;IACb,MAAM;MAAEC,GAAG;MAAEC,KAAK,EAAEC,YAAY;MAAEC,KAAK;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAGN,MAAM;IAEnE,MAAMO,MAAM,GAAGV,eAAe,CAACQ,QAAQ,CAAC;IACxC,IAAI,CAACE,MAAM,EAAE;MACT,MAAM,IAAIf,WAAW,CACjB,2BAA2Ba,QAAQ,mBAAmB,EACtD,gBAAgB,EAChB;QACIA;MACJ,CACJ,CAAC;IACL;IAEA,MAAMH,KAAK,GAAGT,uBAAuB,CAAC;MAClCK,mBAAmB;MACnBQ,KAAK,EAAEA,KAAK,CAACA,KAAK;MAClBJ,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAMK,OAAO,GAAGd,UAAU,CAACY,KAAK,CAAC;IAEjC,MAAM;MAAEG,QAAQ;MAAEC;IAAK,CAAC,GAAGX,eAAe,CAAC;MACvCO,KAAK;MACLJ,KAAK;MACLS,aAAa,EAAER,YAAY;MAC3BF,GAAG;MACHO;IACJ,CAAC,CAAC;IAEFD,MAAM,CAACK,KAAK,CAACR,KAAK,EAAE;MAChBS,IAAI,EAAEP,KAAK,CAACA,KAAK,CAACQ,OAAO;MACzBL,QAAQ;MACRC,IAAI;MACJR,KAAK;MACLM;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,17 +1,22 @@
1
- import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types";
2
- import type { ModelFields } from "../types";
1
+ import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { ModelFields } from "../../../../operations/entry/elasticsearch/types.js";
3
3
  import type { PluginsContainer } from "@webiny/plugins";
4
- import type { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types";
4
+ import type { OpenSearchBoolQueryConfig } from "@webiny/api-opensearch/types.js";
5
+ import type { CmsEntryOpenSearchValueSearchRegistry } from "../../../../features/CmsEntryOpenSearchValueSearch/index.js";
6
+ import type { CmsEntryOpenSearchFilterRegistry } from "../../../../features/CmsEntryOpenSearchFilter/index.js";
5
7
  export interface CreateExecParams {
6
8
  model: CmsModel;
7
9
  fields: ModelFields;
8
10
  plugins: PluginsContainer;
11
+ valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;
12
+ filterRegistry: CmsEntryOpenSearchFilterRegistry.Interface;
9
13
  }
10
- export interface ExecParams {
14
+ export interface IExecParams {
11
15
  where: CmsEntryListWhere;
12
- query: ElasticsearchBoolQueryConfig;
16
+ query: OpenSearchBoolQueryConfig;
17
+ isValues?: boolean;
13
18
  }
14
19
  export interface CreateExecFilteringResponse {
15
- (params: ExecParams): void;
20
+ (params: IExecParams): void;
16
21
  }
17
22
  export declare const createExecFiltering: (params: CreateExecParams) => CreateExecFilteringResponse;
@@ -1,94 +1,55 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createExecFiltering = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- var _search = require("../plugins/search");
10
- var _operator = require("../plugins/operator");
11
- var _initialQuery = require("../initialQuery");
12
- var _apiElasticsearch = require("@webiny/api-elasticsearch");
13
- var _values = require("./values");
14
- var _populated = require("./populated");
15
- var _applyFiltering = require("./applyFiltering");
16
- var _CmsEntryFilterPlugin = require("../../../../plugins/CmsEntryFilterPlugin");
17
- var _assignMinimumShouldMatchToQuery = require("../assignMinimumShouldMatchToQuery");
18
- const createExecFiltering = params => {
1
+ import WebinyError from "@webiny/error";
2
+ import { createOperatorPluginList } from "../plugins/operator.js";
3
+ import { createBaseQuery } from "../initialQuery.js";
4
+ import { parseWhereKey } from "@webiny/api-opensearch";
5
+ import { getWhereValues } from "./values.js";
6
+ import { getPopulated } from "./populated.js";
7
+ import { createApplyFiltering } from "./applyFiltering.js";
8
+ import { assignMinimumShouldMatchToQuery } from "../assignMinimumShouldMatchToQuery.js";
9
+ export const createExecFiltering = params => {
19
10
  const {
20
11
  fields,
21
12
  plugins,
22
- model
13
+ model,
14
+ valueSearchRegistry,
15
+ filterRegistry
23
16
  } = params;
24
-
25
- /**
26
- * We need the search plugins as key -> plugin value, so it is easy to find plugin we need, without iterating through array.
27
- */
28
- const searchPlugins = (0, _search.createSearchPluginList)({
17
+ const operatorPlugins = createOperatorPluginList({
29
18
  plugins
30
19
  });
31
- /**
32
- * We need the operator plugins, which we execute on our where conditions.
33
- */
34
- const operatorPlugins = (0, _operator.createOperatorPluginList)({
35
- plugins,
36
- locale: model.locale
37
- });
38
- const applyFiltering = (0, _applyFiltering.createApplyFiltering)({
20
+ const applyFiltering = createApplyFiltering({
39
21
  operatorPlugins,
40
- searchPlugins
22
+ valueSearchRegistry
41
23
  });
42
- const filteringPlugins = plugins.byType(_CmsEntryFilterPlugin.CmsEntryFilterPlugin.type).reduce((collection, plugin) => {
43
- collection[plugin.fieldType] = plugin;
44
- return collection;
45
- }, {});
46
- const getFilterPlugin = type => {
47
- const plugin = filteringPlugins[type] || filteringPlugins["*"];
48
- if (plugin) {
49
- return plugin;
50
- }
51
- throw new _error.default(`There is no filtering plugin for the given field type "${type}".`, "FILTERING_PLUGIN_ERROR", {
52
- type
53
- });
24
+ const getFilter = type => {
25
+ return filterRegistry.get(type);
54
26
  };
55
27
  const execFiltering = params => {
56
28
  const {
57
29
  where: initialWhere,
58
- query
30
+ query,
31
+ isValues = false
59
32
  } = params;
60
- /**
61
- * No point in continuing if no "where" conditions exist.
62
- */
63
33
  const keys = Object.keys(initialWhere);
64
34
  if (keys.length === 0) {
65
35
  return;
66
36
  }
67
- const where = {
68
- ...initialWhere
69
- };
37
+ const where = structuredClone(initialWhere);
70
38
  for (const key in where) {
71
39
  const value = where[key];
72
- /**
73
- * We always skip if no value is defined.
74
- * Only skip undefined value, null is valid.
75
- */
76
40
  if (value === undefined) {
77
41
  continue;
78
- }
79
- //
80
- /**
81
- * When we are running with AND, the "value" MUST be an array.
82
- */else if (key === "AND") {
83
- const childWhereList = (0, _values.getWhereValues)(value, "AND");
84
- const childQuery = (0, _initialQuery.createBaseQuery)();
42
+ } else if (key === "AND") {
43
+ const childWhereList = getWhereValues(value, "AND");
44
+ const childQuery = createBaseQuery();
85
45
  for (const childWhere of childWhereList) {
86
46
  execFiltering({
87
47
  query: childQuery,
88
- where: childWhere
48
+ where: childWhere,
49
+ isValues
89
50
  });
90
51
  }
91
- const childQueryBool = (0, _populated.getPopulated)(childQuery);
52
+ const childQueryBool = getPopulated(childQuery);
92
53
  if (Object.keys(childQueryBool).length === 0) {
93
54
  continue;
94
55
  }
@@ -96,23 +57,17 @@ const createExecFiltering = params => {
96
57
  bool: childQueryBool
97
58
  });
98
59
  continue;
99
- }
100
- //
101
- /**
102
- * When we are running with OR, the "value" must be an array.
103
- */else if (key === "OR") {
104
- const childWhereList = (0, _values.getWhereValues)(value, "OR");
105
- /**
106
- * Each of the conditions MUST produce it's own should section.
107
- */
60
+ } else if (key === "OR") {
61
+ const childWhereList = getWhereValues(value, "OR");
108
62
  const should = [];
109
63
  for (const childWhere of childWhereList) {
110
- const childQuery = (0, _initialQuery.createBaseQuery)();
64
+ const childQuery = createBaseQuery();
111
65
  execFiltering({
112
66
  query: childQuery,
113
- where: childWhere
67
+ where: childWhere,
68
+ isValues
114
69
  });
115
- const childQueryBool = (0, _populated.getPopulated)(childQuery);
70
+ const childQueryBool = getPopulated(childQuery);
116
71
  if (Object.keys(childQueryBool).length === 0) {
117
72
  continue;
118
73
  }
@@ -124,41 +79,37 @@ const createExecFiltering = params => {
124
79
  continue;
125
80
  }
126
81
  query.should.push(...should);
127
- /**
128
- * If there are any should, minimum to have is 1.
129
- * Of course, do not override if it's already set.
130
- */
131
- (0, _assignMinimumShouldMatchToQuery.assignMinimumShouldMatchToQuery)({
82
+ assignMinimumShouldMatchToQuery({
132
83
  query
133
84
  });
134
85
  continue;
86
+ } else if (key === "values") {
87
+ execFiltering({
88
+ query,
89
+ where: where[key],
90
+ isValues: true
91
+ });
92
+ continue;
135
93
  }
136
94
  const {
137
95
  field: whereFieldId,
138
96
  operator
139
- } = (0, _apiElasticsearch.parseWhereKey)(key);
140
- let fieldId = whereFieldId;
141
-
142
- /**
143
- * TODO This will be required until the storage operations receive the fieldId instead of field storageId.
144
- * TODO For this to work without field searching, we need to refactor how the query looks like.
145
- *
146
- * Storage operations should NEVER receive an field storageId, only alias - fieldId.
147
- */
97
+ } = parseWhereKey(key);
98
+ let fieldId = isValues ? `values.${whereFieldId}` : whereFieldId;
148
99
  const cmsModelField = model.fields.find(f => f.fieldId === fieldId);
149
100
  if (!cmsModelField && !fields[fieldId]) {
150
- throw new _error.default(`There is no CMS Model Field "${fieldId}".`);
101
+ throw new WebinyError(`There is no CMS Model Field "${fieldId}".`);
151
102
  } else if (cmsModelField) {
152
103
  fieldId = cmsModelField.fieldId;
153
104
  }
154
105
  const field = fields[fieldId];
155
106
  if (!field) {
156
- throw new _error.default(`There is no field "${fieldId}".`, "EXEC_FILTERING_ERROR");
107
+ throw new WebinyError(`There is no field "${fieldId}".`, "EXEC_FILTERING_ERROR");
157
108
  }
158
- const filterPlugin = getFilterPlugin(field.type);
159
- filterPlugin.exec({
109
+ const filter = getFilter(field.type);
110
+ filter.exec({
160
111
  applyFiltering,
161
- getFilterPlugin,
112
+ getFilter,
162
113
  key,
163
114
  value,
164
115
  operator,
@@ -170,6 +121,5 @@ const createExecFiltering = params => {
170
121
  };
171
122
  return execFiltering;
172
123
  };
173
- exports.createExecFiltering = createExecFiltering;
174
124
 
175
125
  //# sourceMappingURL=exec.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_search","_operator","_initialQuery","_apiElasticsearch","_values","_populated","_applyFiltering","_CmsEntryFilterPlugin","_assignMinimumShouldMatchToQuery","createExecFiltering","params","fields","plugins","model","searchPlugins","createSearchPluginList","operatorPlugins","createOperatorPluginList","locale","applyFiltering","createApplyFiltering","filteringPlugins","byType","CmsEntryFilterPlugin","type","reduce","collection","plugin","fieldType","getFilterPlugin","WebinyError","execFiltering","where","initialWhere","query","keys","Object","length","key","value","undefined","childWhereList","getWhereValues","childQuery","createBaseQuery","childWhere","childQueryBool","getPopulated","filter","push","bool","should","assignMinimumShouldMatchToQuery","field","whereFieldId","operator","parseWhereKey","fieldId","cmsModelField","find","f","filterPlugin","exec","exports"],"sources":["exec.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport type { ModelFields } from \"~/operations/entry/elasticsearch/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { ElasticsearchBoolQueryConfig, Query } from \"@webiny/api-elasticsearch/types\";\nimport { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search\";\nimport { createOperatorPluginList } from \"~/operations/entry/elasticsearch/plugins/operator\";\nimport { createBaseQuery } from \"~/operations/entry/elasticsearch/initialQuery\";\nimport { parseWhereKey } from \"@webiny/api-elasticsearch\";\nimport { getWhereValues } from \"./values\";\nimport { getPopulated } from \"./populated\";\nimport { createApplyFiltering } from \"./applyFiltering\";\nimport { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin\";\nimport { assignMinimumShouldMatchToQuery } from \"~/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery\";\n\nexport interface CreateExecParams {\n model: CmsModel;\n fields: ModelFields;\n plugins: PluginsContainer;\n}\nexport interface ExecParams {\n where: CmsEntryListWhere;\n query: ElasticsearchBoolQueryConfig;\n}\nexport interface CreateExecFilteringResponse {\n (params: ExecParams): void;\n}\nexport const createExecFiltering = (params: CreateExecParams): CreateExecFilteringResponse => {\n const { fields, plugins, model } = params;\n\n /**\n * We need the search plugins as key -> plugin value, so it is easy to find plugin we need, without iterating through array.\n */\n const searchPlugins = createSearchPluginList({\n plugins\n });\n /**\n * We need the operator plugins, which we execute on our where conditions.\n */\n const operatorPlugins = createOperatorPluginList({\n plugins,\n locale: model.locale\n });\n\n const applyFiltering = createApplyFiltering({\n operatorPlugins,\n searchPlugins\n });\n\n const filteringPlugins = plugins\n .byType<CmsEntryFilterPlugin>(CmsEntryFilterPlugin.type)\n .reduce<Record<string, CmsEntryFilterPlugin>>((collection, plugin) => {\n collection[plugin.fieldType] = plugin;\n\n return collection;\n }, {});\n\n const getFilterPlugin = (type: string) => {\n const plugin = filteringPlugins[type] || filteringPlugins[\"*\"];\n if (plugin) {\n return plugin;\n }\n throw new WebinyError(\n `There is no filtering plugin for the given field type \"${type}\".`,\n \"FILTERING_PLUGIN_ERROR\",\n {\n type\n }\n );\n };\n\n const execFiltering = (params: ExecParams) => {\n const { where: initialWhere, query } = params;\n /**\n * No point in continuing if no \"where\" conditions exist.\n */\n const keys = Object.keys(initialWhere);\n if (keys.length === 0) {\n return;\n }\n const where: CmsEntryListWhere = {\n ...initialWhere\n };\n\n for (const key in where) {\n const value = where[key];\n /**\n * We always skip if no value is defined.\n * Only skip undefined value, null is valid.\n */\n if (value === undefined) {\n continue;\n }\n //\n /**\n * When we are running with AND, the \"value\" MUST be an array.\n */\n else if (key === \"AND\") {\n const childWhereList = getWhereValues(value, \"AND\");\n\n const childQuery = createBaseQuery();\n\n for (const childWhere of childWhereList) {\n execFiltering({\n query: childQuery,\n where: childWhere\n });\n }\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n query.filter.push({\n bool: childQueryBool\n });\n\n continue;\n }\n //\n /**\n * When we are running with OR, the \"value\" must be an array.\n */\n else if (key === \"OR\") {\n const childWhereList = getWhereValues(value, \"OR\");\n /**\n * Each of the conditions MUST produce it's own should section.\n */\n const should: Query[] = [];\n for (const childWhere of childWhereList) {\n const childQuery = createBaseQuery();\n execFiltering({\n query: childQuery,\n where: childWhere\n });\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n should.push({\n bool: childQueryBool\n });\n }\n if (should.length === 0) {\n continue;\n }\n query.should.push(...should);\n /**\n * If there are any should, minimum to have is 1.\n * Of course, do not override if it's already set.\n */\n assignMinimumShouldMatchToQuery({\n query\n });\n continue;\n }\n const { field: whereFieldId, operator } = parseWhereKey(key);\n\n let fieldId: string = whereFieldId;\n\n /**\n * TODO This will be required until the storage operations receive the fieldId instead of field storageId.\n * TODO For this to work without field searching, we need to refactor how the query looks like.\n *\n * Storage operations should NEVER receive an field storageId, only alias - fieldId.\n */\n const cmsModelField = model.fields.find(f => f.fieldId === fieldId);\n if (!cmsModelField && !fields[fieldId]) {\n throw new WebinyError(`There is no CMS Model Field \"${fieldId}\".`);\n } else if (cmsModelField) {\n fieldId = cmsModelField.fieldId;\n }\n\n const field = fields[fieldId];\n if (!field) {\n throw new WebinyError(`There is no field \"${fieldId}\".`, \"EXEC_FILTERING_ERROR\");\n }\n const filterPlugin = getFilterPlugin(field.type);\n\n filterPlugin.exec({\n applyFiltering,\n getFilterPlugin,\n key,\n value,\n operator,\n field,\n fields,\n query\n });\n }\n };\n\n return execFiltering;\n};\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","createOperatorPluginList","createBaseQuery","parseWhereKey","getWhereValues","getPopulated","createApplyFiltering","assignMinimumShouldMatchToQuery","createExecFiltering","params","fields","plugins","model","valueSearchRegistry","filterRegistry","operatorPlugins","applyFiltering","getFilter","type","get","execFiltering","where","initialWhere","query","isValues","keys","Object","length","structuredClone","key","value","undefined","childWhereList","childQuery","childWhere","childQueryBool","filter","push","bool","should","field","whereFieldId","operator","fieldId","cmsModelField","find","f","exec"],"sources":["exec.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type {\n OpenSearchBoolQueryConfig,\n QueryDslQueryContainer as Query\n} from \"@webiny/api-opensearch/types.js\";\nimport { createOperatorPluginList } from \"~/operations/entry/elasticsearch/plugins/operator.js\";\nimport { createBaseQuery } from \"~/operations/entry/elasticsearch/initialQuery.js\";\nimport { parseWhereKey } from \"@webiny/api-opensearch\";\nimport { getWhereValues } from \"./values.js\";\nimport { getPopulated } from \"./populated.js\";\nimport { createApplyFiltering } from \"./applyFiltering.js\";\nimport { assignMinimumShouldMatchToQuery } from \"~/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js\";\nimport type { CmsEntryOpenSearchValueSearchRegistry } from \"~/features/CmsEntryOpenSearchValueSearch/index.js\";\nimport type { CmsEntryOpenSearchFilterRegistry } from \"~/features/CmsEntryOpenSearchFilter/index.js\";\n\nexport interface CreateExecParams {\n model: CmsModel;\n fields: ModelFields;\n plugins: PluginsContainer;\n valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;\n filterRegistry: CmsEntryOpenSearchFilterRegistry.Interface;\n}\nexport interface IExecParams {\n where: CmsEntryListWhere;\n query: OpenSearchBoolQueryConfig;\n isValues?: boolean;\n}\nexport interface CreateExecFilteringResponse {\n (params: IExecParams): void;\n}\nexport const createExecFiltering = (params: CreateExecParams): CreateExecFilteringResponse => {\n const { fields, plugins, model, valueSearchRegistry, filterRegistry } = params;\n\n const operatorPlugins = createOperatorPluginList({\n plugins\n });\n\n const applyFiltering = createApplyFiltering({\n operatorPlugins,\n valueSearchRegistry\n });\n\n const getFilter = (type: string) => {\n return filterRegistry.get(type);\n };\n\n const execFiltering = (params: IExecParams) => {\n const { where: initialWhere, query, isValues = false } = params;\n const keys = Object.keys(initialWhere);\n if (keys.length === 0) {\n return;\n }\n const where = structuredClone(initialWhere);\n\n for (const key in where) {\n const value = where[key as keyof typeof where];\n if (value === undefined) {\n continue;\n } else if (key === \"AND\") {\n const childWhereList = getWhereValues(value, \"AND\");\n const childQuery = createBaseQuery();\n for (const childWhere of childWhereList) {\n execFiltering({ query: childQuery, where: childWhere, isValues });\n }\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n query.filter.push({ bool: childQueryBool });\n continue;\n } else if (key === \"OR\") {\n const childWhereList = getWhereValues(value, \"OR\");\n const should: Query[] = [];\n for (const childWhere of childWhereList) {\n const childQuery = createBaseQuery();\n execFiltering({ query: childQuery, where: childWhere, isValues });\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n should.push({ bool: childQueryBool });\n }\n if (should.length === 0) {\n continue;\n }\n query.should.push(...should);\n assignMinimumShouldMatchToQuery({ query });\n continue;\n } else if (key === \"values\") {\n execFiltering({\n query,\n where: where[key] as CmsEntryListWhere,\n isValues: true\n });\n continue;\n }\n const { field: whereFieldId, operator } = parseWhereKey(key);\n let fieldId: string = isValues ? `values.${whereFieldId}` : whereFieldId;\n\n const cmsModelField = model.fields.find(f => f.fieldId === fieldId);\n if (!cmsModelField && !fields[fieldId]) {\n throw new WebinyError(`There is no CMS Model Field \"${fieldId}\".`);\n } else if (cmsModelField) {\n fieldId = cmsModelField.fieldId;\n }\n\n const field = fields[fieldId];\n if (!field) {\n throw new WebinyError(`There is no field \"${fieldId}\".`, \"EXEC_FILTERING_ERROR\");\n }\n const filter = getFilter(field.type);\n\n filter.exec({\n applyFiltering,\n getFilter,\n key,\n value,\n operator,\n field,\n fields,\n query\n });\n }\n };\n\n return execFiltering;\n};\n"],"mappings":"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","ignoreList":[]}
@@ -1 +1 @@
1
- export * from "./exec";
1
+ export * from "./exec.js";
@@ -1,18 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exec = require("./exec");
7
- Object.keys(_exec).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _exec[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _exec[key];
14
- }
15
- });
16
- });
1
+ export * from "./exec.js";
17
2
 
18
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_exec","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./exec\";\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./exec.js\";\n"],"mappings":"AAAA","ignoreList":[]}
@@ -1,14 +1,16 @@
1
- import type { ElasticsearchQuerySearchValuePlugins, ModelField } from "../types";
1
+ import type { ModelField } from "../../../../operations/entry/elasticsearch/types.js";
2
+ import type { CmsEntryOpenSearchValueSearchRegistry } from "../../../../features/CmsEntryOpenSearchValueSearch/index.js";
2
3
  interface FieldPathFactoryParams {
3
- plugins: ElasticsearchQuerySearchValuePlugins;
4
+ valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;
4
5
  }
5
6
  interface FieldPathParams {
6
7
  field: ModelField;
7
8
  key: string;
8
9
  value: any;
10
+ originalValue: any;
9
11
  keyword: boolean;
10
12
  }
11
- export declare const createFieldPathFactory: ({ plugins }: FieldPathFactoryParams) => (params: FieldPathParams) => {
13
+ export declare const createFieldPathFactory: ({ valueSearchRegistry }: FieldPathFactoryParams) => (params: FieldPathParams) => {
12
14
  basePath: string;
13
15
  path: string;
14
16
  };
@@ -1,26 +1,22 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createFieldPathFactory = void 0;
7
- const createFieldPathFactory = ({
8
- plugins
1
+ export const createFieldPathFactory = ({
2
+ valueSearchRegistry
9
3
  }) => {
10
4
  return params => {
11
5
  const {
12
6
  field,
13
7
  key,
14
8
  value,
15
- keyword
9
+ keyword,
10
+ originalValue
16
11
  } = params;
17
- const plugin = plugins[field.type];
12
+ const search = valueSearchRegistry.get(field.type);
18
13
  let fieldPath = null;
19
- if (plugin) {
20
- fieldPath = plugin.createPath({
14
+ if (search) {
15
+ fieldPath = search.createPath({
21
16
  field: field.field,
22
17
  value,
23
- key
18
+ key,
19
+ originalValue
24
20
  });
25
21
  }
26
22
  if (!fieldPath) {
@@ -29,18 +25,12 @@ const createFieldPathFactory = ({
29
25
  fieldPath = typeof field.path === "function" ? field.path(value) : field.path;
30
26
  }
31
27
  }
32
- const result = [];
33
- if (!field.systemField) {
34
- result.push("values");
35
- }
36
- result.push(...field.parents.map(p => p.storageId));
37
- result.push(fieldPath);
28
+ const result = field.parents.map(p => p.storageId).concat([fieldPath]);
38
29
  return {
39
30
  basePath: result.join("."),
40
31
  path: result.concat(keyword ? ["keyword"] : []).join(".")
41
32
  };
42
33
  };
43
34
  };
44
- exports.createFieldPathFactory = createFieldPathFactory;
45
35
 
46
36
  //# sourceMappingURL=path.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFieldPathFactory","plugins","params","field","key","value","keyword","plugin","type","fieldPath","createPath","storageId","path","result","systemField","push","parents","map","p","basePath","join","concat","exports"],"sources":["path.ts"],"sourcesContent":["import type {\n ElasticsearchQuerySearchValuePlugins,\n ModelField\n} from \"~/operations/entry/elasticsearch/types\";\n\ninterface FieldPathFactoryParams {\n plugins: ElasticsearchQuerySearchValuePlugins;\n}\ninterface FieldPathParams {\n field: ModelField;\n key: string;\n value: any;\n keyword: boolean;\n}\n\nexport const createFieldPathFactory = ({ plugins }: FieldPathFactoryParams) => {\n return (params: FieldPathParams) => {\n const { field, key, value, keyword } = params;\n const plugin = plugins[field.type];\n\n let fieldPath: string | null = null;\n if (plugin) {\n fieldPath = plugin.createPath({ field: field.field, value, key });\n }\n if (!fieldPath) {\n fieldPath = field.field.storageId;\n if (field.path) {\n fieldPath = typeof field.path === \"function\" ? field.path(value) : field.path;\n }\n }\n\n const result: string[] = [];\n if (!field.systemField) {\n result.push(\"values\");\n }\n result.push(...field.parents.map(p => p.storageId));\n result.push(fieldPath);\n\n return {\n basePath: result.join(\".\"),\n path: result.concat(keyword ? [\"keyword\"] : []).join(\".\")\n };\n };\n};\n"],"mappings":";;;;;;AAeO,MAAMA,sBAAsB,GAAGA,CAAC;EAAEC;AAAgC,CAAC,KAAK;EAC3E,OAAQC,MAAuB,IAAK;IAChC,MAAM;MAAEC,KAAK;MAAEC,GAAG;MAAEC,KAAK;MAAEC;IAAQ,CAAC,GAAGJ,MAAM;IAC7C,MAAMK,MAAM,GAAGN,OAAO,CAACE,KAAK,CAACK,IAAI,CAAC;IAElC,IAAIC,SAAwB,GAAG,IAAI;IACnC,IAAIF,MAAM,EAAE;MACRE,SAAS,GAAGF,MAAM,CAACG,UAAU,CAAC;QAAEP,KAAK,EAAEA,KAAK,CAACA,KAAK;QAAEE,KAAK;QAAED;MAAI,CAAC,CAAC;IACrE;IACA,IAAI,CAACK,SAAS,EAAE;MACZA,SAAS,GAAGN,KAAK,CAACA,KAAK,CAACQ,SAAS;MACjC,IAAIR,KAAK,CAACS,IAAI,EAAE;QACZH,SAAS,GAAG,OAAON,KAAK,CAACS,IAAI,KAAK,UAAU,GAAGT,KAAK,CAACS,IAAI,CAACP,KAAK,CAAC,GAAGF,KAAK,CAACS,IAAI;MACjF;IACJ;IAEA,MAAMC,MAAgB,GAAG,EAAE;IAC3B,IAAI,CAACV,KAAK,CAACW,WAAW,EAAE;MACpBD,MAAM,CAACE,IAAI,CAAC,QAAQ,CAAC;IACzB;IACAF,MAAM,CAACE,IAAI,CAAC,GAAGZ,KAAK,CAACa,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACP,SAAS,CAAC,CAAC;IACnDE,MAAM,CAACE,IAAI,CAACN,SAAS,CAAC;IAEtB,OAAO;MACHU,QAAQ,EAAEN,MAAM,CAACO,IAAI,CAAC,GAAG,CAAC;MAC1BR,IAAI,EAAEC,MAAM,CAACQ,MAAM,CAACf,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAACc,IAAI,CAAC,GAAG;IAC5D,CAAC;EACL,CAAC;AACL,CAAC;AAACE,OAAA,CAAAtB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["createFieldPathFactory","valueSearchRegistry","params","field","key","value","keyword","originalValue","search","get","type","fieldPath","createPath","storageId","path","result","parents","map","p","concat","basePath","join"],"sources":["path.ts"],"sourcesContent":["import type { ModelField } from \"~/operations/entry/elasticsearch/types.js\";\nimport type { CmsEntryOpenSearchValueSearchRegistry } from \"~/features/CmsEntryOpenSearchValueSearch/index.js\";\n\ninterface FieldPathFactoryParams {\n valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;\n}\ninterface FieldPathParams {\n field: ModelField;\n key: string;\n value: any;\n originalValue: any;\n keyword: boolean;\n}\n\nexport const createFieldPathFactory = ({ valueSearchRegistry }: FieldPathFactoryParams) => {\n return (params: FieldPathParams) => {\n const { field, key, value, keyword, originalValue } = params;\n const search = valueSearchRegistry.get(field.type);\n\n let fieldPath: string | null = null;\n if (search) {\n fieldPath = search.createPath({ field: field.field, value, key, originalValue });\n }\n if (!fieldPath) {\n fieldPath = field.field.storageId;\n if (field.path) {\n fieldPath = typeof field.path === \"function\" ? field.path(value) : field.path;\n }\n }\n\n const result: string[] = field.parents.map(p => p.storageId).concat([fieldPath]);\n\n return {\n basePath: result.join(\".\"),\n path: result.concat(keyword ? [\"keyword\"] : []).join(\".\")\n };\n };\n};\n"],"mappings":"AAcA,OAAO,MAAMA,sBAAsB,GAAGA,CAAC;EAAEC;AAA4C,CAAC,KAAK;EACvF,OAAQC,MAAuB,IAAK;IAChC,MAAM;MAAEC,KAAK;MAAEC,GAAG;MAAEC,KAAK;MAAEC,OAAO;MAAEC;IAAc,CAAC,GAAGL,MAAM;IAC5D,MAAMM,MAAM,GAAGP,mBAAmB,CAACQ,GAAG,CAACN,KAAK,CAACO,IAAI,CAAC;IAElD,IAAIC,SAAwB,GAAG,IAAI;IACnC,IAAIH,MAAM,EAAE;MACRG,SAAS,GAAGH,MAAM,CAACI,UAAU,CAAC;QAAET,KAAK,EAAEA,KAAK,CAACA,KAAK;QAAEE,KAAK;QAAED,GAAG;QAAEG;MAAc,CAAC,CAAC;IACpF;IACA,IAAI,CAACI,SAAS,EAAE;MACZA,SAAS,GAAGR,KAAK,CAACA,KAAK,CAACU,SAAS;MACjC,IAAIV,KAAK,CAACW,IAAI,EAAE;QACZH,SAAS,GAAG,OAAOR,KAAK,CAACW,IAAI,KAAK,UAAU,GAAGX,KAAK,CAACW,IAAI,CAACT,KAAK,CAAC,GAAGF,KAAK,CAACW,IAAI;MACjF;IACJ;IAEA,MAAMC,MAAgB,GAAGZ,KAAK,CAACa,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACL,SAAS,CAAC,CAACM,MAAM,CAAC,CAACR,SAAS,CAAC,CAAC;IAEhF,OAAO;MACHS,QAAQ,EAAEL,MAAM,CAACM,IAAI,CAAC,GAAG,CAAC;MAC1BP,IAAI,EAAEC,MAAM,CAACI,MAAM,CAACb,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAACe,IAAI,CAAC,GAAG;IAC5D,CAAC;EACL,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types";
2
- export declare const getPopulated: (query: ElasticsearchBoolQueryConfig) => Partial<ElasticsearchBoolQueryConfig>;
1
+ import type { OpenSearchBoolQueryConfig } from "@webiny/api-opensearch/types.js";
2
+ export declare const getPopulated: (query: OpenSearchBoolQueryConfig) => Partial<OpenSearchBoolQueryConfig>;
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getPopulated = void 0;
7
- const getPopulated = query => {
1
+ export const getPopulated = query => {
8
2
  const result = {};
9
3
  let key;
10
4
  for (key in query) {
@@ -20,6 +14,5 @@ const getPopulated = query => {
20
14
  }
21
15
  return result;
22
16
  };
23
- exports.getPopulated = getPopulated;
24
17
 
25
18
  //# sourceMappingURL=populated.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getPopulated","query","result","key","value","undefined","Array","isArray","length","exports"],"sources":["populated.ts"],"sourcesContent":["import type { ElasticsearchBoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\n\nexport const getPopulated = (\n query: ElasticsearchBoolQueryConfig\n): Partial<ElasticsearchBoolQueryConfig> => {\n const result: Partial<ElasticsearchBoolQueryConfig> = {};\n let key: keyof ElasticsearchBoolQueryConfig;\n for (key in query) {\n const value = query[key];\n if (value === undefined || (Array.isArray(value) && value.length === 0)) {\n continue;\n }\n /**\n * TODO figure out better types.\n */\n // @ts-expect-error\n result[key] = value;\n }\n return result;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GACrBC,KAAmC,IACK;EACxC,MAAMC,MAA6C,GAAG,CAAC,CAAC;EACxD,IAAIC,GAAuC;EAC3C,KAAKA,GAAG,IAAIF,KAAK,EAAE;IACf,MAAMG,KAAK,GAAGH,KAAK,CAACE,GAAG,CAAC;IACxB,IAAIC,KAAK,KAAKC,SAAS,IAAKC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAIA,KAAK,CAACI,MAAM,KAAK,CAAE,EAAE;MACrE;IACJ;IACA;AACR;AACA;IACQ;IACAN,MAAM,CAACC,GAAG,CAAC,GAAGC,KAAK;EACvB;EACA,OAAOF,MAAM;AACjB,CAAC;AAACO,OAAA,CAAAT,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["getPopulated","query","result","key","value","undefined","Array","isArray","length"],"sources":["populated.ts"],"sourcesContent":["import type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\n\nexport const getPopulated = (\n query: OpenSearchBoolQueryConfig\n): Partial<OpenSearchBoolQueryConfig> => {\n const result: Partial<OpenSearchBoolQueryConfig> = {};\n let key: keyof OpenSearchBoolQueryConfig;\n for (key in query) {\n const value = query[key];\n if (value === undefined || (Array.isArray(value) && value.length === 0)) {\n continue;\n }\n /**\n * TODO figure out better types.\n */\n // @ts-expect-error\n result[key] = value;\n }\n return result;\n};\n"],"mappings":"AAEA,OAAO,MAAMA,YAAY,GACrBC,KAAgC,IACK;EACrC,MAAMC,MAA0C,GAAG,CAAC,CAAC;EACrD,IAAIC,GAAoC;EACxC,KAAKA,GAAG,IAAIF,KAAK,EAAE;IACf,MAAMG,KAAK,GAAGH,KAAK,CAACE,GAAG,CAAC;IACxB,IAAIC,KAAK,KAAKC,SAAS,IAAKC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAIA,KAAK,CAACI,MAAM,KAAK,CAAE,EAAE;MACrE;IACJ;IACA;AACR;AACA;IACQ;IACAN,MAAM,CAACC,GAAG,CAAC,GAAGC,KAAK;EACvB;EACA,OAAOF,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { CmsEntryListWhere } from "@webiny/api-headless-cms/types";
1
+ import type { CmsEntryListWhere } from "@webiny/api-headless-cms/types/index.js";
2
2
  export declare const getWhereValues: (value: unknown, condition: "AND" | "OR") => CmsEntryListWhere[];
@@ -1,24 +1,16 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.getWhereValues = void 0;
8
- var _error = _interopRequireDefault(require("@webiny/error"));
9
- const getWhereValues = (value, condition) => {
1
+ import WebinyError from "@webiny/error";
2
+ export const getWhereValues = (value, condition) => {
10
3
  const values = value;
11
4
  if (!Array.isArray(values)) {
12
- throw new _error.default(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
5
+ throw new WebinyError(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
13
6
  value
14
7
  });
15
8
  } else if (values.length === 0) {
16
- throw new _error.default(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
9
+ throw new WebinyError(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
17
10
  value
18
11
  });
19
12
  }
20
13
  return values;
21
14
  };
22
- exports.getWhereValues = getWhereValues;
23
15
 
24
16
  //# sourceMappingURL=values.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","getWhereValues","value","condition","values","Array","isArray","WebinyError","length","exports"],"sources":["values.ts"],"sourcesContent":["import type { CmsEntryListWhere } from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getWhereValues = (value: unknown, condition: \"AND\" | \"OR\") => {\n const values = value as CmsEntryListWhere[] | undefined;\n if (!Array.isArray(values)) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is not an array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n } else if (values.length === 0) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is empty array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n }\n return values;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,MAAMC,cAAc,GAAGA,CAACC,KAAc,EAAEC,SAAuB,KAAK;EACvE,MAAMC,MAAM,GAAGF,KAAwC;EACvD,IAAI,CAACG,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IACxB,MAAM,IAAIG,cAAW,CACjB,iCAAiCJ,SAAS,wCAAwC,EAClF,aAAaA,SAAS,YAAY,EAClC;MACID;IACJ,CACJ,CAAC;EACL,CAAC,MAAM,IAAIE,MAAM,CAACI,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAID,cAAW,CACjB,iCAAiCJ,SAAS,uCAAuC,EACjF,aAAaA,SAAS,YAAY,EAClC;MACID;IACJ,CACJ,CAAC;EACL;EACA,OAAOE,MAAM;AACjB,CAAC;AAACK,OAAA,CAAAR,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","getWhereValues","value","condition","values","Array","isArray","length"],"sources":["values.ts"],"sourcesContent":["import type { CmsEntryListWhere } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getWhereValues = (value: unknown, condition: \"AND\" | \"OR\") => {\n const values = value as CmsEntryListWhere[] | undefined;\n if (!Array.isArray(values)) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is not an array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n } else if (values.length === 0) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is empty array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n }\n return values;\n};\n"],"mappings":"AACA,OAAOA,WAAW,MAAM,eAAe;AAEvC,OAAO,MAAMC,cAAc,GAAGA,CAACC,KAAc,EAAEC,SAAuB,KAAK;EACvE,MAAMC,MAAM,GAAGF,KAAwC;EACvD,IAAI,CAACG,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;IACxB,MAAM,IAAIJ,WAAW,CACjB,iCAAiCG,SAAS,wCAAwC,EAClF,aAAaA,SAAS,YAAY,EAClC;MACID;IACJ,CACJ,CAAC;EACL,CAAC,MAAM,IAAIE,MAAM,CAACG,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAIP,WAAW,CACjB,iCAAiCG,SAAS,uCAAuC,EACjF,aAAaA,SAAS,YAAY,EAClC;MACID;IACJ,CACJ,CAAC;EACL;EACA,OAAOE,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -1,12 +1,13 @@
1
- import type { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types";
2
- import type { CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
3
- import type { PluginsContainer } from "@webiny/plugins";
1
+ import type { OpenSearchBoolQueryConfig } from "@webiny/api-opensearch/types.js";
2
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { CmsEntryOpenSearchFullTextSearch } from "../../../features/CmsEntryOpenSearchFullTextSearch/index.js";
4
+ import type { ModelFields } from "../../../operations/entry/elasticsearch/types.js";
4
5
  interface Params {
5
- plugins: PluginsContainer;
6
+ fullTextSearches: CmsEntryOpenSearchFullTextSearch.Interface[];
6
7
  model: CmsModel;
7
- query: ElasticsearchBoolQueryConfig;
8
+ query: OpenSearchBoolQueryConfig;
8
9
  term?: string;
9
- fields: CmsModelField[];
10
+ fields: ModelFields;
10
11
  }
11
12
  export declare const applyFullTextSearch: (params: Params) => void;
12
13
  export {};