@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
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","CmsElasticsearchModelFieldPlugin","ENTRY_META_FIELDS","isDateTimeEntryMetaField","isIdentityEntryMetaField","getBaseFieldType","liveFields","createSystemField","stateFields","locationFields","createSystemFields","onMetaFields","filter","reduce","current","fieldName","type","unmappedType","keyword","systemField","searchable","sortable","field","storageId","fieldId","settings","parents","byMetaFields","undefined","path","id","entryId","version","status","wbyDeleted","binOriginalFolderId","buildCustomFields","params","fields","fieldTypePlugins","collection","typePlugin","fieldType","fullTextSearch","buildFieldsList","plugins","result","plugin","childFields","length","childResult","Object","assign","identifier","map","p","join","createModelFields","model","fieldDefinitionPlugins","byType","canBeApplied","modelId","unmappedTypes","acc","types","isSearchable","isSortable"],"sources":["fields.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type {\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsModelFieldToElasticsearchPlugin } from \"~/types.js\";\nimport type { ModelFieldParent, ModelFields } from \"./types.js\";\nimport { CmsElasticsearchModelFieldPlugin } from \"~/plugins/index.js\";\nimport {\n ENTRY_META_FIELDS,\n isDateTimeEntryMetaField,\n isIdentityEntryMetaField\n} from \"@webiny/api-headless-cms/constants.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\nimport { liveFields } from \"./fields/live.js\";\nimport { createSystemField } from \"./fields/createSystemField.js\";\nimport { stateFields } from \"./fields/state.js\";\nimport { locationFields } from \"./fields/location.js\";\n\nconst createSystemFields = (): ModelFields => {\n const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).reduce(\n (current, fieldName) => {\n return {\n ...current,\n [fieldName]: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: fieldName,\n fieldId: fieldName,\n type: \"text\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n }),\n parents: []\n }\n };\n },\n {}\n );\n\n const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).reduce(\n (current, fieldName) => {\n return {\n ...current,\n [fieldName]: {\n type: \"text\",\n unmappedType: undefined,\n systemField: true,\n searchable: true,\n sortable: true,\n path: `${fieldName}.id`,\n field: createSystemField({\n storageId: fieldName,\n fieldId: fieldName,\n type: \"text\"\n }),\n parents: []\n }\n };\n },\n {}\n );\n\n return {\n id: {\n type: \"text\",\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"id\",\n fieldId: \"id\",\n type: \"text\"\n }),\n parents: []\n },\n entryId: {\n type: \"text\",\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"entryId\",\n fieldId: \"entryId\",\n type: \"text\"\n }),\n parents: []\n },\n\n ...onMetaFields,\n ...byMetaFields,\n\n ...locationFields,\n version: {\n type: \"number\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"version\",\n fieldId: \"version\",\n type: \"number\"\n }),\n parents: []\n },\n status: {\n type: \"string\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: false,\n field: createSystemField({\n storageId: \"status\",\n fieldId: \"status\",\n type: \"string\"\n }),\n parents: []\n },\n wbyDeleted: {\n type: \"boolean\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: false,\n field: createSystemField({\n storageId: \"wbyDeleted\",\n fieldId: \"wbyDeleted\",\n type: \"boolean\"\n }),\n parents: []\n },\n binOriginalFolderId: {\n type: \"text\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: false,\n field: createSystemField({\n storageId: \"binOriginalFolderId\",\n fieldId: \"binOriginalFolderId\",\n type: \"text\"\n }),\n parents: []\n },\n ...stateFields,\n ...liveFields\n };\n};\n\ninterface UnmappedFieldTypes {\n [type: string]: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string | undefined;\n}\n\ninterface FieldTypePlugin {\n unmappedType?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string | undefined;\n searchable: boolean;\n sortable: boolean;\n fullTextSearch?: boolean;\n}\n\ninterface FieldTypePlugins {\n [key: string]: FieldTypePlugin;\n}\n\ninterface BuildCustomFieldsParams {\n fields: CmsElasticsearchModelFieldPlugin[];\n fieldTypePlugins: FieldTypePlugins;\n}\n\nconst buildCustomFields = (params: BuildCustomFieldsParams) => {\n const { fields, fieldTypePlugins } = params;\n\n return fields.reduce<ModelFields>((collection, field) => {\n const typePlugin = fieldTypePlugins[field.fieldType];\n if (!typePlugin) {\n return collection;\n }\n let unmappedType: string | undefined = undefined;\n if (typePlugin.unmappedType) {\n unmappedType = typePlugin.unmappedType(field);\n }\n\n collection[field.fieldId] = {\n type: field.fieldType,\n field: createSystemField({\n storageId: field.fieldId,\n fieldId: field.fieldId,\n type: field.fieldType\n }),\n unmappedType,\n fullTextSearch: field.searchable ? typePlugin.fullTextSearch : false,\n searchable: field.searchable || typePlugin.searchable,\n sortable: field.sortable || typePlugin.sortable,\n systemField: false,\n path: field.path,\n parents: []\n };\n\n return collection;\n }, {});\n};\n\ninterface BuildParams {\n plugins: FieldTypePlugins;\n fields: CmsModelField[];\n parents: ModelFieldParent[];\n}\n\nconst buildFieldsList = (params: BuildParams): ModelFields => {\n const { plugins, fields, parents } = params;\n\n return fields.reduce<ModelFields>((result, field) => {\n const fieldType = getBaseFieldType(field);\n const plugin = plugins[fieldType];\n if (!plugin) {\n throw new WebinyError(`There is no plugin for field type \"${field.type}\".`);\n }\n\n const { searchable, sortable, unmappedType, fullTextSearch } = plugin;\n /**\n * If a field has child fields, go through them and add them to a result.\n */\n const childFields = field.settings?.fields || [];\n if (childFields.length > 0) {\n /**\n * Let's build all the child fields\n */\n const childResult = buildFieldsList({\n fields: childFields,\n plugins,\n parents: [\n ...parents,\n {\n fieldId: field.fieldId,\n storageId: field.storageId,\n type: fieldType\n }\n ]\n });\n Object.assign(result, childResult);\n }\n\n const identifier = [...parents.map(p => p.fieldId), field.fieldId].join(\".\");\n\n result[identifier] = {\n type: fieldType,\n parents,\n searchable,\n sortable,\n fullTextSearch,\n unmappedType: typeof unmappedType === \"function\" ? unmappedType(field) : undefined,\n systemField: false,\n field\n };\n\n return result;\n }, {});\n};\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\n\nexport const createModelFields = ({ plugins, model }: Params) => {\n const fields = model.fields;\n const fieldDefinitionPlugins = plugins\n .byType<CmsElasticsearchModelFieldPlugin>(CmsElasticsearchModelFieldPlugin.type)\n .filter(plugin => {\n return plugin.canBeApplied(model.modelId);\n });\n /**\n * Collect all unmappedType from elastic plugins.\n */\n const unmappedTypes = plugins\n .byType<CmsModelFieldToElasticsearchPlugin>(\"cms-model-field-to-elastic-search\")\n .reduce<UnmappedFieldTypes>((acc, plugin) => {\n if (!plugin.unmappedType) {\n return acc;\n }\n acc[plugin.fieldType] = plugin.unmappedType;\n return acc;\n }, {});\n /**\n * Collect all field types from the plugins.\n */\n const fieldTypePlugins = plugins\n .byType<CmsModelFieldToGraphQLPlugin>(\"cms-model-field-to-graphql\")\n .reduce<FieldTypePlugins>((types, plugin) => {\n const { fieldType, fullTextSearch } = plugin;\n types[fieldType] = {\n unmappedType: unmappedTypes[fieldType],\n searchable: plugin.isSearchable,\n sortable: plugin.isSortable,\n fullTextSearch\n };\n return types;\n }, {});\n\n return {\n ...createSystemFields(),\n ...buildCustomFields({\n fields: fieldDefinitionPlugins,\n fieldTypePlugins\n }),\n ...buildFieldsList({\n fields,\n plugins: fieldTypePlugins,\n parents: [\n {\n fieldId: \"values\",\n type: \"object\",\n storageId: \"values\"\n }\n ]\n })\n };\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AASvC,SAASC,gCAAgC;AACzC,SACIC,iBAA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,CAAqC,mCAAmC,CAAC,CAC/E/C,MAAM,CAAqB,CAACmD,GAAG,EAAEjB,MAAM,KAAK;IACzC,IAAI,CAACA,MAAM,CAAC9B,YAAY,EAAE;MACtB,OAAO+C,GAAG;IACd;IACAA,GAAG,CAACjB,MAAM,CAACL,SAAS,CAAC,GAAGK,MAAM,CAAC9B,YAAY;IAC3C,OAAO+C,GAAG;EACd,CAAC,EAAE,CAAC,CAAC,CAAC;EACV;AACJ;AACA;EACI,MAAMzB,gBAAgB,GAAGM,OAAO,CAC3Be,MAAM,CAA+B,4BAA4B,CAAC,CAClE/C,MAAM,CAAmB,CAACoD,KAAK,EAAElB,MAAM,KAAK;IACzC,MAAM;MAAEL,SAAS;MAAEC;IAAe,CAAC,GAAGI,MAAM;IAC5CkB,KAAK,CAACvB,SAAS,CAAC,GAAG;MACfzB,YAAY,EAAE8C,aAAa,CAACrB,SAAS,CAAC;MACtCtB,UAAU,EAAE2B,MAAM,CAACmB,YAAY;MAC/B7C,QAAQ,EAAE0B,MAAM,CAACoB,UAAU;MAC3BxB;IACJ,CAAC;IACD,OAAOsB,KAAK;EAChB,CAAC,EAAE,CAAC,CAAC,CAAC;EAEV,OAAO;IACH,GAAGvD,kBAAkB,CAAC,CAAC;IACvB,GAAG0B,iBAAiB,CAAC;MACjBE,MAAM,EAAEqB,sBAAsB;MAC9BpB;IACJ,CAAC,CAAC;IACF,GAAGK,eAAe,CAAC;MACfN,MAAM;MACNO,OAAO,EAAEN,gBAAgB;MACzBb,OAAO,EAAE,CACL;QACIF,OAAO,EAAE,QAAQ;QACjBR,IAAI,EAAE,QAAQ;QACdO,SAAS,EAAE;MACf,CAAC;IAET,CAAC;EACL,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["WebinyError","ENTRY_META_FIELDS","isDateTimeEntryMetaField","isIdentityEntryMetaField","getBaseFieldType","liveFields","createSystemField","stateFields","locationFields","createSystemFields","onMetaFields","filter","reduce","current","fieldName","type","unmappedType","keyword","systemField","searchable","sortable","field","storageId","fieldId","settings","parents","byMetaFields","undefined","path","id","entryId","version","status","wbyDeleted","binOriginalFolderId","buildFieldsList","params","plugins","fields","result","fieldType","plugin","isFullTextSearchable","fullTextSearch","childFields","length","childResult","Object","assign","identifier","map","p","join","createModelFields","model","fieldRegistry","fieldIndexRegistry","unmappedTypes","getAll","acc","fieldIndex","fieldTypePlugins","types","isSearchable","isSortable"],"sources":["fields.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ModelFieldParent, ModelFields } from \"./types.js\";\nimport {\n ENTRY_META_FIELDS,\n isDateTimeEntryMetaField,\n isIdentityEntryMetaField\n} from \"@webiny/api-headless-cms/constants.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\nimport { liveFields } from \"./fields/live.js\";\nimport { createSystemField } from \"./fields/createSystemField.js\";\nimport { stateFields } from \"./fields/state.js\";\nimport { locationFields } from \"./fields/location.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/features/graphql/index.js\";\nimport { CmsEntryOpenSearchFieldIndexRegistry } from \"~/features/CmsEntryOpenSearchFieldIndex/index.js\";\n\nconst createSystemFields = (): ModelFields => {\n const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).reduce(\n (current, fieldName) => {\n return {\n ...current,\n [fieldName]: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: fieldName,\n fieldId: fieldName,\n type: \"text\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n }),\n parents: []\n }\n };\n },\n {}\n );\n\n const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).reduce(\n (current, fieldName) => {\n return {\n ...current,\n [fieldName]: {\n type: \"text\",\n unmappedType: undefined,\n systemField: true,\n searchable: true,\n sortable: true,\n path: `${fieldName}.id`,\n field: createSystemField({\n storageId: fieldName,\n fieldId: fieldName,\n type: \"text\"\n }),\n parents: []\n }\n };\n },\n {}\n );\n\n return {\n id: {\n type: \"text\",\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"id\",\n fieldId: \"id\",\n type: \"text\"\n }),\n parents: []\n },\n entryId: {\n type: \"text\",\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"entryId\",\n fieldId: \"entryId\",\n type: \"text\"\n }),\n parents: []\n },\n\n ...onMetaFields,\n ...byMetaFields,\n\n ...locationFields,\n version: {\n type: \"number\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: true,\n field: createSystemField({\n storageId: \"version\",\n fieldId: \"version\",\n type: \"number\"\n }),\n parents: []\n },\n status: {\n type: \"string\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: false,\n field: createSystemField({\n storageId: \"status\",\n fieldId: \"status\",\n type: \"string\"\n }),\n parents: []\n },\n wbyDeleted: {\n type: \"boolean\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: false,\n field: createSystemField({\n storageId: \"wbyDeleted\",\n fieldId: \"wbyDeleted\",\n type: \"boolean\"\n }),\n parents: []\n },\n binOriginalFolderId: {\n type: \"text\",\n unmappedType: undefined,\n keyword: false,\n systemField: true,\n searchable: true,\n sortable: false,\n field: createSystemField({\n storageId: \"binOriginalFolderId\",\n fieldId: \"binOriginalFolderId\",\n type: \"text\"\n }),\n parents: []\n },\n ...stateFields,\n ...liveFields\n };\n};\n\ninterface UnmappedFieldTypes {\n [type: string]: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string | undefined;\n}\n\ninterface FieldTypePlugin {\n unmappedType?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">) => string | undefined;\n searchable: boolean;\n sortable: boolean;\n isFullTextSearchable?: boolean;\n}\n\ninterface FieldTypePlugins {\n [key: string]: FieldTypePlugin;\n}\n\ninterface BuildParams {\n plugins: FieldTypePlugins;\n fields: CmsModelField[];\n parents: ModelFieldParent[];\n}\n\nconst buildFieldsList = (params: BuildParams): ModelFields => {\n const { plugins, fields, parents } = params;\n\n return fields.reduce<ModelFields>((result, field) => {\n const fieldType = getBaseFieldType(field);\n const plugin = plugins[fieldType];\n if (!plugin) {\n throw new WebinyError(`There is no plugin for field type \"${field.type}\".`);\n }\n\n const { searchable, sortable, unmappedType, isFullTextSearchable: fullTextSearch } = plugin;\n /**\n * If a field has child fields, go through them and add them to a result.\n */\n const childFields = field.settings?.fields || [];\n if (childFields.length > 0) {\n /**\n * Let's build all the child fields\n */\n const childResult = buildFieldsList({\n fields: childFields,\n plugins,\n parents: [\n ...parents,\n {\n fieldId: field.fieldId,\n storageId: field.storageId,\n type: fieldType\n }\n ]\n });\n Object.assign(result, childResult);\n }\n\n const identifier = [...parents.map(p => p.fieldId), field.fieldId].join(\".\");\n\n result[identifier] = {\n type: fieldType,\n parents,\n searchable,\n sortable,\n fullTextSearch,\n unmappedType: typeof unmappedType === \"function\" ? unmappedType(field) : undefined,\n systemField: false,\n field\n };\n\n return result;\n }, {});\n};\n\ninterface ICreateModelFieldsParams {\n model: CmsModel;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface;\n}\n\nexport const createModelFields = ({\n model,\n fieldRegistry,\n fieldIndexRegistry\n}: ICreateModelFieldsParams) => {\n const fields = model.fields;\n /**\n * Collect all unmappedType from field index registry.\n */\n const unmappedTypes = fieldIndexRegistry\n .getAll()\n .reduce<UnmappedFieldTypes>((acc, fieldIndex) => {\n if (!fieldIndex.unmappedType) {\n return acc;\n }\n acc[fieldIndex.fieldType] = fieldIndex.unmappedType;\n return acc;\n }, {});\n /**\n * Collect all field types from the plugins.\n */\n const fieldTypePlugins = fieldRegistry.getAll().reduce<FieldTypePlugins>((types, field) => {\n types[field.fieldType] = {\n unmappedType: unmappedTypes[field.fieldType],\n searchable: field.isSearchable,\n sortable: field.isSortable,\n isFullTextSearchable: field.isFullTextSearchable\n };\n return types;\n }, {});\n\n return {\n ...createSystemFields(),\n ...buildFieldsList({\n fields,\n plugins: fieldTypePlugins,\n parents: [\n {\n fieldId: \"values\",\n type: \"object\",\n storageId: \"values\"\n }\n ]\n })\n };\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAGvC,SACIC,iBAAiB,EACjBC,wBAAwB,EACxBC,wBAAwB,QACrB,uCAAuC;AAC9C,SAASC,gBAAgB,QAAQ,oDAAoD;AACrF,SAASC,UAAU;AACnB,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,cAAc;AAIvB,MAAMC,kBAAkB,GAAGA,CAAA,KAAmB;EAC1C,MAAMC,YAAY,GAAGT,iBAAiB,CAACU,MAAM,CAACT,wBAAwB,CAAC,CAACU,MAAM,CAC1E,CAACC,OAAO,EAAEC,SAAS,KAAK;IACpB,OAAO;MACH,GAAGD,OAAO;MACV,CAACC,SAAS,GAAG;QACTC,IAAI,EAAE,MAAM;QACZC,YAAY,EAAE,MAAM;QACpBC,OAAO,EAAE,KAAK;QACdC,WAAW,EAAE,IAAI;QACjBC,UAAU,EAAE,IAAI;QAChBC,QAAQ,EAAE,IAAI;QACdC,KAAK,EAAEf,iBAAiB,CAAC;UACrBgB,SAAS,EAAER,SAAS;UACpBS,OAAO,EAAET,SAAS;UAClBC,IAAI,EAAE,MAAM;UACZS,QAAQ,EAAE;YACNT,IAAI,EAAE;UACV;QACJ,CAAC,CAAC;QACFU,OAAO,EAAE;MACb;IACJ,CAAC;EACL,CAAC,EACD,CAAC,CACL,CAAC;EAED,MAAMC,YAAY,GAAGzB,iBAAiB,CAACU,MAAM,CAACR,wBAAwB,CAAC,CAACS,MAAM,CAC1E,CAACC,OAAO,EAAEC,SAAS,KAAK;IACpB,OAAO;MACH,GAAGD,OAAO;MACV,CAACC,SAAS,GAAG;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ignoreList":[]}
@@ -1,8 +1,9 @@
1
- import type { OpenSearchQueryBuilderOperatorPlugins, OpenSearchQuerySearchValuePlugins } from "../../../../operations/entry/elasticsearch/types.js";
2
- import type { ApplyFilteringCb } from "../../../../plugins/CmsEntryFilterPlugin.js";
1
+ import type { OpenSearchQueryBuilderOperatorPlugins } from "../../../../operations/entry/elasticsearch/types.js";
2
+ import type { CmsEntryOpenSearchFilter } from "../../../../features/CmsEntryOpenSearchFilter/index.js";
3
+ import type { CmsEntryOpenSearchValueSearchRegistry } from "../../../../features/CmsEntryOpenSearchValueSearch/index.js";
3
4
  interface CreateParams {
4
5
  operatorPlugins: OpenSearchQueryBuilderOperatorPlugins;
5
- searchPlugins: OpenSearchQuerySearchValuePlugins;
6
+ valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;
6
7
  }
7
- export declare const createApplyFiltering: ({ operatorPlugins, searchPlugins }: CreateParams) => ApplyFilteringCb;
8
+ export declare const createApplyFiltering: ({ operatorPlugins, valueSearchRegistry }: CreateParams) => CmsEntryOpenSearchFilter.ApplyFiltering;
8
9
  export {};
@@ -4,10 +4,10 @@ import { hasKeyword } from "../keyword.js";
4
4
  import { createFieldPathFactory } from "./path.js";
5
5
  export const createApplyFiltering = ({
6
6
  operatorPlugins,
7
- searchPlugins
7
+ valueSearchRegistry
8
8
  }) => {
9
9
  const createFieldPath = createFieldPathFactory({
10
- plugins: searchPlugins
10
+ valueSearchRegistry
11
11
  });
12
12
  return params => {
13
13
  const {
@@ -24,7 +24,7 @@ export const createApplyFiltering = ({
24
24
  });
25
25
  }
26
26
  const value = transformValueForSearch({
27
- plugins: searchPlugins,
27
+ valueSearchRegistry,
28
28
  field: field.field,
29
29
  value: initialValue
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","transformValueForSearch","hasKeyword","createFieldPathFactory","createApplyFiltering","operatorPlugins","searchPlugins","createFieldPath","plugins","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 {\n OpenSearchQueryBuilderOperatorPlugins,\n OpenSearchQuerySearchValuePlugins\n} from \"~/operations/entry/elasticsearch/types.js\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path.js\";\nimport type { ApplyFilteringCb } from \"~/plugins/CmsEntryFilterPlugin.js\";\n\ninterface CreateParams {\n operatorPlugins: OpenSearchQueryBuilderOperatorPlugins;\n searchPlugins: OpenSearchQuerySearchValuePlugins;\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 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;AAKnB,SAASC,sBAAsB;AAQ/B,OAAO,MAAMC,oBAAoB,GAAGA,CAAC;EACjCC,eAAe;EACfC;AACU,CAAC,KAAuB;EAClC,MAAMC,eAAe,GAAGJ,sBAAsB,CAAC;IAC3CK,OAAO,EAAEF;EACb,CAAC,CAAC;EAEF,OAAOG,MAAM,IAAI;IACb,MAAM;MAAEC,GAAG;MAAEC,KAAK,EAAEC,YAAY;MAAEC,KAAK;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAGN,MAAM;IAEnE,MAAMO,MAAM,GAAGX,eAAe,CAACS,QAAQ,CAAC;IACxC,IAAI,CAACE,MAAM,EAAE;MACT,MAAM,IAAIhB,WAAW,CACjB,2BAA2Bc,QAAQ,mBAAmB,EACtD,gBAAgB,EAChB;QACIA;MACJ,CACJ,CAAC;IACL;IAEA,MAAMH,KAAK,GAAGV,uBAAuB,CAAC;MAClCO,OAAO,EAAEF,aAAa;MACtBS,KAAK,EAAEA,KAAK,CAACA,KAAK;MAClBJ,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAMK,OAAO,GAAGf,UAAU,CAACa,KAAK,CAAC;IAEjC,MAAM;MAAEG,QAAQ;MAAEC;IAAK,CAAC,GAAGZ,eAAe,CAAC;MACvCQ,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
+ {"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":[]}
@@ -2,10 +2,14 @@ import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types
2
2
  import type { ModelFields } from "../../../../operations/entry/elasticsearch/types.js";
3
3
  import type { PluginsContainer } from "@webiny/plugins";
4
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
14
  export interface IExecParams {
11
15
  where: CmsEntryListWhere;
@@ -1,52 +1,28 @@
1
1
  import WebinyError from "@webiny/error";
2
- import { createSearchPluginList } from "../plugins/search.js";
3
2
  import { createOperatorPluginList } from "../plugins/operator.js";
4
3
  import { createBaseQuery } from "../initialQuery.js";
5
4
  import { parseWhereKey } from "@webiny/api-opensearch";
6
5
  import { getWhereValues } from "./values.js";
7
6
  import { getPopulated } from "./populated.js";
8
7
  import { createApplyFiltering } from "./applyFiltering.js";
9
- import { CmsEntryFilterPlugin } from "../../../../plugins/CmsEntryFilterPlugin.js";
10
8
  import { assignMinimumShouldMatchToQuery } from "../assignMinimumShouldMatchToQuery.js";
11
- import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
12
9
  export const createExecFiltering = params => {
13
10
  const {
14
11
  fields,
15
12
  plugins,
16
- model
13
+ model,
14
+ valueSearchRegistry,
15
+ filterRegistry
17
16
  } = params;
18
-
19
- /**
20
- * We need the search plugins as key -> plugin value, so it is easy to find plugin we need, without iterating through array.
21
- */
22
- const searchPlugins = createSearchPluginList({
23
- plugins
24
- });
25
- /**
26
- * We need the operator plugins, which we execute on our where conditions.
27
- */
28
17
  const operatorPlugins = createOperatorPluginList({
29
18
  plugins
30
19
  });
31
20
  const applyFiltering = createApplyFiltering({
32
21
  operatorPlugins,
33
- searchPlugins
22
+ valueSearchRegistry
34
23
  });
35
- const filteringPlugins = plugins.byType(CmsEntryFilterPlugin.type).reduce((collection, plugin) => {
36
- collection[plugin.fieldType] = plugin;
37
- return collection;
38
- }, {});
39
- const getFilterPlugin = type => {
40
- const fieldType = getBaseFieldType({
41
- type
42
- });
43
- const plugin = filteringPlugins[fieldType] || filteringPlugins["*"];
44
- if (plugin) {
45
- return plugin;
46
- }
47
- throw new WebinyError(`There is no filtering plugin for the given field type "${fieldType}".`, "FILTERING_PLUGIN_ERROR", {
48
- fieldType
49
- });
24
+ const getFilter = type => {
25
+ return filterRegistry.get(type);
50
26
  };
51
27
  const execFiltering = params => {
52
28
  const {
@@ -54,9 +30,6 @@ export const createExecFiltering = params => {
54
30
  query,
55
31
  isValues = false
56
32
  } = params;
57
- /**
58
- * No point in continuing if no "where" conditions exist.
59
- */
60
33
  const keys = Object.keys(initialWhere);
61
34
  if (keys.length === 0) {
62
35
  return;
@@ -64,17 +37,9 @@ export const createExecFiltering = params => {
64
37
  const where = structuredClone(initialWhere);
65
38
  for (const key in where) {
66
39
  const value = where[key];
67
- /**
68
- * We always skip if no value is defined.
69
- * Only skip undefined value, null is valid.
70
- */
71
40
  if (value === undefined) {
72
41
  continue;
73
- }
74
- //
75
- /**
76
- * When we are running with AND, the "value" MUST be an array.
77
- */else if (key === "AND") {
42
+ } else if (key === "AND") {
78
43
  const childWhereList = getWhereValues(value, "AND");
79
44
  const childQuery = createBaseQuery();
80
45
  for (const childWhere of childWhereList) {
@@ -92,15 +57,8 @@ export const createExecFiltering = params => {
92
57
  bool: childQueryBool
93
58
  });
94
59
  continue;
95
- }
96
- //
97
- /**
98
- * When we are running with OR, the "value" must be an array.
99
- */else if (key === "OR") {
60
+ } else if (key === "OR") {
100
61
  const childWhereList = getWhereValues(value, "OR");
101
- /**
102
- * Each of the conditions MUST produce it's own should section.
103
- */
104
62
  const should = [];
105
63
  for (const childWhere of childWhereList) {
106
64
  const childQuery = createBaseQuery();
@@ -121,10 +79,6 @@ export const createExecFiltering = params => {
121
79
  continue;
122
80
  }
123
81
  query.should.push(...should);
124
- /**
125
- * If there are any should, minimum to have is 1.
126
- * Of course, do not override if it's already set.
127
- */
128
82
  assignMinimumShouldMatchToQuery({
129
83
  query
130
84
  });
@@ -142,13 +96,6 @@ export const createExecFiltering = params => {
142
96
  operator
143
97
  } = parseWhereKey(key);
144
98
  let fieldId = isValues ? `values.${whereFieldId}` : whereFieldId;
145
-
146
- /**
147
- * TODO This will be required until the storage operations receive the fieldId instead of field storageId.
148
- * TODO For this to work without field searching, we need to refactor how the query looks like.
149
- *
150
- * Storage operations should NEVER receive an field storageId, only alias - fieldId.
151
- */
152
99
  const cmsModelField = model.fields.find(f => f.fieldId === fieldId);
153
100
  if (!cmsModelField && !fields[fieldId]) {
154
101
  throw new WebinyError(`There is no CMS Model Field "${fieldId}".`);
@@ -159,10 +106,10 @@ export const createExecFiltering = params => {
159
106
  if (!field) {
160
107
  throw new WebinyError(`There is no field "${fieldId}".`, "EXEC_FILTERING_ERROR");
161
108
  }
162
- const filterPlugin = getFilterPlugin(field.type);
163
- filterPlugin.exec({
109
+ const filter = getFilter(field.type);
110
+ filter.exec({
164
111
  applyFiltering,
165
- getFilterPlugin,
112
+ getFilter,
166
113
  key,
167
114
  value,
168
115
  operator,
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","createSearchPluginList","createOperatorPluginList","createBaseQuery","parseWhereKey","getWhereValues","getPopulated","createApplyFiltering","CmsEntryFilterPlugin","assignMinimumShouldMatchToQuery","getBaseFieldType","createExecFiltering","params","fields","plugins","model","searchPlugins","operatorPlugins","applyFiltering","filteringPlugins","byType","type","reduce","collection","plugin","fieldType","getFilterPlugin","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","filterPlugin","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 { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search.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 { CmsEntryFilterPlugin } from \"~/plugins/CmsEntryFilterPlugin.js\";\nimport { assignMinimumShouldMatchToQuery } from \"~/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\nexport interface CreateExecParams {\n model: CmsModel;\n fields: ModelFields;\n plugins: PluginsContainer;\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 } = 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 });\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 fieldType = getBaseFieldType({\n type\n });\n\n const plugin = filteringPlugins[fieldType] || filteringPlugins[\"*\"];\n if (plugin) {\n return plugin;\n }\n throw new WebinyError(\n `There is no filtering plugin for the given field type \"${fieldType}\".`,\n \"FILTERING_PLUGIN_ERROR\",\n {\n fieldType\n }\n );\n };\n\n const execFiltering = (params: IExecParams) => {\n const { where: initialWhere, query, isValues = false } = 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 = structuredClone(initialWhere);\n\n for (const key in where) {\n const value = where[key as keyof typeof where];\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 isValues\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 isValues\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 } 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\n let fieldId: string = isValues ? `values.${whereFieldId}` : 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":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAQvC,SAASC,sBAAsB;AAC/B,SAASC,wBAAwB;AACjC,SAASC,eAAe;AACxB,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,cAAc;AACvB,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,oBAAoB;AAC7B,SAASC,+BAA+B;AACxC,SAASC,gBAAgB,QAAQ,oDAAoD;AAerF,OAAO,MAAMC,mBAAmB,GAAIC,MAAwB,IAAkC;EAC1F,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGH,MAAM;;EAEzC;AACJ;AACA;EACI,MAAMI,aAAa,GAAGf,sBAAsB,CAAC;IACzCa;EACJ,CAAC,CAAC;EACF;AACJ;AACA;EACI,MAAMG,eAAe,GAAGf,wBAAwB,CAAC;IAC7CY;EACJ,CAAC,CAAC;EAEF,MAAMI,cAAc,GAAGX,oBAAoB,CAAC;IACxCU,eAAe;IACfD;EACJ,CAAC,CAAC;EAEF,MAAMG,gBAAgB,GAAGL,OAAO,CAC3BM,MAAM,CAAuBZ,oBAAoB,CAACa,IAAI,CAAC,CACvDC,MAAM,CAAuC,CAACC,UAAU,EAAEC,MAAM,KAAK;IAClED,UAAU,CAACC,MAAM,CAACC,SAAS,CAAC,GAAGD,MAAM;IAErC,OAAOD,UAAU;EACrB,CAAC,EAAE,CAAC,CAAC,CAAC;EAEV,MAAMG,eAAe,GAAIL,IAAY,IAAK;IACtC,MAAMI,SAAS,GAAGf,gBAAgB,CAAC;MAC/BW;IACJ,CAAC,CAAC;IAEF,MAAMG,MAAM,GAAGL,gBAAgB,CAACM,SAAS,CAAC,IAAIN,gBAAgB,CAAC,GAAG,CAAC;IACnE,IAAIK,MAAM,EAA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AO,CAAC;MACnE,IAAI,CAACC,aAAa,IAAI,CAACtC,MAAM,CAACqC,OAAO,CAAC,EAAE;QACpC,MAAM,IAAIlD,WAAW,CAAC,gCAAgCkD,OAAO,IAAI,CAAC;MACtE,CAAC,MAAM,IAAIC,aAAa,EAAE;QACtBD,OAAO,GAAGC,aAAa,CAACD,OAAO;MACnC;MAEA,MAAMH,KAAK,GAAGlC,MAAM,CAACqC,OAAO,CAAC;MAC7B,IAAI,CAACH,KAAK,EAAE;QACR,MAAM,IAAI/C,WAAW,CAAC,sBAAsBkD,OAAO,IAAI,EAAE,sBAAsB,CAAC;MACpF;MACA,MAAMI,YAAY,GAAG5B,eAAe,CAACqB,KAAK,CAAC1B,IAAI,CAAC;MAEhDiC,YAAY,CAACC,IAAI,CAAC;QACdrC,cAAc;QACdQ,eAAe;QACfU,GAAG;QACHC,KAAK;QACLY,QAAQ;QACRF,KAAK;QACLlC,MAAM;QACNiB;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;EAED,OAAOH,aAAa;AACxB,CAAC","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":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAQvC,SAASC,wBAAwB;AACjC,SAASC,eAAe;AACxB,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,cAAc;AACvB,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,+BAA+B;AAmBxC,OAAO,MAAMC,mBAAmB,GAAIC,MAAwB,IAAkC;EAC1F,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC,KAAK;IAAEC,mBAAmB;IAAEC;EAAe,CAAC,GAAGL,MAAM;EAE9E,MAAMM,eAAe,GAAGd,wBAAwB,CAAC;IAC7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AAC,EAAE;QACpC,MAAM,IAAI3C,WAAW,CAAC,gCAAgC2C,OAAO,IAAI,CAAC;MACtE,CAAC,MAAM,IAAIC,aAAa,EAAE;QACtBD,OAAO,GAAGC,aAAa,CAACD,OAAO;MACnC;MAEA,MAAMH,KAAK,GAAG9B,MAAM,CAACiC,OAAO,CAAC;MAC7B,IAAI,CAACH,KAAK,EAAE;QACR,MAAM,IAAIxC,WAAW,CAAC,sBAAsB2C,OAAO,IAAI,EAAE,sBAAsB,CAAC;MACpF;MACA,MAAMP,MAAM,GAAGnB,SAAS,CAACuB,KAAK,CAACtB,IAAI,CAAC;MAEpCkB,MAAM,CAACW,IAAI,CAAC;QACR/B,cAAc;QACdC,SAAS;QACTY,GAAG;QACHC,KAAK;QACLY,QAAQ;QACRF,KAAK;QACL9B,MAAM;QACNa;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;EAED,OAAOH,aAAa;AACxB,CAAC","ignoreList":[]}
@@ -1,6 +1,7 @@
1
- import type { OpenSearchQuerySearchValuePlugins, ModelField } from "../../../../operations/entry/elasticsearch/types.js";
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: OpenSearchQuerySearchValuePlugins;
4
+ valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;
4
5
  }
5
6
  interface FieldPathParams {
6
7
  field: ModelField;
@@ -9,7 +10,7 @@ interface FieldPathParams {
9
10
  originalValue: any;
10
11
  keyword: boolean;
11
12
  }
12
- export declare const createFieldPathFactory: ({ plugins }: FieldPathFactoryParams) => (params: FieldPathParams) => {
13
+ export declare const createFieldPathFactory: ({ valueSearchRegistry }: FieldPathFactoryParams) => (params: FieldPathParams) => {
13
14
  basePath: string;
14
15
  path: string;
15
16
  };
@@ -1,6 +1,5 @@
1
- import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
2
1
  export const createFieldPathFactory = ({
3
- plugins
2
+ valueSearchRegistry
4
3
  }) => {
5
4
  return params => {
6
5
  const {
@@ -10,11 +9,10 @@ export const createFieldPathFactory = ({
10
9
  keyword,
11
10
  originalValue
12
11
  } = params;
13
- const fieldType = getBaseFieldType(field);
14
- const plugin = plugins[fieldType];
12
+ const search = valueSearchRegistry.get(field.type);
15
13
  let fieldPath = null;
16
- if (plugin) {
17
- fieldPath = plugin.createPath({
14
+ if (search) {
15
+ fieldPath = search.createPath({
18
16
  field: field.field,
19
17
  value,
20
18
  key,
@@ -1 +1 @@
1
- {"version":3,"names":["getBaseFieldType","createFieldPathFactory","plugins","params","field","key","value","keyword","originalValue","fieldType","plugin","fieldPath","createPath","storageId","path","result","parents","map","p","concat","basePath","join"],"sources":["path.ts"],"sourcesContent":["import type {\n OpenSearchQuerySearchValuePlugins,\n ModelField\n} from \"~/operations/entry/elasticsearch/types.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\ninterface FieldPathFactoryParams {\n plugins: OpenSearchQuerySearchValuePlugins;\n}\ninterface FieldPathParams {\n field: ModelField;\n key: string;\n value: any;\n originalValue: any;\n keyword: boolean;\n}\n\nexport const createFieldPathFactory = ({ plugins }: FieldPathFactoryParams) => {\n return (params: FieldPathParams) => {\n const { field, key, value, keyword, originalValue } = params;\n const fieldType = getBaseFieldType(field);\n const plugin = plugins[fieldType];\n\n let fieldPath: string | null = null;\n if (plugin) {\n fieldPath = plugin.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":"AAIA,SAASA,gBAAgB,QAAQ,oDAAoD;AAarF,OAAO,MAAMC,sBAAsB,GAAGA,CAAC;EAAEC;AAAgC,CAAC,KAAK;EAC3E,OAAQC,MAAuB,IAAK;IAChC,MAAM;MAAEC,KAAK;MAAEC,GAAG;MAAEC,KAAK;MAAEC,OAAO;MAAEC;IAAc,CAAC,GAAGL,MAAM;IAC5D,MAAMM,SAAS,GAAGT,gBAAgB,CAACI,KAAK,CAAC;IACzC,MAAMM,MAAM,GAAGR,OAAO,CAACO,SAAS,CAAC;IAEjC,IAAIE,SAAwB,GAAG,IAAI;IACnC,IAAID,MAAM,EAAE;MACRC,SAAS,GAAGD,MAAM,CAACE,UAAU,CAAC;QAAER,KAAK,EAAEA,KAAK,CAACA,KAAK;QAAEE,KAAK;QAAED,GAAG;QAAEG;MAAc,CAAC,CAAC;IACpF;IACA,IAAI,CAACG,SAAS,EAAE;MACZA,SAAS,GAAGP,KAAK,CAACA,KAAK,CAACS,SAAS;MACjC,IAAIT,KAAK,CAACU,IAAI,EAAE;QACZH,SAAS,GAAG,OAAOP,KAAK,CAACU,IAAI,KAAK,UAAU,GAAGV,KAAK,CAACU,IAAI,CAACR,KAAK,CAAC,GAAGF,KAAK,CAACU,IAAI;MACjF;IACJ;IAEA,MAAMC,MAAgB,GAAGX,KAAK,CAACY,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,CAACZ,OAAO,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAACc,IAAI,CAAC,GAAG;IAC5D,CAAC;EACL,CAAC;AACL,CAAC","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,9 +1,9 @@
1
1
  import type { OpenSearchBoolQueryConfig } from "@webiny/api-opensearch/types.js";
2
2
  import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
3
- import type { PluginsContainer } from "@webiny/plugins";
3
+ import type { CmsEntryOpenSearchFullTextSearch } from "../../../features/CmsEntryOpenSearchFullTextSearch/index.js";
4
4
  import type { ModelFields } from "../../../operations/entry/elasticsearch/types.js";
5
5
  interface Params {
6
- plugins: PluginsContainer;
6
+ fullTextSearches: CmsEntryOpenSearchFullTextSearch.Interface[];
7
7
  model: CmsModel;
8
8
  query: OpenSearchBoolQueryConfig;
9
9
  term?: string;
@@ -1,9 +1,8 @@
1
1
  import { normalizeValue } from "@webiny/api-opensearch";
2
- import { CmsEntryElasticsearchFullTextSearchPlugin, createCmsEntryElasticsearchFullTextSearchPlugin } from "../../../plugins/index.js";
3
2
  /**
4
- * Our default plugin is working with the AND operator for the multiple words query string.
3
+ * Our default implementation works with the AND operator for the multiple words query string.
5
4
  */
6
- const defaultPlugin = createCmsEntryElasticsearchFullTextSearchPlugin({
5
+ const defaultFullTextSearch = {
7
6
  apply: params => {
8
7
  const {
9
8
  query,
@@ -21,44 +20,41 @@ const defaultPlugin = createCmsEntryElasticsearchFullTextSearchPlugin({
21
20
  }
22
21
  });
23
22
  }
24
- });
25
- defaultPlugin.name = "headless-cms.elasticsearch.entry.fullTextSearch.default";
26
- const getPlugin = params => {
23
+ };
24
+ const getFullTextSearch = params => {
27
25
  const {
28
- container,
26
+ fullTextSearches,
29
27
  model
30
28
  } = params;
31
29
  /**
32
- * We need to reverse the plugins, so we can take the last one first - possibility to override existing plugins.
30
+ * We need to reverse the list, so we can take the last one first - possibility to override existing implementations.
33
31
  */
34
- const plugins = container.byType(CmsEntryElasticsearchFullTextSearchPlugin.type).reverse();
32
+ const reversed = [...fullTextSearches].reverse();
35
33
  /**
36
- * We need to find the most specific plugin for the given model.
37
- * Also, we need to use the first possible plugin if the specific one is not found.
34
+ * We need to find the most specific implementation for the given model.
35
+ * Also, we need to use the first possible implementation if the specific one is not found.
38
36
  */
39
- let plugin = null;
40
- for (const pl of plugins) {
41
- const models = pl.models || [];
37
+ let fallback = null;
38
+ for (const item of reversed) {
39
+ const models = item.models || [];
42
40
  /**
43
- * We take the first available plugin for the given model.
41
+ * We take the first available implementation for the given model.
44
42
  */
45
43
  if (models.includes(model.modelId)) {
46
- return pl;
47
- }
48
- /**
49
- * Then we set the first possible plugin, which has no models defined, as the default one.
50
- * It is important not to set the plugin which has models defined as they are specifically for the targeted model.
51
- */
52
- //
53
- else if (!plugin && models.length === 0) {
54
- plugin = pl;
44
+ return item;
45
+ } else if (!fallback && models.length === 0) {
46
+ /**
47
+ * Then we set the first possible implementation, which has no models defined, as the default one.
48
+ * It is important not to set the one which has models defined as they are specifically for the targeted model.
49
+ */
50
+ fallback = item;
55
51
  }
56
52
  }
57
- return plugin || defaultPlugin;
53
+ return fallback || defaultFullTextSearch;
58
54
  };
59
55
  export const applyFullTextSearch = params => {
60
56
  const {
61
- plugins,
57
+ fullTextSearches,
62
58
  query,
63
59
  term,
64
60
  fields,
@@ -68,11 +64,11 @@ export const applyFullTextSearch = params => {
68
64
  if (!term || term.length === 0 || keys.length === 0) {
69
65
  return;
70
66
  }
71
- const plugin = getPlugin({
72
- container: plugins,
67
+ const fullTextSearch = getFullTextSearch({
68
+ fullTextSearches,
73
69
  model
74
70
  });
75
- plugin.apply({
71
+ fullTextSearch.apply({
76
72
  model,
77
73
  createFieldPath: field => {
78
74
  if (typeof field.path === "function") {
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeValue","CmsEntryElasticsearchFullTextSearchPlugin","createCmsEntryElasticsearchFullTextSearchPlugin","defaultPlugin","apply","params","query","term","fields","createFieldPath","prepareTerm","must","push","query_string","allow_leading_wildcard","Object","values","map","default_operator","name","getPlugin","container","model","plugins","byType","type","reverse","plugin","pl","models","includes","modelId","length","applyFullTextSearch","keys","field","path","systemField","storageId"],"sources":["fullTextSearch.ts"],"sourcesContent":["import type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\nimport { normalizeValue } from \"@webiny/api-opensearch\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport {\n CmsEntryElasticsearchFullTextSearchPlugin,\n createCmsEntryElasticsearchFullTextSearchPlugin\n} from \"~/plugins/index.js\";\nimport type { ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\n\n/**\n * Our default plugin is working with the AND operator for the multiple words query string.\n */\nconst defaultPlugin = createCmsEntryElasticsearchFullTextSearchPlugin({\n apply: params => {\n const { query, term, fields, createFieldPath, prepareTerm } = params;\n\n query.must.push({\n query_string: {\n allow_leading_wildcard: true,\n fields: Object.values(fields).map(createFieldPath),\n query: `*${prepareTerm(term)}*`,\n default_operator: \"and\"\n }\n });\n }\n});\ndefaultPlugin.name = \"headless-cms.elasticsearch.entry.fullTextSearch.default\";\n\ninterface GetPluginParams {\n container: PluginsContainer;\n model: CmsModel;\n}\nconst getPlugin = (params: GetPluginParams): CmsEntryElasticsearchFullTextSearchPlugin => {\n const { container, model } = params;\n /**\n * We need to reverse the plugins, so we can take the last one first - possibility to override existing plugins.\n */\n const plugins = container\n .byType<CmsEntryElasticsearchFullTextSearchPlugin>(\n CmsEntryElasticsearchFullTextSearchPlugin.type\n )\n .reverse();\n /**\n * We need to find the most specific plugin for the given model.\n * Also, we need to use the first possible plugin if the specific one is not found.\n */\n let plugin: CmsEntryElasticsearchFullTextSearchPlugin | null = null;\n for (const pl of plugins) {\n const models = pl.models || [];\n /**\n * We take the first available plugin for the given model.\n */\n if (models.includes(model.modelId)) {\n return pl;\n }\n /**\n * Then we set the first possible plugin, which has no models defined, as the default one.\n * It is important not to set the plugin which has models defined as they are specifically for the targeted model.\n */\n //\n else if (!plugin && models.length === 0) {\n plugin = pl;\n }\n }\n\n return plugin || defaultPlugin;\n};\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n query: OpenSearchBoolQueryConfig;\n term?: string;\n fields: ModelFields;\n}\nexport const applyFullTextSearch = (params: Params): void => {\n const { plugins, query, term, fields, model } = params;\n const keys = Object.keys(fields);\n if (!term || term.length === 0 || keys.length === 0) {\n return;\n }\n\n const plugin = getPlugin({\n container: plugins,\n model\n });\n\n plugin.apply({\n model,\n createFieldPath: field => {\n if (typeof field.path === \"function\") {\n return field.path(term);\n } else if (field.systemField) {\n return field.path || field.field.storageId;\n }\n return `values.${field.path || field.field.storageId}`;\n },\n fields,\n query,\n term,\n prepareTerm: normalizeValue\n });\n};\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,wBAAwB;AAGvD,SACIC,yCAAyC,EACzCC,+CAA+C;AAInD;AACA;AACA;AACA,MAAMC,aAAa,GAAGD,+CAA+C,CAAC;EAClEE,KAAK,EAAEC,MAAM,IAAI;IACb,MAAM;MAAEC,KAAK;MAAEC,IAAI;MAAEC,MAAM;MAAEC,eAAe;MAAEC;IAAY,CAAC,GAAGL,MAAM;IAEpEC,KAAK,CAACK,IAAI,CAACC,IAAI,CAAC;MACZ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AK,CAAC,IAAIE,IAAI,CAACF,MAAM,KAAK,CAAC,EAAE;IACjD;EACJ;EAEA,MAAML,MAAM,GAAGP,SAAS,CAAC;IACrBC,SAAS,EAAEE,OAAO;IAClBD;EACJ,CAAC,CAAC;EAEFK,MAAM,CAACvB,KAAK,CAAC;IACTkB,KAAK;IACLb,eAAe,EAAE0B,KAAK,IAAI;MACtB,IAAI,OAAOA,KAAK,CAACC,IAAI,KAAK,UAAU,EAAE;QAClC,OAAOD,KAAK,CAACC,IAAI,CAAC7B,IAAI,CAAC;MAC3B,CAAC,MAAM,IAAI4B,KAAK,CAACE,WAAW,EAAE;QAC1B,OAAOF,KAAK,CAACC,IAAI,IAAID,KAAK,CAACA,KAAK,CAACG,SAAS;MAC9C;MACA,OAAO,UAAUH,KAAK,CAACC,IAAI,IAAID,KAAK,CAACA,KAAK,CAACG,SAAS,EAAE;IAC1D,CAAC;IACD9B,MAAM;IACNF,KAAK;IACLC,IAAI;IACJG,WAAW,EAAEV;EACjB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["normalizeValue","defaultFullTextSearch","apply","params","query","term","fields","createFieldPath","prepareTerm","must","push","query_string","allow_leading_wildcard","Object","values","map","default_operator","getFullTextSearch","fullTextSearches","model","reversed","reverse","fallback","item","models","includes","modelId","length","applyFullTextSearch","keys","fullTextSearch","field","path","systemField","storageId"],"sources":["fullTextSearch.ts"],"sourcesContent":["import type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\nimport { normalizeValue } from \"@webiny/api-opensearch\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsEntryOpenSearchFullTextSearch } from \"~/features/CmsEntryOpenSearchFullTextSearch/index.js\";\nimport type { ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\n\n/**\n * Our default implementation works with the AND operator for the multiple words query string.\n */\nconst defaultFullTextSearch: CmsEntryOpenSearchFullTextSearch.Interface = {\n apply: params => {\n const { query, term, fields, createFieldPath, prepareTerm } = params;\n\n query.must.push({\n query_string: {\n allow_leading_wildcard: true,\n fields: Object.values(fields).map(createFieldPath),\n query: `*${prepareTerm(term)}*`,\n default_operator: \"and\"\n }\n });\n }\n};\n\ninterface GetFullTextSearchParams {\n fullTextSearches: CmsEntryOpenSearchFullTextSearch.Interface[];\n model: CmsModel;\n}\nconst getFullTextSearch = (\n params: GetFullTextSearchParams\n): CmsEntryOpenSearchFullTextSearch.Interface => {\n const { fullTextSearches, model } = params;\n /**\n * We need to reverse the list, so we can take the last one first - possibility to override existing implementations.\n */\n const reversed = [...fullTextSearches].reverse();\n /**\n * We need to find the most specific implementation for the given model.\n * Also, we need to use the first possible implementation if the specific one is not found.\n */\n let fallback: CmsEntryOpenSearchFullTextSearch.Interface | null = null;\n for (const item of reversed) {\n const models = item.models || [];\n /**\n * We take the first available implementation for the given model.\n */\n if (models.includes(model.modelId)) {\n return item;\n } else if (!fallback && models.length === 0) {\n /**\n * Then we set the first possible implementation, which has no models defined, as the default one.\n * It is important not to set the one which has models defined as they are specifically for the targeted model.\n */\n fallback = item;\n }\n }\n\n return fallback || defaultFullTextSearch;\n};\n\ninterface Params {\n fullTextSearches: CmsEntryOpenSearchFullTextSearch.Interface[];\n model: CmsModel;\n query: OpenSearchBoolQueryConfig;\n term?: string;\n fields: ModelFields;\n}\nexport const applyFullTextSearch = (params: Params): void => {\n const { fullTextSearches, query, term, fields, model } = params;\n const keys = Object.keys(fields);\n if (!term || term.length === 0 || keys.length === 0) {\n return;\n }\n\n const fullTextSearch = getFullTextSearch({\n fullTextSearches,\n model\n });\n\n fullTextSearch.apply({\n model,\n createFieldPath: field => {\n if (typeof field.path === \"function\") {\n return field.path(term);\n } else if (field.systemField) {\n return field.path || field.field.storageId;\n }\n return `values.${field.path || field.field.storageId}`;\n },\n fields,\n query,\n term,\n prepareTerm: normalizeValue\n });\n};\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,wBAAwB;AAKvD;AACA;AACA;AACA,MAA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B,MAAM;EAC/D,MAAM0B,IAAI,GAAGhB,MAAM,CAACgB,IAAI,CAACvB,MAAM,CAAC;EAChC,IAAI,CAACD,IAAI,IAAIA,IAAI,CAACsB,MAAM,KAAK,CAAC,IAAIE,IAAI,CAACF,MAAM,KAAK,CAAC,EAAE;IACjD;EACJ;EAEA,MAAMG,cAAc,GAAGb,iBAAiB,CAAC;IACrCC,gBAAgB;IAChBC;EACJ,CAAC,CAAC;EAEFW,cAAc,CAAC5B,KAAK,CAAC;IACjBiB,KAAK;IACLZ,eAAe,EAAEwB,KAAK,IAAI;MACtB,IAAI,OAAOA,KAAK,CAACC,IAAI,KAAK,UAAU,EAAE;QAClC,OAAOD,KAAK,CAACC,IAAI,CAAC3B,IAAI,CAAC;MAC3B,CAAC,MAAM,IAAI0B,KAAK,CAACE,WAAW,EAAE;QAC1B,OAAOF,KAAK,CAACC,IAAI,IAAID,KAAK,CAACA,KAAK,CAACG,SAAS;MAC9C;MACA,OAAO,UAAUH,KAAK,CAACC,IAAI,IAAID,KAAK,CAACA,KAAK,CAACG,SAAS,EAAE;IAC1D,CAAC;IACD5B,MAAM;IACNF,KAAK;IACLC,IAAI;IACJG,WAAW,EAAER;EACjB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,12 +1,12 @@
1
1
  import type { Sort as OpenSearchSort } from "@webiny/api-opensearch/types.js";
2
- import type { PluginsContainer } from "@webiny/plugins";
3
2
  import type { CmsEntryListSort, CmsModel } from "@webiny/api-headless-cms/types/index.js";
4
3
  import type { ModelFields } from "./types.js";
4
+ import type { CmsEntryOpenSearchValueSearchRegistry } from "../../../features/CmsEntryOpenSearchValueSearch/index.js";
5
5
  interface Params {
6
- plugins: PluginsContainer;
7
6
  sort?: CmsEntryListSort;
8
7
  modelFields: ModelFields;
9
8
  model: CmsModel;
9
+ valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;
10
10
  }
11
11
  export declare const createElasticsearchSort: (params: Params) => OpenSearchSort;
12
12
  export {};
@@ -1,6 +1,5 @@
1
1
  import { createSort, OpenSearchFieldPlugin } from "@webiny/api-opensearch";
2
2
  import { hasKeyword } from "./keyword.js";
3
- import { createSearchPluginList } from "./plugins/search.js";
4
3
  import { createFieldPathFactory } from "./filtering/path.js";
5
4
  import { NoValueContainer } from "../../../values/NoValueContainer.js";
6
5
  const matchField = input => {
@@ -28,7 +27,7 @@ export const createElasticsearchSort = params => {
28
27
  const {
29
28
  sort,
30
29
  modelFields,
31
- plugins
30
+ valueSearchRegistry
32
31
  } = params;
33
32
  if (!sort || sort.length === 0) {
34
33
  return [{
@@ -37,11 +36,8 @@ export const createElasticsearchSort = params => {
37
36
  }
38
37
  }];
39
38
  }
40
- const searchPlugins = createSearchPluginList({
41
- plugins
42
- });
43
39
  const createFieldPath = createFieldPathFactory({
44
- plugins: searchPlugins
40
+ valueSearchRegistry
45
41
  });
46
42
  const fieldIdToStorageIdIdMap = {};
47
43
  const sortPlugins = Object.values(modelFields).reduce((plugins, field) => {