@webiny/api-headless-cms-utils-os 0.0.0-unstable.0156a4c312

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 (322) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/configurations.d.ts +9 -0
  4. package/configurations.js +17 -0
  5. package/configurations.js.map +1 -0
  6. package/exports/api/cms/opensearch.d.ts +18 -0
  7. package/exports/api/cms/opensearch.js +18 -0
  8. package/features/CmsEntryOpenSearchBodyBuilder/CmsEntryOpenSearchBodyBuilder.d.ts +32 -0
  9. package/features/CmsEntryOpenSearchBodyBuilder/CmsEntryOpenSearchBodyBuilder.js +154 -0
  10. package/features/CmsEntryOpenSearchBodyBuilder/CmsEntryOpenSearchBodyBuilder.js.map +1 -0
  11. package/features/CmsEntryOpenSearchBodyBuilder/abstractions.d.ts +22 -0
  12. package/features/CmsEntryOpenSearchBodyBuilder/abstractions.js +5 -0
  13. package/features/CmsEntryOpenSearchBodyBuilder/abstractions.js.map +1 -0
  14. package/features/CmsEntryOpenSearchBodyBuilder/feature.d.ts +4 -0
  15. package/features/CmsEntryOpenSearchBodyBuilder/feature.js +11 -0
  16. package/features/CmsEntryOpenSearchBodyBuilder/feature.js.map +1 -0
  17. package/features/CmsEntryOpenSearchBodyBuilder/index.d.ts +2 -0
  18. package/features/CmsEntryOpenSearchBodyBuilder/index.js +2 -0
  19. package/features/CmsEntryOpenSearchBodyBuilder/sort.d.ts +17 -0
  20. package/features/CmsEntryOpenSearchBodyBuilder/sort.js +76 -0
  21. package/features/CmsEntryOpenSearchBodyBuilder/sort.js.map +1 -0
  22. package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +16 -0
  23. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +5 -0
  24. package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -0
  25. package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +1 -0
  26. package/features/CmsEntryOpenSearchBodyModifier/index.js +1 -0
  27. package/features/CmsEntryOpenSearchExecFiltering/CmsEntryOpenSearchExecFiltering.d.ts +17 -0
  28. package/features/CmsEntryOpenSearchExecFiltering/CmsEntryOpenSearchExecFiltering.js +118 -0
  29. package/features/CmsEntryOpenSearchExecFiltering/CmsEntryOpenSearchExecFiltering.js.map +1 -0
  30. package/features/CmsEntryOpenSearchExecFiltering/abstractions.d.ts +17 -0
  31. package/features/CmsEntryOpenSearchExecFiltering/abstractions.js +5 -0
  32. package/features/CmsEntryOpenSearchExecFiltering/abstractions.js.map +1 -0
  33. package/features/CmsEntryOpenSearchExecFiltering/applyFiltering.d.ts +11 -0
  34. package/features/CmsEntryOpenSearchExecFiltering/applyFiltering.js +31 -0
  35. package/features/CmsEntryOpenSearchExecFiltering/applyFiltering.js.map +1 -0
  36. package/features/CmsEntryOpenSearchExecFiltering/feature.d.ts +4 -0
  37. package/features/CmsEntryOpenSearchExecFiltering/feature.js +11 -0
  38. package/features/CmsEntryOpenSearchExecFiltering/feature.js.map +1 -0
  39. package/features/CmsEntryOpenSearchExecFiltering/index.d.ts +2 -0
  40. package/features/CmsEntryOpenSearchExecFiltering/index.js +2 -0
  41. package/features/CmsEntryOpenSearchExecFiltering/populated.d.ts +2 -0
  42. package/features/CmsEntryOpenSearchExecFiltering/populated.js +12 -0
  43. package/features/CmsEntryOpenSearchExecFiltering/populated.js.map +1 -0
  44. package/features/CmsEntryOpenSearchExecFiltering/values.d.ts +2 -0
  45. package/features/CmsEntryOpenSearchExecFiltering/values.js +15 -0
  46. package/features/CmsEntryOpenSearchExecFiltering/values.js.map +1 -0
  47. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +14 -0
  48. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +42 -0
  49. package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  50. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +32 -0
  51. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +5 -0
  52. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -0
  53. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +11 -0
  54. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +5 -0
  55. package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
  56. package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +1 -0
  57. package/features/CmsEntryOpenSearchFieldIndex/constants.js +4 -0
  58. package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -0
  59. package/features/CmsEntryOpenSearchFieldIndex/feature.d.ts +4 -0
  60. package/features/CmsEntryOpenSearchFieldIndex/feature.js +29 -0
  61. package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -0
  62. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +11 -0
  63. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +60 -0
  64. package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -0
  65. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +13 -0
  66. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +33 -0
  67. package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -0
  68. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +10 -0
  69. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +21 -0
  70. package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -0
  71. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +10 -0
  72. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +22 -0
  73. package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -0
  74. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +11 -0
  75. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +32 -0
  76. package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -0
  77. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +12 -0
  78. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +116 -0
  79. package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -0
  80. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +10 -0
  81. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +21 -0
  82. package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -0
  83. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.d.ts +15 -0
  84. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js +40 -0
  85. package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js.map +1 -0
  86. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.d.ts +15 -0
  87. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js +40 -0
  88. package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js.map +1 -0
  89. package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +3 -0
  90. package/features/CmsEntryOpenSearchFieldIndex/index.js +3 -0
  91. package/features/CmsEntryOpenSearchFieldPathFactory/CmsEntryOpenSearchFieldPathFactory.d.ts +11 -0
  92. package/features/CmsEntryOpenSearchFieldPathFactory/CmsEntryOpenSearchFieldPathFactory.js +40 -0
  93. package/features/CmsEntryOpenSearchFieldPathFactory/CmsEntryOpenSearchFieldPathFactory.js.map +1 -0
  94. package/features/CmsEntryOpenSearchFieldPathFactory/abstractions.d.ts +21 -0
  95. package/features/CmsEntryOpenSearchFieldPathFactory/abstractions.js +5 -0
  96. package/features/CmsEntryOpenSearchFieldPathFactory/abstractions.js.map +1 -0
  97. package/features/CmsEntryOpenSearchFieldPathFactory/feature.d.ts +4 -0
  98. package/features/CmsEntryOpenSearchFieldPathFactory/feature.js +11 -0
  99. package/features/CmsEntryOpenSearchFieldPathFactory/feature.js.map +1 -0
  100. package/features/CmsEntryOpenSearchFieldPathFactory/index.d.ts +2 -0
  101. package/features/CmsEntryOpenSearchFieldPathFactory/index.js +2 -0
  102. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +11 -0
  103. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +36 -0
  104. package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  105. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +37 -0
  106. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +5 -0
  107. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -0
  108. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +9 -0
  109. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +5 -0
  110. package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
  111. package/features/CmsEntryOpenSearchFilter/constants.d.ts +1 -0
  112. package/features/CmsEntryOpenSearchFilter/constants.js +4 -0
  113. package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -0
  114. package/features/CmsEntryOpenSearchFilter/feature.d.ts +4 -0
  115. package/features/CmsEntryOpenSearchFilter/feature.js +17 -0
  116. package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -0
  117. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +9 -0
  118. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +26 -0
  119. package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -0
  120. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +9 -0
  121. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +43 -0
  122. package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -0
  123. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +9 -0
  124. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +36 -0
  125. package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -0
  126. package/features/CmsEntryOpenSearchFilter/index.d.ts +3 -0
  127. package/features/CmsEntryOpenSearchFilter/index.js +3 -0
  128. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +20 -0
  129. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +5 -0
  130. package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -0
  131. package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +1 -0
  132. package/features/CmsEntryOpenSearchFullTextSearch/index.js +1 -0
  133. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +11 -0
  134. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +17 -0
  135. package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -0
  136. package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +14 -0
  137. package/features/CmsEntryOpenSearchIndex/abstractions.js +5 -0
  138. package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -0
  139. package/features/CmsEntryOpenSearchIndex/feature.d.ts +4 -0
  140. package/features/CmsEntryOpenSearchIndex/feature.js +11 -0
  141. package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -0
  142. package/features/CmsEntryOpenSearchIndex/index.d.ts +3 -0
  143. package/features/CmsEntryOpenSearchIndex/index.js +3 -0
  144. package/features/CmsEntryOpenSearchIndexCreate/CmsEntryOpenSearchIndexCreate.d.ts +13 -0
  145. package/features/CmsEntryOpenSearchIndexCreate/CmsEntryOpenSearchIndexCreate.js +64 -0
  146. package/features/CmsEntryOpenSearchIndexCreate/CmsEntryOpenSearchIndexCreate.js.map +1 -0
  147. package/features/CmsEntryOpenSearchIndexCreate/ModelAfterCreateFromHandler.d.ts +11 -0
  148. package/features/CmsEntryOpenSearchIndexCreate/ModelAfterCreateFromHandler.js +22 -0
  149. package/features/CmsEntryOpenSearchIndexCreate/ModelAfterCreateFromHandler.js.map +1 -0
  150. package/features/CmsEntryOpenSearchIndexCreate/ModelAfterCreateHandler.d.ts +11 -0
  151. package/features/CmsEntryOpenSearchIndexCreate/ModelAfterCreateHandler.js +22 -0
  152. package/features/CmsEntryOpenSearchIndexCreate/ModelAfterCreateHandler.js.map +1 -0
  153. package/features/CmsEntryOpenSearchIndexCreate/abstractions.d.ts +12 -0
  154. package/features/CmsEntryOpenSearchIndexCreate/abstractions.js +5 -0
  155. package/features/CmsEntryOpenSearchIndexCreate/abstractions.js.map +1 -0
  156. package/features/CmsEntryOpenSearchIndexCreate/feature.d.ts +4 -0
  157. package/features/CmsEntryOpenSearchIndexCreate/feature.js +11 -0
  158. package/features/CmsEntryOpenSearchIndexCreate/feature.js.map +1 -0
  159. package/features/CmsEntryOpenSearchIndexCreate/index.d.ts +2 -0
  160. package/features/CmsEntryOpenSearchIndexCreate/index.js +2 -0
  161. package/features/CmsEntryOpenSearchIndexDelete/CmsEntryOpenSearchIndexDelete.d.ts +13 -0
  162. package/features/CmsEntryOpenSearchIndexDelete/CmsEntryOpenSearchIndexDelete.js +42 -0
  163. package/features/CmsEntryOpenSearchIndexDelete/CmsEntryOpenSearchIndexDelete.js.map +1 -0
  164. package/features/CmsEntryOpenSearchIndexDelete/ModelAfterDeleteHandler.d.ts +11 -0
  165. package/features/CmsEntryOpenSearchIndexDelete/ModelAfterDeleteHandler.js +22 -0
  166. package/features/CmsEntryOpenSearchIndexDelete/ModelAfterDeleteHandler.js.map +1 -0
  167. package/features/CmsEntryOpenSearchIndexDelete/abstractions.d.ts +12 -0
  168. package/features/CmsEntryOpenSearchIndexDelete/abstractions.js +5 -0
  169. package/features/CmsEntryOpenSearchIndexDelete/abstractions.js.map +1 -0
  170. package/features/CmsEntryOpenSearchIndexDelete/feature.d.ts +4 -0
  171. package/features/CmsEntryOpenSearchIndexDelete/feature.js +11 -0
  172. package/features/CmsEntryOpenSearchIndexDelete/feature.js.map +1 -0
  173. package/features/CmsEntryOpenSearchIndexDelete/index.d.ts +2 -0
  174. package/features/CmsEntryOpenSearchIndexDelete/index.js +2 -0
  175. package/features/CmsEntryOpenSearchOperatorList/CmsEntryOpenSearchOperatorList.d.ts +12 -0
  176. package/features/CmsEntryOpenSearchOperatorList/CmsEntryOpenSearchOperatorList.js +22 -0
  177. package/features/CmsEntryOpenSearchOperatorList/CmsEntryOpenSearchOperatorList.js.map +1 -0
  178. package/features/CmsEntryOpenSearchOperatorList/abstractions.d.ts +8 -0
  179. package/features/CmsEntryOpenSearchOperatorList/abstractions.js +5 -0
  180. package/features/CmsEntryOpenSearchOperatorList/abstractions.js.map +1 -0
  181. package/features/CmsEntryOpenSearchOperatorList/feature.d.ts +4 -0
  182. package/features/CmsEntryOpenSearchOperatorList/feature.js +11 -0
  183. package/features/CmsEntryOpenSearchOperatorList/feature.js.map +1 -0
  184. package/features/CmsEntryOpenSearchOperatorList/index.d.ts +2 -0
  185. package/features/CmsEntryOpenSearchOperatorList/index.js +2 -0
  186. package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +16 -0
  187. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +5 -0
  188. package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -0
  189. package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +1 -0
  190. package/features/CmsEntryOpenSearchQueryModifier/index.js +1 -0
  191. package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +15 -0
  192. package/features/CmsEntryOpenSearchSortModifier/abstractions.js +5 -0
  193. package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -0
  194. package/features/CmsEntryOpenSearchSortModifier/index.d.ts +1 -0
  195. package/features/CmsEntryOpenSearchSortModifier/index.js +1 -0
  196. package/features/CmsEntryOpenSearchUtilsFeature.d.ts +4 -0
  197. package/features/CmsEntryOpenSearchUtilsFeature.js +39 -0
  198. package/features/CmsEntryOpenSearchUtilsFeature.js.map +1 -0
  199. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +12 -0
  200. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +31 -0
  201. package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  202. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +22 -0
  203. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +5 -0
  204. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -0
  205. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +10 -0
  206. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +5 -0
  207. package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
  208. package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +4 -0
  209. package/features/CmsEntryOpenSearchValueSearch/feature.js +17 -0
  210. package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -0
  211. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +10 -0
  212. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +21 -0
  213. package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -0
  214. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +10 -0
  215. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +44 -0
  216. package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -0
  217. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +10 -0
  218. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +22 -0
  219. package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -0
  220. package/features/CmsEntryOpenSearchValueSearch/index.d.ts +3 -0
  221. package/features/CmsEntryOpenSearchValueSearch/index.js +3 -0
  222. package/features/CmsEntryOpenSearchValueTransformer/CmsEntryOpenSearchValueTransformer.d.ts +11 -0
  223. package/features/CmsEntryOpenSearchValueTransformer/CmsEntryOpenSearchValueTransformer.js +25 -0
  224. package/features/CmsEntryOpenSearchValueTransformer/CmsEntryOpenSearchValueTransformer.js.map +1 -0
  225. package/features/CmsEntryOpenSearchValueTransformer/abstractions.d.ts +13 -0
  226. package/features/CmsEntryOpenSearchValueTransformer/abstractions.js +5 -0
  227. package/features/CmsEntryOpenSearchValueTransformer/abstractions.js.map +1 -0
  228. package/features/CmsEntryOpenSearchValueTransformer/feature.d.ts +4 -0
  229. package/features/CmsEntryOpenSearchValueTransformer/feature.js +11 -0
  230. package/features/CmsEntryOpenSearchValueTransformer/feature.js.map +1 -0
  231. package/features/CmsEntryOpenSearchValueTransformer/index.d.ts +2 -0
  232. package/features/CmsEntryOpenSearchValueTransformer/index.js +2 -0
  233. package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +23 -0
  234. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +5 -0
  235. package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -0
  236. package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +1 -0
  237. package/features/CmsEntryOpenSearchValuesModifier/index.js +1 -0
  238. package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.d.ts +15 -0
  239. package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.js +5 -0
  240. package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.js.map +1 -0
  241. package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.d.ts +8 -0
  242. package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.js +17 -0
  243. package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.js.map +1 -0
  244. package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndexProvider.d.ts +12 -0
  245. package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndexProvider.js +35 -0
  246. package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndexProvider.js.map +1 -0
  247. package/features/CmsModelOpenSearchIndex/abstractions.d.ts +20 -0
  248. package/features/CmsModelOpenSearchIndex/abstractions.js +5 -0
  249. package/features/CmsModelOpenSearchIndex/abstractions.js.map +1 -0
  250. package/features/CmsModelOpenSearchIndex/feature.d.ts +4 -0
  251. package/features/CmsModelOpenSearchIndex/feature.js +13 -0
  252. package/features/CmsModelOpenSearchIndex/feature.js.map +1 -0
  253. package/features/CmsModelOpenSearchIndex/index.d.ts +7 -0
  254. package/features/CmsModelOpenSearchIndex/index.js +5 -0
  255. package/helpers/entryIndexHelpers.d.ts +20 -0
  256. package/helpers/entryIndexHelpers.js +80 -0
  257. package/helpers/entryIndexHelpers.js.map +1 -0
  258. package/helpers/fieldIdentifier.d.ts +6 -0
  259. package/helpers/fieldIdentifier.js +23 -0
  260. package/helpers/fieldIdentifier.js.map +1 -0
  261. package/helpers/index.d.ts +2 -0
  262. package/helpers/index.js +2 -0
  263. package/index.d.ts +1 -0
  264. package/index.js +1 -0
  265. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
  266. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +9 -0
  267. package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
  268. package/operations/entry/elasticsearch/fields/createSystemField.d.ts +4 -0
  269. package/operations/entry/elasticsearch/fields/createSystemField.js +9 -0
  270. package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -0
  271. package/operations/entry/elasticsearch/fields/live.d.ts +2 -0
  272. package/operations/entry/elasticsearch/fields/live.js +50 -0
  273. package/operations/entry/elasticsearch/fields/live.js.map +1 -0
  274. package/operations/entry/elasticsearch/fields/location.d.ts +2 -0
  275. package/operations/entry/elasticsearch/fields/location.js +50 -0
  276. package/operations/entry/elasticsearch/fields/location.js.map +1 -0
  277. package/operations/entry/elasticsearch/fields/state.d.ts +2 -0
  278. package/operations/entry/elasticsearch/fields/state.js +104 -0
  279. package/operations/entry/elasticsearch/fields/state.js.map +1 -0
  280. package/operations/entry/elasticsearch/fields/system.d.ts +7 -0
  281. package/operations/entry/elasticsearch/fields/system.js +58 -0
  282. package/operations/entry/elasticsearch/fields/system.js.map +1 -0
  283. package/operations/entry/elasticsearch/fields.d.ts +14 -0
  284. package/operations/entry/elasticsearch/fields.js +209 -0
  285. package/operations/entry/elasticsearch/fields.js.map +1 -0
  286. package/operations/entry/elasticsearch/fullTextSearch.d.ts +13 -0
  287. package/operations/entry/elasticsearch/fullTextSearch.js +60 -0
  288. package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
  289. package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
  290. package/operations/entry/elasticsearch/fullTextSearchFields.js +10 -0
  291. package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
  292. package/operations/entry/elasticsearch/initialQuery.d.ts +21 -0
  293. package/operations/entry/elasticsearch/initialQuery.js +43 -0
  294. package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
  295. package/operations/entry/elasticsearch/initialQuery.test.d.ts +1 -0
  296. package/operations/entry/elasticsearch/initialQuery.test.js +48 -0
  297. package/operations/entry/elasticsearch/initialQuery.test.js.map +1 -0
  298. package/operations/entry/elasticsearch/keyword.d.ts +2 -0
  299. package/operations/entry/elasticsearch/keyword.js +17 -0
  300. package/operations/entry/elasticsearch/keyword.js.map +1 -0
  301. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
  302. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +8 -0
  303. package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
  304. package/operations/entry/elasticsearch/types.d.ts +31 -0
  305. package/operations/entry/elasticsearch/types.js +0 -0
  306. package/operations/entry/recordType.d.ts +3 -0
  307. package/operations/entry/recordType.js +6 -0
  308. package/operations/entry/recordType.js.map +1 -0
  309. package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
  310. package/operations/entry/transformations/transformEntryToIndex.js +20 -0
  311. package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
  312. package/package.json +34 -0
  313. package/testing/createTestModelIndexName.d.ts +3 -0
  314. package/testing/createTestModelIndexName.js +11 -0
  315. package/testing/createTestModelIndexName.js.map +1 -0
  316. package/testing/index.d.ts +1 -0
  317. package/testing/index.js +1 -0
  318. package/types.d.ts +5 -0
  319. package/types.js +0 -0
  320. package/values/NoValueContainer.d.ts +5 -0
  321. package/values/NoValueContainer.js +11 -0
  322. package/values/NoValueContainer.js.map +1 -0
@@ -0,0 +1,209 @@
1
+ import error from "@webiny/error";
2
+ import { ENTRY_META_FIELDS, isDateTimeEntryMetaField, isIdentityEntryMetaField } from "@webiny/api-headless-cms/constants.js";
3
+ import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
4
+ import { liveFields } from "./fields/live.js";
5
+ import { createSystemField } from "./fields/createSystemField.js";
6
+ import { stateFields } from "./fields/state.js";
7
+ import { locationFields } from "./fields/location.js";
8
+ import { createEntrySystemFields } from "./fields/system.js";
9
+ const createSystemFields = (entrySystemFields)=>{
10
+ const onMetaFields = ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField).reduce((current, fieldName)=>({
11
+ ...current,
12
+ [fieldName]: {
13
+ type: "date",
14
+ unmappedType: "date",
15
+ keyword: false,
16
+ systemField: true,
17
+ searchable: true,
18
+ sortable: true,
19
+ field: createSystemField({
20
+ storageId: fieldName,
21
+ fieldId: fieldName,
22
+ type: "text",
23
+ settings: {
24
+ type: "dateTimeWithoutTimezone"
25
+ }
26
+ }),
27
+ parents: []
28
+ }
29
+ }), {});
30
+ const byMetaFields = ENTRY_META_FIELDS.filter(isIdentityEntryMetaField).reduce((current, fieldName)=>({
31
+ ...current,
32
+ [fieldName]: {
33
+ type: "text",
34
+ unmappedType: void 0,
35
+ systemField: true,
36
+ searchable: true,
37
+ sortable: true,
38
+ path: `${fieldName}.id`,
39
+ field: createSystemField({
40
+ storageId: fieldName,
41
+ fieldId: fieldName,
42
+ type: "text"
43
+ }),
44
+ parents: []
45
+ }
46
+ }), {});
47
+ return {
48
+ id: {
49
+ type: "text",
50
+ systemField: true,
51
+ searchable: true,
52
+ sortable: true,
53
+ field: createSystemField({
54
+ storageId: "id",
55
+ fieldId: "id",
56
+ type: "text"
57
+ }),
58
+ parents: []
59
+ },
60
+ entryId: {
61
+ type: "text",
62
+ systemField: true,
63
+ searchable: true,
64
+ sortable: true,
65
+ field: createSystemField({
66
+ storageId: "entryId",
67
+ fieldId: "entryId",
68
+ type: "text"
69
+ }),
70
+ parents: []
71
+ },
72
+ ...onMetaFields,
73
+ ...byMetaFields,
74
+ ...locationFields,
75
+ version: {
76
+ type: "number",
77
+ unmappedType: void 0,
78
+ keyword: false,
79
+ systemField: true,
80
+ searchable: true,
81
+ sortable: true,
82
+ field: createSystemField({
83
+ storageId: "version",
84
+ fieldId: "version",
85
+ type: "number"
86
+ }),
87
+ parents: []
88
+ },
89
+ status: {
90
+ type: "string",
91
+ unmappedType: void 0,
92
+ keyword: false,
93
+ systemField: true,
94
+ searchable: true,
95
+ sortable: false,
96
+ field: createSystemField({
97
+ storageId: "status",
98
+ fieldId: "status",
99
+ type: "string"
100
+ }),
101
+ parents: []
102
+ },
103
+ wbyDeleted: {
104
+ type: "boolean",
105
+ unmappedType: void 0,
106
+ keyword: false,
107
+ systemField: true,
108
+ searchable: true,
109
+ sortable: false,
110
+ field: createSystemField({
111
+ storageId: "wbyDeleted",
112
+ fieldId: "wbyDeleted",
113
+ type: "boolean"
114
+ }),
115
+ parents: []
116
+ },
117
+ binOriginalFolderId: {
118
+ type: "text",
119
+ unmappedType: void 0,
120
+ keyword: false,
121
+ systemField: true,
122
+ searchable: true,
123
+ sortable: false,
124
+ field: createSystemField({
125
+ storageId: "binOriginalFolderId",
126
+ fieldId: "binOriginalFolderId",
127
+ type: "text"
128
+ }),
129
+ parents: []
130
+ },
131
+ ...stateFields,
132
+ ...liveFields,
133
+ ...createEntrySystemFields(entrySystemFields)
134
+ };
135
+ };
136
+ const buildFieldsList = (params)=>{
137
+ const { plugins, fields, parents } = params;
138
+ return fields.reduce((result, field)=>{
139
+ const fieldType = getBaseFieldType(field);
140
+ const plugin = plugins[fieldType];
141
+ if (!plugin) throw new error(`There is no plugin for field type "${field.type}".`);
142
+ const { searchable, sortable, unmappedType, isFullTextSearchable: fullTextSearch } = plugin;
143
+ const childFields = field.settings?.fields || [];
144
+ if (childFields.length > 0) {
145
+ const childResult = buildFieldsList({
146
+ fields: childFields,
147
+ plugins,
148
+ parents: [
149
+ ...parents,
150
+ {
151
+ fieldId: field.fieldId,
152
+ storageId: field.storageId,
153
+ type: fieldType
154
+ }
155
+ ]
156
+ });
157
+ Object.assign(result, childResult);
158
+ }
159
+ const identifier = [
160
+ ...parents.map((p)=>p.fieldId),
161
+ field.fieldId
162
+ ].join(".");
163
+ result[identifier] = {
164
+ type: fieldType,
165
+ parents,
166
+ searchable,
167
+ sortable,
168
+ fullTextSearch,
169
+ unmappedType: "function" == typeof unmappedType ? unmappedType(field) : void 0,
170
+ systemField: false,
171
+ field
172
+ };
173
+ return result;
174
+ }, {});
175
+ };
176
+ const createModelFields = ({ model, fieldRegistry, fieldIndexRegistry, systemFields })=>{
177
+ const fields = model.fields;
178
+ const unmappedTypes = fieldIndexRegistry.getAll().reduce((acc, fieldIndex)=>{
179
+ if (!fieldIndex.unmappedType) return acc;
180
+ acc[fieldIndex.fieldType] = fieldIndex.unmappedType;
181
+ return acc;
182
+ }, {});
183
+ const fieldTypePlugins = fieldRegistry.getAll().reduce((types, field)=>{
184
+ types[field.fieldType] = {
185
+ unmappedType: unmappedTypes[field.fieldType],
186
+ searchable: field.isSearchable,
187
+ sortable: field.isSortable,
188
+ isFullTextSearchable: field.isFullTextSearchable
189
+ };
190
+ return types;
191
+ }, {});
192
+ return {
193
+ ...createSystemFields(systemFields),
194
+ ...buildFieldsList({
195
+ fields,
196
+ plugins: fieldTypePlugins,
197
+ parents: [
198
+ {
199
+ fieldId: "values",
200
+ type: "object",
201
+ storageId: "values"
202
+ }
203
+ ]
204
+ })
205
+ };
206
+ };
207
+ export { createModelFields };
208
+
209
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/elasticsearch/fields.js","sources":["../../../../src/operations/entry/elasticsearch/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 { createEntrySystemFields } from \"./fields/system.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/features/graphql/index.js\";\nimport { CmsEntryOpenSearchFieldIndexRegistry } from \"~/features/CmsEntryOpenSearchFieldIndex/index.js\";\n\nconst createSystemFields = (entrySystemFields: CmsModelField[]): 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 ...createEntrySystemFields(entrySystemFields)\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 /** Fields registered as `CmsEntrySystemField`, filterable under `system`. */\n systemFields: CmsModelField[];\n}\n\nexport const createModelFields = ({\n model,\n fieldRegistry,\n fieldIndexRegistry,\n systemFields\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(systemFields),\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"],"names":["createSystemFields","entrySystemFields","onMetaFields","ENTRY_META_FIELDS","isDateTimeEntryMetaField","current","fieldName","createSystemField","byMetaFields","isIdentityEntryMetaField","undefined","locationFields","stateFields","liveFields","createEntrySystemFields","buildFieldsList","params","plugins","fields","parents","result","field","fieldType","getBaseFieldType","plugin","WebinyError","searchable","sortable","unmappedType","fullTextSearch","childFields","childResult","Object","identifier","p","createModelFields","model","fieldRegistry","fieldIndexRegistry","systemFields","unmappedTypes","acc","fieldIndex","fieldTypePlugins","types"],"mappings":"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"}
@@ -0,0 +1,13 @@
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";
5
+ interface Params {
6
+ fullTextSearches: CmsEntryOpenSearchFullTextSearch.Interface[];
7
+ model: CmsModel;
8
+ query: OpenSearchBoolQueryConfig;
9
+ term?: string;
10
+ fields: ModelFields;
11
+ }
12
+ export declare const applyFullTextSearch: (params: Params) => void;
13
+ export {};
@@ -0,0 +1,60 @@
1
+ import { normalizeValue } from "@webiny/api-opensearch";
2
+ const defaultFullTextSearch = {
3
+ apply: (params)=>{
4
+ const { query, term, fields, createFieldPath, prepareTerm } = params;
5
+ query.must.push({
6
+ query_string: {
7
+ allow_leading_wildcard: true,
8
+ lenient: true,
9
+ fields: Object.values(fields).map(createFieldPath),
10
+ query: `*${prepareTerm(term)}*`,
11
+ default_operator: "and"
12
+ }
13
+ });
14
+ }
15
+ };
16
+ const getFullTextSearch = (params)=>{
17
+ const { fullTextSearches, model } = params;
18
+ const reversed = [
19
+ ...fullTextSearches
20
+ ].reverse();
21
+ let fallback = null;
22
+ for (const item of reversed){
23
+ const models = item.models || [];
24
+ if (models.includes(model.modelId)) return item;
25
+ else if (!fallback && 0 === models.length) fallback = item;
26
+ }
27
+ return fallback || defaultFullTextSearch;
28
+ };
29
+ const applyFullTextSearch = (params)=>{
30
+ const { fullTextSearches, query, term, fields, model } = params;
31
+ const keys = Object.keys(fields);
32
+ if (!term || 0 === term.length || 0 === keys.length) return;
33
+ const fullTextSearch = getFullTextSearch({
34
+ fullTextSearches,
35
+ model
36
+ });
37
+ fullTextSearch.apply({
38
+ model,
39
+ createFieldPath: (field)=>{
40
+ if ("function" == typeof field.path) return field.path(term);
41
+ else if (field.systemField) return field.path || field.field.storageId;
42
+ const parents = field.parents.length > 0 ? field.parents.map((p)=>p.storageId) : [
43
+ "values"
44
+ ];
45
+ const path = [
46
+ ...parents,
47
+ field.path || field.field.storageId
48
+ ].join(".");
49
+ if ("searchable-json" === field.type) return `${path}.*`;
50
+ return path;
51
+ },
52
+ fields,
53
+ query,
54
+ term,
55
+ prepareTerm: normalizeValue
56
+ });
57
+ };
58
+ export { applyFullTextSearch };
59
+
60
+ //# sourceMappingURL=fullTextSearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/elasticsearch/fullTextSearch.js","sources":["../../../../src/operations/entry/elasticsearch/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 /**\n * Searchable JSON fields are dynamically mapped, so their subfields can be of any type (date, number, boolean...).\n * Wildcard queries are not allowed on those types, so we need to ignore them instead of failing the whole query.\n */\n lenient: 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 /**\n * Fields can live inside object fields, so we need to prepend the storage ids of all the parents.\n * Root fields have the `values` parent only.\n */\n const parents =\n field.parents.length > 0 ? field.parents.map(p => p.storageId) : [\"values\"];\n const path = [...parents, field.path || field.field.storageId].join(\".\");\n /*\n * Searchable JSON fields are indexed as objects, so the searchable values live on the\n * nested keys. Target all of them with a wildcard.\n */\n if (field.type === \"searchable-json\") {\n return `${path}.*`;\n }\n return path;\n },\n fields,\n query,\n term,\n prepareTerm: normalizeValue\n });\n};\n"],"names":["defaultFullTextSearch","params","query","term","fields","createFieldPath","prepareTerm","Object","getFullTextSearch","fullTextSearches","model","reversed","fallback","item","models","applyFullTextSearch","keys","fullTextSearch","field","parents","p","path","normalizeValue"],"mappings":";AASA,MAAMA,wBAAoE;IACtE,OAAOC,CAAAA;QACH,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,MAAM,EAAEC,eAAe,EAAEC,WAAW,EAAE,GAAGL;QAE9DC,MAAM,IAAI,CAAC,IAAI,CAAC;YACZ,cAAc;gBACV,wBAAwB;gBAKxB,SAAS;gBACT,QAAQK,OAAO,MAAM,CAACH,QAAQ,GAAG,CAACC;gBAClC,OAAO,CAAC,CAAC,EAAEC,YAAYH,MAAM,CAAC,CAAC;gBAC/B,kBAAkB;YACtB;QACJ;IACJ;AACJ;AAMA,MAAMK,oBAAoB,CACtBP;IAEA,MAAM,EAAEQ,gBAAgB,EAAEC,KAAK,EAAE,GAAGT;IAIpC,MAAMU,WAAW;WAAIF;KAAiB,CAAC,OAAO;IAK9C,IAAIG,WAA8D;IAClE,KAAK,MAAMC,QAAQF,SAAU;QACzB,MAAMG,SAASD,KAAK,MAAM,IAAI,EAAE;QAIhC,IAAIC,OAAO,QAAQ,CAACJ,MAAM,OAAO,GAC7B,OAAOG;aACJ,IAAI,CAACD,YAAYE,AAAkB,MAAlBA,OAAO,MAAM,EAKjCF,WAAWC;IAEnB;IAEA,OAAOD,YAAYZ;AACvB;AASO,MAAMe,sBAAsB,CAACd;IAChC,MAAM,EAAEQ,gBAAgB,EAAEP,KAAK,EAAEC,IAAI,EAAEC,MAAM,EAAEM,KAAK,EAAE,GAAGT;IACzD,MAAMe,OAAOT,OAAO,IAAI,CAACH;IACzB,IAAI,CAACD,QAAQA,AAAgB,MAAhBA,KAAK,MAAM,IAAUa,AAAgB,MAAhBA,KAAK,MAAM,EACzC;IAGJ,MAAMC,iBAAiBT,kBAAkB;QACrCC;QACAC;IACJ;IAEAO,eAAe,KAAK,CAAC;QACjBP;QACA,iBAAiBQ,CAAAA;YACb,IAAI,AAAsB,cAAtB,OAAOA,MAAM,IAAI,EACjB,OAAOA,MAAM,IAAI,CAACf;iBACf,IAAIe,MAAM,WAAW,EACxB,OAAOA,MAAM,IAAI,IAAIA,MAAM,KAAK,CAAC,SAAS;YAM9C,MAAMC,UACFD,MAAM,OAAO,CAAC,MAAM,GAAG,IAAIA,MAAM,OAAO,CAAC,GAAG,CAACE,CAAAA,IAAKA,EAAE,SAAS,IAAI;gBAAC;aAAS;YAC/E,MAAMC,OAAO;mBAAIF;gBAASD,MAAM,IAAI,IAAIA,MAAM,KAAK,CAAC,SAAS;aAAC,CAAC,IAAI,CAAC;YAKpE,IAAIA,AAAe,sBAAfA,MAAM,IAAI,EACV,OAAO,GAAGG,KAAK,EAAE,CAAC;YAEtB,OAAOA;QACX;QACAjB;QACAF;QACAC;QACA,aAAamB;IACjB;AACJ"}
@@ -0,0 +1,8 @@
1
+ import type { ModelFields } from "../../../operations/entry/elasticsearch/types.js";
2
+ interface Params {
3
+ fields: ModelFields;
4
+ term?: string;
5
+ targets?: string[];
6
+ }
7
+ export declare const createFullTextSearchFields: (params: Params) => ModelFields;
8
+ export {};
@@ -0,0 +1,10 @@
1
+ const createFullTextSearchFields = (params)=>{
2
+ const { term, targets, fields } = params;
3
+ if (!targets?.length || !term || 0 === term.trim().length) return {};
4
+ const result = {};
5
+ for(const key in fields)if (false !== targets.includes(key)) result[key] = fields[key];
6
+ return result;
7
+ };
8
+ export { createFullTextSearchFields };
9
+
10
+ //# sourceMappingURL=fullTextSearchFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/elasticsearch/fullTextSearchFields.js","sources":["../../../../src/operations/entry/elasticsearch/fullTextSearchFields.ts"],"sourcesContent":["import type { ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\n\ninterface Params {\n fields: ModelFields;\n term?: string;\n targets?: string[];\n}\nexport const createFullTextSearchFields = (params: Params): ModelFields => {\n const { term, targets, fields } = params;\n if (!targets?.length || !term || term.trim().length === 0) {\n return {};\n }\n\n const result: ModelFields = {};\n for (const key in fields) {\n if (targets.includes(key) === false) {\n continue;\n }\n result[key] = fields[key];\n }\n return result;\n};\n"],"names":["createFullTextSearchFields","params","term","targets","fields","result","key"],"mappings":"AAOO,MAAMA,6BAA6B,CAACC;IACvC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGH;IAClC,IAAI,CAACE,SAAS,UAAU,CAACD,QAAQA,AAAuB,MAAvBA,KAAK,IAAI,GAAG,MAAM,EAC/C,OAAO,CAAC;IAGZ,MAAMG,SAAsB,CAAC;IAC7B,IAAK,MAAMC,OAAOF,OACd,IAAID,AAA0B,UAA1BA,QAAQ,QAAQ,CAACG,MAGrBD,MAAM,CAACC,IAAI,GAAGF,MAAM,CAACE,IAAI;IAE7B,OAAOD;AACX"}
@@ -0,0 +1,21 @@
1
+ import type { OpenSearchBoolQueryConfig } from "@webiny/api-opensearch/types.js";
2
+ import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types/index.js";
3
+ export declare const createBaseQuery: () => OpenSearchBoolQueryConfig;
4
+ interface Params {
5
+ /**
6
+ * Whether the model's index is shared between tenants, from CmsModelOpenSearchIndexProvider.
7
+ */
8
+ shared: boolean;
9
+ model: CmsModel;
10
+ where: CmsEntryListWhere;
11
+ }
12
+ /**
13
+ * Latest and published are specific in Elasticsearch to that extend that they are tagged in the __type property.
14
+ * We allow either published or either latest.
15
+ * Latest is used in the manage API and published in the read API.
16
+ *
17
+ *
18
+ * We add the query.filter terms because we do not need scored search here and it is a bit faster.
19
+ */
20
+ export declare const createInitialQuery: (params: Params) => OpenSearchBoolQueryConfig;
21
+ export {};
@@ -0,0 +1,43 @@
1
+ import error from "@webiny/error";
2
+ import { createLatestRecordType, createPublishedRecordType } from "../recordType.js";
3
+ const createBaseQuery = ()=>({
4
+ must: [],
5
+ must_not: [],
6
+ should: [],
7
+ filter: []
8
+ });
9
+ const createInitialQuery = (params)=>{
10
+ const { model, where, shared } = params;
11
+ const query = createBaseQuery();
12
+ if (shared) {
13
+ query.filter.push({
14
+ term: {
15
+ "tenant.keyword": model.tenant
16
+ }
17
+ });
18
+ query.filter.push({
19
+ term: {
20
+ "modelId.keyword": model.modelId
21
+ }
22
+ });
23
+ }
24
+ if (true === where.published) query.filter.push({
25
+ term: {
26
+ "__type.keyword": createPublishedRecordType()
27
+ }
28
+ });
29
+ else if (true === where.latest) query.filter.push({
30
+ term: {
31
+ "__type.keyword": createLatestRecordType()
32
+ }
33
+ });
34
+ else throw new error('Cannot call Elasticsearch query when not setting "published" or "latest".', "OPENSEARCH_UNSUPPORTED_QUERY", {
35
+ where
36
+ });
37
+ delete where.published;
38
+ delete where.latest;
39
+ return query;
40
+ };
41
+ export { createBaseQuery, createInitialQuery };
42
+
43
+ //# sourceMappingURL=initialQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/elasticsearch/initialQuery.js","sources":["../../../../src/operations/entry/elasticsearch/initialQuery.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createLatestRecordType, createPublishedRecordType } from \"../recordType.js\";\n\nexport const createBaseQuery = (): OpenSearchBoolQueryConfig => {\n return {\n must: [],\n must_not: [],\n should: [],\n filter: []\n };\n};\n\ninterface Params {\n /**\n * Whether the model's index is shared between tenants, from CmsModelOpenSearchIndexProvider.\n */\n shared: boolean;\n model: CmsModel;\n where: CmsEntryListWhere;\n}\n/**\n * Latest and published are specific in Elasticsearch to that extend that they are tagged in the __type property.\n * We allow either published or either latest.\n * Latest is used in the manage API and published in the read API.\n *\n *\n * We add the query.filter terms because we do not need scored search here and it is a bit faster.\n */\nexport const createInitialQuery = (params: Params): OpenSearchBoolQueryConfig => {\n const { model, where, shared } = params;\n\n const query = createBaseQuery();\n\n /**\n * When the index is shared between tenants, filter records by tenant ID. The model's index\n * provider decides, so a decorator that isolates or shares an index per model is respected.\n */\n if (shared) {\n /**\n * Tenant for the filtering is taken from the model.\n *\n * TODO determine if we want to send it in the \"where\" parameter?\n */\n query.filter.push({\n term: {\n \"tenant.keyword\": model.tenant\n }\n });\n /**\n * Also, we must search only in selected model.\n */\n query.filter.push({\n term: {\n \"modelId.keyword\": model.modelId\n }\n });\n }\n\n /**\n * We must transform published and latest where args into something that is understandable by our Elasticsearch\n */\n if (where.published === true) {\n query.filter.push({\n term: {\n \"__type.keyword\": createPublishedRecordType()\n }\n });\n } else if (where.latest === true) {\n query.filter.push({\n term: {\n \"__type.keyword\": createLatestRecordType()\n }\n });\n }\n //\n /**\n * We do not allow filtering without the published or latest parameter.\n * Also, we do not want to set the default one, as there is a large possibility for user error when filtering.\n */\n else {\n throw new WebinyError(\n `Cannot call Elasticsearch query when not setting \"published\" or \"latest\".`,\n \"OPENSEARCH_UNSUPPORTED_QUERY\",\n {\n where\n }\n );\n }\n /**\n * We need to remove fields that actually do not exist on the record - it will break otherwise.\n * This will modify the original object, which is what we want.\n */\n delete where.published;\n delete where.latest;\n\n return query;\n};\n"],"names":["createBaseQuery","createInitialQuery","params","model","where","shared","query","createPublishedRecordType","createLatestRecordType","WebinyError"],"mappings":";;AAKO,MAAMA,kBAAkB,IACpB;QACH,MAAM,EAAE;QACR,UAAU,EAAE;QACZ,QAAQ,EAAE;QACV,QAAQ,EAAE;IACd;AAmBG,MAAMC,qBAAqB,CAACC;IAC/B,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGH;IAEjC,MAAMI,QAAQN;IAMd,IAAIK,QAAQ;QAMRC,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,MAAM;gBACF,kBAAkBH,MAAM,MAAM;YAClC;QACJ;QAIAG,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,MAAM;gBACF,mBAAmBH,MAAM,OAAO;YACpC;QACJ;IACJ;IAKA,IAAIC,AAAoB,SAApBA,MAAM,SAAS,EACfE,MAAM,MAAM,CAAC,IAAI,CAAC;QACd,MAAM;YACF,kBAAkBC;QACtB;IACJ;SACG,IAAIH,AAAiB,SAAjBA,MAAM,MAAM,EACnBE,MAAM,MAAM,CAAC,IAAI,CAAC;QACd,MAAM;YACF,kBAAkBE;QACtB;IACJ;SAQA,MAAM,IAAIC,MACN,6EACA,gCACA;QACIL;IACJ;IAOR,OAAOA,MAAM,SAAS;IACtB,OAAOA,MAAM,MAAM;IAEnB,OAAOE;AACX"}
@@ -0,0 +1,48 @@
1
+ import { afterEach, describe, expect, it } from "vitest";
2
+ import { createInitialQuery } from "./initialQuery.js";
3
+ const model = {
4
+ modelId: "article",
5
+ tenant: "acme"
6
+ };
7
+ const tenantFilter = {
8
+ term: {
9
+ "tenant.keyword": "acme"
10
+ }
11
+ };
12
+ const modelFilter = {
13
+ term: {
14
+ "modelId.keyword": "article"
15
+ }
16
+ };
17
+ describe("createInitialQuery", ()=>{
18
+ const original = process.env.OPENSEARCH_SHARED_INDEXES;
19
+ afterEach(()=>{
20
+ process.env.OPENSEARCH_SHARED_INDEXES = original;
21
+ });
22
+ it("filters by tenant and model when the index is shared, even if the variable says otherwise", ()=>{
23
+ process.env.OPENSEARCH_SHARED_INDEXES = "false";
24
+ const query = createInitialQuery({
25
+ model: model,
26
+ where: {
27
+ latest: true
28
+ },
29
+ shared: true
30
+ });
31
+ expect(query.filter).toContainEqual(tenantFilter);
32
+ expect(query.filter).toContainEqual(modelFilter);
33
+ });
34
+ it("doesn't filter by tenant when the index isn't shared, even if the variable says it is", ()=>{
35
+ process.env.OPENSEARCH_SHARED_INDEXES = "true";
36
+ const query = createInitialQuery({
37
+ model: model,
38
+ where: {
39
+ latest: true
40
+ },
41
+ shared: false
42
+ });
43
+ expect(query.filter).not.toContainEqual(tenantFilter);
44
+ expect(query.filter).not.toContainEqual(modelFilter);
45
+ });
46
+ });
47
+
48
+ //# sourceMappingURL=initialQuery.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/elasticsearch/initialQuery.test.js","sources":["../../../../src/operations/entry/elasticsearch/initialQuery.test.ts"],"sourcesContent":["import { afterEach, describe, expect, it } from \"vitest\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createInitialQuery } from \"./initialQuery.js\";\n\nconst model = { modelId: \"article\", tenant: \"acme\" } as CmsModel;\n\nconst tenantFilter = { term: { \"tenant.keyword\": \"acme\" } };\nconst modelFilter = { term: { \"modelId.keyword\": \"article\" } };\n\n/*\n * Whether entries are filtered by tenant must follow the model's index (CmsModelOpenSearchIndex),\n * not the OPENSEARCH_SHARED_INDEXES variable. A decorator can isolate or share an index per model,\n * so the two can disagree.\n */\ndescribe(\"createInitialQuery\", () => {\n const original = process.env.OPENSEARCH_SHARED_INDEXES;\n\n afterEach(() => {\n process.env.OPENSEARCH_SHARED_INDEXES = original;\n });\n\n it(\"filters by tenant and model when the index is shared, even if the variable says otherwise\", () => {\n process.env.OPENSEARCH_SHARED_INDEXES = \"false\";\n\n const query = createInitialQuery({ model, where: { latest: true }, shared: true });\n\n expect(query.filter).toContainEqual(tenantFilter);\n expect(query.filter).toContainEqual(modelFilter);\n });\n\n it(\"doesn't filter by tenant when the index isn't shared, even if the variable says it is\", () => {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n\n const query = createInitialQuery({ model, where: { latest: true }, shared: false });\n\n expect(query.filter).not.toContainEqual(tenantFilter);\n expect(query.filter).not.toContainEqual(modelFilter);\n });\n});\n"],"names":["model","tenantFilter","modelFilter","describe","original","process","afterEach","it","query","createInitialQuery","expect"],"mappings":";;AAIA,MAAMA,QAAQ;IAAE,SAAS;IAAW,QAAQ;AAAO;AAEnD,MAAMC,eAAe;IAAE,MAAM;QAAE,kBAAkB;IAAO;AAAE;AAC1D,MAAMC,cAAc;IAAE,MAAM;QAAE,mBAAmB;IAAU;AAAE;AAO7DC,SAAS,sBAAsB;IAC3B,MAAMC,WAAWC,QAAQ,GAAG,CAAC,yBAAyB;IAEtDC,UAAU;QACND,QAAQ,GAAG,CAAC,yBAAyB,GAAGD;IAC5C;IAEAG,GAAG,6FAA6F;QAC5FF,QAAQ,GAAG,CAAC,yBAAyB,GAAG;QAExC,MAAMG,QAAQC,mBAAmB;YAAET,OAAAA;YAAO,OAAO;gBAAE,QAAQ;YAAK;YAAG,QAAQ;QAAK;QAEhFU,OAAOF,MAAM,MAAM,EAAE,cAAc,CAACP;QACpCS,OAAOF,MAAM,MAAM,EAAE,cAAc,CAACN;IACxC;IAEAK,GAAG,yFAAyF;QACxFF,QAAQ,GAAG,CAAC,yBAAyB,GAAG;QAExC,MAAMG,QAAQC,mBAAmB;YAAET,OAAAA;YAAO,OAAO;gBAAE,QAAQ;YAAK;YAAG,QAAQ;QAAM;QAEjFU,OAAOF,MAAM,MAAM,EAAE,GAAG,CAAC,cAAc,CAACP;QACxCS,OAAOF,MAAM,MAAM,EAAE,GAAG,CAAC,cAAc,CAACN;IAC5C;AACJ"}
@@ -0,0 +1,2 @@
1
+ import type { ModelField } from "./types.js";
2
+ export declare const hasKeyword: (field: ModelField) => boolean;
@@ -0,0 +1,17 @@
1
+ import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
2
+ const noKeywordFields = [
3
+ "date",
4
+ "datetime",
5
+ "number",
6
+ "boolean"
7
+ ];
8
+ const hasKeyword = (field)=>{
9
+ const fieldType = getBaseFieldType(field);
10
+ if (noKeywordFields.includes(fieldType)) return false;
11
+ else if (field.unmappedType) return false;
12
+ else if (false === field.keyword) return false;
13
+ return true;
14
+ };
15
+ export { hasKeyword };
16
+
17
+ //# sourceMappingURL=keyword.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/elasticsearch/keyword.js","sources":["../../../../src/operations/entry/elasticsearch/keyword.ts"],"sourcesContent":["import type { ModelField } from \"./types.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\nconst noKeywordFields: string[] = [\"date\", \"datetime\", \"number\", \"boolean\"];\nexport const hasKeyword = (field: ModelField): boolean => {\n const fieldType = getBaseFieldType(field);\n /**\n * We defined some field types that MUST have no keyword added to the field path\n */\n if (noKeywordFields.includes(fieldType)) {\n return false;\n }\n /**\n * If field has unmapped type defined, do not add keyword.\n */\n //\n else if (field.unmappedType) {\n return false;\n }\n /**\n * And if specifically defined that field has no keyword, do not add it.\n */\n //\n else if (field.keyword === false) {\n return false;\n }\n /**\n * All other fields have keyword added.\n */\n return true;\n};\n"],"names":["noKeywordFields","hasKeyword","field","fieldType","getBaseFieldType"],"mappings":";AAGA,MAAMA,kBAA4B;IAAC;IAAQ;IAAY;IAAU;CAAU;AACpE,MAAMC,aAAa,CAACC;IACvB,MAAMC,YAAYC,iBAAiBF;IAInC,IAAIF,gBAAgB,QAAQ,CAACG,YACzB,OAAO;SAMN,IAAID,MAAM,YAAY,EACvB,OAAO;SAMN,IAAIA,AAAkB,UAAlBA,MAAM,OAAO,EAClB,OAAO;IAKX,OAAO;AACX"}
@@ -0,0 +1,2 @@
1
+ import type WebinyError from "@webiny/error";
2
+ export declare const shouldIgnoreEsResponseError: (error: WebinyError) => boolean;
@@ -0,0 +1,8 @@
1
+ const IGNORED_ES_SEARCH_EXCEPTIONS = [
2
+ "index_not_found_exception",
3
+ "search_phase_execution_exception"
4
+ ];
5
+ const shouldIgnoreEsResponseError = (error)=>IGNORED_ES_SEARCH_EXCEPTIONS.some((ignoredMessage)=>error.message.includes(ignoredMessage));
6
+ export { shouldIgnoreEsResponseError };
7
+
8
+ //# sourceMappingURL=shouldIgnoreEsResponseError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/elasticsearch/shouldIgnoreEsResponseError.js","sources":["../../../../src/operations/entry/elasticsearch/shouldIgnoreEsResponseError.ts"],"sourcesContent":["import type WebinyError from \"@webiny/error\";\n\nconst IGNORED_ES_SEARCH_EXCEPTIONS = [\n \"index_not_found_exception\",\n \"search_phase_execution_exception\"\n];\n\nexport const shouldIgnoreEsResponseError = (error: WebinyError) => {\n return IGNORED_ES_SEARCH_EXCEPTIONS.some(ignoredMessage =>\n error.message.includes(ignoredMessage)\n );\n};\n"],"names":["IGNORED_ES_SEARCH_EXCEPTIONS","shouldIgnoreEsResponseError","error","ignoredMessage"],"mappings":"AAEA,MAAMA,+BAA+B;IACjC;IACA;CACH;AAEM,MAAMC,8BAA8B,CAACC,QACjCF,6BAA6B,IAAI,CAACG,CAAAA,iBACrCD,MAAM,OAAO,CAAC,QAAQ,CAACC"}
@@ -0,0 +1,31 @@
1
+ import type { OpenSearchQueryBuilderOperator } from "@webiny/api-opensearch/exports/api/opensearch.js";
2
+ import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
3
+ /**
4
+ * ./fields
5
+ */
6
+ type ModelFieldPath = string | ((value: string) => string);
7
+ export type FieldType = "text" | "date" | "datetime" | "time" | "number" | "boolean" | string;
8
+ export interface ModelFieldParent {
9
+ fieldId: string;
10
+ storageId: string;
11
+ type: FieldType;
12
+ }
13
+ export interface ModelField {
14
+ unmappedType?: string;
15
+ keyword?: boolean;
16
+ searchable: boolean;
17
+ sortable: boolean;
18
+ type: FieldType;
19
+ systemField?: boolean;
20
+ field: CmsModelField;
21
+ path?: ModelFieldPath;
22
+ fullTextSearch?: boolean;
23
+ parents: ModelFieldParent[];
24
+ }
25
+ export interface ModelFields {
26
+ [fieldId: string]: ModelField;
27
+ }
28
+ export interface OpenSearchQueryBuilderOperators {
29
+ [key: string]: OpenSearchQueryBuilderOperator.Interface;
30
+ }
31
+ export {};
File without changes
@@ -0,0 +1,3 @@
1
+ export declare const createRecordType: () => string;
2
+ export declare const createLatestRecordType: () => string;
3
+ export declare const createPublishedRecordType: () => string;
@@ -0,0 +1,6 @@
1
+ const createRecordType = ()=>"cms.entry";
2
+ const createLatestRecordType = ()=>`${createRecordType()}.l`;
3
+ const createPublishedRecordType = ()=>`${createRecordType()}.p`;
4
+ export { createLatestRecordType, createPublishedRecordType, createRecordType };
5
+
6
+ //# sourceMappingURL=recordType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/recordType.js","sources":["../../../src/operations/entry/recordType.ts"],"sourcesContent":["export const createRecordType = (): string => {\n return \"cms.entry\";\n};\nexport const createLatestRecordType = (): string => {\n return `${createRecordType()}.l`;\n};\nexport const createPublishedRecordType = (): string => {\n return `${createRecordType()}.p`;\n};\n"],"names":["createRecordType","createLatestRecordType","createPublishedRecordType"],"mappings":"AAAO,MAAMA,mBAAmB,IACrB;AAEJ,MAAMC,yBAAyB,IAC3B,GAAGD,mBAAmB,EAAE,CAAC;AAE7B,MAAME,4BAA4B,IAC9B,GAAGF,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { CmsEntry, CmsEntryValues, CmsStorageEntry, StorageOperationsCmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { CmsEntryOpenSearchFieldIndexRegistry } from "../../../features/CmsEntryOpenSearchFieldIndex/index.js";
3
+ interface TransformEntryToIndexParams<T extends CmsEntryValues = CmsEntryValues> {
4
+ model: StorageOperationsCmsModel<T>;
5
+ entry: CmsEntry<T>;
6
+ storageEntry: CmsStorageEntry<T>;
7
+ fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface;
8
+ }
9
+ export declare const transformEntryToIndex: <T extends CmsEntryValues = CmsEntryValues>(params: TransformEntryToIndexParams<T>) => import("../../../types").CmsIndexEntry<T>;
10
+ export {};
@@ -0,0 +1,20 @@
1
+ import { prepareEntryToIndex } from "../../../helpers/index.js";
2
+ const transformEntryToIndex = (params)=>{
3
+ const { model, entry, storageEntry, fieldIndexRegistry } = params;
4
+ const result = prepareEntryToIndex({
5
+ model,
6
+ entry: structuredClone(entry),
7
+ storageEntry: structuredClone(storageEntry),
8
+ fieldIndexRegistry
9
+ });
10
+ delete result["PK"];
11
+ delete result["SK"];
12
+ delete result["GSI1_PK"];
13
+ delete result["GSI1_SK"];
14
+ delete result["published"];
15
+ delete result["latest"];
16
+ return result;
17
+ };
18
+ export { transformEntryToIndex };
19
+
20
+ //# sourceMappingURL=transformEntryToIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/transformations/transformEntryToIndex.js","sources":["../../../../src/operations/entry/transformations/transformEntryToIndex.ts"],"sourcesContent":["import type {\n CmsEntry,\n CmsEntryValues,\n CmsStorageEntry,\n StorageOperationsCmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { prepareEntryToIndex } from \"~/helpers/index.js\";\nimport type { CmsEntryOpenSearchFieldIndexRegistry } from \"~/features/CmsEntryOpenSearchFieldIndex/index.js\";\n\ninterface TransformEntryToIndexParams<T extends CmsEntryValues = CmsEntryValues> {\n model: StorageOperationsCmsModel<T>;\n entry: CmsEntry<T>;\n storageEntry: CmsStorageEntry<T>;\n fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface;\n}\n\nexport const transformEntryToIndex = <T extends CmsEntryValues = CmsEntryValues>(\n params: TransformEntryToIndexParams<T>\n) => {\n const { model, entry, storageEntry, fieldIndexRegistry } = params;\n const result = prepareEntryToIndex<T>({\n model,\n entry: structuredClone(entry),\n storageEntry: structuredClone(storageEntry),\n fieldIndexRegistry\n });\n\n delete result[\"PK\"];\n delete result[\"SK\"];\n delete result[\"GSI1_PK\"];\n delete result[\"GSI1_SK\"];\n delete result[\"published\"];\n delete result[\"latest\"];\n\n return result;\n};\n"],"names":["transformEntryToIndex","params","model","entry","storageEntry","fieldIndexRegistry","result","prepareEntryToIndex","structuredClone"],"mappings":";AAgBO,MAAMA,wBAAwB,CACjCC;IAEA,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,YAAY,EAAEC,kBAAkB,EAAE,GAAGJ;IAC3D,MAAMK,SAASC,oBAAuB;QAClCL;QACA,OAAOM,gBAAgBL;QACvB,cAAcK,gBAAgBJ;QAC9BC;IACJ;IAEA,OAAOC,MAAM,CAAC,KAAK;IACnB,OAAOA,MAAM,CAAC,KAAK;IACnB,OAAOA,MAAM,CAAC,UAAU;IACxB,OAAOA,MAAM,CAAC,UAAU;IACxB,OAAOA,MAAM,CAAC,YAAY;IAC1B,OAAOA,MAAM,CAAC,SAAS;IAEvB,OAAOA;AACX"}